Browse Source

Do not draw Y-chromosome hook

Remove all code that attempted to draw a rightdown hook to
represent a Y chromosome. This was an ugly hack that never
gave a satisfactory result.

Use the AMS \text macro to typeset gene names.
develop
Damien Goutte-Gattat 6 years ago
parent
commit
ca9fe0735e
1 changed files with 13 additions and 71 deletions
  1. +13
    -71
      flygenet.dtx

+ 13
- 71
flygenet.dtx View File

@ -1,6 +1,6 @@
% \iffalse
%
% Copyright (C) 2013 Damien Goutte-Gattat
% Copyright (C) 2013,2014 Damien Goutte-Gattat
%
% This work may be distributed and/or modified under the conditions of the
% LaTeX Project Public License, either version 1.3 of the license or (at
@ -27,7 +27,7 @@
\askforoverwritefalse
\preamble
Copyright (C) 2013 Damien Goutte-Gattat
Copyright (C) 2013,2014 Damien Goutte-Gattat
This file is part of a work distributed under the conditins of the
LaTeX Project Public License. See the source file from which this file
@ -43,7 +43,7 @@ has been generated for details.
%</batchfile>
%
%<*driver>
\ProvidesFile{flygenet.dtx}[2013/10/09 v0.2 Fly genetics notation]
\ProvidesFile{flygenet.dtx}[2014/01/01 v0.3 Fly genetics notation]
\documentclass[a4paper]{ltxdoc}
\usepackage{hyperref}
\usepackage{flygenet}
@ -76,7 +76,7 @@ has been generated for details.
%
% \DoNotIndex{\,}
% \DoNotIndex{\active}
% \DoNotIndex{\DeclareOption,\def,\draw}
% \DoNotIndex{\DeclareOption,\def}
% \DoNotIndex{\else,\empty,\end,\endgroup,\ensuremath}
% \DoNotIndex{\fi,\frac}
% \DoNotIndex{\height}
@ -86,11 +86,12 @@ has been generated for details.
% \DoNotIndex{\NeedsTeXFormat,\newif,\node,\normalsize}
% \DoNotIndex{\ProcessOptions,\ProvidesPackage}
% \DoNotIndex{\RequirePackage,\raisebox,\relax}
% \DoNotIndex{\tikz}
% \DoNotIndex{\text}
% \DoNotIndex{\venus}
%
% \changes{0.1}{2013/07/14}{Initial version.}
% \changes{0.2}{2013/10/09}{Remove limitations.}
% \changes{0.3}{2014/01/01}{Do not draw Y hook.}
%
% \GetFileInfo{flygenet.dtx}
%
@ -124,9 +125,7 @@ has been generated for details.
% However, typesetting a genotype can be quite tedious, as it requires
% many calls to the |\frac| macro (or the |\over| primitive) and
% constant use of manual spacing to override \TeX's
% math-mode spacing. And besides, to my knowledge there is no easy way
% to get the harpoon-like fraction bar needed to represent a Y
% chromosome.
% math-mode spacing.
%
% This package is intended to reduce the amount of code needed to
% typeset a genotype. For example, the genotype above is the result of
@ -149,9 +148,7 @@ has been generated for details.
% chromosome pairs and slashes to separate the two chromosomes of a
% pair.
%
% A pair without any slash denotes a homozygous chromosome pair. If the
% second chromosome of a pair is only ``Y'', that pair is assumed to be
% a male sexual pair (XY).
% A pair without any slash denotes a homozygous chromosome pair.
%
% The macros |\female|, |\male|, and |\virgin| are used in the same way
% and perform the same task as |\genotype|, but they insert a female
@ -195,31 +192,15 @@ has been generated for details.
\RequirePackage{wasysym}
% \end{macrocode}
%
% We load the |tikz| package, that we will use to draw the Y chromosome
% symbol.
% We load the |amstext| package, which provides the |\text| macro that
% we need to typeset gene names in math mode.
% \begin{macrocode}
\RequirePackage{tikz}
\RequirePackage{amstext}
% \end{macrocode}
%
%
% \subsection{Helper macros}
%
% \begin{macro}{\FG@mbox}
% This macro is intended to be used in math mode. It typesets its
% argument as normal, italicized text. The rationale behind this macro
% is that we need a |\mbox| to prevent LaTeX from applying math mode
% rules when parsing genotypes (regarding spacing and special
% characters); but |\mbox| alone also prevent the automatic sizing of
% the text depending on its location within a math expression.
% \begin{macrocode}
\def\FG@mbox#1{\mathchoice%
{\mbox{\normalsize\itshape #1}}%
{\mbox{\normalsize\itshape #1}}%
{\mbox{\scriptsize\itshape #1}}%
{\mbox{\scriptsize\itshape #1}}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FG@findslash}
% This macro determines whether its argument contains a forward slash,
% and sets the |\ifFG@foundslash| boolean accordingly.
@ -237,41 +218,7 @@ has been generated for details.
% \begin{macro}{\FGChromosome}
% This macro typesets a single chromosome.
% \begin{macrocode}
\def\FGChromosome#1{\ifmmode\mbox{\itshape #1}\else{\itshape #1}\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\FGXYPair}
% 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.
% \begin{macrocode}
\def\FG@XYPair@display#1{%
\tikz{%
\node[inner sep=.9ex] (y) {\raisebox{0pt}[\height][0pt]{\normalsize\itshape #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]{\scriptsize\itshape #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{%
\ifmmode\mathchoice%
{\FG@XYPair@display{#1}}%
{\FG@XYPair@inline{#1}}%
{\FG@XYPair@inline{#1}}%
{\FG@XYPair@inline{#1}}%
\else\FG@XYPair@inline{#1}\fi}
\def\FGChromosome#1{\ensuremath{\text{\itshape #1}}}
% \end{macrocode}
% \end{macro}
%
@ -279,16 +226,11 @@ has been generated for details.
% 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\FGChromosome{#1}\else%
\if\FG@argii Y\FGXYPair{#1}\else%
\ensuremath{\frac{\FG@mbox{#1}}{\FG@mbox{#2}}}%
\fi%
\ensuremath{\frac{\text{\itshape #1}}{\text{\itshape #2}}}
\fi}
% \end{macrocode}
% \end{macro}


Loading…
Cancel
Save