summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/shipunov/biokey.sty
blob: ef88da239e2477cb0005ea6b4c9602a5d7205ba3 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
% Author: Alexey B. Shipunov (plantago@herba.msu.ru)

\ProvidesPackage{biokey}%
        [2008/02/11 v3.1 Typesetting biological identification keys]

\newlength\TML@a
\newlength\TML@b
\newlength\TML@c
\newbox\dot@box
\newcounter{TMC@Ba}

\newif\if@MARG
\DeclareOption{nomargin}{\@MARGfalse}
\DeclareOption{margin}{\@MARGtrue}

\ExecuteOptions{nomargin}
\ProcessOptions

% REFERENCES
% Main reference
\def\SameDecl{\samepage}
\AtBeginDocument{\setbox\dot@box=\hbox to .5em{\hss.\hss}}
\def\dbox@fill{\leaders\copy%
        \dot@box\hskip 4.3\wd\dot@box plus1fill minus .3\wd\dot@box}
\def\dbox@fil{\leaders\copy\dot@box\hfil}
% Against vertical breaks
\def\dot@leaders{\doublehyphendemerits0\finalhyphendemerits0%
        \parfillskip0pt\SameDecl%
        \penalty800\dbox@fill\penalty400%
        \vadjust{}\penalty10000\dbox@fil}
\def\T#1\par{{\dot@leaders\SHRIFTN{#1}\par}\par}
% `Automatically' paragraph aligment
\def\TTTT#1\par{{\tolerance 9999 \dot@leaders\SHRIFTN{#1}\par}\par}

% Old style reference
\def\old@f{\hbox to .5em{\hss.\hss}}
\def\old@filt{\xleaders\old@f\hfill}
\def\old@dot@leaders{\doublehyphendemerits0\finalhyphendemerits0%
        \parfillskip0pt\SameDecl%
        \unskip\nobreak\old@filt\penalty50%
        \xleaders\old@f\hskip2em%
        \vadjust{}\nobreak\old@filt}
\def\TTT#1\par{{\old@dot@leaders\SHRIFTN{#1}\par}\par}

% OBJECTS
% With indent
\def\N#1\par{{\penalty50\SameDecl%
        \hskip 1em plus 1.2em minus .2em
\penalty200\hskip0pt\SHRIFTN{#1}\par}\par}

% With glue, but without leaders
\def\NN#1\par{{\parfillskip0pt\SameDecl%
        \doublehyphendemerits0\finalhyphendemerits0%
        \penalty10000\hskip 2em plus 1fil\penalty400%
        \vadjust{}\penalty10000\hfil\SHRIFTN{#1}\par}\par}

% Object as new paragraph
\def\NNN#1\par{{\nopagebreak\par%
        \Indent@C\SHRIFTN{#1}\par}\par}

% PUNCTS
% Common punct
\let\TT=\T

% Hanging punct
\def\VT{\@ifstar{\H@P}{\H@@P}}
% Leaders stopped on right margin of text
\def\H@@P#1\par{{\dot@leaders
        \makebox[0pt][l]{\hspace{.5em}#1}\par}\par}
% Leaders stopped before punct
\def\H@P#1\par{{\dot@leaders
        \makebox[-.5em][l]{#1}\par}\par}

% THESES AND ANTITHESES
% Hooks...
\def\SHRIFTZ{\relax}
\def\SHRIFTN{\relax}

% Lengths (hang = 2em)
\settowidth{\TML@b}{\SHRIFTZ{.}}
\TML@a=1.5em
\addtolength{\TML@a}{-\TML@b}
\addtolength{\TML@b}{0.5em}
\def\Indent@T{\hangindent2em\noindent}
\def\OTSTUP{2em}
\def\Indent@C{\parindent\OTSTUP\hangindent\parindent}

% Common thesa
\def\Z#1. {\Indent@T\makebox[1.5em][r]%
        {\SHRIFTZ{#1.}}\hspace{0.5em}}
% Thesa with back reference
\def\ZZ#1(#2).{\Indent@T\makebox[\TML@a][r]%
        {\SHRIFTZ{#1}}\hspace{0.45em}\SHRIFTZ{(#2).}}
% Antitheses
\def\ZZZ#1{\Indent@T\makebox[\TML@a][r]%
        {#1}\hspace{\TML@b}}
% First
\def\AN{\ZZZ{$-$}}
% You can replace it to $+$
\def\Ap{\ZZZ{$+$}}
% Second (with trichotomy)
\def\AAN{\ZZZ{$=$}}
% Third (with tetrachotomy)
\def\AAAN{\ZZZ{$\equiv$}}

% COMMENTS
\def\FK#1\par{{\nopagebreak\smallskip%
        \Indent@C%
        \footnotesize#1\par\smallskip}}
% You can use it as `numberless thesa'
\def\KOM#1\par{{\nopagebreak\smallskip%
        \Indent@C#1\par\smallskip}}
% Comment for object
\def\VPRAVO#1 \par{{\nopagebreak\vskip-\parskip
        \hbox to \linewidth {\hfil #1}\par}}

% AUTOMATICAL KEYS
\def\TEZA#1{\refstepcounter{TMC@Ba}\label{#1}%
        \Indent@T\makebox[1.5em][r]%
        {\SHRIFTZ{\arabic{TMC@Ba}.}}\hspace{0.5em}\ignorespaces}
\def\STEZA#1#2{\refstepcounter{TMC@Ba}\label{#1}%
        \Indent@T\makebox[\TML@a][r]%
        {\SHRIFTZ{\arabic{TMC@Ba}}}\hspace{0.45em}\SHRIFTZ{(\ref{#2}).}}
\def\SSYLKA#1{\T\ref{#1}.}
% Shorthands
\let\TE\TEZA
\let\SE\STEZA
\let\SS\SSYLKA

% LEVELED KEYS
\newenvironment{SDVIG}[1][1]
       {\TML@c=#1em \let\TML@@c\TML@c
        \def\Indent@T{\hangindent=2em\parindent=0em
        \advance\hangindent by 2\TML@@c
        \advance\parindent by 2\TML@@c}
        \def\Indent@C{\hangindent=2em\parindent=2em
        \advance\hangindent by 2\TML@@c
        \advance\parindent by 2\TML@@c}}{}
% Shorthands
\let\LE\SDVIG
\let\endLE\endSDVIG

% KEYS WITH MARKERS ON LEFT PAGE MARGIN

\if@MARG
\def\Indent@C{\relax}%
\def\Z#1. {\noindent\makebox[0em][r]%
        {\SHRIFTZ{#1.}\hspace{0.5em}}}%
\def\ZZ#1(#2).{\settowidth{\TML@c}{(#2)}%
        \noindent\makebox[\TML@c][r]%
        {\SHRIFTZ{#1}\hspace{0.5em}\SHRIFTZ{(#2).}}}%
\def\ZZZ#1{\noindent\makebox[0em][r]%
        {#1\hspace{\TML@b}}}%
\else\relax
\fi

% Some useful stuff
\let\K=\textit
\let\J=\textbf
\def\KN#1 {\textit{#1 }}
\def\NN#1 #2 {\textit{#1 #2 }}
\def\IN#1.#2.{#1.\,#2.~\ignorespaces}

\endinput