Browse Source

Merge branch 'develop'

master v0.1
Damien Goutte-Gattat 8 years ago
parent
commit
a7f02ac7b6
3 changed files with 219 additions and 16 deletions
  1. +1
    -1
      .gitignore
  2. +5
    -5
      Makefile
  3. +213
    -10
      flygenet.dtx

+ 1
- 1
.gitignore View File

@ -1,4 +1,4 @@
flygenet.cls
flygenet.sty
flygenet.pdf
dist
*.aux


+ 5
- 5
Makefile View File

@ -1,9 +1,9 @@
ENGINE = pdflatex
DESTDIR = dist
all: flygenet.cls flygenet.pdf
all: flygenet.sty flygenet.pdf
flygenet.cls flygenet.glo flygenet.idx: flygenet.dtx lppl-1-3c.tex
flygenet.sty flygenet.glo flygenet.idx: flygenet.dtx lppl-1-3c.tex
$(ENGINE) $<
flygenet.gls: flygenet.glo
@ -16,18 +16,18 @@ flygenet.pdf: flygenet.dtx flygenet.gls flygenet.ind
$(ENGINE) $<
$(ENGINE) $<
install: flygenet.pdf flygenet.cls
install: flygenet.pdf flygenet.sty
mkdir -p $(DESTDIR)/src/latex/flygenet
mkdir -p $(DESTDIR)/doc/latex/flygenet
mkdir -p $(DESTDIR)/tex/latex/flygenet
install -m 644 flygenet.dtx lppl-1-3c.tex Makefile $(DESTDIR)/src/latex/flygenet
install -m 644 flygenet.pdf $(DESTDIR)/doc/latex/flygenet
install -m 644 flygenet.cls $(DESTDIR)/tex/latex/flygenet
install -m 644 flygenet.sty $(DESTDIR)/tex/latex/flygenet
clean:
rm -f flygenet.{aux,glo,gls,idx,ilg,ind,log,out,toc}
mrproper: clean
rm -f flygenet.{cls,pdf}
rm -f flygenet.{sty,pdf}
.PHONY: clean mrproper

+ 213
- 10
flygenet.dtx View File

@ -36,7 +36,7 @@ has been generated for details.
\endpreamble
\generate{
\file{flygenet.cls}{\from{flygenet.dtx}{class}}
\file{flygenet.sty}{\from{flygenet.dtx}{package}}
}
\endgroup
@ -46,6 +46,7 @@ has been generated for details.
\ProvidesFile{flygenet.dtx}[2013/07/14 v0.1 Fly genetics notation]
\documentclass[a4paper]{ltxdoc}
\usepackage{hyperref}
\usepackage{flygenet}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@ -55,7 +56,7 @@ has been generated for details.
%</driver>
% \fi
%
% \CheckSum{0}
% \CheckSum{110}
%
% \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
@ -73,17 +74,27 @@ has been generated for details.
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
% \DoNotIndex{\active}
% \DoNotIndex{\begingroup}
% \DoNotIndex{\catcode}
% \DoNotIndex{\DeclareOption,\def}
% \DoNotIndex{\else,\empty,\end,\endgroup}
% \DoNotIndex{\fi,\frac}
% \DoNotIndex{\gdef}
% \DoNotIndex{\ifx}
% \DoNotIndex{\let}
% \DoNotIndex{\mars,\mathchardef,\mathit,\mercury}
% \DoNotIndex{\NeedsTeXFormat}
% \DoNotIndex{\ProcessOptions,\ProvidesClass}
% \DoNotIndex{\RequirePackage}
% \DoNotIndex{\ProcessOptions,\ProvidesPackage}
% \DoNotIndex{\RequirePackage,\relax}
% \DoNotIndex{\venus}
%
% \changes{0.1}{2013/07/14}{Initial version.}
%
% \GetFileInfo{flygenet.dtx}
%
% \title{^^A
% The \textsf{flygenet} class\thanks{^^A
% The \textsf{flygenet} package\thanks{^^A
% This file has version number \fileversion, last revised \filedate.}}
% \author{^^A
% Damien Goutte-Gattat\thanks{^^A
@ -94,13 +105,96 @@ has been generated for details.
%
% \maketitle
%
% \abstract{The abstract}
%
% \tableofcontents
%
% \section{Introduction}
% The introduction.
%
% Fly geneticists conventionally denote fly genotypes using a math-like
% 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}
% $$
%
% Consequently, \LaTeX's math mode (and especially displayed math mode,
% as above) is well suited to typeset such notation.
%
% 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.
%
% This package is intended to reduce the amount of code needed to
% typeset a genotype. For example, the genotype above is the result of
% 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}
% \end{verbatim}
%
% A complete genotype can thus be written in a very intuitive way, the
% only \TeX ism being the exponentiation symbol (|^|).
%
%
% \section{User interface}
%
% The main user-level macro is |\genotype|. It accepts a single argument
% which is the genotype to typeset, with semi-colons to separate
% chromosome pairs and slashes to separate the two chromosomes of a
% 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
% (\venus), male (\mars), or virgin female (\mercury) symbol in front of
% the genotype:
%
% $$
% \female{cn bw/;TM2/tra}
% \quad
% \virgin{cn bw/;TM2/tra}
% \quad
% \male{FM7a/Y;In(2LR)O,Cy/+}
% $$
%
% The plural forms of these macros (|\females|, |\males|, and
% |\virgins|) are similar but insert \emph{two} symbols, thus denotating
% several individuals of the indicated genotype.
%
%
% \section{Limitations}
%
% Homozygous chromosome must be written with an ending slash, as in the
% following example:
%
% \begin{minipage}{.6\textwidth}
% \begin{verbatim}
% \genotype{cn bw/;TM2/tra}
% \end{verbatim}
% \end{minipage}
% \begin{minipage}{.3\textwidth}
% $$
% \genotype{cn bw/;TM2/tra}
% $$
% \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}
@ -114,11 +208,120 @@ has been generated for details.
% \section{The code}
%
% \subsection{Initialization code}
% We start by identifying the class.
% We start by identifying the package.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[2003/12/01]
\ProvidesClass{flygenet}[2013/07/14 v0.1 Fly genetics notation]
\ProvidesPackage{flygenet}[2013/07/14 v0.1 Fly genetics notation]
% \end{macrocode}
%
% We load the |wasysym| package, that we will use to typeset the female
% (\venus), male (\mars) and virgin female (\mercury) symbols.
% \begin{macrocode}
\RequirePackage{wasysym}
% \end{macrocode}
%
% \subsection{Typesetting genotypes}
%
% \begin{macro}{\fly@printchromosome}
% This macro typesets a single chromosome pair, as a mathematical
% fraction.
% \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}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fly@parsechromosome}
% This macro parses a genotype notation (chromosome pairs separated by
% semi-colons), and calls the |\fly@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}
% \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.
% \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
% \end{macrocode}
% \end{macro}
%
% \subsection{Gender symbols}
%
% \begin{macro}{\female}
% \begin{macro}{\male}
% \begin{macro}{\virgin}
% These macros typeset a genotype as |\genotype| does, but insert a
% female (\venus), male (\mars) or virgin female (\mercury) symbol at
% the beginning. This is intended as an abstraction layer above the
% |wasysym| package providing these symbols.
% \begin{macrocode}
\def\female{\venus\;\genotype}
\def\male{\mars\;\genotype}
\def\virgin{\mercury\;\genotype}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\females}
% \begin{macro}{\males}
% \begin{macro}{\virgins}
% These macros are similar to their singular forms above, but inserts
% two female, male or virgin female symbols at the beginning. By
% convention, this is used to represent several individuals of the
% indicated genotype.
% \begin{macrocode}
\def\females{\venus\venus\;\genotype}
\def\males{\mars\mars\;\genotype}
\def\virgins{\mercury\mercury\;\genotype}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \Finale
\endinput

Loading…
Cancel
Save