Using xstring in order to compare text containing \\ produces a compilation error. Here is my MWE:
\documentclass{report}
\usepackage{xstring}
\makeatletter
\def\Example#1{\def\@Example{#1}}
\def\printExample{\@Example}
\makeatother
\Example{not \\ void}
\AtBeginDocument{
\begin{titlepage}
\centering
\IfStrEq{}{\printExample}
{void}
{\printExample}
\end{titlepage}
}
\begin{document}
\end{document}
The first error message is:
! Undefined control sequence. \ ->\let \reserved@e \relax \let \reserved@f \relax @ifstar {\let \reserv... l.15 \begin{document}
The \Example command defined here should accept \\. How can I get this working? The solution should take into account that the (La)TeX distribution version used here is the one included in Linux Mint 18.3, i.e. TeX Live 2017/Debian, which cannot be changed.
\noexpandarg, but I am not sure what the code is supposed to do. – Peter Grill May 22 '19 at 09:23etoolboxmight be better, that is what I normally use. But as Peter mentions, it is not quite clear what you are trying to do. – daleif May 22 '19 at 09:52xifthenusing this test:\ifthenelse{\equal{\printExample}{}}{void}{\printExample}– frougon May 22 '19 at 09:57etoolbox(\ifdefvoid,\ifstremptyor\ifblank) do not work with TeX Live 2017/Debian (but they work for current TeX Live). Command\ifthenelsefromxifthenworks well, indeed (even if, from a "logical" perspective, I would expect a command whose argument is directly a string, not a boolean). Can someone explain why\\breaks\IfStrEqand if there is a way (or not) to use it? – Jérôme Champavère May 22 '19 at 19:52\centeringin environmenttitlepagebecause it causes an error (! Incomplete \iffalse; all text was ignored after line …) when\ifthenelsetest is used. An other error is raised withcenterenvironment (! Use of @item doesn't match its definition.). In both cases, one needs to use\protect\\in order to get it working as expected. – Jérôme Champavère May 22 '19 at 20:32