I have created a macro which I used to format DNA sequences, as they should be in the monospaced font and uppercased:
\newcommand{\DNA}[1]{\texttt{\uppercase{#1}}}
Now I have a column with some different DNA sequences on different rows, lets say:
1 & \DNA{GCATCCAATGCC}\\
2 & \DNA{GGGACCAATGCG}\\
3 & \DNA{TTATCCAATCTC}\
I would like to color each character (base) in the DNA sequence with a different color, as it easier for the reader to see certain patterns (in this case the reoccuring CCAAT sequence, a putative Hap complex binding domain).
(for example as done here)
that means, all
A -> Red
T -> Green
C -> Blue
G -> Black
Is there a way to do this, or a verbatim package in which this can be achieved ?
Thanks alot for your help!
———-
Liu's example posted works well, but not in my tabular/floatrow table
Tobi's example works well in all environments tested..
Thanks again for your great help all!
Best Answer
Like this?
[EDIT: I changed the example so it doesn’t touch other listings.]
You can use it also in commands like
\section
See thelistings
manual for more info.