summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/cjk/texinput/CJKspace.sty
blob: 7399a3958bbb6eee6ffa3cdc95cfb866fa7e2e4e (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
% This is the file CJKspace.sty of the CJK package
%   for suppressing spaces between CJK characters only.
%
% created by Wenchang Sun <sunwch@hotmail.com>
%            Werner Lemberg <wl@gnu.org>
%
% Version 4.8.2 (29-Dec-2008)
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program in doc/COPYING; if not, write to the Free
% Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
% MA 02110-1301 USA

\NeedsTeXFormat{LaTeX2e}[2001/06/01]

\def\fileversion{3.8.0}
\def\filedate{2008/12/29}
\ProvidesPackage{CJKspace}[\filedate\space\fileversion]


\endlinechar \m@ne


% redefine `\CJK@ignorespaces'.

\def\CJK@@ignorespaces{
  \expandafter\CJK@@@ignorespaces}

\renewenvironment{CJK*}[3][]{
  \let\CJK@ignorespaces\CJK@@ignorespaces
  \CJK@envStart{#1}{#2}{#3}}
  {\CJK@envEnd}


\def\CJK@@@ignorespaces{
  \futurelet\CJK@next@token
  \CJK@check@next}

\def\CJK@check@next{
  \ifx\CJK@next@token\@sptoken
    \expandafter\CJK@@check@next
  \fi}

{
  \catcode`\-=11

  \global\let\-empty\@empty

  % define \CJK@@check@next to gobble subsequent space tokens.

  \def\:{\CJK@@check@next}
  \global\expandafter\def\: {
    \futurelet\cjk-let-token
    \cjk---check-next}

  % since characters in the output of \meaning\something have
  %     catcode 12, we have to change the catcodes of `\', `C',
  %     `J', `K', and `@'.

  \catcode`\/=0
  \catcode`\C=12
  \catcode`\J=12
  \catcode`\K=12
  \catcode`\@=12
  \catcode`\\=12

  /gdef/cjk---check-next{
    /expandafter/cjk-get-keystring
     /meaning/cjk-let-token\CJK@@@/cjk-space-stop
    /cjk-temp}

  % we check whether we can find the signature `\CJK@@@' at the
  %     beginning of following macro -- only the CJK package
  %     inserts this.

  /long/gdef/cjk-get-keystring#1\CJK@@@#2/cjk-space-stop{
    /edef/cjk-temp{#2}
    /ifx/cjk-temp/-empty
      /def/cjk-temp{ }
    /else
      /def/cjk-temp{}
    /fi}
}


\endlinechar `\^^M

\endinput