2

I wonder if there is a way to have reftex print and use labels inserted in a .dtx file from the TOC menu.

As every line in a .dtx file begins with %, reftex seems unable to display labels. For example, from the TOC menu (C-c =), hitting on l has no effect.

Furthermore, as reftex does not see the labels, I am unable to insert references from C-c ).

On another side, Ref -> Global Actions -> Goto Label works as expected.

I use emacs 26.1, and AUCTeX 13.0.14 from gnu.

Any help would be much appreciated.

1 Answer 1

2

RefTeX sees the \label macros which are commented out, it just doesn't show them by default. You can access them in the *RefTeX Select* buffer. This is a documented feature. From the manual:

3.2 Referencing Labels

RefTeX scans the document in order to find all labels. [...].
Here is a list of special commands in the selection buffer. A summary of this information is always available from the selection process by pressing ?.

Controlling what gets displayed

[...]
% Toggle the display of labels hidden in comments in the selection buffers. Sometimes, you may have commented out parts of your document. If these parts contain label definitions, RefTeX can still display and reference these labels.

For example, I loaded a test file, say arabluatex.dtx, moved point in the paragraph in \section{Introduction} (after line 465) and hit C-c ), when asked to SELECT A REFERENCE FORMAT, I hit RET followed by SPACE for all labels. In *RefTeX Select* buffer, I hit % and it looks like this: enter image description here

I can now select a label as usual.

1
  • Thank you, this works. Unfortunately, going through C-c = then hitting l leads to a dead end, but C-c ) gives the expected result and saves me a lot of time. Commented Dec 5, 2021 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.