[texhax] enviroment/ifthen

Toby Cubitt tsc25 at cantab.net
Wed Feb 11 15:32:53 CET 2009


Uwe Lück wrote:
>> 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).
>> [...]
> 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.

If you do want to embark on this foolish quest :-), perhaps the xstring
package might help?

Even if the task arises frequently, a simple sed script (or similar)
will be far quicker to write, easier to maintain, more robust...and
generally better in almost every way. In my experience, string
substitution is just not a task that LaTeX is well suited to. It's not
difficult to integrate running your source through a sed script into
your LaTeX build procedure (you could even write a quick Makefile).

HTH,

Toby


More information about the texhax mailing list