summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mathpunctspace
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2017-04-04 05:16:32 +0000
committerNorbert Preining <preining@logic.at>2017-04-04 05:16:32 +0000
commit5f75f308456b141211e9bbd313ac641ab977bb0f (patch)
treee0f171e27c39af3ef65ce30ec3651b78575a3da4 /Master/texmf-dist/tex/latex/mathpunctspace
parentf7e3f0fec458c74f13009de5518ddd65e011208f (diff)
mathpunctspace (new 4/Apr)
git-svn-id: svn://tug.org/texlive/trunk@43689 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mathpunctspace')
-rw-r--r--Master/texmf-dist/tex/latex/mathpunctspace/mathpunctspace.sty95
1 files changed, 95 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/mathpunctspace/mathpunctspace.sty b/Master/texmf-dist/tex/latex/mathpunctspace/mathpunctspace.sty
new file mode 100644
index 00000000000..2c9a1bc2d78
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/mathpunctspace/mathpunctspace.sty
@@ -0,0 +1,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