1

I need to typeset multiple tables from .csv data files in relatively complex document. I'm using pgfplotstable/longtable (resp. longtabu) combo and everithing works fine except some special (very rare in practice) circumstances: sometimes the table header is duplicated on a new page (and in addition separate top rule on previous page): enter image description here

There is MWE for this (wrong case):

\documentclass[10pt]{article}
\usepackage{filecontents}
\usepackage{pgfplotstable}
\usepackage{longtable, tabu, makecell}

\pagestyle{empty}
    \pgfplotstableset{
    col sep=semicolon,
    string type,
    trim cells,
    header=has colnames,
    skip coltypes=true,
    font={\small},
%
    after row={
    },
%
    every head row/.style={
        before row={
            \rowfont{\bfseries}
            \tabucline[1pt]{-}
        },
        after row={
            \tabucline[0.2pt]{-}
            \endhead
        }
    },
%
    every first row/.append style={
        before row={
            \tabucline[1pt]{-}
            \endfoot
        },
    },
}
%
    \begin{filecontents*}{data.csv}
date;       grade
2016-01-01; A
2016-01-15; B
2016-01-01; A
2016-01-15; B
2016-01-01; A
2016-01-15; B
\end{filecontents*}

\begin{document}

\vspace*{17.6cm}

\pgfplotstabletypeset[
    begin table=\begin{longtabu} to \textwidth {@{}|X[p]|c|@{}},
    end table=\end{longtabu},
    %   
    columns={
        date,
        grade},
    %
    columns/date/.style={
        column name={\makecell{Date\\Datum}}},
    columns/grade/.style={
        column name={\makecell{Grade\\Známka}}},
]{data.csv}

\end{document}

Any help or suggestion how to correctly define longtable header/footer or what else is wrong with my code??

Thank you very much in advance for any help or suggestion!

Best regards,

Lubos

Your Answer

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

Browse other questions tagged or ask your own question.