diff options
author | Karl Berry <karl@freefriends.org> | 2009-05-22 23:51:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-05-22 23:51:44 +0000 |
commit | 566f5207d7e3cafb0633d31277067336ccd9cca7 (patch) | |
tree | 7af53e7ac405185168bc1dc38c4e820f442b78d0 /Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-xspace.html | |
parent | b0beea26ffffd915bb6d9b82f2d65a0a05b7e23b (diff) |
move generic english documents out of texmf-doc
git-svn-id: svn://tug.org/texlive/trunk@13396 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-xspace.html')
-rw-r--r-- | Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-xspace.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-xspace.html b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-xspace.html new file mode 100644 index 00000000000..ff4cbfb70d1 --- /dev/null +++ b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-xspace.html @@ -0,0 +1,56 @@ +<head> +<title>UK TeX FAQ -- question label xspace</title> +</head><body> +<h3>Commands gobble following space</h3> +<p/>People are forever surprised that simple commands gobble the space +after them: this is just the way it is. The effect arises from the +way TeX works, and Lamport describes a solution (place a pair of braces +after a command’s invocation) in the description of LaTeX syntax. +Thus the requirement is in effect part of the definition of LaTeX. +<p/>This FAQ, +for example, is written with definitions that <em>require</em> one to +type <code>\</code><code>fred{}</code> + +for almost all macro invocations, regardless +of whether the following space is required: however, this FAQ +is written by highly dedicated (and, some would say, eccentric) +people. Many users find all those braces become very tedious very +quickly, and would really rather not type them all. +<p/>An alternative structure, that doesn’t violate the design of LaTeX, +is to say <code>\</code><code>fred</code><code>\</code><code> </code> — the <code>\</code><code> </code> command is “self +terminating” (like <code>\</code><code>\</code>) and you don’t need braces after +<em>it</em>. Thus one can reduce to one the extra characters one needs +to type. +<p/>If even that one character is too many, the package <i>xspace</i> +defines a command <code>\</code><code>xspace</code> that guesses whether there should have +been a space after it, and if so introduces that space. So + +“<code>fred<code>\</code><code>xspace</code> jim</code>” produces “fred jim”, while +“<code>fred<code>\</code><code>xspace</code>. jim</code>” produces “fred. jim”. Which +usage would of course be completely pointless; but you can incorporate +<code>\</code><code>xspace</code> in your own macros: +<blockquote> +<pre> +\usepackage{xspace} +... +\newcommand{\restenergy}{\ensuremath{mc^2}\xspace} +... +and we find \restenergy available to us... +</pre> + +</blockquote><p> +The <code>\</code><code>xspace</code> command must be the last thing in your macro +definition (as in the example); it’s not completely foolproof, but it +copes with most obvious situations in running text. +<p/>The <i>xspace</i> package doesn’t save you anything if you only use +a modified macro once or twice within your document. In any case, be +careful with usage of <code>\</code><code>xspace</code> — it changes your input syntax, +which can be confusing, notably to a collaborating author +(particularly if you create some commands which use it and some which +don’t). Of course, no command built into LaTeX or into any +“standard” class or package will use <code>\</code><code>xspace</code>. +<dl> +<dt><tt><i>xspace.sty</i></tt><dd>Distributed as part of <a href="ftp://cam.ctan.org/tex-archive/macros/latex/required/tools.zip">macros/latex/required/tools</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/required/tools.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/required/tools/">browse</a>) +</dl> +<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=xspace">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=xspace</a> +</body> |