0

I'm generating tables from csv that have very specific formatting requirements in terms of captions and spacing. A few of these tables extend across multiple pages, for which I'm using csvautolongbook from the csvsimple package. One requirement I'm having trouble with is that rows must be single spaced, yet my code is adding extra vertical space between rows. Likewise, there shouldn't be vertical space between the caption and the table

\csvautobooklongtable[
  table head={
    \caption[Sampling effort and results.]{Sampling effort and results.}\\
    \hline
    \csvlinetotablerow\\
    \hline
    \endfirsthead
    \caption[]{Continued.}\\\hline
    \csvlinetotablerow\\
    \hline
    \endhead\hline
    \endfoot
    \label{tab:sample_results}
  }, respect all]{tables/sample_results.csv}

Most of what's here is related to the caption requirements. How do I remove the extra vertical space following the caption and between the table rows?

1

Since your MWE is not complete (please see here), I don't know if this solution fits your needs.

However, you could use \LTcapskip from ltcaption package to set the skip between the caption and the contents below the caption as you like.

\documentclass{article}
\usepackage{csvsimple}
\usepackage{longtable}
\usepackage{array}
\renewcommand*{\arraystretch}{1.2}
\usepackage{ltcaption}
\setlength\LTcapskip{4pt}

\usepackage{filecontents}
\begin{filecontents*}{sample_results.csv}
    No.,Name,Effort, Result
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31
    1,pippo,123, 10
    2,pluto,456, 24
    3,paperino,789, 31  
\end{filecontents*}

\begin{document}
\csvautobooklongtable[
    table head={
        \caption[Sampling effort and results.]{Sampling effort and results.}\\
        \hline
        \csvlinetotablerow\\
        \hline
        \endfirsthead
        \caption[]{Continued.}\\\hline
        \csvlinetotablerow\\
        \hline
        \endhead\hline
        \endfoot
        \label{tab:sample_results}
    }, respect all]{sample_results.csv}
\end{document}

enter image description here

enter image description here

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.