PerlでLaTeXのマクロを記述する PerlTeX

screenshot

PerlTeX is a combination Perl script (perltex.pl) and LaTeX2e style file (perltex.sty) that, together, give the user the ability to define LaTeX macros in terms of Perl code. Once defined, a Perl macro becomes indistinguishable from any other LaTeX macro. PerlTeX thereby combines LaTeX's typesetting power with Perl's programmability.

PerlTeXを利用すると、PerlLaTeXのマクロを記述することができる。たとえば、

\perlnewcommand{\reversewords}[1]{join " ", reverse split " ", $_[0]}

というマクロを定義すると、LaTeXで以下のように処理することができるらしい。楽しげ。

\reversewords{Try doing this without Perl!}”
 ↓
Perl! without this doing Try