TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the posts to the question of Timtico (here) several ways have been proposed to colour the As,Ts,Cs and Gs differently within a DNA sequence. What I want is also to be able to underline some nucleotides to emphasise them, e.g.: \dna{ATACAG$\underbar{AG}$CATA} but I didn't manage to do so. Does anyone have suggestions to this problem? Thank you very much!

share|improve this question
Do you want to underline a specific subsequence like AG? Not everyone here is a biologist. Please describe your question without many professional terms, and provide some examples/pictures to illustrate the question. – Leo Liu May 22 '11 at 11:51
You might want to have a look at the texshade package (Typesetting nucleotide and peptide alignments) and maybe also textopo (for shaded membrane protein topology plots) by the same author. – clemens Mar 22 '12 at 17:52
up vote 4 down vote accepted

I added a delimiter to the code from my answer at typesetting different characters with different colors in a DNA sequence


The result is
result of the above code

I think, this should work for you.

share|improve this answer
Wow, that was indeed what I was looking for. Thank you very much!! – Ros May 22 '11 at 13:52
@Ros Your welcome :-D – Tobi May 22 '11 at 14:03
One additional question: would it also be possible to write the literate shorter? (That would be handy when colouring protein sequences, for which multiple letters have to be the same colour). E.g. something like this: literate={A,B,C,D}{\textcolor{green}{\1}}{1}, {E,F,G,H}{\textcolor{blue}{\1}}{1} etc.. – Ros May 22 '11 at 17:20
@Ros: I don’t believe that there is a way to do it with listings. Maybe the manual can give you more information. ps. Note that there’s no comma , between the literate definitions. – Tobi May 22 '11 at 17:48

Your Answer


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.