Answer below
Issue
I am using the package xifthen to try and check if a string variable is equal to a specific string in order to input something. I only want to do something in case the test is validated, meaning no else.
i.e. \ifthenelse{<test>}{true}{}
When testing the string against an integer (e.g. \equal{string}{1}), it works as expected. However, when checking against a string (e.g. \equal{string}{test}) it breaks if no value is set for the else part.
[Edit] Here is the error message I get:
The document does compile if I build it at least twice, but fails the first time.
Question
Why is that so? How can I fix it or find a workaround?
MWE
\documentclass{article}
\usepackage{mwe}
\usepackage{xifthen}
\begin{document}
\ifthenelse{\equal{string}{1}}{1}{}
\smallbreak
\ifthenelse{\equal{string}{test}}{true}{}
\end{document}
Edit & answer
The MWE does not output anything which makes latexmk crash. By outputing one thing before or after, it works as expected.
\ifthenelse{\equal{string}{test}}{true}{\relax}. What does \relax do? – Chris H Mar 13 '17 at 14:44stringandtestto be literals, but rather some macro or something?? Please clarify. – Steven B. Segletes Mar 13 '17 at 14:59pdftexdoesn't create an "empty" PDF (whatever that means in real life). It doesn't create a .pdf file at all.latexmkthen fails, because the LaTeX run apparently worked (no errors on the log file) but it can't find the .pdf to check if it needs to runpdftexagain to resolve cross-references properly, etc. This is arguably a bug, but not a very interesting one since almost any non-minimal example will produce some output in the PDF, even if it is complete garbage! – alephzero Mar 14 '17 at 04:27