summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biocon/biocon-old.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/biocon/biocon-old.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/biocon/biocon-old.sty')
-rw-r--r--macros/latex/contrib/biocon/biocon-old.sty125
1 files changed, 125 insertions, 0 deletions
diff --git a/macros/latex/contrib/biocon/biocon-old.sty b/macros/latex/contrib/biocon/biocon-old.sty
new file mode 100644
index 0000000000..09f5a811b2
--- /dev/null
+++ b/macros/latex/contrib/biocon/biocon-old.sty
@@ -0,0 +1,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%
+}