![像 moderncv 模板这样的部分?](https://linux22.com/image/332887/%E5%83%8F%20moderncv%20%E6%A8%A1%E6%9D%BF%E8%BF%99%E6%A0%B7%E7%9A%84%E9%83%A8%E5%88%86%EF%BC%9F.png)
答案1
我在现代简历来源
\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}
它创建了框。该部分的完整定义是
\RenewDocumentCommand{\section}{sm}{%
\par\addvspace{2.5ex}%
\phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{section}{#2}%
\cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}%
\par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
您只需替换 cvitem 和所有变量。
编辑(这包括所有必要的长度,您必须自己插入颜色):
\usepackage{xparse}
\makeatletter
\newlength{\hintscolumnwidth} \setlength{\hintscolumnwidth}{0.175\textwidth}
\newlength{\baseletterheight} \settoheight{\baseletterheight}{o}
\newlength{\separatorcolumnwidth} \setlength{\separatorcolumnwidth}{0.025\textwidth}
% fonts
\newcommand*{\sectionfont}{\Large\mdseries\upshape}
% styles
\newcommand*{\sectionstyle}[1]{{\sectionfont{#1}}}
\RenewDocumentCommand{\section}{sm}{%
\par\addvspace{2.5ex}%
\addcontentsline{toc}{section}{#2}%
{\strut\raggedleft\raisebox{\baseletterheight}{\rule{\hintscolumnwidth}{0.95ex}}}\hspace*{\separatorcolumnwidth}{\strut\sectionstyle{#2}}%
\par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother