Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to use the dnaseq package (documentation here: http://mirrors.linsrv.net/tex-archive/macros/latex/contrib/dnaseq/dnaseq.pdf)

Basically, it takes whatever you put between "\DNA!" and "!", organizes it in blocks of customizable length, and displays the text with a numbering on the left, starting from 1.

This package is useful for displaying easy-to-read DNA sequences, but for any reason, I would like it to start numbering from a negative number (actually my starting reference is in the middle of my sequence).

So I have to redefine the starting number to something negative. I'm not new to latex but I never tried to customize packages, this is why I request some help to :

-localize in code the variable to change (I think it's \@tempcntb=0)

-write a command to redefine this variable from my preamble (something like \def, not used to its syntax)

This package is relatively simple so I hope somebody will help me out.

Thank you anyway !

share|improve this question
add comment

1 Answer

Please when asking question always provide a "MWE" complete document and say what the expected output should be, that makes it a lot easier to answer/test questions. this is an untested answer..

dnaseq defines

\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
}

so you could for example put, after loading the package

\makeatletter
\def\DNA#1#2{%
   \def\@DNA@end{#2}\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=#1
   \fboxrule=0pt \fboxsep=0pt
   \advance\@tempcntb 1
   \noindent\phantom{\DNAreserve}\llap{\the\@tempcntb}\
   \advance\@tempcntb -1
   \@DNA
}
\makeatother

and use as ... \DNA{25}!....! with the counter being initialised from 25 rather than 0.

share|improve this answer
    
I'd put #1 instead of \the\@tempcntb as the argument of \llap; but unfortunately this doesn't work when the sequence has to be broken into more lines. –  egreg Jul 16 '12 at 12:12
    
hello ! thanks a lot, your answer helped me a lot (actually the #1 should go after \@tempcntb and not \@tempcnta), it works well and helped me to get how to use \def to redefine something in the code. –  flyingbike Jul 16 '12 at 12:13
    
I only noticed the literal 1 in the original after I put it in the answer so \the\@tempcntb was just a quick fix. But do you mean neither works? –  David Carlisle Jul 16 '12 at 12:17
    
David Carlisle, your code works well, I don't understand egreg's comment. –  flyingbike Jul 16 '12 at 15:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.