[texhax] Writing verbatim to file

Reinhard Kotucha reinhard.kotucha at web.de
Mon Mar 7 03:11:42 CET 2011


On 2011-03-06 at 17:28:12 -0800, Mike B. wrote:

 > Hi All,
 > 
 > I'm trying achieve the following sequence:
 > 1. a variable l is assigned some length.
 > 2. if some condition is true then the following line should be
 >    written to a file
 > \setlength{x}{<length of l>}
 > 
 > A psuedo-code for this seems to be:
 > \ifthenelse{ condition is true }{
 > write to file as verbatim: \setlength{x}{ 
 > write to file the value of l: \the\l
 > write to file as verbatim (close braces): }
 > }{}
 > 
 > The newfile package allows to output to a file but:

 > - not inside an argument to another command (I need this inside an
 >   \ifthenelse structure)
 > - verbatim text must have balanced curly braces

You can precede characters which have a special meaning with \string,
for instance

   \string\foo

when writing to a file.

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


More information about the texhax mailing list