summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tudscr/mathswap.sty
blob: cd7ffb4894865f82ff236278cb68986a8c509b11 (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
%%
%% This is file `mathswap.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tudscr-mathswap.dtx  (with options: `package')
%% 
%% TUD-Script -- Corporate Design of Technische Universitaet Dresden
%% 
%%   2020/11/10 v2.06k TUD-Script
%% 
%% Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2012-2020
%% 
%% This file was generated from file(s) of the TUD-Script bundle.
%% ----------------------------------------------------------------------------
%% 
%% This work may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, version 1.3c of the license.
%% 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 2005/12/01 or later and of this work.
%% 
%% This work has the LPPL maintenance status "author-maintained".
%% 
%% The current maintainer and author of this work is Falk Hanisch.
%% 
%%% From File: tudscr-mathswap.dtx
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mathswap}[%
  2020/11/10 v2.06k TUD-Script
  package
  (swap mathematical separators)%
]
\newcommand*\@commaswap{,}
\newcommand*\commaswap[1]{\gdef\@commaswap{#1}\ignorespaces}
\newcommand*\@dotswap{\,}
\newcommand*\dotswap[1]{\gdef\@dotswap{#1}\ignorespaces}
\newcommand*\ms@commachar{}
\newcommand*\ms@dotchar{}
\AtBeginDocument{%
  \DeclareMathSymbol{\ms@comma}{\mathord}{letters}{"3B}%
  \mathchardef\ms@commachar\mathcode\expandafter`,%
  \mathcode\expandafter`,="8000%
  \DeclareMathSymbol{\ms@dot}{\mathord}{letters}{"3A}%
  \mathchardef\ms@dotchar\mathcode\expandafter`.%
  \mathcode\expandafter`.="8000%
  \mathswapon%
}
\newcommand*\ms@commaswap{}
\newcommand*\ms@dotswap{}
\newcommand*\mathswapon{%
  \def\ms@commaswap{\@commaswap}%
  \def\ms@dotswap{\@dotswap}%
}
\newcommand*\mathswapoff{%
  \def\ms@commaswap{\ms@commachar}%
  \def\ms@dotswap{\ms@dotchar}%
}
\newcommand*\ms@ifnum[2]{%
  \ifx\ms@token0\ms@@ifnum{#1}\else%
  \ifx\ms@token1\ms@@ifnum{#1}\else%
  \ifx\ms@token2\ms@@ifnum{#1}\else%
  \ifx\ms@token3\ms@@ifnum{#1}\else%
  \ifx\ms@token4\ms@@ifnum{#1}\else%
  \ifx\ms@token5\ms@@ifnum{#1}\else%
  \ifx\ms@token6\ms@@ifnum{#1}\else%
  \ifx\ms@token7\ms@@ifnum{#1}\else%
  \ifx\ms@token8\ms@@ifnum{#1}\else%
  \ifx\ms@token9\ms@@ifnum{#1}\else%
  #2%
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
}
\newcommand*\ms@@ifnum[1]{%
  \begingroup%
    \mathcode\expandafter`,=\the\ms@comma%
    \mathcode\expandafter`.=\the\ms@dot%
    #1%
  \endgroup%
}
\newcommand*\ms@token{}
\begingroup
  \catcode`,=\active
  \gdef,{\futurelet\ms@token\ms@smartcomma}
  \catcode`.=\active
  \gdef.{\futurelet\ms@token\ms@smartdot}
\endgroup
\newcommand*\ms@smartcomma{\ms@ifnum{\ms@commaswap}{\ms@commachar}}
\newcommand*\ms@smartdot{\ms@ifnum{\ms@dotswap}{\ms@dotchar}}
\endinput
%%
%% End of file `mathswap.sty'.