答案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