Colin Baxter <[email protected]> writes:
> When I insert a \label then what's in the bracket is always a random
> alphanumeric, as in say \label{58f7161e}, and never some descriptive
> text.
Ok.
> Obviously I refer to the label with \ref{58f7161e}. This is done by
> hand; something which I don't find inconvenient because I think it is
> more important for me to know where and what is written in the text
> rather than ease of use.
I'd suggest you start using RefTeX. RefTeX can be configured to insert
simple numbers after a prefix like 'eq:1' or 'sec:14'[1]. Then you use
C-) to reference a label and RefTeX starts a selection process
incl. showing the text around the \label macro etc., very convenient.
> I envisaged that using your completion function would give me a choice
> of random numbers.
No, it gives you a list of already defined labels like 58f7161e
incl. context (aka annotation).
> Even if some run-on texts is included in the completion buffer then
> this still might not provide sufficient context for me to choose the
> completion accurately, especially if \label is some distance away in
> the text from the corresponding \ref.
My code relies solely on what RefTeX does: The text shown as annotation
is what RefTeX holds in memory as context around the \label macro, and
that can be configured.
> All this might seem inconsistent with my supposed "knowing the text"
> and I may have completely misunderstood what you propose.
I hope it is now more clear.
Best, Arash
Footnotes:
[1]
https://www.gnu.org/software/emacs/manual/html_mono/reftex.html#Options-_002d-Creating-Labels