[texhax] How to write a TeX code into file literally

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sun Oct 9 15:07:50 CEST 2011

On Sun, Oct 09, 2011 at 08:43:17PM +0800, Yue Wu wrote:

> Thanks, it solves most part of the problem, but stil has a few left, plz see
> them below the context.

> >   \immediate\write\myout{#1\noexpand\endgraf#2}%

The \noexpand is on purpose. It prevents the expansion and
adds a space after the command token.

>   \immediate\write\testout{{\bf#1}\endgraf#2}


\noexpand is not needed before unexpandable command tokens
(plain defines \let\endgraf\par). Thus it is just defensive
programming in case \endgraf is redefined as macro.

Yours sincerely
  Heiko Oberdiek

More information about the texhax mailing list