I have a LaTeX question that is bugging me. I have been trying to get a list environment to appear correctly inside the tabular environment. So far I have gotten everything to my liking except one thing: the top of the list does not align with other entries in the table, in fact it looks like it adds one line above the list... I would like to have these lists at the top. This is what I have, a custom list environment:
\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}}
Renamed ragged right:
\newcommand{\rr}{\raggedright}
and here is my table:
\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}
Update
Thank you Little Bo开发者_JAVA技巧bby Tables and Charles Stewart for your responses. I tried out both of your suggestions and unfortunately could not get them to work.
For tweaklist I tried:
...
\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}
...
and for paralist I tried:
...
\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}
...
Let me know if I missed something I tried to use the documentation provided with the packages as best I could.
Unfortunately, your change to topsep won't take effect, as the dimension has already been used by the time your definition is used. Take a look at Jason Schiøtz's tweaklist
package, that adjusts the list environments so that these definitions happen in good time.
I had exactly this problem for years before I understood what was going on...
Another option is to use the paralist package. It's compactitem env. is probably what you want - A compacted items list with very little vertical spaces, much more suitable in a table than the default env.
I was able to find a solution on the LaTeX Stack Exchange site.
精彩评论