summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/12many/12many.sty
blob: 00b333a41e3f576599b31c5a070a091cd0424a23 (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
124
125
126
127
128
129
130
%%
%% This is file `12many.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% 12many.dtx  (with options: `sty')
%% This is a generated file.
%% 
%% This file is part of the `12many' package.
%% The `12many' package has the LPPL maintenance status: maintained.
%% Current Maintainer is Ulrich M. Schwarz, ulmi@users.sarovar.org
%% 
%% Copyright (C) 2004,2005 by Ulrich M. Schwarz.
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3a 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
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{12many}[2005/05/09 v0.3 1, 2, many: numbersets  (ums)]

\RequirePackage{calc, keyval}
\newcommand\newOTMstyle{%
  \let\otm@@newcmd\newcommand
  \otm@@fooOTMstyle
}
\newcommand\renewOTMstyle{%
  \let\otm@@newcmd\renewcommand
  \otm@@fooOTMstyle
}
\newcommand*\otm@@fooOTMstyle[2][\relax]{%
  \ifx #1\relax\else
  \@for\parm:=#1\do{%
    \expandafter\otm@@newkvOTMparameter\parm={#2}%
  }%
  \fi
  \expandafter\otm@@newcmd\expandafter*\csname otm@style@#2\endcsname[2]%
}
\def\otm@@newkvOTMparameter#1=#2=#3{%
  \newOTMparameter{#3}{#1}{#2}%
}
\newcommand\newOTMparameter[3]{%
  \expandafter\providecommand\csname otm@#1@#2\endcsname{#3}%
  \define@key{otm@#1}{#2}{\expandafter\renewcommand\csname otm@#1@#2\endcsname{##1}}%
}
\newcommand\setOTMparameter[2]{%
  \expandafter\renewcommand\csname otm@#1@#2\endcsname%
}
\newcommand\getOTMparameter[2][\otm@@currentstyle]{%
  \csname otm@#1@#2\endcsname%
}
\newcommand*\setOTMstyle[2][]{%
  \protected@edef\otm@@currentstyle{#2}%
  \PackageInfo{12many}{Using style \otm@@currentstyle[#1]}%
  \setkeys{otm@\otm@@currentstyle}{#1}%
  \expandafter\let\expandafter\nto\csname otm@style@\otm@@currentstyle\endcsname%
}
\newcommand\nto{%
  \PackageWarning{12many}{No style selected. Using dots.}%
  \setOTMstyle{dots}%
  \nto%
}
\newcommand\oto{\nto{0}}
\newcommand\ito{\nto{1}}

%% Style "`set"': the "`proper way"': {i\in N: x<=i<=y}
\newOTMstyle[var=i,naturals={\mathrm{N}_0},where=|]{set}{%
  \{\getOTMparameter{var}\in\getOTMparameter{naturals}%
  \getOTMparameter{where} #1\leq\getOTMparameter{var}\leq#2\}%
}
%% Style "`laue"': 1 to n is n with some sort of rharpoon below.
\newcounter{otm@scratch}

\newOTMstyle{laue}{%
  \ifcase#1\relax
  (\{0\}\otm@laue@setplus\otm@@laue@laue{#2})%
  \or
  \otm@@laue@laue{#2}%
  \else
  \setcounter{otm@scratch}{#1}%
  \addtocounter{otm@scratch}{-1}%
  (\otm@@laue@laue{#2}%
  \otm@laue@setminus\otm@@laue@laue{\arabic{otm@scratch}})%
  \fi
}
\newOTMparameter{laue}{setminus}{\setminus}
\newOTMparameter{laue}{setplus}{\cup}
\newOTMparameter{laue}{ybelow}{0.3ex}
\newOTMparameter{laue}{strokewidth}{0.08ex}
\newOTMparameter{laue}{innersidegap}{0.05em}
\newOTMparameter{laue}{outersidegap}{0.05em}
\newcommand{\otm@@laue@laue}[1]{%
  \mathpalette{\let\laue@mathstyle}{\ensuremath{%
      \rlap{\hspace*{\otm@laue@innersidegap}$\laue@mathstyle #1$}%
      \rule[-\otm@laue@ybelow]%
           {\widthof{\ensuremath{\laue@mathstyle #1}}+\otm@laue@innersidegap *2}%
           {\otm@laue@strokewidth}%
           \rule[-\otm@laue@ybelow]%
                {\otm@laue@strokewidth}%
                {\otm@laue@ybelow *2}}}}
%% Style "`dots"': variations of the {1,...,n} theme.

\newOTMstyle[dots={,\ldots,}]{dots}{%
  \{#1\getOTMparameter{dots}#2\}%
}
%% Style "`nude"': variations of the 1..n theme.

\newOTMstyle[dots={\ldotp\ldotp}]{nude}{%
  #1\getOTMparameter{dots}#2%
}
%%
%% PART III: Use existing customization file
%%
\InputIfFileExists{12many.cfg}{%
  \PackageInfo{12many}{Also using customization file 12many.cfg}
}{%
  \PackageInfo{12many}{No customization file used}
}

%%
%% PART IV: Use package parameter
%%
\DeclareOption*{\setOTMstyle{\CurrentOption}}
\ProcessOptions\relax
\endinput
%%
%% End of file `12many.sty'.