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

前端 未结 5 1493
说谎
说谎 2021-01-18 11:10

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

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 11:35

    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 }
    

提交回复
热议问题