多列多标题
我目前正在创建一个包含多个标题的表格,这些标题跨越多个列。我询问了第一个标题这里,并处理了第一个,但我不确定如何分解其他标题。
我想要一个关于如何以不同的布局呈现这些标题的通用解决方案/解释。
我已附加一个 html 示例,我用于渲染的源代码在这里:
\documentclass[10pt]{article}
\usepackage[letterpaper, inner=18mm, outer=18mm, top=25mm, bottom=25mm]{geometry}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{pgfplotstable}
\begin{filecontents*}{datafile.csv}
a, b, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
a, b, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
a, b, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
\end{filecontents*}
\usepackage{lipsum} % for a very long title
\begin{document}
\begin{table}[!htp]
\centering
\pgfplotstabletypeset[
col sep=comma,
string type,
column type=,
begin table={
\begin{tabularx}{\textwidth}{*{14}{X}}
},
end table={\end{tabularx}},
every head row/.style={
before row={%
\multicolumn{14}{@{}c@{}}{%
\colorbox{black}{%
\parbox{\dimexpr\textwidth-2\fboxsep}{%
\textcolor{white}{This header belongs to the entire table}%
}%
}%
}\\
\multicolumn{14}{@{}c@{}}{%
\colorbox{gray}{%
\parbox{\dimexpr\textwidth-2\fboxsep}{%
\textcolor{white}{This belongs to the letters. header1 header2 header3}%
}%
}%
}\\
},
},
every even row/.style={before row = {\rowcolor[gray]{0.9}}},
font=\footnotesize
]{datafile.csv}
\end{table}
\end{document}