[texhax] enviroment/ifthen

Uwe Lück uwe.lueck at web.de
Wed Feb 11 12:57:51 CET 2009


>Date: Tue, 10 Feb 2009 19:32:13 +0100
>To: wawan <wa2n at nrar.net>, texhax at tug.org
>From: Uwe Lück <uwe.lueck at web.de>
>Subject: Re: [texhax] enviroment/ifthen
>
>At 13:38 08.02.09, wawan wrote:
>>I need help how to build sty in latex ( environment ) that can replace 
>>squences of chars with my symbols. For example if there input chars "SU" 
>>than replace with XY ( my symbols from metafont).
>
>There is a number of difficulties with such operations. The present 
>implementation breaks when you try to embed another environment, and it 
>ignores the content of curly braces. I have another version which looks 
>inside braces but disables macros with arguments. This can hardly be 
>improved without considerably more work.

You need to know about category codes here, how to change them, and how to 
work with unusual category codes. Things are easier when one doesn't try to 
substitute and to typeset "at the same time". The next step to handle curly 
braces properly could be reading them as "other" first, write the replacing 
result to disk, \input that with usual category codes. The fancyvrb package 
may me useful for some steps of this.

You might reason whether your actual task is worth such efforts. If the 
task arises all the time with new projects and with a large number of 
different strings, this may be the case. I have made such a thing, yet I 
can't release it as it is. This works on entire files, not environments.

-- Uwe. 



More information about the texhax mailing list