On Dec 14, 2006, at 10:33 PM, Piero D'Ancona wrote:
Haris, the Insert Label command is nice but difficult to use. Let me explain.
First of all I must write by hand \ref{} or \eqref{} and this could be improved as you say.
Will fix that in my next commit, I've already made the changes locally. It does require that you type the first couple of letters of the citation though, like "fig" for instance for figures, or "eq" for equations.
But the worse is that usually the number of labels is quite high (50+ is common). When I invoke the command, a very long list appears, and it is in alphabetical order. I must scroll up and down to locate the label I want; of course I do not remember which one it is exactly, so it takes a long time to find the right one.
You don't have to scroll up and down, you can just start typing letters starting with the first letter and it moves you to the appropriate place in the list. And the long list will be there no matter what format the thing is in, no matter what, if that's how many citations you have.
You will say: I must write the initial letters of the label so the list that appears is much shorter. This is not a solution because:
- this forces me to remember the beginning of
the right label: it takes even longer to remember it, and it takes longer to write \eqref{firstletters...} than to write the full label by hand
If you name them consistently, with eq for equations, thm for theorems, def for definitions and so one, it would certainly be easy to type the first three letters, presumably you know what kind of text you want to link to, i.e. whether it refers to an equation or whatnot. I always follow the "three letters plus a :" convention, and it certainly makes my life easier. I also opt for very long descriptive names, like fig:changeNearCritPoint and thm:descentPathBasis. So often the name gives me quite a clue as to what the label refers to. If we even had Allan's nice "Go to..." window, it would make filtering even easier. *That* would be the better solution IMO.
- all of my labels start with eq: (I'm not alone I think)
Apparently, if I write eq: followed by some letters the script does not work; maybe you check for letters and digits only in the name?
The problem here is that you have not set ":" to be in your list of word characters (Preferences -> Text Editing). If you stop at eq, or if you add : to this list, it should work just fine. The command accepts as input the current word or selection, so if ":" is not a word character, then the caret doesn't find a word to work with, since it is between the ":" and the "}" atm.
Exactly to overcome these problems I proposed some weeks ago a different mechanism based on a semi-permanent html window. Would you like to give a look to it? It's rudimentary but I used it a little and it seems to be handier that the present Insert Label command. Please tell me if you have the time to check it, I think there is something useful in it
I have actually looked at it, and it is pretty nice overall. It is definitely nice that you can leave it open at the side, though I think for that a plugin would be better, or at least a HTML window that using javascript to reparse the file every now and then and update its information. My main problem with it is though, that it requires you to use the mouse, and that is really not acceptable. It has the great advantage of showing you the context of each label, and this is something we could relatively easily incorporate into the existing command, at least showing the line that the label is at on the side (well, should probably cut the line to 40 characters or so, since LaTeX lines tend to be long).
The thing we are missing, which would be very nice, would be a command that would show you as a popup the context around the corresponding \label entry, when you are over a \ref entry. Shouldn't be too hard to implement.
Piero
Haris