3 ms·
As a casual LaTeX user I never really got into the macro/package programming side of it, but for some reason I really don't want to have to type a backslash bef
by olympus 13y ago
As a casual LaTeX user I never really got into the macro/package programming side of it, but for some reason I really don't want to have to type a backslash before every 'therefore.' Is it possible to write a procedure that finds every instance of 'therefore' and replaces it with a synonym at compile time? I still wouldn't use this package for formal papers but it might be fun to play with.
- rca 13y agoHum, you could use something like sed -re "s/[Tt]herefore[,]?/\\\Therefore/g" on your .tex before compiling it with the 'therefore' package. This will not allow you to choose which 'therefore' you want replaced though. Then again, if it's just for fun you probably don't care :)
- gus_massa 13y agoYou can change the catcode of the upercase "T" and define it as a macro that peeks some characters to see if it if part of a "Therefore". This may break other commands that have the upercase T in their name, so it will create some random unexpected incompatibilities. (Many babel languages change catcodes to make accents easier to use, and therefore they create some random unexpected incompatibilities.) More info about catcodes: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=activechars http://www.tex.ac.uk/cgi-bin/texfaq2html?label=activechars
- adiM 13y agoWith LuaTeX (the modern version of TeX), such catcode trickery is not needed. LuaTeX provides a hook into the file reader, and you can simply change transform the input as you read it. For an example in ConTeXt, see this answer on Tex.sx: http://tex.stackexchange.com/a/4174/323 http://tex.stackexchange.com/a/4174/323