1

This question already has an answer here:

When I am using \caption{$\E_\A(D)$ where $\ora{UF}\!_n$} inside a table environment there shows some errors.

Error :

Only one # is allowed per tab. ...crcr }}}_n$\relax }}{95}{table.caption.41}

Error :

Illegal parameter number in definition of \reserved@a. \caption{$\E_\A(D)$ where $\ora{UF}\!_n$}

Here \E stands for \mathscr{E}, \A stands for \text{\k{A}}, \ora for \overrightarrow.

Please help resolving this problem.

marked as duplicate by Werner tables Aug 24 '17 at 15:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    I think defining new commands of only one letter is a bad idea. However, please add a complete MWE (since you're member for more than one year you should know it's necessary). – CarLaTeX Aug 24 '17 at 5:05
  • This problem is similar in nature to \overleftarrow in subfigure caption. Different environment, but it's the same cause and therefore a similar solution. – Werner Aug 24 '17 at 15:04
7

\overrightarrow is not robust and breaks in moving arguments. Protect it with \protect:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{caption}
\usepackage[mathscr]{euscript}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\newcommand*{\A}{\text{\k{A}}}
\newcommand*{\E}{\mathscr{E}}
\newcommand*{\ora}{\overrightarrow}
\begin{document}
\listoffigures
\begin{figure}
\caption{$\E_\A(D)$ where $\protect\ora{UF}\!_n$}
\end{figure}
\end{document}

Result

Alternative:

\DeclareRobustCommand*{\ora}{\overrightarrow}

Then \ora is robust and \protect is not needed.

Not the answer you're looking for? Browse other questions tagged or ask your own question.