[OS X TeX] Plain TeX question

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Sun Feb 20 15:02:21 CET 2005


It's been a long time that I used plain tex and had been confronted 
with similar problems. My solution then was to use the construction
\csname def\endcsname

Unfortunately, I am no longer fluent in these hacks and can only hope 
that a sample of my former code might help you to find the solution 
yourself.

Claus

%creates roman numerals for the labels
\define\apr#1#2#3#4{\csname\expandafter#1\romannumeral#2p%
            \romannumeral#3p\romannumeral#4\endcsname}
\define\Apr#1#2#3#4{\csname\string{#1\romannumeral#2p%
            \romannumeral#3p\romannumeral#4}\endcsname}
%
% the write macros for cross-referencing
%
%Theorem, e.g \wt{8}{9}{0}%, #1=headno, #2= proclaimno, the default for 
#3=0
%schliesse immer mit % ab.
\define\wt#1#2#3{\ifnum \workdone=0 %
\immediate\write\lab{\csname def\endcsname\apr t{#1}{#2}{#3}{Theorem 
\pc}}\else \fi}
%

On Feb 20, 2005, at 13:47, Eric van der Oord wrote:

> I would like to use TeX to parse some files, e.g.
>
> %%% example
>
> \long\def\foo#1#2#3#4#5{%
> \write1{#3&#5&#4}%
> }
> \openout1=dest.tex
> \input source.tex
> \immediate\closeout1
> \bye
>
> %%% end example
>
> Unfortunately  TeX expands all macros contained in #3, #5, #4 before 
> writing them.
>
> How could I prevent expanding macros in "write" ?
>
> thanks for any help
>
> Eric
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list