In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
This is a common issue when using line breaks in captions with LaTeX. The problem occurs because the `\caption` command interacts with the hyperref package, which can cause issues with the `\\` line break. Here are a few solutions: 1. Use `\protect\\` instead of just `\\`:
1 | \caption{First line \protect\\ Second line} |
1 | \caption{First line \protect\newline Second line} |
1 2 3 4 | \caption{\begin{minipage}[t]{\linewidth} First line \\ Second line \end{minipage}} |
1 | \newcommand{\captionbreak}{\protect\\} |
1 | \caption{First line \captionbreak Second line} |
Testing if the previous output contains the string \protect
: True
In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
This is a common issue when using line breaks in captions with hyperref package. There are several ways to fix this: 1. The simplest solution is to use \protect before the line break:
1 | \caption{First line \protect\\ Second line} |
1 | \caption{First line \newline Second line} |
1 2 3 4 5 | \caption{\begin{minipage}[t]{\linewidth} First line \\ Second line \\ Third line \end{minipage}} |
Testing if the previous output contains the string \protect
: True
In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
This is a common issue when using line breaks (\\\) in captions while the hyperref package is loaded. Here are two solutions: 1. Use \protect before the line break:
1 | \caption{First line \protect\\ Second line} |
1 | \caption{First line \newline Second line} |
1 2 3 4 5 | \begin{figure} \includegraphics{image.png} \caption{First line \protect\\ Second line} \label{fig:example} \end{figure} |
Testing if the previous output contains the string \protect
: True
In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
This is a common issue when using line breaks (\\\) in captions with hyperref package. Here are two solutions: 1. Use \protect before the line break:
1 | \caption{First line \protect\\ Second line} |
1 | \caption{\shortstack{First line \\ Second line}} |
1 | \caption{\makecell{First line \\ Second line}} |
1 | \usepackage{makecell} |
Testing if the previous output contains the string \protect
: True
In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
In latex when I force a newline in a caption with \\ it gives an error saying \Hy@tempa has an extra } runaway argument?
This is a common issue when using line breaks in captions with hyperref. To fix this, you can either: 1. Use `\protect\\` instead of just `\\`:
1 | \caption{First line \protect\\ Second line} |
1 | \caption[Short caption]{First line \\ Second line} |
Testing if the previous output contains the string \protect
: True