diff options
Diffstat (limited to 'Master/texmf-doc/doc/english/FAQ-en/html/FAQ-protect.html')
-rw-r--r-- | Master/texmf-doc/doc/english/FAQ-en/html/FAQ-protect.html | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-protect.html b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-protect.html index bcc7d341a3b..710c346f896 100644 --- a/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-protect.html +++ b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-protect.html @@ -2,7 +2,7 @@ <title>UK TeX FAQ -- question label protect</title> </head><body> <h3>What’s the reason for ‘protection’?</h3> -<p>Sometimes LaTeX saves data it will reread later. These data are +<p/>Sometimes LaTeX saves data it will reread later. These data are often the argument of some command; they are the so-called moving arguments. (‘Moving’ because data are moved around.) Places to look for are all arguments that may go into table of contents, list of figures, @@ -11,25 +11,41 @@ read in later. Other places are those data that might appear in head- or footlines. Section headings and figure captions are the most prominent examples; there’s a complete list in Lamport’s book (see <a href="FAQ-books.html">TeX-related books</a>). -<p> +<p/> -<p>What’s going on really, behind the scenes? The commands in the moving -arguments are already expanded to their internal structure during the +<p/>What’s going on really, behind the scenes? The commands in moving +arguments are normally expanded to their internal structure during the process of saving. Sometimes this expansion results in invalid TeX -code when processed again. “<code>\</code><code>protect</code><code>\</code><code>cmd</code>” tells LaTeX to save -<code>\</code><code>cmd</code> as <code>\</code><code>cmd</code>, without expansion. -<p>What is a ‘fragile command’? It’s a command that expands into illegal +code, which shows either during expansion or when the code is +processed again. Protecting a command, using +“<code>\</code><code>protect</code><code>\</code><code>cmd</code>” tells LaTeX to save <code>\</code><code>cmd</code> as +<code>\</code><code>cmd</code>, without expanding it at all. +<p/>So, what is a ‘fragile command’? — it’s a command that expands into +illegal TeX code during the save process. +<p/>What is a ‘robust command’? — it’s a command that expands into legal TeX code during the save process. -<p>What is a ‘robust command’? It’s a command that expands into legal -TeX code during the save process. -<p>Again, commands are marked as ‘robust’ or ‘fragile’, as they’re -defined in Lamport’s book. Sadly, some commands are robust in -LaTeX itself, but are redefined by some packages to be fragile; the -<code>\</code><code>cite</code> command commonly suffers this treatment. -<p>No-one (of course) likes this situation; the LaTeX3 team have -removed the need for protection of some things in the production of -LaTeX2e, but the techniques available to them within current -LaTeX mean that this is an expensive exercise. It remains a -long-term aim of the team to remove all need for these things. -<p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=protect">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=protect</a> +<p/>Lamport’s book says in its description of every LaTeX command whether +it is ‘robust’ or ‘fragile’; it also says that every command with an +optional argument is fragile. These lists aren’t as reliable as the +list of moving arguments; the statements may have been true in +early versions of LaTeX2e but are not any longer necessarily so: +<ul> +<li> Some fragile commands, such as <code>\</code><code>cite</code>, have been made robust + in later revisions of LaTeX. +<li> Some robust commands are redefined by certain packages to be + fragile (the <code>\</code><code>cite</code> command commonly suffers this treatment). +<li> Some commands, such as <code>\</code><code>end</code> and <code>\</code><code>nocite</code>, are fragile + even though they have no optional arguments. +<li> The “user’s way” of creating a command with an optional + argument (using <code>\</code><code>newcommand</code>) now always creates a robust + command. There is no reason that a package author should not also + make robust commands with optional arguments as part of the + package. +</ul> +In short, the situation is confusing. No-one believes this is +satisfactory, and the LaTeX team have removed the need for +protection of some things, but the techniques available in +current LaTeX mean that this is an expensive exercise. It remains +a long-term aim of the team to remove all need for <code>\</code><code>protect</code>ion. +<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=protect">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=protect</a> </body> |