我正在努力尝试垂直对齐标题行,有人能指出我做错了什么吗?
\documentclass{article}
\usepackage{tikz}
\usepackage{tabu}
\usepackage{multirow}
\usepackage[T1]{fontenc}
\usepackage{droidserif}
\usepackage{sourcesanspro}
\begin{document}
\centering \begin{tabu}{ | X[3,m] *4{|X[1,m]} | }
\hline
\rowfont{\fontfamily{fdr}\fontseries{b}\selectfont}
& \multicolumn{4}{c|}{Multi Column Header} \\ \cline{2-5}
\rowfont{\fontfamily{fdr}\fontseries{b}\selectfont}
& \multicolumn{4}{c|}{\small headers not vertically aligned } \\ \cline{2-5}
\rowfont[c]{\fontfamily{fdr}\fontseries{b}\selectfont}
\multirow{-3}{*}{Multi-Row} & \small 1-25 & \small 26-100 & \small 101-500 & 501 \\
\hline
\rowfont{\fontfamily{fdm}\selectfont\small}
Something here &
\multicolumn{1}{r|}{11111} &
\multicolumn{1}{r|}{22222} &
\multicolumn{1}{r|}{22222} &
\multicolumn{1}{r|}{22222} \\
\hline
\end{tabu}
\end{document}
答案1
我去掉了多余的分隔符,用array
包定义了一些自定义名称的列,tabular
代替tabu
和booktabs
用于花哨的规则。我认为这就是你想要的
\documentclass{article}
\usepackage{tikz}
\usepackage{array,booktabs,multirow}
\newcolumntype{C}{>{\fontfamily{fdr}\fontseries{b}\selectfont}c}
\newcolumntype{T}{>{\fontfamily{fdm}\selectfont\small}c}
\newcolumntype{P}{>{\fontfamily{fdm}\selectfont\small}p{3cm}}
\usepackage[T1]{fontenc}
\usepackage{droidserif}
\usepackage{sourcesanspro}
\begin{document}
\begin{table}
\centering
\begin{tabular} {PTTTT}
\toprule
\multirow{3}{*}{\fontfamily{fdr}\fontseries{b}\selectfont Multi-Row}&\multicolumn{4}{C}{Multi Column Header}\\
&\multicolumn{4}{C}{\small headers not vertically centered}\\
&\multicolumn{1}{C}{1--25}&\multicolumn{1}{C}{26--100}&\multicolumn{1}{C}{101--500}&\multicolumn{1}{C}{501}\\
\midrule
Something here & 11111&22222&22222&22222\\
\bottomrule
\end{tabular}
\end{table}
\end{document}