Background
In this site there are excellent examples of How to draw up a hierarchical tree diagram for taxonomic classification of several groups but often you must show only the position of a concrete group or single species across a long classification. Then a tree is not useful. A solution is simply show the ordered taxons in plain text:
Class Mammalia C. Linnaeus, 1758
Order Primates C. Linnaeus, 1758
Superfamily Hominoidea (Gray, 1825)
Family Hominidae Gray, 1825
Genus Homo C. Linnaeus, 1758
Homo sapiens C. Linnaeus, 1758
This is correct, but usually is showed with a hierarchical indentation that make a slopping margin (that looks much better and it is easier to follow IMHO):
Class Mammalia Linnaeus, 1758
Order Primates Linnaeus, 1758
Superfamily Hominoidea (Gray, 1825)
Family Hominidae Gray, 1825
Genus Homo Linnaeus, 1758
Species Homo sapiens Linnaeus, 1758
Obtain the above manually in LaTeX is easy, but it could look much better if the scientific names are also indented in parallel to the left margin. Make this manually is possible with a tabular environments, so you can obtain:
Class Mammalia Linnaeus, 1758
Order Primates Linnaeus, 1758
Superfamily Hominoidea (Gray, 1825)
Family Hominidae Gray, 1825
Genus Homo Linnaeus, 1758
Especies Homo sapiens Linnaeus, 1758
But need a lot of typing and any taxon as Mammalia
must be at the right of all the groups levels (Family
,Genus
, etc.). This could be fine in one column with this example but in a long classifications (20-25 lines) or a two column document, the horizontal space is limited, and then it is better start Mamalia
at the left of the end of Species
:
Class Mammalia Linnaeus, 1758
Order Primates Linnaeus, 1758
Superfamily Hominoidea (Gray, 1825)
Family Hominidae Gray, 1825
Genus Homo Linnaeus, 1758
Species Homo sapiens Linnaeus, 1758
And reduce the indentation length as needed:
Class Mammalia Linnaeus, 1758
Order Primates Linnaeus, 1758
Superfamily Hominoidea (Gray, 1825)
Family Hominidae Gray, 1825
Genus Homo Linnaeus, 1758
Species Homo sapiens Linnaeus, 1758
As this cannot be done (easily) within a table, I think in a environment to make this (more or less) "automagically".
Desired goals
Ideally, the environment (or any other approach) should work without typing any (= as less as possible) LaTeX command in the plain text:
\begin{taxonomy}
Class Mammalia Linnaeus, 1758
Order Primates Linnaeus, 1758
Superfamily Hominoidea (Gray, 1825)
Family Hominidae Gray, 1825
Genus Homo Linnaeus, 1758
Homo sapiens Linnaeus, 1758
\end{taxonomy}
And:
Do not break any line as far it is possible without reducing the font size. That is, if text of some line take more than
1\linewidth
with the default spacing, this spacing must be reduced to a reasonable value.If the whole environment take less than
\linewidth
, it must be centered (without losing the format, obviously).
But this is my naive attempt so far:
\documentclass[12pt]{article}
\usepackage{lipsum,xcolor}
\newcounter{line}
\def\doline#1{\addtocounter{line}{1}\hspace{\value{line}\parindent}#1}
\def\marker{\end{taxonomicon}}
{\obeylines
\gdef\getlines#1
{\def\text{#1}%
\ifx\text\marker \let\next\text
\else \doline{#1}\let\next\getlines \fi
\next}}
\newenvironment{taxonomicon}{\sffamily\hfill\begingroup\obeylines\getlines}%
{\setcounter{line}{0}\endgroup}
\newcommand\taxon[2]{
\makebox[7em][l]{\color{gray}#1\dotfill}
#2
}
\begin{document}
\lipsum[1]
% poor man's version
\parindent=1.7em % adjust as needed
\begin{taxonomicon}
Class Mammalia C. Linnaeus, 1758
Order Primates C. Linnaeus, 1758
Superfamily Hominoidea (Gray, 1825)
Family Hominidae Gray, 1825
Genus Homo C. Linnaeus, 1758
Homo sapiens C. Linnaeus, 1758
\end{taxonomicon}
\lipsum[2]
\parindent=1.2em % adjust as needed
\begin{taxonomicon}
\taxon{Class}{Mammalia Linnaeus, 1758}
\taxon{Order}{Primates Linnaeus, 1758}
\taxon{Superfamily}{Hominoidea (Gray, 1825)}
\taxon{Family}{Hominidae Gray, 1825}
\taxon{Genus}{Homo Linnaeus, 1758}
\taxon{Species}{Homo sapiens} Linnaeus, 1758
\end{taxonomicon}
\lipsum[3]
\end{document}
Note: I asking only a solution for a classification that always descend 1 level in each line (no matter of the real meaning of the text), but suggestion for more complex classifications (with two families, and several genera, for example) would be wonderful.