我想将我的语言技能添加到我的简历中。我使用moderncv
文档类来塑造我的简历。我尝试为这些添加表格,但结果输出不是统一的表格。有什么方法可以根据我的喜好调整我的表格吗?提前谢谢
可重现的代码
\documentclass{moderncv}
\moderncvtheme{classic}
\usepackage{booktabs}
\firstname{John}
\lastname{Doe}
\setlength\tabcolsep{6pt}
\begin{document}
\makecvtitle
\section{Test Score}
\cvitemwithcomment{\textit{GRE}}{%
\centering
\begin{tabular}{*{5}{c}}
\toprule
\multicolumn{2}{c}{Verbal Reasoning} & \multicolumn{2}{c}{Quantitative Reasoning} & Analytical Writing \\ \midrule
& xxx (xx\%) & xxx (xx\%) & & xx (xx\%) & \\ \bottomrule
\end{tabular}%
}{}
\cvitemwithcomment{TOEFL iBT}{%
\centering
\begin{tabular}{*{5}{c}}
\toprule
Reading & Listening & Speaking & Writing \\ \midrule
\\ xx & xx & xx & xx \\ \bottomrule
\end{tabular}%
}{}
\end{document}
预期输出
这是我使用moderncv
文档类的预期表格:
更新
最好将数字与相应文本居中。此外,还希望减少垂直和水平行距并保持几何对齐。有什么想法吗?
答案1
以下是使用 tabularx 的示例:
\documentclass{moderncv}
\moderncvtheme{classic}
\usepackage{booktabs}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\firstname{John}
\lastname{Doe}
\setlength\tabcolsep{6pt}
\begin{document}
\makecvtitle
\section{Test Score}
\cvitemwithcomment{\textit{GRE}}{%
\centering
\begin{tabularx}{\textwidth-\hintscolumnwidth-\separatorcolumnwidth}{YYY}
\toprule
Verbal Reasoning & Quantitative Reasoning & Analytical Writing \\ \midrule
xxx (xx\%) & xxx (xx\%) & xx (xx\%) \\ \bottomrule
\end{tabularx}%
}{}
\cvitemwithcomment{TOEFL iBT}{%
\centering
\begin{tabularx}{\textwidth-\hintscolumnwidth-\separatorcolumnwidth}{YYYY}
\toprule
Reading & Listening & Speaking & Writing \\ \midrule
xx & xx & xx & xx \\ \bottomrule
\end{tabularx}%
}{}
\end{document}
为了实现水平和垂直居中的内容,您还可以使用以下命令:
\documentclass{moderncv}
\moderncvtheme{classic}
\usepackage{booktabs}
\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{>{\centering\arraybackslash}m{#1}}
\firstname{John}
\lastname{Doe}
\setlength\tabcolsep{6pt}
\begin{document}
\makecvtitle
\section{Test Score}
\cvitemwithcomment{\textit{GRE}}{%
\centering
\begin{tabularx}{\textwidth-\hintscolumnwidth-\separatorcolumnwidth}{XXX}
\toprule
Verbal Reasoning & Quantitative Reasoning & Analytical Writing \\ \midrule
xxx (xx\%) & xxx (xx\%) & xx (xx\%) \\ \bottomrule
\end{tabularx}%
}{}
\cvitemwithcomment{TOEFL iBT}{%
\centering
\begin{tabularx}{\textwidth-\hintscolumnwidth-\separatorcolumnwidth}{XXXX}
\toprule
Reading & Listening & Speaking & Writing \\ \midrule
xx & xx & xx & xx \\ \bottomrule
\end{tabularx}%
}{}
\end{document}