longtable with pgfplotstable - adding predefined rows and breaking manually
up vote
3
down vote
favorite
Based on this link pgfplotstable; longtable with caption and repeating header
I wrote this 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={%
ifnumpgfplotstablerow=-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}
But the result is:
Is possible to break line arbitrarily?
How can I improve the code to obtain something like this:
longtable pgfplotstable
add a comment |
up vote
3
down vote
favorite
Based on this link pgfplotstable; longtable with caption and repeating header
I wrote this 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={%
ifnumpgfplotstablerow=-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}
But the result is:
Is possible to break line arbitrarily?
How can I improve the code to obtain something like this:
longtable pgfplotstable
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Based on this link pgfplotstable; longtable with caption and repeating header
I wrote this 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={%
ifnumpgfplotstablerow=-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}
But the result is:
Is possible to break line arbitrarily?
How can I improve the code to obtain something like this:
longtable pgfplotstable
Based on this link pgfplotstable; longtable with caption and repeating header
I wrote this 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={%
ifnumpgfplotstablerow=-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}
But the result is:
Is possible to break line arbitrarily?
How can I improve the code to obtain something like this:
longtable pgfplotstable
longtable pgfplotstable
edited Nov 22 at 19:07
asked Apr 1 '16 at 19:01
leonardo cesar
320314
320314
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f302015%2flongtable-with-pgfplotstable-adding-predefined-rows-and-breaking-manually%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown