In the LaTeX companion, the authors recommend to use the package ifthen for complex conditional.

But in his answer to LaTeX conditional expression Will Robertson doesn't mention it, and in the comments, Philipp says that the package is obsolete.

The question is in which way ifthen is obsolete and what are the risk to use it in a document.

  • 8
    Note that my comment is only a one-liner, not an exhaustive explanation. "Obsolete" here just means "for many problems there exist better solutions nowadays."
    – Philipp
    Commented Mar 19, 2011 at 14:32
  • 1
    More general reference to obsolete packages: How to keep up with packages and know which ones are obsolete?
    – Werner
    Commented Sep 9, 2014 at 23:27
  • So what about xifthen? Same thing? Obsolete, too? Commented May 7, 2019 at 20:09
  • The \if..., \else, \fi TeX primitives are not obsolete. The packages mentioned here are based on these primitives. The good concept is to use only these TeX primitives, no useless macro packages.
    – wipet
    Commented Mar 15 at 20:37

3 Answers 3


The main reason why people may consider ifthen obsolete (last version is of 2001/05/26 with about one page of user manual plus four pages of code documentation) is that it is superseded by e.g. etoolbox, which uses the advanced possibilities of eTeX. Using these allows faster processing. You still can use ifthen for your existing and new documents if you like and I don't think there is a risk in doing so. However for new code, especially new packages which use a lot of boolean expression using the more modern alternatives is recommended.

  • 9
    Not to mention that etoolbox is fantastically useful for other things too.
    – TH.
    Commented Mar 19, 2011 at 11:10
  • 2
    Perhaps to have some faster codes, the better solution is to use TeX's primtives or eTeX's primitives directly Commented Mar 19, 2011 at 12:16
  • @Altermundus: I prefer \if-switches before booleans as well, but I see also the drawbacks. The way TeX is skipping false branches has its drawbacks. Also for more complex expressions a framework is very handy. Commented Mar 19, 2011 at 12:38
  • @Martin: I agree that for more complex expressions, a framework is very handy. Do you know some packages that use etoolbox (for examples)? Commented Mar 19, 2011 at 13:20
  • 3
    On the other hand, \ifstrequal from etoolbox doesn’t work in all circumstances where \ifthenelse{\equal…} works. Commented Mar 19, 2011 at 14:22

From my experience in various forums and newsgroups, ifthen often seems to do more harm than good, especially when used by newbies. The main \ifthenelse command is fragile, so something like


doesn't work. The comparison is not expandable, so that the command "possibly has only limited usefulness for macro code writers" (quoted from the ifthen manual). Plus I find the syntax quite cumbersome compared to e.g.


This is not a diss of the ifthen package; its weaknesses are known and unavoidable because it had to be compatible to an older macro package and was written long before e-TeX was implemented. I just conclude that for many problems there exist solutions with fewer problems. If you want to use the ifthen package, then that is fine, but you should know about its limitations.

  • 1
    I don't know etoolbox so perhaps my answer will be different in several months, but actually I know some limitations of ifthen and I know the problems with fragile commands (it's not possible to avoid all of them), so my first idea would be : \DeclareRobustCommand\title{\ifthenelse{\equal{a}{a}}{b}{c}} \section{\title}. Now it will be interesting to know the limitation of etoolbox. I agree that etex is virtually indispensable. Commented Mar 19, 2011 at 15:32
  • Many things do more harm than good when misused ;). ifthen has certain virtues in terms of its limited scope: etoolbox is rather overwhelming, I think, just because it is so powerful. So I can see arguments on both sides here.
    – cfr
    Commented Jul 26, 2015 at 15:58

2024 update: Note that etoolbox itself, while not obsolete, has largely been superseded by better solutions developed by the people working on LaTeX 3. There are still some things you have to use etoolbox for, but conditional expressions aren't among them. Using expl3 syntax and/or the new commands for creating commands and handling conditionals in LaTeX itself is now preferable to reliance on etoolbox, ifthen etc. These are (mostly) documented in usrguide and clsguide.

Terminological Caution

I think that a certain degree of caution is required here in the way we classify packages. While some people may consider ifthen obsolete, it is certainly not marked officially as obsolete.

Compare ifthen's CTAN page with subfigure's.

This is not to say that there are not often better options, but the existence of better alternatives does not, just in itself, render a package obsolete.

Compare the case of packages for handling sub-figures. subfigure is definitely obsolete, but this leaves several other options, including both subfig and subcaption. In very many cases, the latter is preferable to the former - certainly it is more powerful, it works well with the powerful caption package etc. But that does not render subfig obsolete.

Something being obsolete means, to me, that there is good reason for me to update existing code (e.g. packages or classes for which I'm responsible) even if there are no obvious problems with it. If my code includes the use of things like \sf in a LaTeX document, or loads subfigure, I really should do something about that if it is at all practical to do so.

But there is not the same kind of reason for me to update code which loads subfig or ifthen and so it would be misleading to describe these packages as 'obsolete'. They are not. Not yet, anyway.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .