![如何在表格前显示部分名称?](https://linux22.com/image/350724/%E5%A6%82%E4%BD%95%E5%9C%A8%E8%A1%A8%E6%A0%BC%E5%89%8D%E6%98%BE%E7%A4%BA%E9%83%A8%E5%88%86%E5%90%8D%E7%A7%B0%EF%BC%9F.png)
我在想如何在表格前面加上部分名称。我想我可能需要使用float
。图 1 中输出的代码
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\section*{Abbreviations}
\begin{table}
\begin{tabularx}{\textwidth}{l | l}
\textit{Abbreviation} & \textit{Definition} \\ \hline
EHF & Ebola Hemorrhagic Fever (deprecated) \\
EVD & Ebola Virus Disease (current) \\
IP & Incubation period \\
GP & Glycoprotein \\
VHF & Viral Hemmorrhagic Fever \\
\end{tabularx}
\end{table}
\end{document}
图 1 输出
操作系统:Debian 8.7
答案1
tabular
环境中没有必要必须有或类似的东西table
。您的实例不是浮点数,因此不需要table
:
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\section*{Abbreviations}
\noindent
\begin{tabularx}{\textwidth}{l | X}
\textit{Abbreviation} & \textit{Definition} \\ \hline
EHF & Ebola Hemorrhagic Fever (depreciated) \\
EVD & Ebola Virus Disease (current) \\
IP & Incubation period \\
GP & Glycoprotein \\
VHF & Viral Hemmorrhagic Fever
\end{tabularx}
\end{document}
请注意,tabularx
至少需要一X
列。
另一方面,我认为没有tabularx
必要。
\documentclass{article}
\begin{document}
\section*{Abbreviations}
\begin{description}
\item[EHF] Ebola Hemorrhagic Fever (depreciated)
\item[EVD] Ebola Virus Disease (current)
\item[IP] Incubation period
\item[GP] Glycoprotein
\item[VHF] Viral Hemmorrhagic Fever
\end{description}
\end{document}
答案2
如果缩写列表很长,请考虑使用longtable
环境而不是tabularx
或tabular
环境。这将允许在需要时自动分页。
\documentclass{article}
\usepackage{longtable,booktabs}
\begin{document}
\section*{Abbreviations}
\setlength\LTleft{0pt} % left-align rather than center-set the longtable
\begin{longtable}{@{}l p{0.75\textwidth}@{}}
\textit{Abbreviation} & \textit{Definition} \\
\midrule
\endhead
EHF & Ebola Hemorrhagic Fever (depreciated) \\
EVD & Ebola Virus Disease (current) \\
IP & Incubation period \\
GP & Glycoprotein \\
VHF & Viral Hemmorrhagic Fever \\
\end{longtable}
\end{document}
答案3
如果您希望它作为浮动环境,那么使用:
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\section*{Abbreviations}
\begin{table}[ht]%%%%%%%%%
\begin{tabularx}{\textwidth}{l | X}
\textit{Abbreviation} & \textit{Definition} \\ \hline
EHF & Ebola Hemorrhagic Fever (depreciated) \\
EVD & Ebola Virus Disease (current) \\
IP & Incubation period \\
GP & Glycoprotein \\
VHF & Viral Hemmorrhagic Fever \\
\end{tabularx}
\end{table}
\end{document}
然而,table
在这里不使用环境使用它更有意义。