summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-matchbrak.html
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-doc/doc/english/FAQ-en/html/FAQ-matchbrak.html')
-rw-r--r--Master/texmf-doc/doc/english/FAQ-en/html/FAQ-matchbrak.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-matchbrak.html b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-matchbrak.html
new file mode 100644
index 00000000000..efcbf4da21c
--- /dev/null
+++ b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-matchbrak.html
@@ -0,0 +1,57 @@
+<head>
+<title>UK TeX FAQ -- question label matchbrak</title>
+</head><body>
+<h3>My brackets don&rsquo;t match</h3>
+<p>(La)TeX has a low-level mechanism for matching braces in document
+text. This means you can type something like:
+<blockquote>
+<pre>
+\section{All \emph{OK} now.}
+</pre>
+</blockquote><p>
+and know that the first brace (for the argument of <code>\</code><code>section</code>) will
+be matched with the last brace, and the internal pair of braces (for
+the argument of <code>\</code><code>emph</code>) will be matched with each other. It&rsquo;s all
+very simple.
+<p>However, LaTeX has a convention of enclosing optional arguments in
+brackets, as in:
+<blockquote>
+<pre>
+\section[OK]{All \emph{OK} now.}
+</pre>
+</blockquote><p>
+These brackets are not matched by TeX mechanisms, despite the
+superficial similarity of their use. As a result,
+straightforward-looking usages like:
+<blockquote>
+<pre>
+\section[All [OK] now]{All \emph{OK} now.}
+</pre>
+</blockquote><p>
+aren&rsquo;t OK at all &mdash; the optional argument comes to consist of
+&ldquo;All [OK&rdquo;, and <code>\</code><code>section</code> takes the single character &ldquo;n&rdquo; (of
+the first &ldquo;now&rdquo;) as its argument.
+<p>Fortunately, TeX&rsquo;s scanning mechanisms helps us by accepting the
+syntax &ldquo;<code>{]}</code>&rdquo; to &lsquo;hide&rsquo; the closing bracket from the
+scanning mechanism that LaTeX uses. In practice, the commonest way
+to use this facility is:
+<blockquote>
+<pre>
+\section[All {[OK]} now]{All \emph{OK} now.}
+</pre>
+</blockquote><p>
+since bracing the bracket on its own &ldquo;looks odd&rdquo;.
+<p>LaTeX has another argument syntax, even less regular, where the
+argument is enclosed in parentheses, as in:
+<blockquote>
+<pre>
+\put(1,2){foo}
+</pre>
+</blockquote><p>
+(a picture environment command).
+<p>This mechanism is also prone to problems with matching closing
+parentheses, but the issue seldom arises since such arguments rarely
+contain text. If it were to arise, the same solution (enclosing the
+confused characters in braces) would solve the problem.
+<p><p><p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=matchbrak">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=matchbrak</a>
+</body>