Browse Source

Add the FGChrPair and FGXYPair macros

develop
Damien Goutte-Gattat 8 years ago
parent
commit
ad9d58daa8
1 changed files with 63 additions and 3 deletions
  1. +63
    -3
      flygenet.dtx

+ 63
- 3
flygenet.dtx View File

@ -43,7 +43,7 @@ has been generated for details.
%</batchfile>
%
%<*driver>
\ProvidesFile{flygenet.dtx}[2013/07/14 v0.1 Fly genetics notation]
\ProvidesFile{flygenet.dtx}[2013/10/07 v0.2 Fly genetics notation]
\documentclass[a4paper]{ltxdoc}
\usepackage{hyperref}
\usepackage{flygenet}
@ -56,7 +56,7 @@ has been generated for details.
%</driver>
% \fi
%
% \CheckSum{110}
% \CheckSum{0}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@ -211,7 +211,7 @@ has been generated for details.
% We start by identifying the package.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2003/12/01]
\ProvidesPackage{flygenet}[2013/07/14 v0.1 Fly genetics notation]
\ProvidesPackage{flygenet}[2013/10/07 v0.2 Fly genetics notation]
% \end{macrocode}
%
% We load the |wasysym| package, that we will use to typeset the female
@ -220,6 +220,66 @@ has been generated for details.
\RequirePackage{wasysym}
% \end{macrocode}
%
% We load the |tikz| package, that we will use to draw the Y chromosome
% symbol.
% \begin{macrocode}
\RequirePackage{tikz}
% \end{macrocode}
%
%
% \subsection{Typesetting chromosomes}
%
% \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.
%
% We first define two helper macros that will do the actual work of
% drawing the genotype.
% \begin{macrocode}
\def\FG@XYPair@display#1{%
\tikz{%
\node[inner sep=.9ex] (y) {\raisebox{0pt}[\height][0pt]{$\displaystyle\mathit{#1}$}};
\draw[line cap=round] (y.south west) -- (y.south east) -- ++(-0.1,-0.1);
}}
\def\FG@XYPair@inline#1{%
\tikz{%
\node[inner sep=.3ex] (y) {\raisebox{0pt}[\height][0pt]{$\scriptstyle\mathit{#1}$}};
\draw[line cap=round] (y.south west) -- (y.south east) -- ++(-0.1,-0.1);
}}
% \end{macrocode}
%
% Then, we define the public macro, in which we call the appropriate
% helper macro depending on the math mode we are in.
% \begin{macrocode}
\def\FGXYPair#1{%
\mathchoice%
{\FG@XYPair@display{#1}}%
{\FG@XYPair@inline{#1}}%
{\FG@XYPair@inline{#1}}%
{\FG@XYPair@inline{#1}}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FGChrPair}
% This macro typesets a chromosome pair. If the second argument is
% non-empty, the genotype is typeset as a fraction; an empty second
% argument denotes a homozygous pair which is typeset on a single line.
% As a special case, if the second argument is equal to ``Y'', this
% denotes a male sexual pair (X/Y) which is typeset using the
% |\FGXYPair| macro.
% \begin{macrocode}
\def\FGChrPair#1#2{%
\def\FG@argii{#2}%
\ifx\FG@argii\empty\mathit{#1}\else%
\if\FG@argii Y\FGXYPair{#1}\else%
\frac{\mathit{#1}}{\mathit{#2}}%
\fi%
\fi}
% \end{macrocode}
% \end{macro}
%
% \subsection{Typesetting genotypes}
%
% \begin{macro}{\fly@printchromosome}


Loading…
Cancel
Save