Menu

#233 tab after \label{}• in TeX mode

9.1.2
closed
nobody
None
Bug
major
2020-06-16
2020-05-20
No

In TeXmode, if after typing
\label{}•
I move the cursor back to put it between { and }
and then I use the key TAB, then \label{}• is removed.
If follow the same steps with say ref, i.e.
\ref{}• , back between { and } and TAB, I jump to the next stop, i.e., I get
\ref{}
with the cursor after }

Actually this strange behavior seems to occur only with \label. I understand that a "label" should be entered between { and }. But I want to be free to do it rigth away or later.

Question: is there a way to disable this feature.

Note that, on purpose, I am not using the binding (and proc) which creates \label{}• . In doing so, I want to argue that the problem is not with this proc, but seems to be in the proc elec::nextStopOrIndent given by Tab. But why is the behavior different between \label{}• and \ref{}•

Discussion

  • Bernard Desgraupes

    Hi Laurent,
    thank you for reporting this oddity. It is indeed quite surprising and I don't see the rationale here. The same happens if you have something like
    \label{eq:}•
    and similarly with a few other hardcoded prefixes.
    The culprit is found in proc TeX::nextStop (in file latexEnvironments.tcl). To get ridd of this behaviour, you should comment out lines 1285-1288.
    Unless I hear objections, I'll remove all this part of the code.

     

    Last edit: Bernard Desgraupes 2020-05-22
  • Bernard Desgraupes

    This is fixed now.
    Changes committed to the repository (rev. 1901).

     
  • Bernard Desgraupes

    • status: open --> fixed
    • Version: 9.1.1* --> 9.0
     
  •  Laurent PRALY

    Laurent PRALY - 2020-05-22

    Cher Bernard



    A nouveau un grand merci pour votre aide pour cet autre problème. Au moins cette fois, ce n'est pas ma configuration qui est en cause.



    Par contre je vois que cette proc
    TeX::nextStop est déjà sous cette forme

    FILE: "latexEnvironments.tcl"

                                              created: 11/10/1992 {10:42:08 AM}

                                          last update: 2011-10-24 21:19:50

    Il est donc étrange que le problème que je mentionne n'ait pas déjà été signalé depuis 2011. Ces 4 lignes ont donc peut-être leur raison d'être pour une toute autre cause. Donc comme vous érivez

    Unless I hear objections



    Bien cordialement

    Laurent Praly

     

    Last edit: Bernard Desgraupes 2020-05-26
    • Vittorio

      Vittorio - 2020-05-22

      let me say that there is some rational in the behavior: \label{}• is removed only if the label si empty. Since an empty label does not make any sense, deleting the label command is reasonable.
      But it is fine with me if the behavior is changed.

      best regards

      Vittorio

       

      Last edit: Bernard Desgraupes 2020-05-26
  • Bernard Desgraupes

    In fact, I agree with Vittorio that the deletion of empty \label{} macros is quite useful inside math environment templates: if you don't want the label, just press Tab instead of removing it manually.
    So, there is now a new preference in LaTeX mode called Tab Deletes Empty Labels to control this behavior. For compatibility, it is activated by default. It can be unset in the Electrics panel of the Alpha ↣ TeX Mode Setup ↣ Mode Preferences dialog.

     
  •  Laurent PRALY

    Laurent PRALY - 2020-05-26

    But then why this behavior for \label{} only, why not also for \bibitem{}, \ref{}, \cite{}, ... ?



    My view point is:

    If you don't want a label you do not enter it, instead of entering it and then deleting it with a procedure nominally supposed to move the cursor to the next or previous bullet and in particular to exit the range of {}



    It is anyway a good thing that we can monitor the behavior. Thank you for this.



    Laurent Praly

     

    Last edit: Bernard Desgraupes 2020-05-26
  • Bernard Desgraupes

    We are speaking here about the situation where templates introduce empty labels. For instance, if you insert a template for the align environment (select Maths Environments > align… and, say, choose 2 equations), here is what Alpha inserts in your document (the vertical bar here shows the location of the insertion cursor):

    \begin{align}
        | & •
        \label{•}\\
        • & •
        \label{•}
    \end{align}•
    

    Now when you press the Tab key in order to fill the template, if you do not want a label it vanishes automatically. If you want one, just fill it out. This is very handy.

     
  •  Laurent PRALY

    Laurent PRALY - 2020-05-26

    OK. Thanks for the clarification. In this case I do agree. This is very handy

    De : "Bernard Desgraupes"
    A : "[alphacocoa:tickets] " <233@tickets.alphacocoa.p.re.sourceforge.net>
    Envoyé: mardi 26 Mai 2020 10:06
    Objet : [alphacocoa:tickets] #233 tab after \label{}• in TeX mode
     

    We are speaking here about the situation where templates introduce empty labels. For instance, if you insert a template for the align environment (select Maths Environments > align… and, say, choose 2 equations), here is what Alpha inserts in your document (the vertical bar here shows the location of the insertion cursor):

    \begin{align}
        | & •
        \label{•}\\
        • & •
        \label{•}
    \end{align}•
    

    Now when you press the Tab key in order to fill the template, if you do not want a label it vanishes automatically. If you want one, just fill it out. This is very handy.


    [tickets:#233] tab after \label{}• in TeX mode

    Status: fixed
    Created: Wed May 20, 2020 03:32 PM UTC by Laurent PRALY
    Last Updated: Tue May 26, 2020 05:03 AM UTC
    Owner: nobody

    In TeXmode, if after typing
    \label{}•
    I move the cursor back to put it between { and }
    and then I use the key TAB, then \label{}• is removed.
    If follow the same steps with say ref, i.e.
    \ref{}• , back between { and } and TAB, I jump to the next stop, i.e., I get
    \ref{}
    with the cursor after }

    Actually this strange behavior seems to occur only with \label. I understand that a "label" should be entered between { and }. But I want to be free to do it rigth away or later.

    Question: is there a way to disable this feature.

    Note that, on purpose, I am not using the binding (and proc) which creates \label{}• . In doing so, I want to argue that the problem is not with this proc, but seems to be in the proc elec::nextStopOrIndent given by Tab. But why is the behavior different between \label{}• and \ref{}•


    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/alphacocoa/tickets/233/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     

    <link href="https://sourceforge.net/p/alphacocoa/tickets/233/" itemprop="url"> <meta content="View" itemprop="name"> <meta content="View" itemprop="description">

     

     
  • Bernard Desgraupes

    • status: fixed --> closed
    • Version: 9.0 --> 9.1.2
     

Log in to post a comment.