0

I get a compilation warning whenever I use $...$ signs in headings and subheadings. Is there any way to remove these errors?

The code that I use is given below:

\subsection{Solving $\widetilde{(Ric_\phi^m)}_{I\infty}=0$}

I am attaching the error messages below. These disappear when I remove the $...$ signs in the subheading

enter image description here

8
  • 2
    Welcome to TeX.SE! Please show us a short compilable TeX code resulting in your error ...
    – Mensch
    Commented Nov 18, 2021 at 19:37
  • 1
    What the error say? Post it please, with your code.
    – mmr
    Commented Nov 18, 2021 at 19:51
  • 1
    the error will not be from $ but from the commands that you have between them, since you have neither shown your input nor the error message that you got it is hard to help but my guess would be that you have an old latex and you need to use \protect in front of some commands such as \sqrt Commented Nov 18, 2021 at 20:15
  • 2
    The error you report is related to an attempt by hyperref to create a bookmark. It is undoubtedly related to the fact that \widetilde is not recognized in this context. What you need to do is translate the math expression to a \texorpdfstring{$...$}{<text equivalent>}. There are other questions here that might give useful information. Commented Nov 18, 2021 at 20:51
  • 2
    to make a bookmark (the links in the left sidebar in most pdf viewers) latex needs to make plain text with no typesetting commands, it doesn't know what to do with widetilde so it simply drops most of the commands in the definition, if you use \texorpdfstring{$abc$}{zzz} latex does not attempt the conversion at all, it typesets $abc$ in the main document and uses the supplied text zzz in the bookmark Commented Nov 18, 2021 at 22:37

1 Answer 1

3

The error you report is related to an attempt by hyperref to create a bookmark (the links in the left sidebar in most PDF viewers). It is undoubtedly related to the fact that hyperref doesn't recognize \widetilde and thus can't put it into a bookmark.

What you need to do is translate the math expression to a \textorpdfstring{$...$}{<text equivalent>}.

To borrow David Carlisle's very nice explanation, here's what's necessary to make a bookmark. LaTeX needs to make plain text with no typesetting commands. It doesn't know what to do with \widetilde so it drops most of the commands in that math string, and complains. If you use \texorpdfstring{$\xxx$}{zzz}, LaTeX doesn't bother to attempt the conversion. It simply typesets $\xxx$ in the main document and puts zzz in the bookmark.

3
  • Thanks so much for this explanation!
    – freebird
    Commented Nov 19, 2021 at 0:01
  • 2
    @freebird, if you find that this answers your question, you can accept it by clicking on the check mark next to the answer. Commented Nov 19, 2021 at 0:07
  • Thanks so much!
    – freebird
    Commented Nov 23, 2021 at 23:51

Not the answer you're looking for? Browse other questions tagged .