7
votes
3answers
133 views

Command that expands to the contents of a file

I'd like to make a macro that expands to the contents of a file. Basically something like \def{\mycommand}{\input{file.txt}} % file.txt contains "Hello%" \anothercommand{\mycommand} ...
3
votes
2answers
136 views

Can Texinfo's @value macro be made to work in the filename argument to @xref and friends?

Given a file xref-and-value.texi with contents: \input texinfo @c -*- TeX-PDF-mode: t; -*- @setfilename xref-and-value.info @settitle @code{@@xref} and @code{@@value} in \pdftex @set fngccint ...
9
votes
1answer
1k views

Expansion in \numexpr…\relax versus \pdfstrcmp

The \numexpr...\relax construction in eTeX allows to evaluate numerical expressions, and it expands tokens fully as it goes. The \pdfstrcmp{...}{...} construction in pdfTeX lets us compare two lists ...
4
votes
3answers
2k views

Can (pdf)LaTeX recognize text strings and replace (expand) them?

I'd like LaTeX to replace e^ with \mathrm{e}^. I know I could just make a macro \e that does this, but I know I'll forget using it.. Can LaTeX find and replace and replace letter combinations (I ...
15
votes
4answers
563 views

Expandable full expansion of tokens that preserves catcodes

Is it possible to fully expand tokens in an expandable manner and preserves category codes? I'd like to do this just using pdfTeX. I'm looking for something that would work like this: \def\foo{foo} ...