[英]LaTeX list environment inside the tabular environment: extra line at top preventing alignment
我有一个困扰我的LaTeX问题。 我一直在尝试使列表环境在表格环境中正确显示。 到目前为止,我已经满足了我的所有喜好,除了一件事:列表的顶部与表中的其他条目不对齐,实际上看起来好像在列表上方添加了一行...我想拥有这些列表在顶部。 这就是我的自定义列表环境:
\newenvironment{flushemize}{
\begin{list}{$\bullet$}
{\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\setlength{\partopsep}{0pt}
\setlength{\topsep}{0pt}
\setlength{\leftmargin}{12pt}}}{\end{list}}
重命名衣衫right的权利:
\newcommand{\rr}{\raggedright}
这是我的桌子:
\begin{table}[H]\caption{Tank comparisons}\label{tab:tanks}
\centering
\rowcolors{2}{white}{tableShade}
\begin{tabular}{p{1in}p{1.5in}p{1.5in}rr}
\toprule
{\bf Material} & {\bf Pros} & {\bf Cons} & {\bf Size} & {\bf Cost} \\
\midrule
\rr Reinforced concrete &\rr \begin{flushemize}\item Strong \item Secure \end{flushemize}&\rr \begin{flushemize}\item Prone to leaks \item Relatively expensive to install \item Heavy \end{flushemize} & 100,000 gal & \$299,400 \\
\rr Steel & \begin{flushemize}\item Strong \item Secure \end{flushemize} & \begin{flushemize}\item Relatively expensive to install \item Heavy \item Require painting to prevent rusting \end{flushemize} & 100,000 gal & \$130,100 \\
\rr Polypropylene & \begin{flushemize}\item Easy to install \item Mobile \item Inexpensive \item Prefabricated \end{flushemize} & \begin{flushemize}\item Relatively insecure \item Max size available 10,000 gal \end{flushemize} & 10,000 gal & \$5,000 \\
\rr Wood & \begin{flushemize}\item Easy to install \item Mobile \item Cheap to install \end{flushemize} & \begin{flushemize}\item Prone to rot \item Must remain full once constructed \end{flushemize} & 100,000 gal & \$86,300\\
\bottomrule
\end{tabular}
\end{table}
更新资料
谢谢Little Bobby Tables和Charles Stewart的回应。 我尝试了您的两个建议,但很遗憾无法使它们生效。
对于调整列表,我尝试了:
...
\usepackage{tweaklist}
\renewcommand{\enumhook}{\setlength{\topsep}{0pt}
\setlength{\itemsep}{0pt}}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{lp{2in}l}
blah & \begin{itemize}\item One \item Two\end{itemize} & blah \\
blah & blah & blah \\
\end{tabular}
\end{table}
...
对于清单主义者,我尝试过:
...
\usepackage{paralist}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{lp{2in}l}
blah & \begin{compactitem}\item One \item Two\end{compactitem} & blah \\
blah & blah & blah \\
\end{tabular}
\end{table}
...
让我知道如果我错过了什么,我会尽量使用软件包随附的文档。
不幸的是,您对topsep所做的更改将不会生效,因为在使用定义时该维已被使用。 看一看tweaklist
的tweaklist
软件包 ,该软件包可调整列表环境,以便及时进行这些定义。
在我了解发生了什么之前,我确实遇到了多年的问题...
另一种选择是使用paralist包 。 这是compactitem env。 可能就是您想要的-紧凑的项目列表,垂直空间很小,比默认的环境更适合表中的内容。
我可以在LaTeX Stack Exchange网站上找到解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.