[texhax] Write verbatim to file - can't stop

CV Radhakrishnan cvr at river-valley.org
Fri Sep 3 14:30:12 CEST 2004


<quote who="Matthew Leingang">
> Hello,
>
> I have a long LaTeX file with several control sequences of the form
>
> \cs{text}
>
> I'd like to change the definition of \cs to write "text" to another
> file, unexpanded.

Try the following, this seems to work as you wanted.

\documentclass{article}

\makeatletter
\newwrite\x
\immediate\openout\x=tmp.tex
\def\cs#1{\gdef\next{#1}
     \immediate\write\x{\expandafter\strip at prefix\meaning\next}}
\makeatother

\begin{document}

\cs{\file}

\cs{Good}

\cs{$\gamma$}

\end{document}


-- 
Radhakrishnan



More information about the texhax mailing list