Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transform a tex source so that all macros are replaced by their definition

Tags:

latex

tex

Is it possible to see the output of the TeX ‘pre-processor’, i. e. the intermediate step before the actual output is done but with all user-defined macros replaced and only a subset of TeX primitives left?

Or is there no such intermediate step?

like image 916
Debilski Avatar asked Mar 17 '10 13:03

Debilski


2 Answers

Write

\edef\xxx{Any text with any commands. For example, $\phantom x$.}

And then for output in the log-file

\show\xxx

or for output in your document

\meaning\xxx
like image 70
Alexey Malistov Avatar answered Nov 04 '22 19:11

Alexey Malistov


There is no "pre-processor" in TeX. The replacement text for any control sequence at any stage can vary (this is used for a lot of things!). For example

\def\demo{\def\demo{cde}}
\demo

will first define \demo in one way and then change it. In the same way, you can redirect TeX primitives. For example, the LaTeX kernel moves \input to an internal position and alters it. A simplified version:

\let\@@input\input
\def\input#1{\@@input#1 }
like image 45
Joseph Wright Avatar answered Nov 04 '22 21:11

Joseph Wright