I created a supposedly robust command through \DeclareRobustCommand{\plusplus}{\relsize{-3}{++}} that modifies some ++ sign, and I use it in the document. However, when I use the \relsize and the hyperref package with the tocdepth counter set, I obtain a cryptic error (at least for me)
Runaway argument? {\@tempcnta >\z@ \relax \advance \@tempcnta \m@ne \@tempdimb ! TeX capacity exceeded, sorry [main memory size=10000000]. ...\@tempcnta \m@ne \@tempdimb \@tempa \@tempdimb \relax l.15 \subsubsection{test\plusplus}
I even try to increase the memory size, as you can see, up to 10000000. And, in my full document the error changes to
Runaway definition? ->\protect 5.3.4 test\protect \<>-\kernel@ifnextchar [4]\<>-\@ifnextchar \ETC . ! TeX capacity exceeded, sorry [main memory size=10000000]. \new@ifnex tchar l.108 \subsection{test\plusplus}
I don't understand why the error changes. However, the code below is the shortest code I get before removing the error. However, I need to use the hyperref package and the table of contents. How can I solve this problem?
\documentclass{book}
\usepackage{relsize}
\DeclareRobustCommand{\plusplus}{\relsize{-3}{++}}
\usepackage{hyperref}%remove hyperref and it compiles
\begin{document}
\setcounter{tocdepth}{3}%or remove teh tocdepth and it compiles
%but use both and it doesn't
\tableofcontents
\subsubsection{test\plusplus}
\end{document}


\relsizeand an easy way for shifting the + up. There's really no way to cope with complicated constructions and the bookmarks without resorting to\pdfstringdefDisableCommands. Having smaller and raised + symbols in the bookmarks is impossible (unless you find a suitable Unicode character), because those are simply strings, not typeset boxes. – egreg Apr 01 '13 at 13:20