diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tools/xspace.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tools/xspace.sty | 136 |
1 files changed, 108 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/tools/xspace.sty b/Master/texmf-dist/tex/latex/tools/xspace.sty index 1437d4e223b..b71da9dc935 100644 --- a/Master/texmf-dist/tex/latex/tools/xspace.sty +++ b/Master/texmf-dist/tex/latex/tools/xspace.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 +%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -16,12 +16,12 @@ %% -------------------------------------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 +%% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2003/12/01 or later. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. %% %% This file may only be distributed together with a copy of the LaTeX %% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' @@ -30,33 +30,113 @@ %% The list of all files belonging to the LaTeX `Tools Bundle' is %% given in the file `manifest.txt'. %% -%% File: xspace.dtx Copyright (C) 1991-1996 David Carlisle +%% File: xspace.dtx Copyright (C) 1991-1997 David Carlisle +%% File: xspace.dtx Copyright (C) 2004-2006 David Carlisle, +%% Morten H\o gholm \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{xspace} - [1997/10/13 v1.06 Space after command names (DPC)] -\DeclareRobustCommand\xspace{\futurelet\@let@token\@xspace} + [2006/05/08 v1.12 Space after command names (DPC,MH)] +\DeclareRobustCommand\xspace{\@xspace@firsttrue + \futurelet\@let@token\@xspace} +\newif\if@xspace@first +\def\@xspace@simple{\futurelet\@let@token\@xspace} +\def\@xspace@exceptions@tlp{% + ,.'/?;:!~-)\ \/\bgroup\egroup\@sptoken\space\@xobeysp + \footnote\footnotemark +} +\newcommand*\xspaceaddexceptions{% + \g@addto@macro\@xspace@exceptions@tlp +} +\newcommand*\xspaceremoveexception[1]{% + \def\reserved@a##1#1##2##3\@@{% + \@xspace@if@q@nil@NF##2{% + \def\reserved@a####1#1####2\@@{% + \gdef\@xspace@exceptions@tlp{####1####2}}% + \expandafter\reserved@a\@xspace@exceptions@tlp\@@ + }% + }% + \expandafter\reserved@a\@xspace@exceptions@tlp#1\@xspace@q@nil\@@ +} +\def\@xspace@break@loop#1\@nil{} +\providecommand*\@xspace@hook{} +\begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname eTeXversion\endcsname\relax + \begingroup + \catcode`\;=\active \catcode`\:=\active + \catcode`\?=\active \catcode`\!=\active + \catcode`\,=\active \catcode`\'=\active \catcode`\-=\active + \xspaceaddexceptions{;:?!,'-} + \endgroup + \let\@xspace@eTeX@setup\relax +\else + \def\@xspace@eTeX@setup{% + \begingroup + \everyeof{}% + \endlinechar=-1\relax + \catcode`\ =10\relax + \makeatletter + \catcode`\\\z@ + \catcode`\{\@ne + \catcode`\}\tw@ + \scantokens\expandafter{\expandafter\gdef + \expandafter\@xspace@exceptions@tlp + \expandafter{\@xspace@exceptions@tlp}}% + \endgroup + } +\fi \def\@xspace{% - \ifx\@let@token\bgroup\else - \ifx\@let@token\egroup\else - \ifx\@let@token\/\else - \ifx\@let@token\ \else - \ifx\@let@token~\else - \ifx\@let@token.\else - \ifx\@let@token!\else - \ifx\@let@token,\else - \ifx\@let@token:\else - \ifx\@let@token;\else - \ifx\@let@token?\else - \ifx\@let@token/\else - \ifx\@let@token'\else - \ifx\@let@token)\else - \ifx\@let@token-\else - \ifx\@let@token\@xobeysp\else - \ifx\@let@token\space\else - \ifx\@let@token\@sptoken\else - \space - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - + \@xspace@lettoken@if@letter@TF \space{% + \if@xspace@first + \@xspace@firstfalse + \let\@xspace@maybespace\space + \@xspace@eTeX@setup + \fi + \expandafter\@xspace@check@token + \@xspace@exceptions@tlp\@xspace@q@nil\@nil + \@xspace@token@if@equal@NNT \space \@xspace@maybespace + {% + \@xspace@lettoken@if@expandable@TF + {\expandafter\@xspace@simple}% + {\@xspace@maybespace\@xspace@hook}% + }% + }% +} +\def\@xspace@check@token #1{% + \ifx\@xspace@q@nil#1% + \expandafter\@xspace@break@loop + \fi + \expandafter\ifx\csname @let@token\endcsname#1% + \let\@xspace@maybespace\relax + \expandafter\@xspace@break@loop + \fi + \@xspace@check@token +} +\def\@xspace@lettoken@if@letter@TF{% + \ifcat\noexpand\@let@token @% letter + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +\def\@xspace@lettoken@if@expandable@TF{% + \expandafter\ifx\noexpand\@let@token\@let@token% + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} +\def\@xspace@token@if@equal@NNT#1#2{% + \ifx#1#2% + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi} +\def\@xspace@q@nil{\@xspace@q@nil} +\def\@xspace@if@q@nil@NF#1{% + \ifx\@xspace@q@nil#1% + \expandafter\@gobble + \else + \expandafter\@firstofone + \fi} \endinput %% %% End of file `xspace.sty'. |