| 1 | unravel: Watching TeX digest tokens |
| 2 | ==================================================== |
| 3 | * E-mail: [email protected] |
| 4 | * Released under the LaTeX Project Public License v1.3c or later |
| 5 | See http://www.latex-project.org/lppl.txt |
| 6 | |
| 7 | The `unravel` LaTeX package provides tools to explore TeX code, |
| 8 | performing expansion and assignments step by step. |
| 9 | |
| 10 | TeX is a strange beast. Its eyes read files, making characters |
| 11 | into tokens. Its mouth then chews tokens, expanding them if |
| 12 | possible, namely, expanding user-defined macros, or conditionals, |
| 13 | etc. When meeting a so called 'unexpandable' token, TeX's |
| 14 | stomach comes into play, performing assignments, or moving boxes |
| 15 | around, eventually typesetting the result thanks to its great |
| 16 | line- and page-breaking algorithms. |
| 17 | |
| 18 | All of this is interleaved, and difficult to follow. Of course, |
| 19 | one can always use `\tracingall`, but the result is... messy. |
| 20 | This package is an attempt to replicate how TeX digests tokens, |
| 21 | and to make the process easier to follow. Namely, |
| 22 | `\unravel{\some\tokens}` will let you go through expansions and |
| 23 | assignments performed by TeX upon seeing of `\some\tokens`, |
| 24 | step by step. |
| 25 | |
| 26 | Some parts of TeX are not covered. In particular, category codes |
| 27 | are fixed for the whole argument of `\unravel` when it is read. |
| 28 | |
| 29 | The package is extracted by running `pdflatex unravel.ins`. |
| 30 | For the documentation, run `pdflatex unravel.dtx` twice. |
| 31 | |
| 32 | This is work in progress, all suggestions/comments/bug reports |
| 33 | are welcome! See https://github.com/blefloch/latex-unravel/ |