Generalwarning for using math symbol in section

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
pallav
Posts: 170
Joined: Wed Nov 12, 2008 5:53 pm

warning for using math symbol in section

Post by pallav »

I am getting a warning for using math symbol in section. (a package hyperref warning: Token are not allowed in a PDF string(PDFDocEncoding): removing \tau_2 in line ... ) What to do?

Code: Select all

\section{Computation of the coefficients $\tau_2$, $\sigma_2$ and $\delta_2$}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

warning for using math symbol in section

Post by cgnieder »

This is a hyperref warning. It means the greek symbols cannot be used in the pdf bookmarks. The easiest fix is using \texorpdfstring{tex}{pdf}. You might also consider using \boldsymbol to get bold greek symbols in the section title.

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}
\begin{document}
\section{Computation of the coefficients \texorpdfstring{$\boldsymbol{\tau_2}$}{tau2},
\texorpdfstring{$\boldsymbol{\sigma_2}$}{sigma2} and \texorpdfstring{$\boldsymbol{\delta_2}$}{delta2}}

\end{document}
It could be worth creating a custom command here:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}

\newcommand*\mathinhead[2]{\texorpdfstring{$\boldsymbol{#1}$}{#2}}
\begin{document}
\section{Computation of the coefficients \mathinhead{\tau_2}{tau2},
\mathinhead{\sigma_2}{sigma2} and \mathinhead{\delta_2}{delta2}}

\end{document}
site moderator & package author
Post Reply