<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% \iffalse
%% 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
%%
%
%&lt;*dtx&gt;
          \ProvidesFile{dnaseq.dtx}[2002/05/20 v0.01 dna sequence setter]
%&lt;/dtx&gt;
%&lt;dnaseq&gt;\NeedsTeXFormat{LaTeX2e}
%&lt;dnaseq&gt;\ProvidesPackage{dnaseq}[2002/05/20 v0.01 dna sequence setter]
%&lt;dnaseq&gt;\RequirePackage{color}
%&lt;driver&gt;\ProvidesFile{dnaseq.drv}
% \fi
%\iffalse
%&lt;*driver&gt;
\documentclass{ltxdoc}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{dnaseq}
\begin{document}
\DocInput{dnaseq.dtx}
\end{document}
%&lt;/driver&gt;
%\fi
% \GetFileInfo{dnaseq.dtx}
% \title{The \textsf{dnaseq} package\thanks{This file
%        has version number \fileversion, last
%        revised \filedate.}}
% \author{Bj{\o}rn Pedersen}
% \date{\filedate}
% \maketitle
% \CheckSum{154}
% 
%\section{Introduction}
%\label{sec:intro}

%This package allows easy setting of simple dna-sequences in
%userdefined grouping, with numbering of bases (at the begin of
%each line.
%
%If you need to typeset alignments, have a look at the
%\texttt{texshade}-Package.
%
% The main code has been posted by Andreas Matthias
% \texttt{&lt;amat@kabsi.at&gt;} on \texttt{de.comp.text.tex} and is based
% by itself on old code from Anselm Lingnau.
%\section{Usage}
%\label{sec:usage}
%
%\subsection{DNA}
%\DescribeMacro{\DNA}
%\verb|\DNA| is the main macro of this package. It is used as
%following:
%\begin{verbatim}
%\DNA! actctgctagtcgatgcat!
%\end{verbatim}
%where the delimiting character \verb|!| can be any normal character.
%
%Within the argument you can use \verb|'{&lt;color&gt;}| to change the color
%of your bases. The color names are normal color.sty names. 
%Look at the full example for more info.
%
%\subsection{Configuration}
%
%\DescribeMacro{\DNAblock}The macro \verb|\DNAblock| stores the desired blocking intervall of
%your sequence. Just do a \verb|\renewcommand{\DNAblock}{&lt;some number&gt;}|
%to change the default of 10.
%
%\DescribeMacro{\DNAreserve}The macro defines how much space to reserve
%for the numbering of bases. 
%To change, do a \verb|\renewcommand{\DNAreserve}{&lt;template&gt;}| The
%default template is \verb|0000| allowing for for digit numbering.
%
%\section{Example}
%\label{sec:ex}
%
%\begin{verbatim}
%\noindent\begin{minipage}{100pt}
%
%\noindent\rule{\textwidth}{.5pt}
%\DNA!  ACGT'{red}A CGT'{white}TGCA'{green}x s df'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}TGCA'{green}x sdf '{white}FJKDSLAF
%DSAIOFDSA AC GT'{red}ACGT'{white}TG CA'{green}xsdf'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}T GCA'{green} xs df'{white}FJKDSLA
%FDSAIOFDSA ACGT'{red}AC GT'{white}TGCA'{green}xsdf'{white}FJK DSLA
%FDSAIOFDSA !
%\end{minipage}
%
%\noindent\begin{minipage}{200pt}
%\noindent\rule{\textwidth}{.5pt}
%\DNA!  ACGT'{red}A CGT'{white}TGCA'{green}x s df'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}TGCA'{green}x sdf '{white}FJKDSLAF
%DSAIOFDSA AC GT'{red}ACGT'{white}TG CA'{green}xsdf'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}T GCA'{green} xs df'{white}FJKDSLA
%FDSAIOFDSA ACGT'{red}AC GT'{white}TGCA'{green}xsdf'{white}FJK DSLA
%FDSAIOFDSA !
%\end{minipage}
%
%\noindent\begin{minipage}{\textwidth}
%\noindent\rule{\textwidth}{.5pt}
%\DNA!  ACGT'{red}A CGT'{white}TGCA'{green}x s df'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}TGCA'{green}x sdf '{white}FJKDSLAF
%DSAIOFDSA AC GT'{red}ACGT'{white}TG CA'{green}xsdf'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}T GCA'{green} xs df'{white}FJKDSLA
%FDSAIOFDSA ACGT'{red}AC GT'{white}TGCA'{green}xsdf'{white}FJK DSLA
%FDSAIOFDSA !
%\end{minipage}
%
%\renewcommand{\DNAblock}{5}
%\noindent\begin{minipage}{\textwidth}
%\noindent\rule{\textwidth}{.5pt}
%\DNA!  ACGT'{red}A CGT'{white}TGCA'{green}x s df'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}TGCA'{green}x sdf '{white}FJKDSLAF
%DSAIOFDSA AC GT'{red}ACGT'{white}TG CA'{green}xsdf'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}T GCA'{green} xs df'{white}FJKDSLA
%FDSAIOFDSA ACGT'{red}AC GT'{white}TGCA'{green}xsdf'{white}FJK DSLA
%FDSAIOFDSA !
%\end{minipage}
%\end{verbatim}
%\noindent\begin{minipage}{100pt}
%
%\noindent\rule{\textwidth}{.5pt}
%\DNA!  ACGT'{red}A CGT'{white}TGCA'{green}x s df'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}TGCA'{green}x sdf '{white}FJKDSLAF
%DSAIOFDSA AC GT'{red}ACGT'{white}TG CA'{green}xsdf'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}T GCA'{green} xs df'{white}FJKDSLA
%FDSAIOFDSA ACGT'{red}AC GT'{white}TGCA'{green}xsdf'{white}FJK DSLA
%FDSAIOFDSA !
%\end{minipage}
%
%\noindent\begin{minipage}{200pt}
%\noindent\rule{\textwidth}{.5pt}
%\DNA!  ACGT'{red}A CGT'{white}TGCA'{green}x s df'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}TGCA'{green}x sdf '{white}FJKDSLAF
%DSAIOFDSA AC GT'{red}ACGT'{white}TG CA'{green}xsdf'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}T GCA'{green} xs df'{white}FJKDSLA
%FDSAIOFDSA ACGT'{red}AC GT'{white}TGCA'{green}xsdf'{white}FJK DSLA
%FDSAIOFDSA !
%\end{minipage}
%
%\noindent\begin{minipage}{\textwidth}
%\noindent\rule{\textwidth}{.5pt}
%\DNA!  ACGT'{red}A CGT'{white}TGCA'{green}x s df'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}TGCA'{green}x sdf '{white}FJKDSLAF
%DSAIOFDSA AC GT'{red}ACGT'{white}TG CA'{green}xsdf'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}T GCA'{green} xs df'{white}FJKDSLA
%FDSAIOFDSA ACGT'{red}AC GT'{white}TGCA'{green}xsdf'{white}FJK DSLA
%FDSAIOFDSA !
%\end{minipage}
%
%\renewcommand{\DNAblock}{5}
%\noindent\begin{minipage}{\textwidth}
%\noindent\rule{\textwidth}{.5pt}
%\DNA!  ACGT'{red}A CGT'{white}TGCA'{green}x s df'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}TGCA'{green}x sdf '{white}FJKDSLAF
%DSAIOFDSA AC GT'{red}ACGT'{white}TG CA'{green}xsdf'{white}FJKD SLAF
%DSAIOFDSA ACGT'{red}ACGT'{white}T GCA'{green} xs df'{white}FJKDSLA
%FDSAIOFDSA ACGT'{red}AC GT'{white}TGCA'{green}xsdf'{white}FJK DSLA
%FDSAIOFDSA !
%\end{minipage}
%
%\StopEventually
%
%\section{The code}
%&lt;*dnaseq&gt;
%    \begin{macrocode}
\def\DNAblock{10}
\def\DNAreserve{0000}% für 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&gt;\t@mpln\advance\blocks by 1
 \repeat
 \advance\blocks by -1
 \ifnum\blocks&lt;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
}
%    \end{macrocode}
%&lt;/dnaseq&gt;
% \Finale
</pre></body></html>