2

I have a strange vertical spacing after a \enumeration in a table although I have set all seps to 0pt ([itemsep=0pt, topsep=0pt, parsep=0pt, partopsep=0pt]. I want zero vertical spacing after the enumeration.

MWE

\documentclass{report}
\usepackage{enumitem}
\usepackage{xparse}

%compressed lists
% usage: Now just use \compress before \begin{itemize}.
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother

 %% cmd for table generation
\newcommand{\cTable}[5] % caption - a- b - c - label
{
  \begin{table}[ht!]
    \caption{{#1}}
    \begin{tabular}{p{3.4cm} p{11cm}}
      \textbf{\raggedright -a}          & {#2}   \\
      \textbf{\raggedright -b}          & {#3}   \\
      \textbf{\raggedright -c}          & {#4}
    \end{tabular}
  \label{#5}
  \end{table}
}
%% end cmd for table generation

%% cmd for item generation
%% see https://tex.stackexchange.com/questions/317680/new-command-for-automatic-enumerate-generation
\ExplSyntaxOn%

\seq_new:N \l_local_enum_seq

\newcommand{\storethestuff}[1]{%
  \seq_set_from_clist:Nn \l_local_enum_seq {#1}%
}

\newcommand{\dotheenumstuff}{%
\int_zero:N \l_tmpa_int
\seq_map_inline:Nn \l_local_enum_seq {%
    \int_incr:N \l_tmpa_int% Increase the counter
    \item ##1
    % Check whether the list has reached the end -- if so, use '.' instead of ','
    \int_compare:nNnTF 
     { \l_tmpa_int } < {\seq_count:N \l_local_enum_seq} 
     {,} {.}
  }
}

\ExplSyntaxOff

\NewDocumentCommand{\dostuff}{+m}{%
  \storethestuff{#1}%
  \compress
  \begin{enumerate}[itemsep=0pt, topsep=0pt, parsep=0pt, partopsep=0pt, leftmargin=*]
    \dotheenumstuff%
  \end{enumerate}
}
%% end cmd for item generation

\begin{document}

\cTable
    {this is a caption}
    {value of a}
    {\dostuff{1,1,1,1,11}}
    {value of c} %value of c needs to be a list
    {tab:exampleTab}

\end{document}

Strange vertical spacing Image for strange vertical spacing in table after enumeration


EDIT

The solution provivide in A list inside a table looked way to complex to be a solution to this simple problem. Furthermore the solution in comments to use \baselineskip works perfectly and is not given as an answer in the referenced question. Therefore I would want to leave this as an extra question, since, with the answer in the comment, there is a very good solution to the problem.

  • 1
    Possible duplicate of A list inside a table – Runar Jul 4 '16 at 17:24
  • 2
    Consider adding after={\vspace{-\baselineskip}} to your list of enumerate options. – Werner Jul 4 '16 at 17:26
  • make this a answer and I accpect it - works perfectly :) – user69453 Jul 4 '16 at 17:36
  • 1
    @user69453: Sorry for the delay. Done. – Werner Jul 19 '16 at 22:52
2

You can add

after={\vspace{-\baselineskip}}

to the list of enumerate options you currently have. This should revert the empty line following the list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.