From 5f75f308456b141211e9bbd313ac641ab977bb0f Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 4 Apr 2017 05:16:32 +0000 Subject: mathpunctspace (new 4/Apr) git-svn-id: svn://tug.org/texlive/trunk@43689 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/mathpunctspace/mathpunctspace.sty | 95 ++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/mathpunctspace/mathpunctspace.sty (limited to 'Master/texmf-dist/tex/latex/mathpunctspace') 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 -- cgit v1.2.3