我正在尝试使用 tabularx 创建一个具有不同列宽的表格:
\documentclass{scrbook}
\usepackage{tabularx}
\newcolumntype{b}{X}
\newcolumntype{s}{>{\hsize=.5\hsize}X}
\begin{document}
\begin{tabularx}{\linewidth}{sbs}
\caption[Oligonucleotides]{List of oligonucleotides ...}\\
\toprule
\textbf{Number} & \textbf{Sequence} & \textbf{Application}\\[6pt]
\midrule
\endfirsthead
\toprule
\textbf{Number} & \textbf{Sequence} & \textbf{Application}\\[6pt]
\midrule
\endhead
01247 & CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG & Gibson cloning\\
01248 & GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG & Gibson cloning\\
01249 & CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC & Gibson cloning\\
01250 & GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG & Gibson cloning\\
01251 & CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC & Gibson cloning\\
\bottomrule
\end{tabularx}
\end{document}
但我收到了很多错误:
\caption outside float. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
\caption outside float. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
\caption outside float. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
\caption outside float. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Undefined control sequence. \end{tabularx}
Overfull \hbox (7.21417pt too wide) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (178.28296pt too wide) in paragraph
Overfull \hbox (76.84334pt too wide) in paragraph
Overfull \hbox (101.40483pt too wide) in paragraph
Overfull \hbox (76.84332pt too wide) in paragraph
Overfull \hbox (100.72044pt too wide) in paragraph
Overfull \hbox (10.95003pt too wide) in paragraph
有人知道如何解决这些问题吗?
答案1
如果你想要一个“长” tabularx
,你需要加载ltablex
。
\documentclass{scrbook}
\usepackage{tabularx,booktabs,seqsplit,ltablex}
\newcolumntype{s}[1]{>{\hsize=#1\hsize}X}
\begin{document}
\begin{tabularx}{\textwidth}{
@{}
s{0.5}
s{2}
>{\raggedright\arraybackslash}s{0.5}
@{}
}
\caption[Oligonucleotides]{List of oligonucleotides ...}\\
\toprule
\textbf{Number} & \textbf{Sequence} & \textbf{Application}\\
\midrule
\endfirsthead
\toprule
\textbf{Number} & \textbf{Sequence} & \textbf{Application}\\
\midrule
\endhead
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01247 & \seqsplit{CACAGTATTGTCTTTCCCTGCTCCGCCAGGGACCTTGACTTTGAAG} & Gibson cloning\\
01248 & \seqsplit{GAAAGTGTCCCTGGAGCCCCCTTCAAAGTCAAG} & Gibson cloning\\
01249 & \seqsplit{CTTGACTTTGAAGGGGGCTCCAGGGACACTTTCGTC} & Gibson cloning\\
01250 & \seqsplit{GAAAGTGTCCCTGGAGACCCCTTCAAAGTCAAG} & Gibson cloning\\
01251 & \seqsplit{CTTGACTTTGAAGGGGTCTCCAGGGACACTTTCGTC} & Gibson cloning\\
\bottomrule
\end{tabularx}
\end{document}
您可以使用\hsize=<fraction>\hsize
,但分数值的总和应等于X
列数。