Hi there, is there a way to determine if a macro is used on document level (in contrast of being hidden in the expansion text of some other macro)? One way that I think this could be determined is looking at the current input_stack level (which would be 1 (or 2?) inside the expansion of that macro) however while you can get at the current max stack level via status.max_in_stack I don't see any exposure of the current stack level (as a read only value). Am I missing something? Can you see any other way to determine that a macro is really used on document/file level? frank
On 11/4/2015 12:13 PM, Frank Mittelbach wrote:
Hi there,
is there a way to determine if a macro is used on document level (in contrast of being hidden in the expansion text of some other macro)?
One way that I think this could be determined is looking at the current input_stack level (which would be 1 (or 2?) inside the expansion of that macro) however while you can get at the current max stack level via status.max_in_stack I don't see any exposure of the current stack level (as a read only value). Am I missing something?
Can you see any other way to determine that a macro is really used on document/file level?
\directlua{tex.print(tex.currentgrouplevel)} {\directlua{tex.print(tex.currentgrouplevel)}} ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hi Hans
Can you see any other way to determine that a macro is really used on document/file level?
\directlua{tex.print(tex.currentgrouplevel)} {\directlua{tex.print(tex.currentgrouplevel)}}
that's unfortunately not the same as input stack. both calls are happening at the same input level - both are visible in your mail = document to motivate my question: people sometimes use procedural markup rather than semantic markup. Now if you want to find those in the document, say \textbf, but not if part of a higher-level structure, say inside a \section, then you need to know that this command actually appeared inside the document/file But it doesn't matter if it appear inside a "group" frank
On 11/4/2015 12:39 PM, Frank Mittelbach wrote:
Hi Hans
Can you see any other way to determine that a macro is really used on document/file level?
\directlua{tex.print(tex.currentgrouplevel)} {\directlua{tex.print(tex.currentgrouplevel)}}
that's unfortunately not the same as input stack.
both calls are happening at the same input level - both are visible in your mail = document
to motivate my question: people sometimes use procedural markup rather than semantic markup. Now if you want to find those in the document, say \textbf, but not if part of a higher-level structure, say inside a \section, then you need to know that this command actually appeared inside the document/file
But it doesn't matter if it appear inside a "group"
ok, so file level then ... i'll add this then: status.input_ptr (luatex version 0.85) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Frank Mittelbach
-
Hans Hagen