longtable 与 pgfplotstable - 添加预定义行并手动中断

longtable 与 pgfplotstable - 添加预定义行并手动中断

基于此链接pgfplotstable;带有标题和重复标题的长表

我写了这个MWE:

\documentclass{article}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{pgfplotstable}
%%% Code from Dr. Christian ------ for not using headers.----------------------
\pgfkeysifdefined{/pgfplots/table/output empty row/.@cmd}{
    % upcoming releases offer this more convenient option:
    \pgfplotstableset{
        empty header/.style={
          every head row/.style={output empty row},
        }
    }
}{
    % versions up to and including 1.5.1 need this:
    \pgfplotstableset{
        empty header/.style={
            typeset cell/.append code={%
                \ifnum\pgfplotstablerow=-1 %
                    \pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
                \fi
            }
        }
    }
}
%%%-----------------------------------------------
\begin{document}


\pgfplotstabletypeset[
    empty header, 
    begin table=\begin{longtable},
    end table=\end{longtable},
    col sep=semicolon, % space|tab|comma|semicolon|colon|braces|&|ampersand 
    /pgf/number format/precision=0, % precision
    /pgf/number format/fixed, % format number
    /pgf/number format/fixed zerofill,
    /pgf/number format/set decimal separator = {,}, %decimal separator
    /pgf/number format/1000 sep = {.},
% % % % % % % % % % % % % % % % % % % % % % 
    every first row/.append style={
%       output empty row,   
        before row={%
        \caption{Population forecasting - Santo Antonio}%
        \label{tab:projpopagua}\\
        \toprule
        \multirow{2}{*}{\bfseries Year} & \multicolumn{4}{c}{\bf Methods}\\\cmidrule{2-5}
%   
                &
                \multicolumn{1}{p{2.0cm}}{\bf Arithmetic} &
                \multicolumn{1}{p{2.0cm}}{\bf Geometric} &              
                \multicolumn{1}{p{2.0cm}}{\bf Decreasing rate} &    
                \multicolumn{1}{p{2.5cm}}{\bf Logistic growth} \\
        \midrule
%   
        \endfirsthead
%
        \caption{Population forecasting - Santo Antonio}\\
%
        \toprule
        \multirow{2}{*}{\bfseries Year} & \multicolumn{4}{c}{\bf Methods}\\\cmidrule{2-5}
%       
        &
                \multicolumn{1}{p{2.0cm}}{\bf Arithmetic} &
                \multicolumn{1}{p{2.0cm}}{\bf Geometric} &              
                \multicolumn{1}{p{2.0cm}}{\bf Decreasing rate} &    
                \multicolumn{1}{p{2.5cm}}{\bf Logistic growth} \\
        \midrule
%
        \endhead
%
        \midrule
        \multicolumn{5}{r}{\textit{Continued on next page}} \\ \bottomrule
        \endfoot
%
        \bottomrule
        \endlastfoot
    }},
%   every last row/.append style = {after row={%
%   %
%   }}},
% % % % % % % % % % % % % % % % 
    every row no  0/.style = {before row = \bf Immediate future\\\cmidrule{1-1}},
    every row no  3/.style = {before row = \bf Short term\\\cmidrule{1-1}},
    every row no  8/.style = {before row = \bf Mid-term\\\cmidrule{1-1}},
    every row no 12/.style = {before row = \bf Long term\\\cmidrule{1-1}},
% % % % % % % % % % % % % % % % % %% % % % % % % % % % % % % % % % % % % % % %
    display columns/1/.style={fixed},
    display columns/2/.style={fixed},
    display columns/3/.style={fixed},
    display columns/4/.style={fixed},
    display columns/5/.style={fixed},
]%
{%
2016;44030;44126;45049;45307
2017;44250;44367;45507;45842
2018;44471;44610;45986;46414
2019;44691;44853;46489;47025
2020;44912;45098;47015;47678
2021;45132;45345;47566;48379
2022;45352;45592;48144;49131
2023;45573;45842;48749;49940
2024;45793;46092;49382;50812
2025;46014;46344;50046;51753
2026;46234;46597;50741;52772
2027;46455;46852;51470;53876
2028;46675;47107;52233;55077
2029;46896;47365;53032;56387
2030;47116;47624;53869;57820
2031;47336;47884;54747;59391
2032;47557;48145;55665;61123
2033;47777;48408;56628;63037
2034;47998;48673;57636;65163
2035;48218;48939;58692;67537
2036;48439;49206;59799;70201
}
\end{document}

但结果是:

在此处输入图片描述

可以任意断线吗?

我怎样才能改进代码来获得如下效果:

在此处输入图片描述

相关内容