Take the 2-minute tour ×
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.

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.

share|improve this question
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 Mar 19 '11 at 14:32
More general reference to obsolete packages: How to keep up with packages and know which ones are obsolete? –  Werner Sep 9 '14 at 23:27

3 Answers 3

up vote 60 down vote accepted

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.

share|improve this answer
Not to mention that etoolbox is fantastically useful for other things too. –  TH. Mar 19 '11 at 11:10
Perhaps to have some faster codes, the better solution is to use TeX's primtives or eTeX's primitives directly –  Alain Matthes Mar 19 '11 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. –  Martin Scharrer Mar 19 '11 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)? –  Alain Matthes Mar 19 '11 at 13:20
On the other hand, \ifstrequal from etoolbox doesn’t work in all circumstances where \ifthenelse{\equal…} works. –  Konrad Rudolph Mar 19 '11 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.

share|improve this answer
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. –  Alain Matthes Mar 19 '11 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 Jul 26 at 15:58

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.

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.