考虑以下 MWE,我希望跨越/组合multicolumn
中的列数。pgfplotstable
longtable
\multicolumn{\pgfplotstablecols}{r}{{\small\tablename\ \thetable{} -- will continue.}}
根据提供的文件,列数应为四,.csv
但multicolumn
除非我输入,否则无法正确跨越
\multicolumn{6}{r}{{\small\tablename\ \thetable{} -- will continue.}}
这是输出,显然没有右对齐跨越所有列。我做错了什么?
\documentclass[a5paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{pgfplotstable,booktabs,longtable}
\usepackage{siunitx,filecontents}
\pgfplotsset{compat=newest,
/pgf/number format/.cd,
use comma,}
\pgfplotstableset{
begin table=\begin{longtable},
end table=\end{longtable},
}
\sisetup{exponent-product = {\cdot},output-decimal-marker={,}, per-mode=symbol}
\begin{filecontents}{table.csv}
Period; M1; M2; M3
a; 9,4; 1706; 1706
b; 9,2; 1135; 2841
c; 9,4; 1319; 4160
d; 9,4; 1525; 5685
e; 9,2; 1367; 7052
f; 9,5; 1261; 8313
g; 9,3; 1814; 10127
h; 9,2; 1450; 1157
a; 9,4; 1706; 1706
b; 9,2; 1135; 2841
c; 9,4; 1319; 4160
d; 9,4; 1525; 5685
e; 9,2; 1367; 7052
f; 9,5; 1261; 8313
g; 9,3; 1814; 10127
h; 9,2; 1450; 1157
a; 9,4; 1706; 1706
b; 9,2; 1135; 2841
c; 9,4; 1319; 4160
d; 9,4; 1525; 5685
e; 9,2; 1367; 7052
f; 9,5; 1261; 8313
g; 9,3; 1814; 10127
h; 9,2; 1450; 1157
a; 9,4; 1706; 1706
b; 9,2; 1135; 2841
c; 9,4; 1319; 4160
d; 9,4; 1525; 5685
e; 9,2; 1367; 7052
f; 9,5; 1261; 8313
g; 9,3; 1814; 10127
h; 9,2; 1450; 11577
\end{filecontents}
\begin{document}
{\centering
\pgfplotstabletypeset[%
col sep=semicolon,
read comma as period=true,
header=true,
every head row/.style={
before row={%
\caption{Some caption}%
\label{tab:sometable}\tabularnewline\toprule%
}, % before row
after row={\midrule\endhead\midrule\multicolumn{\pgfplotstablecols}{r}{{\small\tablename\ \thetable{} -- will continue.}}\endfoot
\bottomrule\endlastfoot%
}, % after row
}, % every head row
display columns/0/.style={column type={l},string type},
display columns/1/.style={string type, column type={S[table-format=2.2, add-decimal-zero=true]}},
display columns/2/.style={sci,sci zerofill,sci sep align,},
display columns/3/.style={sci,sci zerofill,sci sep align,},
]{table.csv}\par
}
\end{document}