summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fixdif/fixdif.sty
blob: b0e967b1c949c7e002d8f605d19f708480337396 (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
%%
%% This is file `fixdif.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fixdif.dtx  (with options: `package')
%% 
%%   Copyright (C) 2022 by Zhang Tingxuan <alphaztx@163.com>
%% 
%%   This work may be distributed and/or modified under the
%%   conditions of the LaTeX Project Public License, either
%%   version 1.3c of this license or (at your option) any later
%%   version. The latest version of this license is in:
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%%   and version 1.3 or later is part of all distributions of
%%   LaTeX version 2005/12/01 or later.
%% 
%%   This work has the LPPL maintenance status `maintained'.
%% 
%%   The Current Maintainer of this work is Zhang Tingxuan.
%% 
%%   This work consists of the files fixdif.dtx,
%%             and the derived files fixdif.ins,
%%                                   fixdif.sty,
%%                                   fixdif.pdf,
%%                               and README.md.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fixdif}[2022/10/27 Interface for defining differential operators.]
\@ifpackageloaded{unicode-math}{
  \Umathcode`\/="4 "0 "002F
  \Umathcode"2044="4 "0 "2044
  \Umathcode"2215="4 "0 "2215
  \Umathcode"2F98="4 "0 "2F98
  \Umathcode`\\="4 "0 "005C
  \Umathcode"2216="4 "0 "2216
  \Umathcode"29F5="4 "0 "29F5
  \Umathcode"29F9="4 "0 "29F9
}{
  \mathcode`\/="413D
  \mathcode`\\="426E % \backslash
  \def\backslash{\delimiter"426E30F\relax}
}
\def\mup@tch{\mathchoice{\mskip-\thinmuskip}{\mskip-\thinmuskip}{}{}}
\def\s@beforep@tch{\mathchoice{}{}{\mbox{}}{\mbox{}}}
\DeclareOption{rm}{\@ifpackageloaded{unicode-math}
  {\def\@@dif{\symrm{d}}}{\def\@@dif{\mathrm{d}}}}
\DeclareOption{normal}{\def\@@dif{d}}
\DeclareOption{partial}{\@tempswatrue}
\DeclareOption{nopartial}{\@tempswafalse}
\ExecuteOptions{rm,partial}
\ProcessOptions\relax
\if@tempswa
  \AtEndOfPackage{\letdif{\partial}{partial}}
\fi
\gdef\resetdfont#1{\let\@@dif\relax%
  \def\@@dif{#1{d}}}
\def\@dif{\mathinner{\@@dif}\mup@tch}
\let\d@accent\d
\DeclareRobustCommand\d{\ifmmode\@dif\else\expandafter\d@accent\fi}
\def\@letdif#1#2{\AtBeginDocument{%
  \ifcsname #2nondif\endcsname\else%
  \expandafter\let\csname #2nondif\expandafter\endcsname
    \csname #2\endcsname%
  \fi%
  \gdef#1{\mathinner{\csname #2nondif\endcsname}\mup@tch}%
}}
\def\s@letdif#1#2{\AtBeginDocument{%
  \ifcsname #2nondif\endcsname\else%
  \expandafter\let\csname #2nondif\expandafter\endcsname
    \csname #2\endcsname%
  \fi%
  \gdef#1{\mathinner{\s@beforep@tch\csname #2nondif\endcsname\mbox{}}\mup@tch}%
}}
\def\letdif{\@ifstar\s@letdif\@letdif}
\long\def\@newdif#1#2{\AtBeginDocument{%
  \ifdefined#1
    \PackageError{fixdif}{\string#1 is already defined.}
      {Try another command instead of \string#1.}%
  \else
    \long\gdef#1{\mathinner{#2}\mup@tch}%
  \fi%
}}
\long\def\s@newdif#1#2{\AtBeginDocument{%
  \ifdefined#1
  \PackageError{fixdif}{\string#1 is already defined.}
    {Try another command instead of \string#1.}%
  \else
    \long\gdef#1{\s@beforep@tch\mathinner{#2\mbox{}}\mup@tch}%
  \fi%
}}
\def\newdif{\@ifstar\s@newdif\@newdif}
\long\def\@renewdif#1#2{\AtBeginDocument{%
  \ifdefined#1
    \long\gdef#1{\mathinner{#2}\mup@tch}%
  \else
    \PackageError{fixdif}{\string#1 has not been defined yet.}
      {You should use \string\newdif instead of \string\renewdif.}%
  \fi%
}}
\long\def\s@renewdif#1#2{\AtBeginDocument{%
  \ifdefined#1
    \long\gdef#1{\s@beforep@tch\mathinner{#2\mbox{}}\mup@tch}%
  \else
    \PackageError{fixdif}{\string#1 has not been defined yet.}
      {You should use \string\newdif instead of \string\renewdif.}%
  \fi%
}}
\def\renewdif{\@ifstar\s@renewdif\@renewdif}
\def\@mathdif#1{\mathinner{#1}\mup@tch}
\def\s@mathdif#1{\s@beforep@tch\mathinner{#1\mbox{}}\mup@tch}
\DeclareRobustCommand\mathdif{\@ifstar\s@mathdif\@mathdif}
\endinput
%%
%% End of file `fixdif.sty'.