blob: 2c9a1bc2d7812f2833bf119cbdbb58f6f38252ec (
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
|
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{mathpunctspace}
[2017/04/03 v1.0 style file ``mathpunctspace.sty''^^J
by Yuwsuke Kieda]
\RequirePackage{xkeyval}
\newif\if@postspace@comma@natural \@postspace@comma@naturaltrue
\newif\if@postspace@semicolon@natural \@postspace@semicolon@naturaltrue
\newif\if@unit@mu \@unit@mutrue
\DeclareOptionX{comma}[natural]{\def\@temp@comma@postskip{#1}}
\DeclareOptionX{semicolon}[natural]{\def\@temp@semicolon@postskip{#1}}
\DeclareOptionX{unit}[mu]{\def\@unit@space{#1}}
\DeclareOptionX{latexorg}{\endinput}
\ProcessOptionsX
\@ifundefined{@temp@comma@postskip}{\def\@temp@comma@postskip{natural}}{}
\@ifundefined{@temp@semicolon@postskip}{\def\@temp@semicolon@postskip{natural}}{}
\@ifundefined{@unit@space}{\def\@unit@space{mu}}{}
\def\@tmp@unit@mu{mu}
\ifx\@unit@space\@tmp@unit@mu\@unit@mutrue\else\@unit@mufalse\fi
\setbox\@tempboxa\hbox{$\mskip\thinmuskip$}%
\def\@temp@comma@postskip@natural{natural}
\ifx\@temp@comma@postskip\@temp@comma@postskip@natural
\newskip\postspace@comma
\def\@temp@comma@postskip{%
\dimexpr\fontdimen2\the\font-\wd\@tempboxa\relax
plus \fontdimen3\the\font
minus \fontdimen4\the\font}
\else
\@postspace@comma@naturalfalse
\if@unit@mu
\newmuskip\postspace@comma
\else
\newskip\postspace@comma
\fi
\fi
\def\@semicolon@postskip@natural{natural}
\ifx\@temp@semicolon@postskip\@semicolon@postskip@natural
\newskip\postspace@semicolon
\def\@temp@semicolon@postskip{%
\dimexpr\fontdimen2\the\font-\wd\@tempboxa\relax
plus \fontdimen3\the\font
minus \fontdimen4\the\font}
\else
\@postspace@semicolon@naturalfalse
\if@unit@mu
\newmuskip\postspace@semicolon
\else
\newskip\postspace@semicolon
\fi
\fi
\postspace@comma\@temp@comma@postskip\relax
\postspace@semicolon\@temp@semicolon@postskip\relax
\begingroup
\catcode`\,=\active
\if@postspace@comma@natural
\def\@x@{\def,{\normalcomma\hskip\postspace@comma}}
\else
\if@unit@mu
\def\@x@{\def,{\normalcomma\mskip\postspace@comma}}
\else
\def\@x@{\def,{\normalcomma\hskip\postspace@comma}}
\fi
\fi
\expandafter\endgroup\@x@%
% *only* in math-mode are made active...
\mathcode`\,="8000
% last space is *necessary*
\def\normalcomma{\mathchar"613B }
\begingroup
\catcode`\;=\active
\if@postspace@semicolon@natural
\def\@x@{\def;{\normalsemicolon\hskip\postspace@semicolon}}
\else
\if@unit@mu
\def\@x@{\def;{\normalsemicolon\mskip\postspace@semicolon}}
\else
\def\@x@{\def;{\normalsemicolon\hskip\postspace@semicolon}}
\fi
\fi
\expandafter\endgroup\@x@%
% *only* in math-mode are made active...
\mathcode`\;="8000
% last space is *necessary*
\def\normalsemicolon{\mathchar"603B }
\endinput
|