auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX] reftex and custom macro-with-label parsing


From: Tassilo Horn
Subject: [AUCTeX] reftex and custom macro-with-label parsing
Date: Thu, 20 Nov 2014 14:22:22 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Hi all,

I'm struggling with reftex in order to make it parse a custom macro of
mine which has an optional label arg.  The info docs have a pretty
example of almost the same I'm trying to achieve:

,----[ (info "(reftex)Figure Wrapper") ]
|      \myfig[htp]{filename}{caption text}{label}{1}
| 
|    Now we need to tell RefTeX that the fourth argument of the ‘\myfig’
| macro _is itself_ a figure label, and where to find the context.
| 
|      (setq reftex-label-alist
|            '(("\\myfig[]{}{}{*}{}" ?f nil nil 3)))
`----

Ok, but my macro looks like so:

  %% Definition
  \NewDocumentCommand\apidoc{m m m v o}{...}
  %% Usage
  \apidoc{Function}{namespaceX}{fname}|arg1,arg2 arg2|[label1,label2]

The problems are that

  1) the 4th macro argument is a verbatim one that's enclosed with ||
     instead of {} or [] which seems to be hard-coded in reftex.
     (Actually, it could be enclosed with any pair of same char but I
     stick to the pipes.)

  2) the 5th argument is optional and can be a comma-separated list of
     labels, not just one label.

Is there any chance to make reftex collect those labels?

Currently, I just have my own parsing function that's run by an :after
advice to `reftex-do-parse' which stuffs the label information directly
in the `reftex-docstruct-symbol' var.  Of course, then the labels aren't
at the right positions (marked as LOST LABEL) and won't show up in
*RefTeX Select* buffers.  But at least I can TAB-complete them in there
which is better than nothing.

Bye,
Tassilo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]