summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bropd/bropd.sty
blob: 5f16b74b052608bf5aa71d744a28aa8c489bef44 (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
119
120
121
122
123
%%
%% This is file `bropd.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bropd.dtx 
%% 
%% Copyright 2012 by Benjamin Tatlock
%% 
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3 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 Benjamin Tatlock.
%% 
%% This work consists of the file bropd.dtx and the derived files bropd.sty and
%% bropd.pdf.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bropd}
[2012/11/04 1.0 automated typing of brackets and differential operators]
\newif\if@bropd@a\newif\if@bropd@b\newif\if@bropd@s
\newcounter{@bropd@c}\newcounter{@bropd@d}
\newcounter{@bropd@e}\newcounter{@bropd@f}
\DeclareOption{pdshort}{\@bropd@atrue}
\DeclareOption{sans}{\@bropd@strue}\ProcessOptions
\newcommand\@bropd@g[4]{\def\@bropd@h{#1}
\ifx\@bropd@h\empty
\setcounter{@bropd@c}0\setcounter{@bropd@d}1
\let\@bropd@h\empty
\@for\@bropd@i:=#3\do{\stepcounter{@bropd@c}}
\frac{#4\ifnum\value{@bropd@c}>1
^{\arabic{@bropd@c}}\fi#2}
{\@for\@bropd@i:=#3\do{
\ifx\@bropd@i\@bropd@h
\stepcounter{@bropd@d}
\else
\@bropd@h
\ifnum\value{@bropd@d}>1
^{\arabic{@bropd@d}}
\fi
#4\setcounter{@bropd@d}1
\fi
\let\@bropd@h\@bropd@i}
\@bropd@h
\ifnum\value{@bropd@d}>1
^{\arabic{@bropd@d}}\fi}
\else
\frac{#4^{#1}#2}{#4#3^{#1}}
\fi}
\newcommand\@bropd@j[1]{\setcounter{@bropd@f}0
{\renewcommand{\br}[1]{\stepcounter{@bropd@e}{##1}
\ifnum\value{@bropd@e}>\value{@bropd@f}
\setcounter{@bropd@f}{\value{@bropd@e}}
\fi
\addtocounter{@bropd@e}{-1}}\sbox0{$#1$}}
\loop
\ifnum\value{@bropd@f}>2
\addtocounter{@bropd@f}{-3}
\repeat
\ifnum\value{@bropd@f}>0
\ifnum\value{@bropd@f}>1
\def\@bropd@k{\left\lbrace#1\right\rbrace}
\else
\def\@bropd@k{\left[#1\right]}
\fi
\else
\def\@bropd@k{\left(#1\right)}
\fi}
\if@bropd@a
\let\@bropd@l\empty
\newcommand\br[1]{\let\@bropd@m\@bropd@l
\@bropd@j{\let\@bropd@l\empty#1\let\@bropd@l\@bropd@m}
\ifx\@bropd@l\empty
\def\@bropd@n{\@bropd@k}
\else
\let\@bropd@m\@bropd@l
\def\@bropd@n{\@bropd@k_{\@bropd@m}}
\fi
\let\@bropd@l\empty
\@bropd@n}
\newcommand\pd[3][]{\def\@bropd@h{#1}
\ifx\@bropd@h\empty
\@bropd@bfalse
\else
\if!\ifnum9<1#1!\else_\fi
\@bropd@bfalse
\else
\@bropd@btrue
\fi
\fi
\if@bropd@b\@bropd@g{#1}{#2}{\noexpand#3}\partial
\else
\def\@bropd@o{#2}
\def\@bropd@p{\ifx\@bropd@h\empty
\@for\@bropd@i:=#3\do\@bropd@i\else\setcounter{@bropd@c}0
\loop
\ifnum\value{@bropd@c}<#1
#3\stepcounter{@bropd@c}
\repeat
\fi}
\ifx\@bropd@o\empty
\let\@bropd@l\@bropd@p\else{#2}{_{\@bropd@p}}\fi\fi}
\else
\newcommand\pd[3][]{\@bropd@g{#1}{#2}{\noexpand#3}\partial}
\newcommand\br[1]{\@bropd@j{#1}\@bropd@k}
\fi
\if@bropd@s
\newcommand\@bropd@r{\mathsf{d}}
\else
\newcommand\@bropd@r{\mathrm{d}}
\fi
\newcommand\od[3][]{\def\@bropd@h{#1}
\frac{\@bropd@r\ifx\@bropd@h\empty\else^{#1}\fi#2}
{\@bropd@r#3\ifx\@bropd@h\empty\else^{#1}\fi}}
\endinput
%%
%% End of file `bropd.sty'.