I have a subsection named \subsection{$Rp_{\widehat{Y},*}(\mathcal{P})$ has property bla and bla}. I would like to keep this as title of my subsection, but it creates problems.
My code is the following.
\documentclass[a4paper,12pt,oneside]{article}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsmath,amscd}
\usepackage[english,italian]{babel}
\usepackage{latexsym}
\usepackage{graphicx,subfigure}
\usepackage[a4paper,top=30mm,bottom=30mm,left=30mm,right=30mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,decorations.pathmorphing}
\usepackage{hyperref}
\usepackage{accents}
\usepackage[babel]{csquotes}
\usepackage[maxnames=99,style=alphabetic,backend=bibtex]{biblatex}
\begin{document}
\subsection{$Rp_{\widehat{Y},*}(\mathcal{P})$ has property bla and bla}
\end{document}
If I keep it like this, it compiles giving multiple warnings about "Token not allowed in a PDF string". In this case the main problem is that the sidebar index of sections of the outcome PDF carries "RpY"0362Y,*P bla and bla" instead of the correct title with the math.
Furthermore, if I replace \widehat by \hat, it gives the error "Tex capacity exceeded", and it does not compile.
If I replace \subsection{$Rp_{\widehat{Y},*}(\mathcal{P})$ has property bla and bla} (or the version with \hat) with \subsection[just text]{$Rp_{\widehat{Y},*}(\mathcal{P})$ has property bla and bla} then I get no error. On the other hand, I still don't get what I want in the sidebar, since I would really like the math to be there as well.
How can I have the PDF compiling correctly and carrying the right math on the sidebar as well?
\texorpdfstring{<tex>}{<pdfstring>}to distinguish between what you want in the document -<tex>- and what you want in the bookmark/index -<pdfstring>. – Werner Aug 23 '16 at 00:10\protectbefore the commands\widehatand\mathcal; this may not be absolutely necessary, but it's not going to hurt. second, math isn't really supported in bookmarks; you need to specify a\texorpdfstringto accommodate that; some useful information is given in this answer. – barbara beeton Aug 23 '16 at 00:10\texorpdfstringdiffer from the use of\subsection[put the words here]{put the title here}? Thank you! – Stefano Aug 23 '16 at 00:20\subsection[<toc>]{<title>}puts<toc>in the ToC as well as the bookmarks.\texorpdfstring{<tex>}{<pdfstring>}allows to have something different in the<toc>, the<doc>and the bookmarks. – Werner Aug 23 '16 at 00:23