diff options
Diffstat (limited to 'Master/texmf-doc/doc/english/FAQ-en/html/FAQ-labundef.html')
-rw-r--r-- | Master/texmf-doc/doc/english/FAQ-en/html/FAQ-labundef.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-labundef.html b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-labundef.html new file mode 100644 index 00000000000..5d5b5be1fe8 --- /dev/null +++ b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-labundef.html @@ -0,0 +1,29 @@ +<head> +<title>UK TeX FAQ -- question label labundef</title> +</head><body> +<h3>Finding if a label is undefined</h3> +<p>People seem to want to know (at run time) if a label is undefined (I +don't actually understand <em>why</em>, particularly: it's a transient +state, and LaTeX deals with it quite well). +<p>A resolved label is simply a command: +<code>\</code><code>r@</code><code><<i>label-name</i>></code>; determining if the label is set is +then simply a matter of detecting if the command exists. The usual +LaTeX internal way of doing this is to use the command +<code>\</code><code>@ifundefined</code>: +<blockquote> + <code>\</code><code>@ifundefined{</code><em><code>r@</code>lab-name</em><code>}{</code><em>undef-cmds</em><code>}</code>{def-cmds} +</blockquote> +In which, <<i>lab-name</i>> is exactly what you would use in +a <code>\</code><code>label</code> command, and the remaining two arguments are command +sequences to be used if the label is undefined +(<<i>undef-cmds</i>>) or if it is defined +(<code><em>def-cmds</em></code>). +<p>Note that any command that incorporates <code>\</code><code>@ifundefined</code> is naturally +fragile, so remember to create it with <code>\</code><code>DeclareRobustCommand</code> or to +use it with <code>\</code><code>protect</code> in a moving argument. +<p>If you're into this game, you may well not care about LaTeX's +warning about undefined labels at the end of the document; however, +if you are, include the command <code>\</code><code>G@refundefinedtrue</code> in +<<i><code>undef-cmds</i>></code>. +<p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=labundef">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=labundef</a> +</body> |