我编写了如下所示的表格,但无论我尝试什么选项,表格的标题都会右对齐,并且不会以粗体显示。我该怎么做才能纠正这个问题?
\begin{table}[h]
\centering
\begin{tabularx}{\linewidth}{llX}
\toprule
\multicolumn{3}{l}\textbf{Adapterfinder.py Output File Structure.} \\
\hline
\textbf{File Line} & \textbf{Element} & \textbf{Example} \\
\hline
Meta line 1 & Parent filename & ``Report generated from input\_filename.FASTQ'' \\
\hline
Meta line 2 & Adapter sequence used & ``Adapter sequence: AGATCG'' \\
\hline
Line 1 & Read ID & ``@HWI-3:1101:1239:1968'' \\
\hline
Line 2 & Read sequence & ``TNGCNTAGNGGATTGCATGCAGA'' \\
\hline
Line 3 & Adapter sequence found & ``Adapter contamination: AGA'' \\
\bottomrule
\end{tabularx}
\end{table}
答案1
\documentclass{article}
\usepackage{ragged2e}
\usepackage{booktabs, tabularx}
\usepackage[skip=1ex, font=bf]{caption}
\begin{document}
\begin{table}[ht]
\setlength\tabcolsep{3pt}
\begin{tabularx}{\linewidth}{@{} ll>{\RaggedRight}X @{}}
\toprule
\multicolumn{3}{c}{\textbf{Adapterfinder.py Output File Structure.}} \\
\midrule
\textbf{File Line} & \textbf{Element} & \textbf{Example} \\
\midrule
Meta line 1 & Parent filename & ``Report generated from input\_filename.FASTQ'' \\
Meta line 2 & Adapter sequence used & ``Adapter sequence: AGATCG'' \\
Line 1 & Read ID & ``@HWI-3:1101:1239:1968'' \\
Line 2 & Read sequence & ``TNGCNTAGNGGATTGCATGCAGA'' \\
Line 3 & Adapter sequence found & ``Adapter contamination: AGA'' \\
\bottomrule
\end{tabularx}
\end{table}
or
\begin{table}[ht]
\setlength\tabcolsep{3pt}
\caption*{Adapterfinder.py Output File Structure.}
\begin{tabularx}{\linewidth}{@{} ll>{\RaggedRight}X @{}}
\toprule
\textbf{File Line} & \textbf{Element} & \textbf{Example} \\
\midrule
Meta line 1 & Parent filename & ``Report generated from input\_filename.FASTQ'' \\
Meta line 2 & Adapter sequence used & ``Adapter sequence: AGATCG'' \\
Line 1 & Read ID & ``@HWI-3:1101:1239:1968'' \\
Line 2 & Read sequence & ``TNGCNTAGNGGATTGCATGCAGA'' \\
Line 3 & Adapter sequence found & ``Adapter contamination: AGA'' \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案2
与@leanderiis 评论相关
\begin{table}
\centering
\begin{tabularx}{\linewidth}{llX}
\toprule
\multicolumn{3}{c}{\textbf{Adapterfinder.py Output File Structure.}} \\ \hline
{\textbf{File Line}} & {\textbf{Element}} & {\textbf{Example}} \\ \hline
Meta line 1 & Parent filename & ``Report generated from input\_filename.FASTQ'' \\ \hline
Meta line 2 & Adapter sequence used & ``Adapter sequence: AGATCG'' \\ \hline
Line 1 & Read ID & ``@HWI-3:1101:1239:1968'' \\ \hline
Line 2 & Read sequence & ``TNGCNTAGNGGATTGCATGCAGA'' \\ \hline
Line 3 & Adapter sequence
found & ``Adapter contamination: AGA'' \\\bottomrule
\end{tabularx}
\end{table}