While reading code from various sources, I have often come across the construct \ifx\\<sth>\\ to check if <sth> is empty or not. For example, in the code from this answer I see:
\newcommand*{\mint@}[4]{%
% #1: \limits, \nolimits, \displaylimits
% #2: overlay symbol: -, =, ...
% #3: subscript
% #4: superscript
\mathop{}%
\mkern-\thinmuskip
\mathchoice{%
\mint@@{#1}{#2}{#3}{#4}%
\displaystyle\textstyle\scriptstyle
}{%
\mint@@{#1}{#2}{#3}{#4}%
\textstyle\scriptstyle\scriptstyle
}{%
\mint@@{#1}{#2}{#3}{#4}%
\scriptstyle\scriptscriptstyle\scriptscriptstyle
}{%
\mint@@{#1}{#2}{#3}{#4}%
\scriptscriptstyle\scriptscriptstyle\scriptscriptstyle
}%
\mkern-\thinmuskip
\int#1%
\ifx\\#3\\\else _{#3}\fi
\ifx\\#4\\\else^{#4}\fi
}
I have used the code many times, and with limits. Nothing ever went wrong. Well… almost. Reading through this code in ExplSyntax, LaTeX complained, which explains the space between \else and _{#3}. But if I have limits, say I have \mint-_{B(0,1)}, then \ifx\\B(0,1)\\ should be considered. So it compares \\ with B, concludes they are not the same, and then? What happens to the rest of the limits? They should be processed afterwards and appear in the typesetted pdf, at least this is my expectation. But they don't. So what becomes of them? Why do they not show up?
\ExplSyntaxOn,_is a letter, not the subscript character. Use\sbor\c_math_subscript_token. Anyway, that code should never appear in an\ExplSyntaxOn...\ExplSyntaxOffcontext. – egreg Aug 06 '15 at 09:22\str_case. – MickG Aug 06 '15 at 09:25Explfunctions. But not now… – MickG Aug 06 '15 at 09:26expl3functions for this. – egreg Aug 06 '15 at 09:26