Graphics, Figures & TablesItemize inside a table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Irid
Posts: 3
Joined: Sat May 31, 2008 1:48 pm

Itemize inside a table

Post by Irid »

Hello,
I have a persistent problem that I'm unable to solve on my own. Due to the nature of my data, I would like to present it in a table, but in each cell the data should be itemized as well. The problem is that the spacing of itemize environment is too large, so the table has too much white space inside.

I tried to define my own list with all possible parameters set to zero (\topsep, \parsep, etc.), but my list still adds some additional space above and below the entire block. Currently my best solution is compactitem environment defined in paralist package, however, I wish to get rid of all extra space above and below the environment. Left indentation should possibly be reduced as well. Is there some way to achieve it? Otherwise, what may be the alternatives? (paragraph boxes, tables inside the table?)

I attach a file with the table and below I post an extract of the latex code which was used to generate it:

Code: Select all

\begin{tabular}{p{0.2\textwidth} p{0.4\textwidth} p{0.3\textwidth}}
\hline\hline
Properties & \hspace{0.8cm} Various effects & \hspace{0.8cm} Uses\\
\hline
Surface area effect &
\begin{compactitem}
\item Surface area per weight is over 100 times higher than that of usual fibers.
\item Very large adsorption.
\end{compactitem}
& \begin{compactitem}
\item Adsorption material
\item Biochemical hazard prevention material
\item Ion-exchange material
\end{compactitem}\\
Slip effect 
&
\begin{compactitem}
\item Flow of molecules changes and pressure loss becomes much smaller.
\end{compactitem}
&
\begin{compactitem}
\item Air filter
\item Biochemical hazard prevention material
\end{compactitem}\\
\hline\hline
\end{tabular}
Attachments
table_items.pdf
Itemize environments inside a table produce too much whitespace.
(31.28 KiB) Downloaded 773 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Itemize inside a table

Post by localghost »

Use the enumitem package to eliminate the space before and after the lists.


Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Irid
Posts: 3
Joined: Sat May 31, 2008 1:48 pm

Itemize inside a table

Post by Irid »

Thank you for your reply Thorsten. I've tried to use enumitem package in this manner:

Code: Select all

\begin{itemize}[label=\textbullet, nolistsep, noitemsep]
\item My item1
\item My item2...
\end{itemize}
Unfortunately, the results are identical to my previous attempt. Even with all vertical space suppressed, the itemize environment still adds approx. 0.8 of a line before and after the list, while I would like it to begin at exactly the same level as normal text would. Maybe there are other parameters in enumitem? Or other suggestions?
Strangely enough, this behavior occurs only inside a table. In a normal paragraph mode all the additional vertical space is suppressed as it is supposed to be.
grinder
Posts: 9
Joined: Sat Oct 24, 2009 3:02 pm

Re: Itemize inside a table

Post by grinder »

Did you find any solution to that? I have exactly the same problem :(
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Itemize inside a table

Post by gmedina »

grinder wrote:Did you find any solution to that? I have exactly the same problem :(
The suggestion made by localghost and illustrated by Irid works OK in the following simple example:

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\noindent text text 
\begin{itemize}[label=\textbullet, nolistsep, noitemsep]
\item My item1
\item My item2...
\end{itemize}
text text

\noindent text text

\end{document}


If it is not working for you, we will need a minimal working example showing the undesired behaviour.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
grinder
Posts: 9
Joined: Sat Oct 24, 2009 3:02 pm

Itemize inside a table

Post by grinder »

Thanx for your answer. I am afraid there is no MWE :( I 've already used localghost's suggestion, but it doesn't work. I 've also used the paralist package with the compactitem environment, like the original poster, but I still have vertical space after the itemize block, which I don't want. Indentation is not an issue, since the paralist package, which seems to be closer to my needs, has options for that (specifically for my case it is [flushleft,alwaysadjust]). Am I missing something here?
burgstaa
Posts: 8
Joined: Wed Oct 28, 2009 4:50 pm

Itemize inside a table

Post by burgstaa »

Hello!

I am having exactly the same problem and wonder if it could be solved yet.

the problem is, that the itemized content in a table has more vertical space than the other text.

this is my code:

Code: Select all

\documentclass[pdftex,a4paper,12pt,oneside,abstracton]{scrreprt}

\usepackage{ngerman}										% Paket zum Übersetzen
\usepackage[latin1]{inputenc}						% Eingabe von Umlauten
\usepackage[T1]{fontenc}								% Verwenden von T1 Fonts
\usepackage{array}											% für Tabular-Umgebung
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{enumitem}

\begin{document}
\begin{table}[htbp]
   \footnotesize
   \newcolumntype{v}[1]{%
   >{\raggedright\hspace{0pt}}p{#1}%
   }
   \centering
      \begin{tabularx}{1\textwidth}{X p{3.5cm} p{3.5cm} p{3.5cm}}\toprule
         Typbezeichnung & Charakteristika (Stärken) & positive Ausprägung & negative Ausprägung \\ \addlinespace \midrule       
         \addlinespace
         Der Friedliebende &
         test &
         \begin{itemize}[label=\textbullet, nolistsep, noitemsep, leftmargin=10pt]
         \item[-] test
         \end{itemize} & test \\
      \end{tabularx}
   \caption{Testtabelle}
   \label{tab:Testtabelle}
\end{table}
\end{document}
any help is highly appreciated!
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Itemize inside a table

Post by Juanjo »

Try this to start the itemize environment:

Code: Select all

\begin{itemize}[label=\textbullet, nolistsep, leftmargin=10pt,
            before*={\mbox{}\vspace{-\baselineskip}}]
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
burgstaa
Posts: 8
Joined: Wed Oct 28, 2009 4:50 pm

Re: Itemize inside a table

Post by burgstaa »

that is exactly what i was looking for!

thank you very much!
Post Reply