| 1 |
\NeedsTeXFormat{LaTeX2e} |
| 2 |
\ProvidesPackage{tokmap} |
| 3 |
|
| 4 |
\input{tokmap} |
| 5 |
|
| 6 |
\endinput |
| 7 |
|
| 8 |
tokmap.tex, version 1.0 |
| 9 |
|
| 10 |
Copyright (C) 2025 plante |
| 11 |
This package is released under the LaTeX Project Public License (LPPL) 1.3c. |
| 12 |
|
| 13 |
tokmap: iterate over a token list expandably, without dropping spaces or braced groups. |
| 14 |
|
| 15 |
Usage: `\tokmap <command> { <tokens> }` applies command over the token list tokens. |
| 16 |
Space tokens, left and right braces are replaced with the marker tokens `\tokmap@space`, |
| 17 |
`\tokmap@bgroup`, and `\tokmap@egroup` respectively (who are `\ifx`-equal to themselves |
| 18 |
exclusively). For convenience, command may contain multiple tokens. |
| 19 |
It is assumed that `{` and `}` are the only characters with category codes 1 |
| 20 |
(beginning of group) and 2 (end of group) respectively. |
| 21 |
Expandable. |
| 22 |
|
| 23 |
This package may be used in LaTeX by `\usepackage{tokmap}`, or |
| 24 |
in plain TeX and other formats by `\input{tokmap}`. |
| 25 |
|
| 26 |
See the visualtoks package for an example application. |