TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to implement an if-then-else depending on whether the argument contains a special character or not. Should I be looking here: http://www.tug.org/TUGboat/Articles/tb28-1/tb88glister.pdf, or does anyone know a simpler way?

share|improve this question
up vote 16 down vote accepted

\IfSubStr{Rotterdam}{otter}{ true }{ false }

share|improve this answer



LaTeX should show "YES" in both cases. However, it depends on the kind of "special character" you are interested in.

share|improve this answer
The specific character was "=". This works great, thanks! I was actually just around the corner from a similar solution, all thanks to tex.ac.uk/tex-archive/info/macros2e/macros2e.pdf, but the guide isn't so clear around what an "\ifin@ switch" is, do you happen to have a good guide to doing "advanced" stuff like this? – oleks Aug 29 '11 at 15:30
Nice. I didn't know about \in@ and \ifin@ ... – clemens May 25 '13 at 11:05
@cgnieder They're well hidden in the LaTeX kernel. ;-) Of course expl3 makes better tools available. – egreg May 25 '13 at 11:07

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.