0

I've created the following table that contains long DNA sequences, represented as a long string of characters, with their name in the left column. The way it is formatted now, all sequences get printed in a single line, with the result that the whole table is shrunk until the single lines fit onto one page. I'd like the long sequences to get split into two lines, instead of shrinking the table.

So I'd like to achieve the following:

  • the font size in all tables in my document should be equal (no shrinking of wide tables)
  • long sequences get split if they don't fit on one line, with the top line of the split sequence aligning with the name in the left column

Many thanks!

\usepackage{graphicx}

\usepackage{booktabs}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}

\begin{document}

\begin{table}[hbpt]
    \ra{1.3}
    \centering
    \resizebox{\linewidth}{!}{%
        \begin{tabular}{@{}l|l@{}}
            \toprule[2pt]
            Name & Sequence (5'-3')\\
            \hline
            oligo-dT primer & [5Bio]ACGTACGTACGTACGTACGTACGTCACGACGCTCTTCCGATCT[6-bp cell barcode][10-bp UMI]T\textsubscript{30}VN\\
            TSO & ACGTACGTCACGTACGTACGTACGTCGACGCrGrG+G \\
            XX primer & [5Bio]ACACTCTTTCCCTACACGACGC \\
            XY primer & AACTACTAGGCGACCACCTAGGCGCTACTAGGCGTTCCCTTAGGCGACGCTCTTCCG*A*T*C*T \\
            Index primer & CAAGCAGAAGACGGCATACGAGAT[8-bp index]ACTACGATCATACGTACGTACGT \\
            \bottomrule[2pt]
    \end{tabular}}
    \caption{.....}
\end{table}
1
  • 1
    \resizebox{\linewidth}{!}{% will destroy any hope of consistency in the tables Jun 12, 2020 at 16:32

2 Answers 2

3

You can use seqsplit for splitting the sequences and tabularx for sizing automatically the column.

Here I use \small, but you can omit it.

\documentclass{article}
\usepackage{booktabs,tabularx,seqsplit}

\begin{document}

\begin{table}[hbpt]
\small

\begin{tabularx}{\textwidth}{@{}l>{\raggedright\arraybackslash}X@{}}
\toprule
Name & Sequence (5'-3')\\
\midrule
oligo-dT primer & [5Bio]\seqsplit{ACGTACGTACGTACGTACGTACGTCACGACGCTCTTCCGATCT}%
                  [6-bp cell barcode][10-bp UMI]T\textsubscript{30}VN\\
\addlinespace
TSO             & \seqsplit{ACGTACGTCACGTACGTACGTACGTCGACG}CrGrG+G \\
\addlinespace
XX primer       & [5Bio]\seqsplit{ACACTCTTTCCCTACACGACGC} \\
\addlinespace
XY primer       & \seqsplit{AACTACTAGGCGACCACCTAGGCGCTACTAGGCGTTCCCTTAGGCGACGCTCTTCCG}*A*T*C*T \\
\addlinespace
Index primer    & \seqsplit{CAAGCAGAAGACGGCATACGAGAT}[8-bp index]%
                  \seqsplit{ACTACGATCATACGTACGTACGT} \\
\bottomrule
\end{tabularx}

\caption{.....}

\end{table}

\end{document}

enter image description here

1
  • Thank you, according to the seqsplit manual, this package was indeed created for splitting DNA sequences!
    – Nereus
    Jun 12, 2020 at 19:34
0

You can manually add the blank space to make it able to break a line.

\documentclass{article}

\usepackage{booktabs}
\usepackage{tabularx}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}

\begin{document}

\begin{table}[hbpt]
    \ra{1.3}
    \centering
    \begin{tabularx}{\linewidth}{@{}l|X@{}}
            \toprule[2pt]
            Name & Sequence (5'-3')\\
            \hline
            oligo-dT primer & [5Bio]ACGTACGTACGTACGTACGTACGTCACGACGCT CTTCCGATCT[6-bp cell barcode][10-bp UMI]T\textsubscript{30}VN\\
            TSO & ACGTACGTCACGTACGTACGTACGTCGACGCrGrG+G \\
            XX primer & [5Bio]ACACTCTTTCCCTACACGACGC \\
            XY primer & AACTACTAGGCGACCACCTAGGCGCTACTAGGCGTT CCCTTAGGCGACGCTCTTCCG*A*T*C*T \\
            Index primer & CAAGCAGAAGACGGCATACGAGAT[8-bp index]ACTAC GATCATACGTACGTACGT \\
            \bottomrule[2pt]
    \end{tabularx}
    \caption{.....}
\end{table}
\end{document}

enter image description here

You must log in to answer this question.

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