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 have several commands with some math that I use inside and outside the sectioning commands (\section, etc.). Of course, package hyperref complains. I do not want to scan the sectioning commands to put \texorpdfstring inside them. I thought to change the definitions so my commands use \texorpdfstring. In this case \texorpdfstring will appear outside the sectioning commands. I wonder wheter this will work, or I need another solution.

share|improve this question
\texorpdfstring is independently from the command \section. For more details please provide a MWE. – Marco Daniel Jan 30 '12 at 13:13
Did you try? :) – egreg Jan 30 '12 at 13:14
up vote 7 down vote accepted

\texorpdfstring works outside of \section, I've used it several times to avoid issues with \and in \author (it's not rendered when filling the PDF metadata), and I don't get errors or warnings when I use it that way.

I think it's really just a one-liner to have an if-then-else branching instruction. I may be wrong, of course.

share|improve this answer

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.