I would like to insert a cmidrule when I have an empty line in a table produced by the datatool package and also use \bottomrule. Both of these yield excess vertical space above the line:
How do I eliminate these two instances of excess vertical space?
Code:
\documentclass{article}
\usepackage{datatool}
\usepackage{booktabs}
\usepackage{filecontents}
\begin{filecontents}{foo.dat}
Line1, AAAA
Line2, BBBB
,
Line4, DDDD
Line5, EEEE
\end{filecontents}
\newcommand{\PrintDTLTable}[1]{%
% #1 = database to search
\begin{tabular}{c c}\toprule
Label & Cost \\cmidrule{1-2}
\DTLforeach{#1}{%
\RowID=RowID,%
\Label=Label%
}{%
\DTLifnullorempty{\RowID}{%
\%[-\baselineskip]
%\vspace*{-\baselineskip}%
\cmidrule(lr){1-2}%
}{%
\RowID & \Label \
}%
}%
\\bottomrule
\end{tabular}
}%
\begin{document}
\DTLloaddb[noheader,keys={RowID,Label}]{myDB}{foo.dat}
\PrintDTLTable{myDB}
\end{document}




\\\in the actual data (I cut and used the code from another answer). Have corrected the question. BUT, I don't think it is a good idea to edit the data for formatting related issues. – Peter Grill Aug 09 '18 at 23:09