diff options
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.html | 57 |
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’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’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’t OK at all — the optional argument comes to consist of +“All [OK”, and <code>\</code><code>section</code> takes the single character “n” (of +the first “now”) as its argument. +<p>Fortunately, TeX’s scanning mechanisms helps us by accepting the +syntax “<code>{]}</code>” to ‘hide’ 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 “looks odd”. +<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> |