TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i want to learn to do some basic style programming with latex, I'm searching a bit but i can't find a clear source of information. I'm searching things like

   Comparison Operators
   Automatic Variables
   Arguments Uses

For example when i search information about conditionals i only found some sites that provide one miraculous command that do some specific comparison, is like that there is always \ifSomething=OtherThing command and not only one IF like i'm accustomed to use in any other language where the Comparison operator take the responsability to adapt what we want to compare. Same for the other topics.

share|improve this question
Style Class Tutorials might be relevant here. – Christian Lindig Apr 30 '11 at 15:53
TeXbook, TeX by Topic and Advanced TeXbook. – Leo Liu Apr 30 '11 at 16:02
And for LaTeX, it is also useful to have a look at clsguide, keyval, etextools, etc. – Leo Liu Apr 30 '11 at 16:04
In addition to the points already noted, I'd remind you that automatic variable typing, etc., is not universal. So it might be handy to say which languages you are familiar with. – Joseph Wright Apr 30 '11 at 16:24

etoolbox (also see this post) is a big one for comparisons and conditionals, and it does loops, too. Rather than providing one miraculous command that does a specific comparison, it provides a ton of those commands, one for each comparison type.

It handles a lot of other useful things, too, including patching existing commands, adding things at the beginning or end of environments, documents, preambles, etc.

The included documentation may be a bit short on detailed examples, but for many audiences, it's fine.

share|improve this answer

For ConTeXt, the ConTeXt wiki has a nice page explaining different programming extensions available in ConTeXt. In particular, see the page on System macros, which is based on an old MAPS article by Taco Hoekwater.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.