I found several entries about the fact that the ifthen package is obsolete. So my question is: how to define a condition check then? I have searched and I find several example for ifthenelse (contained in the ifthen) package OR the statement "ifthen package is obsolete".
Asked
Active
Viewed 1.2k times
7
strauberry
- 3,255
2 Answers
8
I prefer
\def\something{} %% set to true
%% or:
\let\something\undefined %% set to false
\ifdefined\something
True
\else
False
\fi
to avoid the ifthen package.
The advantage of not using a package is that this approach can be used in files that are just \input by large document (for example TikZ images), when it cannot be guaranteed that a certain package is loaded.
Scz
- 1,633
-
Your code only shows how to check whether a macro is defined; I believe the OP's question is more general than that. – jub0bs Aug 09 '14 at 14:38
-
If you can influence setting the variable to true or false, you can also instead define or undefine it (
\let\something\undefined) – Scz Aug 11 '14 at 16:30
7
It may be considered obsolete because there exist more modern variants and the package was not updated for a long time.
See for example http://www.ctan.org/pkg/etoolbox which uses e-TeX features.
Apart from the macros in ifthenelse being fragile, if you can handle that, you can just use them, no problem.
Frank
- 313
-
1Welcome to TeX-SX! You may have a look at our starter page for a quick intro if you wish to familiarize yourself with our format. – Claudio Fiandrino May 06 '13 at 12:47
xifthenin place of it is better anyway. – egreg May 06 '13 at 13:01