summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tools/xspace.sty
blob: b71da9dc9350940782b501b5ef13051b0742fb3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
%%
%% This is file `xspace.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xspace.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% 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.
%% 
%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
%% --------------------------------------------------------------------------
%% 
%% It may be distributed and/or modified under the
%% 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.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'
%% without such generated files.
%% 
%% The list of all files belonging to the LaTeX `Tools Bundle' is
%% given in the file `manifest.txt'.
%% 
%% 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}
          [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{%
  \@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'.