I'm using hyperref, which causes trouble when having math in my section title.


\section{Basis for CO\texorpdfstring{\textsubscript{2}{ h}} heat}
\section{Basis for CO\texorpdfstring{\textsubscript{2}} heat}
\section{Basis for CO\texorpdfstring{$_2$} heat}

The first text line will be displayed correctly, but why do I have to add { h} (I know this is not the correct solution, but it works)? If I don't, the space and the h will disappear. I found out that I had to add it by trial and error. How should this be done?

  • 3
    \texorpdfstring takes two arguments: the first is typeset into the document, the second one is put in the bookmark. So \textorpdfstring{\textsubscript{2}}{2} for example. Jun 7, 2015 at 20:14
  • @Qrrbrbirlbel: That's what I tried at first, but it doesn't work.
    – ROLF
    Jun 7, 2015 at 20:17
  • 1
    @ROLF It works for me, given that \textsubscript is defined (which neither report nor hyperref nor fixltx2e (deprecated anyway) do). Jun 7, 2015 at 20:19
  • @Qrrbrbirlbel: Aha, I thought \textsubscript was a standard thing. How should it be defined?
    – ROLF
    Jun 7, 2015 at 20:27
  • \textsubscript is now in the LaTeX kernel (01/2015). You should redo your formats.
    – Bernard
    Jun 7, 2015 at 21:33

1 Answer 1


\texorpdfstring has two arguments, the first is the normal TeX code, the second is a string, which can be used as replacement for the arbitrary TeX in the bookmarks.

If option unicode (or pdfencoding=auto) is enabled, then the subscript 2 is available as \texttwoinferior:

\usepackage{bookmark}% faster updated bookmarks
\section{Basis for
  CO\texorpdfstring{\textsubscript{2}}{\texttwoinferior} heat}
  • I'm confused why it looks just fine in my PDF bookmarks without \texorpdfstring despite the warning in the compile log? I mean, sure, it's not latex-ed, but in my case the chemical formula CO2 was cleanly replaced with just CO2. But i still get the warning. Mar 31, 2019 at 2:03
  • @K.-MichaelAye The formula is CO₂ rather than CO2. There are lots of ways to write chemical formulas in LaTeX, also there are lots of warnings. Without knowing neither of them, helping is difficult. Maybe, make a new question with a minimal example and the full warning. Apr 19, 2019 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.