2

I have to print a multiple sequence alignment, which means I have to use monospaced font and two collums to achieve good alignment on a text which looks like this one: gi|161129|gb|AAA29941.1| MSGSRKFFVGGNWKMNGSRDDNDKLLKLLSEAHFDDNTEVLIAPPSVFLH gi|29841157|gb|AAP06170.1| MSGSRKFFVGGNWKMNGSRDDNDKLLKLLSEAHFDDNTEVLIAPPSVFLH gi|146741274|dbj|BAF62292.1| MSGSRTFFVGGNWKMNGSREDNEKLLKLLSEAHFGDNTEVLIAPPSVFLH gi|71983330|gb|AAZ57433.1| MSGSRKFFVGGNWKMNGSQEENKKLLHILSDAHFGDNTEVLIAPPFVFLQ gi|480328213|gb|AGJ83762.1| MASNRKFFVGGNWKMNGSKESNQKLLKTLSDAKPDANTEILVAVPFVYLK gi|358332321|dbj|GAA50994.1| MEHNRKFFVGGNWKMNGSQSEIDKLIKMLSKAQLDPNTDVLVAPPVLYLQ gi|167643879|gb|ABZ90134.1| MSNQRKFFVGGNWKMNGDKDELTKICNSLMNAKLHETTEVVVAPPSIYLD gi|565321260|gb|ETE72092.1| -MAPRKFFVGGNWKMNGDKKSLSELIHTLNEAKVPAETEVVCGAPSIYLD gi|568249377|gb|ETN59184.1| --MGRKFCVGGNWKMNGDKASIAELCKTLSAGPLDPNTEVVVGCPAPYLS gi|3184376|gb|AAC39072.1| --MSRKFCVGGNWKMNGDQKSIAEIAKTLSSAALDPNTEVVIGCPAIYLM *.* *********.: . :: : * . *::: . * :*

I'm having the worst time trying to do this by combining multicol and texttt, because I have to add several instances of this, which will occupy several pages. Ajusting it manually seems absurd, since the two colums break the text at the end of the page automatically. Maybe I should try using tables? Or Should I only take a screenshot of the already aligned sequence and insert the image on the document?

2
  • 1
    try with longtable package
    – touhami
    Commented Aug 22, 2015 at 20:32
  • if the part on the right side of a line is associated with the part on the left side, you could use tabular, with the left part left-aligned and a "tab" to a "tab stop" at the end of the line for the right part.. Commented Aug 22, 2015 at 20:47

1 Answer 1

3

Here is a solution

Edit just for example use \usepackage[scale=.9]{geometry}

\documentclass{article}
\usepackage[scale=.9]{geometry}
\usepackage{array,longtable}
\begin{document}
\begin{longtable}{>{\ttfamily}l>{\ttfamily}r}
gi|161129|gb|AAA29941.1|       &   MSGSRKFFVGGNWKMNGSRDDNDKLLKLLSEAHFDDNTEVLIAPPSVFLH\\
gi|29841157|gb|AAP06170.1|     &   MSGSRKFFVGGNWKMNGSRDDNDKLLKLLSEAHFDDNTEVLIAPPSVFLH\\
gi|146741274|dbj|BAF62292.1|   &   MSGSRTFFVGGNWKMNGSREDNEKLLKLLSEAHFGDNTEVLIAPPSVFLH\\
gi|71983330|gb|AAZ57433.1|     &   MSGSRKFFVGGNWKMNGSQEENKKLLHILSDAHFGDNTEVLIAPPFVFLQ\\
gi|480328213|gb|AGJ83762.1|    &   MASNRKFFVGGNWKMNGSKESNQKLLKTLSDAKPDANTEILVAVPFVYLK\\
gi|358332321|dbj|GAA50994.1|   &   MEHNRKFFVGGNWKMNGSQSEIDKLIKMLSKAQLDPNTDVLVAPPVLYLQ\\
gi|167643879|gb|ABZ90134.1|    &   MSNQRKFFVGGNWKMNGDKDELTKICNSLMNAKLHETTEVVVAPPSIYLD\\
gi|565321260|gb|ETE72092.1|    &   -MAPRKFFVGGNWKMNGDKKSLSELIHTLNEAKVPAETEVVCGAPSIYLD\\
gi|568249377|gb|ETN59184.1|    &   --MGRKFCVGGNWKMNGDKASIAELCKTLSAGPLDPNTEVVVGCPAPYLS\\
gi|3184376|gb|AAC39072.1|      &   --MSRKFCVGGNWKMNGDQKSIAEIAKTLSSAALDPNTEVVIGCPAIYLM\\
            &            *.* *********.: .  :: : *  .     *::: . *  :*\\
\end{longtable}
\end{document}

enter image description here

5
  • One last question, does this package react well to \centering? It's causing some nasty overfulls and some early tests aren't quite good. Commented Aug 22, 2015 at 21:51
  • I am not sure I understand, do you want (try) \begin{longtable}{>{\ttfamily}c>{\ttfamily}c}?
    – touhami
    Commented Aug 22, 2015 at 21:54
  • The text is long enough to cause overfull hbox, but it could fit well if the table were centered on the page. Now I see that \centering has nothing to do with it. Commented Aug 22, 2015 at 21:56
  • I understand now. by default longtable is centered, here the width of table is large, larger than textwidth. so you need to use \small befor the table and reset font size to normal after or change page layout make textwidth bigger
    – touhami
    Commented Aug 22, 2015 at 22:01
  • @BrunoYamada i update my answer
    – touhami
    Commented Aug 22, 2015 at 22:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .