Browse Source

Rewrite the genotype macro

Rewrite the genotype macro so that it uses the FGChrPair macro to
typeset chromosome pairs.
develop
Damien Goutte-Gattat 8 years ago
parent
commit
509d145266
1 changed files with 22 additions and 78 deletions
  1. +22
    -78
      flygenet.dtx

+ 22
- 78
flygenet.dtx View File

@ -102,6 +102,7 @@ has been generated for details.
% 2 rue Robert Escarpit, 33607 Pessac, France}\\
% \texttt{d.goutte-gattat@iecb.u-bordeaux.fr}}
% \date{\filedate}
% \let\ts\textsuperscript
%
% \maketitle
%
@ -113,7 +114,7 @@ has been generated for details.
% notation, as in the following example:
%
% $$
% \genotype{C(1)RM,y^2/Y; In(2LR)O, Cy cn^2 sp^2/Sco; ci^D/ey^D}
% \genotype{C(1)RM,y\ts2/Y; In(2LR)O, Cy cn\ts2 sp\ts2/Sco; ci\ts D/ey\ts D}
% $$
%
% Consequently, \LaTeX's math mode (and especially displayed math mode,
@ -129,11 +130,13 @@ has been generated for details.
% the following code:
%
% \begin{verbatim}
% \genotype{C(1)RM,y^2/Y; In(2LR)O,Cy cn^2 sp^2/Sco; ci^D/ey^D}
% \genotype{C(1)RM,y\ts2/Y; In(2LR)O,Cy cn\ts2 sp\ts2/Sco; ci\ts D/ey\ts D}
% \end{verbatim}
%
% A complete genotype can thus be written in a very intuitive way, the
% only \TeX ism being the exponentiation symbol (|^|).
% only \TeX ism being the exponentiation macro, |\ts|, which is an alias
% for the |\textsuperscript| macro (this alias is \emph{not} defined by
% this package).
%
%
% \section{User interface}
@ -177,25 +180,6 @@ has been generated for details.
% $$
% \end{minipage}
%
% \bigskip
% When used as an argument to another macro, |\genotype| cannot control
% spacing; spaces between gene symbols must be added manually.
%
% \begin{minipage}{.6\textwidth}
% \begin{verbatim}
% \underbrace{\genotype{cn bw/;TM2/tra}}
% \quad
% \underbrace{\genotype{cn\ bw/;TM2/tra}}
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{.3\textwidth}
% $$
% \underbrace{\genotype{cn bw/;TM2/tra}}
% \quad
% \underbrace{\genotype{cn\ bw/;TM2/tra}}
% $$
% \end{minipage}
%
% ^^A Inserts the LPPL text.
% \providecommand{\LPPLsection}{\section}
% \providecommand{\LPPLsubsection}{\subsection}
@ -256,10 +240,10 @@ has been generated for details.
% \end{macro}
%
% \begin{macro}{\FGXYPair}
% This macro typesets a Y chromosome genotype. It is intended to look
% like a half-fraction, with the genotype as the numerator and without a
% denumerator, and with a downward hook at the right end of the fraction
% bar.
% This macro typesets a pair of X/Y sexual chromosomes. It is intended
% to look like a half-fraction, with the genotype as the numerator and
% without a denumerator, and with a downward hook at the right end of
% the fraction bar.
%
% We first define two helper macros that will do the actual work of
% drawing the genotype.
@ -308,70 +292,30 @@ has been generated for details.
%
% \subsection{Typesetting genotypes}
%
% \begin{macro}{\fly@printchromosome}
% This macro typesets a single chromosome pair, as a mathematical
% fraction.
% \begin{macro}{\FG@printchromosome}
% This macro typesets a single chromosome pair, presented as delimited
% arguments.
% \begin{macrocode}
\def\fly@printchromosome#1/#2\end{%
\def\fly@argii{#2}%
\ifx\fly@argii\empty\mathit{#1}\else\frac{\mathit{#1}}{\mathit{#2}}\fi}
\def\FG@printchromosome#1/#2\end{\FGChrPair{#1}{#2}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fly@parsechromosome}
% \begin{macro}{\FG@parsechromosome}
% This macro parses a genotype notation (chromosome pairs separated by
% semi-colons), and calls the |\fly@printchromosome| for each chromosome
% semi-colons), and calls the |\FG@printchromosome| for each chromosome
% pair.
% \begin{macrocode}
\def\fly@parsechromosome#1;#2\end{%
\fly@printchromosome#1\end%
\def\fly@argii{#2}%
\ifx\fly@argii\empty\else; \fly@parsechromosome#2\end\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mhyphen}
% \begin{macro}{\mcolon}
% These two macros are used to typeset actual hyphens and colons in math
% mode.
% \begin{macrocode}
\mathchardef\mhyphen="2D
\mathchardef\mcolon="3A
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\fly@endgenotype}
% This macro is called at the end of the |\genotype| macro. It performs
% the task of parsing and typesetting the genotype and reset the
% modified catcodes.
% \begin{macrocode}
\def\fly@endgenotype#1{%
\fly@parsechromosome#1;\end%
\catcode`\ =10\relax%
\catcode`\-=12\relax%
\catcode`\:=12\relax}
\def\FG@parsechromosome#1;#2\end{%
\FG@printchromosome#1\end%
\def\FG@argii{#2}%
\ifx\FG@argii\empty\else; \FG@parsechromosome#2\end\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\genotype}
% This macro is the main user interface to typeset a genotype. Its
% declaration is enclosed in a group since we need to locally modify the
% catcodes of some characters. For the same reason, the macro cannot be
% declared as expecting an argument (otherwise, the argument would be
% parsed before the catcodes are modified)---the argument is parsed when
% calling the |\fly@endgenotype| macro.
% This macro is the main user interface to typeset a genotype.
% \begin{macrocode}
\begingroup
\catcode`\ =\active
\catcode`\-=\active
\catcode`\:=\active
\gdef\genotype{%
\catcode`\ =\active\let =\ %
\catcode`\-=\active\let-=\mhyphen%
\catcode`\:=\active\let:=\mcolon%
\fly@endgenotype}
\endgroup
\def\genotype#1{\FG@parsechromosome#1;\end}
% \end{macrocode}
% \end{macro}
%


Loading…
Cancel
Save