summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biocon/biocon.sty
blob: dfc6de431a91d24cddfb29c341b133c6bab12a30 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{biocon}[2001/08/18]


\RequirePackage{keyval}
\RequirePackage{ifthen}
\newcommand{\curr@ntid}{}
\newcounter{Q@D@counter}
\newcommand{\T@mpFirst}{}
\newcommand{\T@mpRest}{}
\newcommand{\Gl@balF@llStyle}{}
\newcommand{\Gl@bal@bbrStyle}{}
\newcommand{\Gl@balPE@llStyle}{}
\newcommand{\Gl@balFE@llStyle}{}
\newcommand{\Gl@balAE@llStyle}{}
\newcommand{\Gl@balBE@llStyle}{}
\newcommand{\newplant}[2]{\n@wsp@cies{P}{#1}{#2}}
\newcommand{\newfungus}[2]{\n@wsp@cies{F}{#1}{#2}}
\newcommand{\newanimal}[2]{\n@wsp@cies{A}{#1}{#2}}
\newcommand{\newbact}[2]{\n@wsp@cies{B}{#1}{#2}}

\newcommand{\plantlike}[2][]
  {\n@wsp@cies{}{Q@D}{#2}\plant[#1]{Q@D}\expandafter\Q@DCleanup\Q@DCleanList+}
\newcommand{\funguslike}[2][]
  {\n@wsp@cies{}{Q@D}{#2}\fungus[#1]{Q@D}\expandafter\Q@DCleanup\Q@DCleanList+}
\newcommand{\animallike}[2][]
  {\n@wsp@cies{}{Q@D}{#2}\animal[#1]{Q@D}\expandafter\Q@DCleanup\Q@DCleanList+}
\newcommand{\bactlike}[2][]
  {\n@wsp@cies{}{Q@D}{#2}\bact[#1]{Q@D}\expandafter\Q@DCleanup\Q@DCleanList+}
\newcommand{\newtaxastyle}[2]{\expandafter\def\csname Sp@cies#1\endcsname{#2}}
\newcommand{\defaultplante}[1]
  {\renewcommand{\Gl@balPE@llStyle}{\csname Sp@cies#1\endcsname}}
\newcommand{\defaultfunguse}[1]
  {\renewcommand{\Gl@balFE@llStyle}{\csname Sp@cies#1\endcsname}}
\newcommand{\defaultanimale}[1]
  {\renewcommand{\Gl@balAE@llStyle}{\csname Sp@cies#1\endcsname}}
\newcommand{\defaultbacte}[1]
  {\renewcommand{\Gl@balBE@llStyle}{\csname Sp@cies#1\endcsname}}
\newcommand{\defaultfull}[1]
  {\renewcommand{\Gl@balF@llStyle}{\csname Sp@cies#1\endcsname}}
\newcommand{\defaultabbr}[1]
  {\renewcommand{\Gl@bal@bbrStyle}{\csname Sp@cies#1\endcsname}}
\newcommand{\plant}[2][]{\sh@wsp@cies{P}{#2}{#1}}
\newcommand{\fungus}[2][]{\sh@wsp@cies{F}{#2}{#1}}
\newcommand{\animal}[2][]{\sh@wsp@cies{A}{#2}{#1}}
\newcommand{\bact}[2][]{\sh@wsp@cies{B}{#2}{#1}}
\newcommand{\n@wsp@cies}[3]{%
\renewcommand{\curr@ntid}{#1#2@}%
\ifthenelse{\equal{#2}{Q@D}}%
  {\relax}%
  {\newcounter{\curr@ntid counter}}%
\setcounter{\curr@ntid counter}{0}%
\setkeys{SpeciesParams}{#3}%
}
\def\Q@DCleanup#1+{\n@wsp@cies{}{Q@D}{#1}}

\newcommand{\add@species@key}[2]{%
  \define@key{SpeciesParams}{#1}{#2}
  \expandafter\ifx\csname Q@DCleanList\endcsname\relax%
     \def\Q@DCleanList{#1=\relax}%
  \else%
     \edef\Q@DCleanList{\Q@DCleanList,#1=\relax}%
  \fi%
}
\def\SplitG@nusL@tters(#1#2){%
  \uppercase{\renewcommand{\T@mpFirst}{#1}}\lowercase{\renewcommand{\T@mpRest}{#2}}}
\add@species@key{genus}{%
  \SplitG@nusL@tters(#1)%
  \expandafter\edef\csname\curr@ntid genus\endcsname{\T@mpFirst\T@mpRest}%
}
\add@species@key{oldgenus}{%
  \SplitG@nusL@tters(#1)%
  \expandafter\edef\csname\curr@ntid oldgenus\endcsname{\T@mpFirst\T@mpRest}%
}
\add@species@key{epithet}{\lowercase{\expandafter\edef\csname\curr@ntid epithet\endcsname{#1}}}
\add@species@key{oldepithet}{\lowercase{\expandafter\edef\csname\curr@ntid oldepithet\endcsname{#1}}}
\add@species@key{author}{\expandafter\edef\csname\curr@ntid author\endcsname{#1}}
\add@species@key{year}{\expandafter\edef\csname\curr@ntid year\endcsname{#1}}
\add@species@key{oldauthor}{\expandafter\edef\csname\curr@ntid oldauthor\endcsname{#1}}
\add@species@key{oldyear}{\expandafter\edef\csname\curr@ntid oldyear\endcsname{#1}}
\define@key{SpeciesParams}{fullstyle}
  {\expandafter\def\csname\curr@ntid fullstyle\endcsname{\csname Sp@cies#1\endcsname}}
\define@key{SpeciesParams}{abbrstyle}
  {\expandafter\def\csname\curr@ntid abbrstyle\endcsname{\csname Sp@cies#1\endcsname}}
\newcommand{\newtaxon}[1]{\add@species@key{#1}{\expandafter\edef\csname\curr@ntid #1\endcsname{##1}}}
\newcommand{\taxon}[1]{\Sh@wTax@n+(#1)+n+}
\newcommand{\taxonfirst}[1]{\Sh@wTax@n+(#1)+a+}

\def\Sh@wTax@n+(#1!#2!#3)+#4+{%
  \expandafter\ifx\csname\curr@ntid#2\endcsname%
    \relax%
  \else%
    \ifthenelse{\equal{#4}{n}}{%
      #1\csname\curr@ntid#2\endcsname#3%
    }{%
      \edef\T@mpTax@n{\csname\curr@ntid#2\endcsname}%
      #1\expandafter\Sh@wFirst\T@mpTax@n+#3%
    }%
  \fi%
}

\def\Sh@wFirst#1#2+{#1}
\DeclareRobustCommand\taxitalics
        {\@nomath\em \ifdim \fontdimen\@ne\font >\z@
                       \upshape \else \itshape \fi}
\DeclareTextFontCommand{\taxit}{\taxitalics}
\newtaxastyle{ePlant}
  {\taxit{\taxon{!genus!}\taxon{ !epithet!}}\taxon{ (!oldauthor!)}\taxon{ !author!}}
\newtaxastyle{eAnimal}
  {\taxit{\taxon{!genus!}\taxon{ (!oldgenus!)}\taxon{ !epithet!}}\taxon{ (!oldauthor!}%
   \taxon{, !oldyear!)}\taxon{!author!}\taxon{, !year!}}
\newtaxastyle{f}
  {\taxit{\taxon{!genus!}\taxon{ !epithet!}}}
\newtaxastyle{a}
  {\taxit{\taxonfirst{!genus!.}\taxon{ !epithet!}}}
\newtaxastyle{g}
  {\taxit{\taxon{!genus!}}}
\defaultplante{ePlant}
\defaultfunguse{ePlant}
\defaultanimale{eAnimal}
\defaultbacte{eAnimal}
\defaultfull{f}
\defaultabbr{a}
\newcommand{\sh@wsp@cies}[3]{%
  \ifthenelse{\equal{#2}{Q@D}}%
    {\renewcommand{\curr@ntid}{#2@}}%
    {\renewcommand{\curr@ntid}{#1#2@}}%
  \ifthenelse{\equal{#3}{}}{%
    \ifnum\value{\curr@ntid counter}=0%
      \setcounter{\curr@ntid counter}{1}%
      \expandafter\ifx\csname\curr@ntid fullstyle\endcsname\relax%
        \csname Gl@balF@llStyle\endcsname%
      \else%
        \csname\curr@ntid fullstyle\endcsname %
      \fi%
    \else%
      \expandafter\ifx\csname\curr@ntid abbrstyle\endcsname\relax%
        \csname Gl@bal@bbrStyle\endcsname%
      \else%
        \csname\curr@ntid abbrstyle\endcsname%
      \fi%
    \fi%
  }{%
    \ifthenelse{\equal{#3}{e}}{%
      \csname Gl@bal#1E@llStyle\endcsname%
    }{%
      \csname Sp@cies#3\endcsname%
    }%
  }%
}