[OS X TeX] LaTeX macro question
J. McKenzie Alexander
jalex at lse.ac.uk
Wed Feb 8 18:25:23 CET 2012
Hello,
I'm trying to write an environment that does the following things: (1) saves the verbatim text between the \begin and \end commands as a list of tokens, (2) computes a simple hash function on that token list to generate a value (so as to be able to detect when the content changes), and (3) uses \scantokens to re-process that list of tokens so as to typeset it "properly".
Right now, I'm having problems with (1) and (3) — I just can't seem to figure out how to save the verbatim text and then process it with \scantokens.
I know the following lets me save verbatim text:
\usepackage{fancyvrb}
\begin{SaveVerbatim}{asdf}
\begin{tikzpicture}
\draw (0,0) -- (0,1) -- (1,1) -- cycle;
\end{tikzpicture}
\end{SaveVerbatim}
And now I can typeset that as many times as I want via \UseVerbatim{asdf}.
But
\scantokens{\UseVerbatim{asdf}}
Just reproduces the same output as \UseVerbatim{asdf}
and
\expandafter\scantokens\expandafter{\UseVerbatim{asdf}}
produces an error.
Any suggestions would be most appreciated!
Cheers,
Jason
--
Dr J. McKenzie Alexander
Department of Philosophy, Logic and Scientific Method
London School of Economics and Political Science
Houghton Street, London WC2A 2AE
Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer
More information about the macostex-archives
mailing list