
여러 열 제목으로 표를 조판하고 싶습니다.오직. 내 현재 시도는 다음과 같습니다.
\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\usepackage{array}
\usepackage{colortbl}
\begin{document}
\pgfplotstabletypeset[col sep=&, header=false,
every head row/.style={
before row={%
\toprule
Facteurs & \multicolumn{5}{c}{Niveaux}\\
}},
every last row/.style={
after row=\bottomrule},
display columns/0/.style={string type}
]
{%
\pgfutilensuremath{\chi} & 8 & 11 & 14 & &
5 & 8 & 11 & 14 & 45 & 2.456
q & 8 & 11 & 14 & & 3
x & 8 & 11 & 14 & 5612345 & 4
b & 8 & 11 & 14 & & 5
}
\end{document}
이는 다음과 같은 결과를 제공합니다:
그림에서 빨간색 원으로 표시된 제목 행을 어떻게 제거합니까?
답변1
PGFPlots 버전 1.6부터(제 생각에는) output empty row
행 인쇄를 억제하는 새로운 키를 사용할 수 있게 되었습니다. 이것은 귀하의 스타일에 사용될 수 있습니다:
\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\begin{document}
\pgfplotstabletypeset[
col sep=&, header=false,
every head row/.style={
output empty row,
before row={%
\toprule
Facteurs & \multicolumn{5}{c}{Niveaux}\\
}
},
every last row/.style={
after row=\bottomrule
},
display columns/0/.style={string type}
]
{%
\pgfutilensuremath{\chi} & 8 & 11 & 14 & &
5 & 8 & 11 & 14 & 45 & 2.456
q & 8 & 11 & 14 & & 3
x & 8 & 11 & 14 & 5612345 & 4
b & 8 & 11 & 14 & & 5
}
\end{document}
이전 버전을 사용하고 있고 업데이트할 수 없거나 업데이트하고 싶지 않은 경우 약간 잔인한 해결 방법이 있습니다. 코드를 추가할 수 있습니다.
\makeatletter
\pgfplotsset{
/pgfplots/table/omit header/.style={%
/pgfplots/table/typeset cell/.append code={%
\ifnum\c@pgfplotstable@rowindex=-1
\pgfkeyslet{/pgfplots/table/@cell content}\pgfutil@empty%
\fi
}
}
}
\makeatother
스타일을 사용할 수 있도록 하는 서문에 있습니다 omit header row
. 에서 해당 키를 사용하면 \pgfplotstable
각 테이블 셀의 출력 루틴이 행 번호(헤더 행)에 있는지 확인하여 수정되며 -1
, 그렇다면 출력이 생성되지 않습니다.
\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\makeatletter
\pgfplotsset{
/pgfplots/table/omit header/.style={%
/pgfplots/table/typeset cell/.append code={%
\ifnum\c@pgfplotstable@rowindex=-1
\pgfkeyslet{/pgfplots/table/@cell content}\pgfutil@empty%
\fi
}
}
}
\makeatother
\begin{document}
\pgfplotstabletypeset[
col sep=&,
header=false,
every head row/.style={
before row={%
\toprule
Facteurs & \multicolumn{5}{c}{Niveaux}\\
}
},
every last row/.style={
after row=\bottomrule
},
display columns/0/.style={string type},
omit header
]
{%
\pgfutilensuremath{\chi} & 8 & 11 & 14 & &
5 & 8 & 11 & 14 & 45 & 2.456
q & 8 & 11 & 14 & & 3
x & 8 & 11 & 14 & 5612345 & 4
b & 8 & 11 & 14 & & 5
}
\end{document}