summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biocon/biocon-old.sty
blob: 09f5a811b242d020600549bdf1d544ff1698ab7c (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
%BioCon.sty: Biological Conventions.
%
%This package tries to automatically typeset some biological entities. Currently (v0.04), only
%species are supported, but plans are to include genes and their products (and maybe even more).
%
%Although, it is not a real convention, this package gives the full name of a species the first
%time it is used in a document. After that, it uses the abbreviated form consisting of the 
%first letter of the genus followed by the epiteton.
%The species name is written emphasized.
%
%The workings of this package are fairly simple. To introduce a new species, use the
%\newspecies[optional identifier]{Genus epiteton} command. If no identifier is given, the first
%letter of the genus in capital followed by the first letter of the epiteton in lowercase are used.
%For example, to introduce Drosophilla melanogaster, type \newspecies[Dros]{Drosophilla melanogaster}
%or \newspecies{Drosophila melanogaster}.
%Then, every time you want to use this species, type \species{Abbreviation}. In the above
%example this would be \species{Dm}.
%
%Of course, long or short names can be forced. This is done through an optional parameter.
%This can be "n" for normal, "l" for long, and "s" for short. Furthermore, the type it was about
%to use by appending a "d" (for "delay") to this.
%
%In the above example, suppose you want to use the full name in the title, and then the first
%time it occurs in the text. In the last sentence, the full name has also to be used:
%\title{The HOX-genes of \species[ld]{Dm}}     ([nd] can also be used)
%....
%....
%As a conclusion: Time flies like an arrow and fruit flies like a banana, and so does
%\species[l]{Dm}.
%
%This package is written by Pieter Edelman (PEdelman@dds.nl). Please send me any comments,
%requests and/or suggestions.
%
%This package is released under the GNU General Public License.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{biocon}[2000/08/11 Typesets Biological Statements, v.0.04 (stable)]

%global defs:
\newcounter{Option}
\newcommand\ShowHow{n}
\newcommand\Short{s}
\newcommand\Long{l}
\newcommand\Normal{n}
\newcommand\LongDelay{ld}
\newcommand\ShortDelay{sd}
\newcommand\NormalDelay{nd}
\newcommand\isEmpty{}

%These are used to store intermediate variables:
\newcommand\GenusFirst{}
\newcommand\Genus{}
\newcommand\EpitetonFirst{}
\newcommand\Epiteton{}
\newcommand\AbName{}
\newcommand\useDefault{}

%These define how a long and a short name should look like.
\newcommand\FullName[1]{\csname#1Genus\endcsname\ \csname#1Epiteton\endcsname}
\newcommand\ShortName[1]{\csname#1GenusFirst\endcsname. \csname#1Epiteton\endcsname}

\def\setSpeciesParams(#1#2 #3#4){%                 This sets the various variables using their intermediates.
   \uppercase{\renewcommand{\GenusFirst}{#1}}%
   \lowercase{\renewcommand{\EpitetonFirst}{#3}}%
   \renewcommand{\Genus}{\uppercase{#1}\lowercase{#2}}%
   \lowercase{\renewcommand{\Epiteton}{#3#4}}%
}   
   
\newcommand{\newspecies}[2][]{%
  \setSpeciesParams(#2)%
  \renewcommand{\useDefault}{#1}%
  \ifx \useDefault\isEmpty%                                       Find out if abbreviation is provided.
    \renewcommand{\AbName}{\GenusFirst\EpitetonFirst}%
  \else%
    \renewcommand{\AbName}{#1}%
  \fi%
  \expandafter\newcounter\expandafter{\AbName}%                   Set new counter using the abbreviated name
  \expandafter\let\csname\AbName GenusFirst\endcsname=\GenusFirst% Set intermediates to real values
  \expandafter\let\csname\AbName Genus\endcsname=\Genus%
  \expandafter\let\csname\AbName Epiteton\endcsname=\Epiteton%
}

\newcommand{\LineInput}[1]{%
  \renewcommand\ShowHow{#1}%
  \ifx\ShowHow\Short%
    \setcounter{Option}{1}%
  \fi%
  \ifx\ShowHow\Long%
    \setcounter{Option}{3}%
  \fi%
  \ifx\ShowHow\Normal%
    \setcounter{Option}{5}%
  \fi%
  \ifx\ShowHow\ShortDelay%
    \setcounter{Option}{0}%
  \fi%
  \ifx\ShowHow\LongDelay%
    \setcounter{Option}{2}%
  \fi%
  \ifx\ShowHow\NormalDelay%
    \setcounter{Option}{4}%
  \fi%  
}  
      
\newcommand{\species}[2][n]{%
  \LineInput{#1}%
  %
  \ifnum\value{Option}>3%     If name is normal
    \ifnum\value{#2}=0%        If name is used for the first time
      \emph{\FullName{#2}}%
    \else%                     If name is used for another time
      \emph{\ShortName{#2}}%
    \fi%
  \else%
    \ifnum\value{Option}<2%   If name is short
      \emph{\ShortName{#2}}%
    \else%                     If name is long 
      \emph{\FullName{#2}}%
    \fi%
  \fi%
  %
  \ifodd\value{Option}%
    \stepcounter{#2}%
  \fi%
}