diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:54:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:54:17 +0000 |
commit | 55c2392c87b7708af17f387d36ac3df547848f24 (patch) | |
tree | f89d16f00cc14ce66e8f413bc3ade6f30084a123 | |
parent | 0c39edc237703bb4d0eaa1b52b4b0f5f7ab081a0 (diff) |
dnaseq
git-svn-id: svn://tug.org/texlive/trunk@830 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/tex/latex/dnaseq/dnaseq.sty | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/dnaseq/dnaseq.sty b/Master/texmf-dist/tex/latex/dnaseq/dnaseq.sty new file mode 100644 index 00000000000..893c55f7253 --- /dev/null +++ b/Master/texmf-dist/tex/latex/dnaseq/dnaseq.sty @@ -0,0 +1,109 @@ +%% +%% This is file `dnaseq.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% dnaseq.dtx (with options: `dnaseq') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from dnaseq.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file dnaseq.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% File: dnaseq.dtx Copyright (C) 2002 Bjoern Pedersen +%% mailto:Bjoern.Pedersen@ch.tum.de +%% This file may be distributed and used freely under +%% the Latex Project Public License +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{dnaseq}[2002/05/20 v0.01 dna sequence setter] +\RequirePackage{color} + +\def\DNAblock{10} +\def\DNAreserve{0000}% f^^fcr 4-stellige Zahlen +%% +%% registers /counters +%% +\newlength\bl@cklen +\newlength\l@neln +\newlength\t@mpln +\newlength\ch@rwd +\newcount{\blocks} +%% +%% calculate blocks per line +%% +\def\DNAc@lcline{% + \settowidth{\ch@rwd}{A} + \setlength{\bl@cklen}{\DNAblock\ch@rwd}% + \settowidth{\t@mpln}{\DNAreserve} + \setlength{\l@neln}{\textwidth} + \addtolength{\l@neln}{-\t@mpln} + \loop% + \setlength{\t@mpln}{\blocks\bl@cklen} + \addtolength{\t@mpln}{\blocks\ch@rwd} + \ifdim\l@neln>\t@mpln\advance\blocks by 1 + \repeat + \advance\blocks by -1 + \ifnum\blocks<1\errmessage{line too short for 1 block^^J}% + \else\expandafter\message\expandafter{Blocks per line: \the\blocks^^J}\fi% +} + +%% main user macro +\def\DNA#1{% + \def\@DNA@end{#1}\bgroup\ttfamily\DNAc@lcline + \settoheight\dimen@{I}\advance\dimen@ by 1pt + \edef\htst{\the\dimen@}% + \def\struty{\rule[-.5pt]{\z@}{\htst}}% + %% dnabase per line counter + \count@=0 + %% block counter + \@tempcnta=0 + %% total dnabase counter + \@tempcntb=0 + \fboxrule=0pt \fboxsep=0pt + \noindent\phantom{\DNAreserve}\llap 1\ + \@DNA +} + +\def\@DNA@color{'} +\def\@DNA@thecolor{white} +\def\@DNA@setcolor#1{\def\@DNA@thecolor{#1}\@DNA} +%% do the blocking/line breaking +\def\@DNA#1{% +%% insert a space after \DNAblock bases + \ifnum\count@=\DNAblock\count@=0\ % + \advance\@tempcnta by 1\fi + \def\@DNA@cmp{#1}% +%% check for end of sequence or color shift + \ifx\@DNA@cmp\@DNA@end + \let\next\egroup + \else + \ifx\@DNA@cmp\@DNA@color + \let\next\@DNA@setcolor + \else + \advance\count@ by 1 + \advance\@tempcntb by 1 +%% line break after calculated number of blocks + \ifnum\@tempcnta=\blocks \\ + \hskip\z@\phantom{\DNAreserve}\llap {\the\@tempcntb}\ % + \@tempcnta=0 + \fi + \colorbox{\@DNA@thecolor}{\struty#1}% + \penalty0\let\next\@DNA + \fi + \fi + \next +} +\endinput +%% +%% End of file `dnaseq.sty'. |