# Spacing after itemize inside a tabular

I have a problem with the spacing after an itemize inside a tabular.

\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{framed}
\usepackage[parfill]{parskip}
\usepackage{array,ragged2e}
\usepackage{enumitem}

\usepackage[left=0.75in,top=1.5in,right=0.75in,bottom=1in]{geometry}

\begin{document}
\lipsum[1]
\lipsum[2]
\begin{tabular}{@{}>{\RaggedRight}p{8.64cm}>{\RaggedRight}p{8.64cm}@{}}
\begin{itemize}[topsep=0pt, itemsep=0pt, leftmargin=2ex]
\item
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\end{itemize} &
\begin{itemize}[topsep=0pt, itemsep=0pt, leftmargin=2ex]
\item
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
%Some text
\end{itemize}
\end{tabular}

\end{document}


The problem is the space after the last itemize. It is too big. If i put some text after the last itemize, the space is exactly what i am looking for.

What commands do I have to use to fix that? I know that the easilest way is to put \vspace{-8pt} after the last itemize but the thing is, the content is dynamic so I do not know what is on the last line.

Thanks for you replies.

EDIT: I have added an item in the right cell so the table is not proportional.

-

1. Defining new column type
I found a possible solution in an answer by Danie Els based on code from Donald Arsenauer, see vspace before itemize in a Table cell, tabular vs longtable. Here you are defining new column types for enumerate and itemise, which you utilise by a \multicolumn-command inside the table. If you do not use enumerated lists, you do not need the e-column type.

To get similar control over the spacing of text columns, I have defined a ragged-right text column type, also activated by the multicolumn-command.

For your MWE, the code will be:

\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{framed}
\usepackage[parfill]{parskip}
\usepackage{ragged2e,longtable,array,enumitem

\usepackage[left=0.75in,top=1.5in,right=0.75in,bottom=1in]{geometry}

\makeatletter
%----  Enumerated columns
\newcolumntype{e}[1]{%
>{\minipage[t]{\linewidth}\let\\\tabularnewline
\enumerate
\setlength{\itemsep}{-\parsep}}%
p{#1}%
<{\@finalstrut\@arstrutbox\endenumerate\endminipage}}

%---- Itemized columns
\newcolumntype{i}[1]{%
>{\minipage[t]{\linewidth}\let\\\tabularnewline
\itemize
\setlength{\itemsep}{-\parsep}}%
p{#1}%
<{\@finalstrut\@arstrutbox\enditemize\endminipage}}

%---- Text columns
\newcolumntype{t}[1]{%
>{\minipage[t]{\linewidth}\let\\\tabularnewline
}%
p{#1}%
<{\@finalstrut\@arstrutbox\endminipage}}

\makeatother

\begin{document}
\lipsum[1]

\lipsum[2]

\begin{tabular}{@{}p{8.64cm}p{8.64cm}@{}}

\multicolumn{1}{@{}i{8.64cm}}{\item This is an empty line
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;}
&
\multicolumn{1}{@{}i{8.64cm}}{\item But this is not an empty line
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\item Some text}
\end{tabular}
\fontsize{13}{6}\selectfont\textbf{Testing}}

\begin{tabular}{@{}p{8.64cm}p{8.64cm}@{}}
\multicolumn{1}{@{}t{8.64cm}}{Lorem ipsum dolor sit amet;Lorem ipsum dolor sit amet;Lorem ipsum dolor sit amet;Lorem ipsum dolor sit amet;

\smallskip
Lorem ipsum dolor sit amet;Lorem ipsum dolor sit amet;Lorem ipsum dolor sit amet;Lorem ipsum dolor sit amet;

\smallskip
Lorem ipsum dolor sit amet;Lorem ipsum dolor sit amet;Lorem ipsum dolor sit amet;Lorem ipsum dolor sit amet;}
&
\multicolumn{1}{@{}i{8.64cm}}{\item This line is empty
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\item Some text}
\end{tabular}
\fontsize{13}{6}\selectfont\textbf{Testing}}
\end{document}


As you see, you can combine ordinary text in one column and lists in the other, still with correct spacing. The output is:

2. Parbox
A simpler solution, with some limitations, is to enclose the itemize-environments in parboxes. To align the text at the top of the parbox, use the optional arguments and give a specific height of the parbox. If you only wants some space, add a \strut after the last itemise in each column. A MWE:

\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{framed}
\usepackage[parfill]{parskip}
\usepackage{array,ragged2e}
\usepackage{enumitem}

\usepackage[left=0.75in,top=1.5in,right=0.75in,bottom=1in]{geometry}

\begin{document}
\lipsum[1]
\lipsum[2]
\begin{tabular}{@{}>{\RaggedRight}p{8.64cm}%
>{\RaggedRight}p{8.64cm}@{}}
\parbox[c][58pt][t]{8.64cm}{%
\begin{itemize}[topsep=0pt, itemsep=0pt, leftmargin=2ex]
\item
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\end{itemize}%
} &
\parbox[c][58pt][t]{8.64cm}{%
\begin{itemize}[topsep=0pt, itemsep=0pt, leftmargin=2ex]
\item
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
%Some text
\end{itemize}%
}
\end{tabular}
\fontsize{13}{6}\selectfont\textbf{Testing}}%

\end{document}


To overcome the limitations, you have to define a function that calculate the height of the parbox. Her is a starting point:

\settototalheight\foo{\parbox[t]{8.64cm}{\begin{itemize}[topsep=0em, itemsep=0pt, leftmargin=2ex]
\item Neither is this line
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\item Lorem ipsum dolor sit amet;
\item Some text \strut
\end{itemize}}
}


parbox does not accept multiple paragraphs. A work around is to enclose the paragraphs in a minipage of the same width as the parbox inside the \parbox.

Example code:

\settototalheight\fooii{\parbox[t]{8.64cm}{\begin{minipage}[t]{8.64cm}
\lipsum[1-2]
\end{minipage}}
}


Then you have to add 3pt to the variable \fooii and use it as heigh of the parbox you typeset in the table.

This picture is the output from the MWE:

-
Thanks, but when the right cell is longer than the left, the left content is centered in the cell. I want it to stay on top and the space after the last element is too small. –  Pete Oct 1 '12 at 20:13
Thanks for your answer, but unfortunately, it only works on static text. If you add another item, the added item will be under the title due to the "position" option of the parbox. If i only use the t parameter, the parboxes are aligned together but the space after and before the parbox is not good because there's too much space before and not enough after. –  Pete Oct 1 '12 at 20:45
Calculating the height of the text would be hard to do due to the non static text. If there is a way to draw the text without putting it to the pdf then retrieve the height and put it to the parameter, i can then set the right margin. It would be hard and long to do, I am sure there's a command to do what i want :) There's also the minipage that is like a \parbox but it has the same problem. –  Pete Oct 1 '12 at 21:22
@Sevinung thanks for your answer, unfortunately i am having trouble with the \settototalheight command because it doesn't accept new paragraphs inside. In my dynamic content, i can have paragraphs inside the tabular. Is there a way to accept the paragraphs inside \settototalheight command? or is there a workaround possible? –  Pete Oct 2 '12 at 15:38
@Pete See the updated answer. –  Sveinung Oct 3 '12 at 7:04