Modern CV自定义线条需求:将灰色线条宽度调整至与页边距一致并在其上方添加章节
解决Modern CV的两个定制需求
需求1:调整灰色线条宽度与文档页边距一致
默认的casual风格中,标题下方的灰色线条宽度是固定值,没有适配文档的正文宽度(也就是页边距内的有效宽度)。我们可以通过重新定义\makecvtitle命令里的线条生成逻辑,把线条宽度设置为\textwidth,让它和页边距完全对齐。
需求2:在灰色线条上方插入章节
要在标题和灰色线条之间插入章节,我们需要修改\makecvtitle的结构,在输出线条之前添加自定义的章节内容。这里直接用\section命令插入即可,也可以根据需求选择无编号的章节格式。
修改后的完整LaTeX代码
\documentclass[11pt,a4paper,sans]{moderncv} \moderncvstyle{casual} \moderncvcolor{grey} \usepackage[USenglish]{babel} \usepackage{lipsum} \usepackage[scale=0.75]{geometry} % 重新定义makecvtitle,同时实现两个定制需求 \renewcommand*{\makecvtitle}{ % 保留原标题的姓名、联系方式等核心内容 \makecvhead % 需求2:在灰色线条上方插入自定义章节(这里示例为职业概述) \section{Professional Summary} \cvitem{}{A results-driven finance professional with expertise in risk analysis and derivatives trading, seeking to leverage analytical skills in a dynamic financial environment.} % 需求1:调整灰色线条宽度为textwidth(与页边距完全匹配) \par\noindent\rule{\textwidth}{0.4pt}\par\vspace{2ex} % 保留原标题的引用语模块(如果启用的话) \ifthenelse{\isundefined{\@quote}}% {}% {{\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\par\vspace{2ex}}}% } %---------------------------------------------------------------------------------------- % 姓名与联系信息部分 %---------------------------------------------------------------------------------------- \firstname{Name} \familyname{LastName} \title{Curriculum Vitae} \address{123 Broadway}{City, State 12345} \mobile{(000) 111 1111} \phone{(000) 111 1112} \fax{(000) 111 1113} \email{john@smith.com} \extrainfo{additional information} %\photo[70pt][0.4pt]{pictures/picture} %\quote{"A witty and playful quotation" - John Smith} %---------------------------------------------------------------------------------------- \begin{document} \makecvtitle %---------------------------------------------------------------------------------------- % 教育背景部分 %---------------------------------------------------------------------------------------- \section{Education} \cventry{2011--2012}{Masters of Commerce}{The University of California}{Berkeley}{\textit{GPA -- 8.0}}{First Class Honours} \cventry{2007--2010}{Bachelor of Business Studies}{The University of California}{Berkeley}{\textit{GPA -- 7.5}}{Specialized in Commerce} \section{Masters Thesis} \cvitem{Title}{\emph{Money Is The Root Of All Evil -- Or Is It?}} \cvitem{Supervisors}{Professor James Smith & Associate Professor Jane Smith} \cvitem{Description}{This thesis explored the idea that money has been the cause of untold anguish and suffering in the world. I found that it has, in fact, not.} %---------------------------------------------------------------------------------------- % 工作经历部分 %---------------------------------------------------------------------------------------- \section{Experience} \subsection{Vocational} \cventry{2012--Present}{1\textsuperscript{st} Year Analyst}{\textsc{Lehman Brothers}}{Los Angeles}{}{Developed spreadsheets for risk analysis on exotic derivatives on a wide array of commodities (ags, oils, precious and base metals), managed blotter and secondary trades on structured notes, liaised with Middle Office, Sales and Structuring for bookkeeping. \\newline{}\\newline{} Detailed achievements: \begin{itemize} \item Learned how to make amazing coffee \item Finally determined the reason for \textsc{PC LOAD LETTER}: \begin{itemize} \item Paper jam \item Software issues: \begin{itemize} \item Word not sending the correct data to printer \item Windows trying to print in letter format \end{itemize} \item Coffee spilled inside printer \end{itemize} \item Broke the office record for number of kitten pictures in cubicle \end{itemize}} \cventry{2011--2012}{Summer Intern}{\textsc{Lehman Brothers}}{Los Angeles}{}{Rated "truly distinctive" for Analytical Skills and Teamwork.} \end{document}
关键修改说明
线条宽度适配:
用\rule{\textwidth}{0.4pt}替换了原命令中固定宽度的线条,\textwidth代表文档正文的有效宽度(即页边距以内的区域),确保线条完全贴合页边距。章节插入位置:
在重新定义的\makecvtitle中,我们在输出灰色线条之前添加了\section{Professional Summary}及对应内容,让这个章节恰好出现在标题和线条之间。如果不需要章节编号,可以改用\section*{Professional Summary}生成无编号章节。
内容的提问来源于stack exchange,提问作者symkly
相关产品推荐
相关产品推荐

