Can anyone tell me, how to use \xspace correctly? I fetched the xspace package
(xspace.dtx -> translated it to xspace.sty and moved it into the standard input
location for all .sty files) and tried to use it, but it felt.
I defined:
==========
\newcommand{\INI}{Intelligent Network Initiative\xspace\index{Intelligent
Network Initiative}}
and used it in my text:
=======================
\subsubsection{The \INI (INI)}
By prcossing it with latex, I got the following error message
=============================================================
This is TeX, Version 3.141 (C version d)
(bla.tex
LaTeX2e <1994/02/03> PRELIMINARY TEST RELEASE
(/usr/local/tex/macros/book.cls
Standard Document Class `book' <1994/02/03>.
(/usr/local/tex/macros/bk10.clo)) (/usr/local/tex/macros/a4wide.sty
(/usr/local/tex/macros/a4.sty)) (/usr/local/tex/macros/fancyheadings.sty)
(/usr/local/tex/macros/float.sty) (/usr/local/tex/macros/xspace.sty)
(macros.tex)
Writing index file bla.idx
(bla.aux) [0] (preface.tex) [1] [2] (bla.toc) [3] [4] (bla.lof) [5] [6]
(bla.lot) [7] [8] (introduction.tex
Chapter 1.
(/usr/local/tex/macros/epsf.tex) [9] [10]) [11] [12] (overview.tex
Chapter 2.
[13]
! Undefined control sequence.
\xspace ->\futurelet \@let@token
\@xspace
l.94 \subsubsection{The \INI (INI)}
?
Can anyone tell me, what's going wrong here? Any suggestions are appreciated.
Regards
--Chris
Christoph Burkhardt
Inst. TIK, ETZ G 61.2
Gloriastrasse 35
ETH Zentrum
CH-8092 Zuerich, SWITZERLAND
Phone: +41 1 632 70 03
Fax: +41 1 632 10 35
e-mail: burk...@tik.ethz.ch
--------------------------------
Federal Institute of Technologie
E T H Z u e r i c h
--------------------------------
C> Hi,
C> Can anyone tell me, how to use \xspace correctly?
Possibly...
C> I fetched the xspace package
C> (xspace.dtx -> translated it to xspace.sty and moved it into the standard input
C> location for all .sty files) and tried to use it, but it felt.
C> I defined:
C> ==========
C> \newcommand{\INI}
C> {Intelligent Network Initiative\xspace\index{Intelligent Network Initiative}}
This in fact would never work, as \xspace has to be the last token in
the definition, so that it can look ahead for punctuation.
So it should be
\newcommand{\INI}
{Intelligent Network Initiative\index{Intelligent Network Initiative}\xspace}
C> and used it in my text:
C> =======================
C> \subsubsection{The \INI (INI)}
Ah, yes, unlike your first problem, which is documented in the package
documentation, this second `feature' is not documented anywhere as far
as I can see. Using \xspace makes the command fragile. Sorry;-)
So you would have to use \protect\INI or make INI robust, as below.
David
\documentclass{article}
\usepackage{xspace}
\DeclareRobustCommand{\INI}
{Intelligent Network Initiative\index{Intelligent Network Initiative}\xspace}
\begin{document}
\tableofcontents
\section{The \INI (INI)}
just a test, \INI should be followed by a space, but not this \INI.
\end{document}