summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-extrabrace.html
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-extrabrace.html')
-rw-r--r--Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-extrabrace.html65
1 files changed, 65 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-extrabrace.html b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-extrabrace.html
new file mode 100644
index 00000000000..1f68cf4bd74
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-extrabrace.html
@@ -0,0 +1,65 @@
+<head>
+<title>UK TeX FAQ -- question label extrabrace</title>
+</head><body>
+<h3>An extra &lsquo;<code>}</code>&rsquo;??</h3>
+<!-- caption heading -->
+<p/>You&rsquo;ve looked at your LaTeX source and there&rsquo;s no sign of a misplaced
+<code>}</code> on the line in question.
+<p/>Well, no: this is TeX&rsquo;s cryptic way of hinting that you&rsquo;ve put a
+<a href="FAQ-protect.html">fragile command</a> in a moving argument.
+
+<p/>For example, <code>\</code><code>footnote</code> is fragile, and if we put that in the
+moving argument of a <code>\</code><code>section</code> command, as
+<blockquote>
+
+<pre>
+\section{Mumble\footnote{I couldn't think of anything better}}
+</pre>
+</blockquote><p>
+we get told
+<blockquote>
+<pre>
+! Argument of \@sect has an extra }.
+</pre>
+</blockquote><p>
+The same happens with captions (the following is a simplification of a
+<i>comp.text.tex</i> post):
+<blockquote>
+<pre>
+\caption{Energy: \[e=mc^2\]}
+</pre>
+</blockquote><p>
+giving us the error message
+<blockquote>
+<pre>
+! Argument of \@caption has an extra }.
+</pre>
+</blockquote><p>
+The solution is usually to use a robust command in place of the one
+you are using, or to force your command to be robust by prefixing it
+with <code>\</code><code>protect</code>, which in the <code>\</code><code>section</code> case would show as
+<blockquote>
+
+<pre>
+\section{Mumble\protect\footnote{I couldn't think of anything better}}
+</pre>
+</blockquote><p>
+In both the <code>\</code><code>section</code> case and the <code>\</code><code>caption</code> case, you can
+separate the moving argument, as in
+<code>\</code><code>section[</code><em>moving</em><code>]{</code><em>static</em><code>}</code>; this gives us another standard
+route &mdash; simply to omit (or otherwise sanitise) the fragile command
+in the moving argument. So, one might rewrite the <code>\</code><code>caption</code>
+example as:
+<blockquote>
+
+<pre>
+\caption[Energy: $E=mc^2$]{Energy: \[E=mc^2\]}
+</pre>
+</blockquote><p>
+for, after all, even if you want display maths in a caption, you
+surely don&rsquo;t want it in the list of figures.
+<p/>The case of footnotes is somewhat more complex;
+&ldquo;<a href="FAQ-ftnsect.html">footnotes in LaTeX section headings</a>&rdquo;
+deals specifically with that issue.
+<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=extrabrace">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=extrabrace</a>
+</body>