4

I'm trying to use todonotes together with the accent package, but the following code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{accents}
\usepackage{todonotes}

\begin{document}
\todo{$\accentset{\circ}{x}$}
\end{document}

gives the error:

! Undefined control sequence.
    \accentset #1#2->\begingroup \def \cc@a 
                                                {#1}\let \math@bgroup \@empty \def \...
        l.7 \todo{$\accentset{\circ}{x}$}

There seems to be a problem with using \accentset inside \todo, but I really don't know what is wrong. Any help would be appreciated!

2

You need to protect \accentset.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{accents}
\usepackage{todonotes}

\begin{document}
\todo{$\protect\accentset{\circ}{x}$}{$y$}
\end{document}

However, this is not specific to \todo, e.g. \section and the like have the same issue.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{accents}
\usepackage{todonotes}

\begin{document}
%\section{$\accentset{\circ}{x}$} % throws an error
\section{$\protect\accentset{\circ}{x}$}  % fine
%\todo{$\accentset{\circ}{x}$}{$y$} % throws an error
\todo{$\protect\accentset{\circ}{x}$}{$y$} % fine
\end{document}

enter image description here

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.