6

This code:

\documentclass[a4paper,twoside,12pt]{scrreprt}
\usepackage{fontspec}
\begin{document}
Test \scalebox{3.0}{$\int$} test.
\begin{table}
  \centering
\begin{tabular}{cc}
  A & B \\
  C & D 
\end{tabular}
\caption{Test \scalebox{3.0}{$\int$} test.}
\end{table}
\end{document}

gives me the error message:

! Argument of \@caption has an extra }.

The result looks how I want it to, though...

What should I do?

2
7

You have two options. First one is to \protect \scalebox:

\documentclass[a4paper,twoside,12pt]{scrreprt}
\usepackage{graphicx}
%\usepackage{fontspec}
\begin{document}
Test \scalebox{3.0}{$\int$} test.
\begin{table}
  \centering
\begin{tabular}{cc}
  A & B \\
  C & D
\end{tabular}
\caption{Test \protect\scalebox{3.0}{$\int$} test.}
\end{table}
\end{document}

Second one is to use the optional argument of \caption:

\documentclass[a4paper,twoside,12pt]{scrreprt}
\usepackage{graphicx}
%\usepackage{fontspec}
\begin{document}
Test \scalebox{3.0}{$\int$} test.
\begin{table}
  \centering
\begin{tabular}{cc}
  A & B \\
  C & D
\end{tabular}
\caption[Test $\int$ test.]{Test \scalebox{3.0}{$\int$} test.}
\end{table}
\end{document}

enter image description here

This happens as the contents of \caption are movable (i.e., fragile) as they may be used in lof and you have to \protect commands (from expanding) used inside the argument.

1
  • I strongly recommend your second method, as there's probably little point in producing an enlarged text-style integral sign in the List of Tables. However, I think that a third option -- \displaystyle\int -- is still better: the integral sign will then be set correctly on the math axis rather stick out bizarely above it. – Mico Aug 3 '14 at 4:34

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