diff options
author | Karl Berry <karl@freefriends.org> | 2010-04-07 22:47:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-04-07 22:47:28 +0000 |
commit | 3f1971c9b7717818766692c9aa497e20e7472f2c (patch) | |
tree | 678de0190b6643b1b21fd9441fa1387bce180726 /Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-csname.html | |
parent | c7c3b090320a234149dbe23315e2a15a2773ac79 (diff) |
FAQ-en 3.19d (7apr10)
git-svn-id: svn://tug.org/texlive/trunk@17742 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-csname.html')
-rw-r--r-- | Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-csname.html | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-csname.html b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-csname.html index d2abced359a..b2872547fbb 100644 --- a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-csname.html +++ b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-csname.html @@ -2,8 +2,8 @@ <title>UK TeX FAQ -- question label csname</title> </head><body> <h3>Defining a macro from an argument</h3> -<p/>It’s common to want a command to create another command: often one -wants the new command’s name to derive from an argument. LaTeX +<p/>It’s common to want a command to create another command: often one +wants the new command’s name to derive from an argument. LaTeX does this all the time: for example, <code>\</code><code>newenvironment</code> creates start- and end-environment commands whose names are derived from the name of the environment command. @@ -13,7 +13,7 @@ name of the environment command. \def\relay#1#2{\def\#1{#2}} </pre> </blockquote><p> -doesn’t work (the TeX engine interprets it +doesn’t work (the TeX engine interprets it as a rather strange redefinition of <code>#</code>). The trick is to use <code>\</code><code>csname</code>, which is a TeX primitive for generating command names from random text, together with <code>\</code><code>expandafter</code>. The definition @@ -28,8 +28,8 @@ above should read: With this definition, <code>\</code><code>relay{blah}{bleah}</code> is equivalent to <code>\</code><code>def</code><code>\</code><code>blah{bleah}</code>. <p/>Note that the definition of <code>\</code><code>relay</code> omits the braces round the -‘command name’ in the <code>\</code><code>newcommand</code> it executes. This is -because they’re not necessary (in fact they seldom are), and in this +‘command name’ in the <code>\</code><code>newcommand</code> it executes. This is +because they’re not necessary (in fact they seldom are), and in this circumstance they make the macro code slightly more tedious. <p/>The name created need not (of course) be <em>just</em> the argument: <blockquote> @@ -52,6 +52,6 @@ With commands \def\finish#1{\csname finish#1\endcsname} </pre> </blockquote><p> -these ‘races’ could behave a bit like LaTeX environments. +these ‘races’ could behave a bit like LaTeX environments. <p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=csname">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=csname</a> </body> |