如何管理简历的自定义标题样式?

如何管理简历的自定义标题样式?

我特别欣赏在线简历中使用的一种标题风格(见下图),我正在尝试在我的 LaTeX 简历中重现它。 在此处输入图片描述

以下是我的 MWE(这是我的第一页简历的实际版本)。编译器:XeLaTeX。

\documentclass[11 pt,oneside,a4paper,titlepage]{article}

%%% PREAMBLE (start) %%%
% Info
\title{My CV}
\usepackage[most]{tcolorbox}
\usepackage{geometry}
\geometry{
    a4paper,
    left=0.1cm,  % left=0.1cm
    right=0.6cm, % right=0.6cm
    top=0.5cm,   % top=0.1cm
    bottom=1.2cm, % bottom=0.1cm
    includefoot,
    headheight=2.5cm, % needed to avoid warnings with fancyhdr package
    showframe=false
}

\usepackage{lipsum} % dummy text
\usepackage{adjustbox} % to a better alignement of text

% Headers and footers
\usepackage{fancyhdr}
%\setlength{\headheight}{12.6pt}
\usepackage{lastpage}

% Fonts
\usepackage[TU]{fontenc}
\usepackage{fourier-otf}
\usepackage{xspace}
\usepackage{microtype} %it helps to fit text inside margins)
\usepackage[en-AU]{datetime2}
\usepackage{csquotes}

% Tables
\usepackage{multirow}

% to have awesome icon 
\usepackage{fontawesome5} 
\usepackage{academicons}

% advanced drawing
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{smartdiagram}
\usepackage{float}
\usepackage{array}
\usetikzlibrary{decorations.text}
\usetikzlibrary{fadings}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.misc,positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{backgrounds} 
\usetikzlibrary{shadings}
\usetikzlibrary{calendar} 
\usetikzlibrary{er}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes} 
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{decorations}
\usetikzlibrary{topaths}
\usepackage{graphicx}

% set TikZ styles
\tikzset{
  contactIcon/.style={%
    minimum height=\baselineskip,
  }
}

% pictures
\usepackage{graphicx}
% loads graphicx, provides align=c option for vertical alignment w.r.t. text
\RequirePackage{graphbox}

\newcommand{\roundpic}[1]{\begin{figure}[H]\tikz  \draw [path picture={ \node at (path picture bounding box.center){\includegraphics[height=3cm]{#1}} ;}] (0,2) circle (1.7) ;\end{figure}}

% more advanced expressions in \setlength
\usepackage{calc}

% Define Colors
\RequirePackage{xcolor}
\definecolor{titleBackColor}{RGB}{25,20,60} 
\definecolor{sideBarColor}{rgb}{0.6,0.6,0.6}
\definecolor{mydarkblue}{rgb}{0.07,0.08,0.4}
\definecolor{myblue}{rgb}{.4,.4,1}
\definecolor{myyellow}{RGB}{245,169,34}

% Lists
\usepackage{enumitem}
\setlist{leftmargin=*,nosep}

% Define Lengths
\newlength\cvPictureWidth    \setlength\cvPictureWidth{4cm}
\newlength\SidebarTextWidth  \setlength\SidebarTextWidth{7cm}
\newlength\leftSideSecWidth  \setlength\leftSideSecWidth{2cm}
\newlength\rightSideSecWidth \setlength\rightSideSecWidth{9cm}
\newlength\SecVertSpace      \setlength\SecVertSpace{0.4cm}

% avoid line overflow
% \setlength{\emergencystretch}{2pt}

% CV tag for skills
\newcommand{\cvtag}[1]{%
  \tikz[baseline]\node[anchor=base,draw=black!30,rounded corners,inner xsep=1ex,inner ysep =0.75ex,text height=1.5ex,text depth=.25ex]{\footnotesize #1};
}

% top box with simple header
\newcommand{\simpleheader}[5]{
\tikz[remember picture,overlay] {%
\node[rectangle, fill=#1, anchor=north, minimum width=\paperwidth, minimum height=3.3cm] (header) at (current page.north){};% height=3.5cm
\node[draw=none, align=left](name) at (header) {%
{\Huge \color{#5} \MakeUppercase{#2} \MakeUppercase{#3} }%\textbf{#3}
};%
\node[draw=none, below](description) at (name.south) {\color{white}#4};% 
}\vspace{-0.7cm} %\vspace{-0.7cm}
}

% SideBar
\newcommand{\sidebar}[1]{
\tikz[remember picture,overlay] {%
\node[rectangle, fill=#1, anchor=north west, minimum width=8.3cm, minimum height=\textheight](header) at (current page.north west){};%
}
} 

% Flag for Languages section and for all small personal icons
\newcommand{\flag}[1]{\includegraphics[align=c, width=1em]{#1}}
\newcommand{\TitleIcon}[1]{\includegraphics[align=c, scale=0.05]{#1}}

% Command for section title
\newcommand{\MySectionTitle}[3]{% inputs: #1: icon, #2: title
\begin{tikzpicture}[remember picture,overlay]   
       % \draw [help lines] (0,0) grid (5,-2);    
        \node[font = {\Large},circle,fill=myyellow, minimum size = 1cm] (c) at (0.5,-1){\color{titleBackColor} #1};
        
        \draw[myyellow, ultra thick] (c.0) -- (\textwidth,-1); % draw of horizontal line
        
        \node at (4.0,-.66) {\bf \Large \raggedright \color{titleBackColor}\MakeUppercase{#2}}; % original: \node at (4.8,-.66)
\end{tikzpicture}
\vspace{1.6cm} 

}


% Command for Education and Works
\newcommand{\MySection}[7]{ % input: years, logo, title, university, city, specialization, description
    \adjustbox{valign=t}{\begin{minipage}{\leftSideSecWidth}
        \begin{flushleft} %original alignment:center
            {\small #1} \\ %years
            \vspace*{0.1cm}
            \includegraphics[width=1.2cm]{#2} %logo
        \end{flushleft}
    \end{minipage}}
    \hspace{0.1cm} \hfill %\vline %\hfill
    \adjustbox{valign=t}{\begin{minipage}{\rightSideSecWidth} %9cm
        {\normalsize\bfseries #3} %title
        \hfill {\footnotesize \faMapMarker  ~ #5} % city
        \newline
        {\small\bfseries \textsc{#4}} %university
        \newline 
        \small {\emph{#6}} %specialization
        %\newline %originally not commented
        \footnotesize {#7} %description
    \end{minipage}}
}

% % ITC section (customized)
% \newcommand{\ITCskill}[4]{\raisebox{-0.7\height}{\includegraphics[height=0.6cm]{#1}} & \footnotesize \textbf{#2}\newline{\footnotesize #3}\vspace{0.5em} &\multirow{2}*{\footnotesize #4}} %height=0.5cm


% Format of the title section in the side column
% based on https://tex.stackexchange.com/questions/65731
\makeatletter
\def\cv@hrulefill{{\color{titleBackColor}\leavevmode\leaders\hrule height 1pt\hfill\kern\z@}}
% line before and after text (some tweaking is required here)
% based on https://tex.stackexchange.com/questions/15119
\NewDocumentCommand{\ruleline}{m}{\par\noindent\raisebox{\baselineskip/4}{\makebox[\linewidth]{\cv@hrulefill\hspace{1ex}\raisebox{-\baselineskip/4}{\large #1}\hspace{1ex}\cv@hrulefill}}\vspace*{0.05cm}}
\makeatother

\usepackage{titlesec} % Allows creating custom \sections

% Format of the section titles
\titleformat{\section}{
\bf \Large\raggedright}{}{0em}{}[\titlerule] % smallcaps, Large, continuous line - looks better if two columns, might look a bit too dramatic if just one ;) 
\titlespacing{\section}{0pt}{12pt}{5pt} % Spacing around titles {<left spacing>}{<before spacing>}{<after spacing>}

% Multiple Column Package
\usepackage{multicol}

%%% PREAMBLE (end) %%%

% DOCUMENT
\begin{document}

%%% Footer
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0.4pt}
\fancyfoot[C]{\small \textcolor{black}{\footnotesize I hereby authorize the processing of the personal data contained in this CV in compliance with the European Regulation (UE) 2016/679.\\
\small  \textcolor{black}{Page \thepage \hspace{1pt} of  \pageref{LastPage}}}}

% Side bar
\sidebar{sideBarColor!25}
\simpleheader{titleBackColor}{Name}{Surname}{xxxxxxxx Engineer \hspace{0.1cm} \TitleIcon{example-image-c}}{white}

% Left-side page
\vspace*{3.0cm}
\adjustbox{valign=t}{\begin{minipage}{7cm}
 %Picture
    \begin{center}
    \begin{tikzpicture}
        \node[
        circle,
        minimum size=\cvPictureWidth,
        path picture={
        \node at (path picture bounding box.center){
         \includegraphics[width=\cvPictureWidth]{example-image-b}
         };
         }]
        {};
    \end{tikzpicture}
    \end{center}
\section*{Side bar}
     \lipsum[1-2]                  
\end{minipage}} %
\hfill 
% Right-side page
\adjustbox{valign=t}{\begin{minipage}{11.6cm} %11.3cm
    \vspace*{1cm}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % Work Experience
    \MySectionTitle{\faSuitcase}{Work Experience}
        
    \MySection{Feb.--Mar. 20XX}{example-image-a}{Role}{University name}{Rome, ITA}{Aerospace Engineering}{\newline \lipsum[2]}
     
    \vspace*{\SecVertSpace} 
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %\section*{\color{titleBackColor}{{\faGraduationCap} EDUCATION}} %OLD Style
    \MySectionTitle{\faGraduationCap}{Education}

    \MySection{20XX--20XX}{example-image-a}{Master's Degree}{University of}{Rome, Italy}{Aerospace Engineering}{\begin{itemize}
        \item Thesis title
        \item Graduation grade: \textbf{XXX/110}
    \end{itemize}   
    }
        
    \vspace*{0.22cm}
        
    \MySection{20XX--20XX}{example-image-b}{Bachelor's Degree}{University of Rome}{Rome, Italy}{Aerospace Engineering}{
    \begin{itemize}
        \item Final report title
        \item Graduation grade: \textbf{XXX/110}
    \end{itemize}
    }
    
    \vspace*{0.22cm}

    \MySection{20XX--20XX}{example-image-c}{High School Diploma}{School name}{Rome}{school type}{
    \begin{itemize}
        \item Diploma grade: \textbf{XXX/100} 
    \end{itemize} 
    }
    
    \vspace*{\SecVertSpace}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \MySectionTitle{\faBook}{Academic Projects}

    \begin{itemize}
        \footnotesize
         \item \lipsum[2]
         \item \lipsum[2]
    \end{itemize}
                
\end{minipage}} %
 
\end{document}

下图显示了结果。 在此处输入图片描述

您能帮我解决以下几点吗?我需要:

  1. 将章节标题与下面的文本对齐(参见前两个红色部分);
  2. 确保所有部分标题相对于图标的距离相同(我的情况是,根据标题长度,我得到了错误的对齐)

Ps:此简历模板是 Overleaf 网站上免费模板的定制版本:简历模板

答案1

请按照评论中所述改进你的问题


第二篇帖子:

考虑到您在评论中提到的意见,您的代码中有许多地方需要改进。让我们从后往前看。

您可能想要的是文档内容中更清晰的代码,如下所示:

  • 你可以通过“图标”
  • 将所有信息逐个参数地放入
    \qualif{\faSuitcase}
            {work experiences}
            {Feb.--Mar. 2021}
            {Visiting Researcher}
            {Sapienza University}
            {Rome, ITALY}
            {Space Engineering}
            {\lipsum[4]}
    
    \qualif{\faUniversity}
            {education}
            {Apr.--Dec. 2020}{Student}
            {Florence University}
            {Florence, ITALY}
            {Space Engineering}
            {\lipsum[3]}

那么,如何\qualif定义?它基本上调用你的绘图和你的\MySection。但是,正如你所看到的,你需要%在每行末尾输入一个右键,即没有其他空格,以避免在 Latex 扩展宏时插入不需要的空格。

但是,正如所指出的,删除一个特定的空行时,布局将会中断。试一试。

定位保存文本的节点有点棘手。您需要:

  • 指定text width(你可能需要超过 5 厘米)
  • 作出任何有效align声明tikz
  • 所以你最终可以水平调整节点/文本
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% let's move all formatting for qualitfications here
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\newcommand\qualif[8]{% max 9 parameters !
    \begin{tikzpicture}[remember picture,overlay]% '%' are vital in macros! (dangling space issues)
        \draw [help lines] (0,0) grid (5,-2);%    

        \node[font = {\Large},circle,fill=orange, minimum size = 1cm]%
            (c) at (0.5,-1){#1};% <<< NEW   
        \draw[orange, thick] (c.0) -- (\textwidth,-1); % <<< NEW (Q3)
        \node at (5.15,-.8) [align=left,text width=5cm]  {\MakeUppercase{#2}};%\MakeUppercase{#2}};% <<< (Q2) almost    
    \end{tikzpicture}%
%       
    \vspace{1.5cm}% !!! the next empty line is needed: else the layout breaks

    \MySection{#3}{}{#4}{#5}{#6}{#7}{\newline #8}%
}

总而言之,在我看来,这是非常脆弱的代码。再见。

结果 2

\documentclass[11 pt,oneside,a4paper,titlepage]{article}

\usepackage{adjustbox} % to a better alignement of text
\usepackage{geometry}
\geometry{
    a4paper,
    left=0.1cm,
    right=0.6cm,
    top=0.1cm,
    bottom=0.1cm,
    showframe=true
}

\usepackage{lipsum}
\usepackage{microtype} 

% More defined colors
\usepackage[dvipsnames]{xcolor}
 
% Required package
\usepackage{tikz}
                        %\usetikzlibrary{positioning}
                        %\usepackage{tikzpagenodes} % not needed?
\usepackage{fontawesome5}

% ~~~ Lengths ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\newlength\SidebarTextWidth \setlength\SidebarTextWidth{7cm}
\newlength\leftSideSecWidth \setlength\leftSideSecWidth{2cm}
\newlength\rightSideSecWidth \setlength\rightSideSecWidth{9cm}

% ~~~ Command for Education and Works ~~~~~~~~~~~~~~~~~~~~~~~~~
\newcommand{\MySection}[7]{% input: years, logo, title, university, city, specialization, description
    \adjustbox{valign=t}{\begin{minipage}{\leftSideSecWidth}%
        \begin{flushleft}% <<< CHANGED (Q1)
            {\small #1}\\% years
            % \vspace*{0.1cm}
            % \includegraphics[width=1.2cm]{#2} %logo
        \end{flushleft}%
    \end{minipage}}%
    \hspace{0.1cm} \hfill%\vline %\hfill
    \adjustbox{valign=t}{\begin{minipage}{9.0cm}%
        {\normalsize\bfseries #3}%title
        \hfill {\footnotesize \faMapMarker  ~ #5}% city
        \newline%
        {\small\bfseries \textsc{#4}}%university
        \newline%
        \small {\emph{#6}}% specialization
        %\newline %originally not commented
        \footnotesize {#7}% description
    \end{minipage}}%
}
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% let's move all formatting for qualitfications here
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\newcommand\qualif[8]{% max 9 parameters !
    \begin{tikzpicture}[remember picture,overlay]% '%' are vital in macros! (dangling space issues)
        \draw [help lines] (0,0) grid (5,-2);%    

        \node[font = {\Large},circle,fill=orange, minimum size = 1cm]%
            (c) at (0.5,-1){#1};% <<< NEW   
        \draw[orange, thick] (c.0) -- (\textwidth,-1); % <<< NEW (Q3)
        \node at (5.15,-.8) [align=left,text width=5cm]  {\MakeUppercase{#2}};%\MakeUppercase{#2}};% <<< (Q2) almost    
    \end{tikzpicture}%
%       
    \vspace{1.5cm}% !!! the next empty line is needed: else the layout breaks

    \MySection{#3}{}{#4}{#5}{#6}{#7}{\newline #8}%
}


% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}

% Left-side page
\adjustbox{valign=t}{\begin{minipage}{7cm}
    \section*{Side bar}
         \lipsum[1-2]                  
\end{minipage}} %
\hfill
\adjustbox{valign=t}{%
  \begin{minipage}{11.6cm} %11.3cm  
  % <<< NEW COMMANDS
  
    \qualif{\faSuitcase}
            {work experiences}
            {Feb.--Mar. 2021}
            {Visiting Researcher}
            {Sapienza University}
            {Rome, ITALY}
            {Space Engineering}
            {\lipsum[4]}
    
    \qualif{\faUniversity}
            {education}
            {Apr.--Dec. 2020}{Student}
            {Florence University}
            {Florence, ITALY}
            {Space Engineering}
            {\lipsum[3]}
    
  \end{minipage}}   
    
\end{document}


第一篇帖子:

不知道您的方法是否是最好的,但这里是对您的 4 个问题的答案。

问题 1:如果这就是你想要的,请从 切换centerflushleft

        \begin{flushleft}% <<< CHANGED (Q1)
            {\small #1} \\ %years
            % \vspace*{0.1cm}
            % \includegraphics[width=1.2cm]{#2} %logo
        \end{flushleft}

第二季度:依赖已知的内部长度

\draw[orange, thick] (c.0) -- (\textwidth,-1);  % <<< NEW (Q3)

第三季度:进行一些重组(不是一次性放置文本)并绘制帮助网格,然后进行一些微调//这有点奇怪,因为(0,0)位于更左侧,在您的侧边栏上方...

    \begin{tikzpicture}[remember picture,overlay]   
        \draw [help lines] (0,0) grid (5,-2);    
        \node[font = {\Large},circle,fill=orange, minimum size = 1cm] 
            (c) at (0.5,-1){\faSuitcase};   
        \draw[orange, thick] (c.0) -- (\textwidth,-1);  % <<< NEW (Q3)
        \node at (4.5,-.8) {\MakeUppercase{work experiences}};% <<< (Q2) almost
    \end{tikzpicture}

Q4:在 tikz 中自己重新绘制此图标可能更容易

附言tikzpagenodes:看起来你根本没用

结果

\documentclass[11 pt,oneside,a4paper,titlepage]{article}
\usepackage{adjustbox} % to a better alignement of text
\usepackage{geometry}
\geometry{
    a4paper,
    left=0.1cm,
    right=0.6cm,
    top=0.1cm,
    bottom=0.1cm,
    showframe=true
}

\usepackage{lipsum}
\usepackage{microtype} 

% More defined colors
\usepackage[dvipsnames]{xcolor}
 
% Required package
\usepackage{tikz}
%\usetikzlibrary{positioning}
\usepackage{tikzpagenodes} % not needed?
\usepackage{fontawesome5}

% Lengths
\newlength\SidebarTextWidth \setlength\SidebarTextWidth{7cm}
\newlength\leftSideSecWidth \setlength\leftSideSecWidth{2cm}
\newlength\rightSideSecWidth \setlength\rightSideSecWidth{9cm}

% Command for Education and Works
\newcommand{\MySection}[7]{ % input: years, logo, title, university, city, specialization, description
    \adjustbox{valign=t}{\begin{minipage}{\leftSideSecWidth}
        \begin{flushleft}% <<< CHANGED (Q1)
            {\small #1} \\ %years
            % \vspace*{0.1cm}
            % \includegraphics[width=1.2cm]{#2} %logo
        \end{flushleft}
    \end{minipage}}
    \hspace{0.1cm} \hfill %\vline %\hfill
    \adjustbox{valign=t}{\begin{minipage}{9.0cm}
        {\normalsize\bfseries #3} %title
        \hfill {\footnotesize \faMapMarker  ~ #5} % city
        \newline
        {\small\bfseries \textsc{#4}} %university
        \newline 
        \small {\emph{#6}} %specialization
        %\newline %originally not commented
        \footnotesize {#7} %description
    \end{minipage}}
}


% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}

% Left-side page
\adjustbox{valign=t}{\begin{minipage}{7cm}
    \section*{Side bar}
         \lipsum[1-2]                  
\end{minipage}} %
\hfill 
% Right-side page
\adjustbox{valign=t}{\begin{minipage}{11.6cm} %11.3cm

    \begin{tikzpicture}[remember picture,overlay]   
        \draw [help lines] (0,0) grid (5,-2);    
        \node[font = {\Large},circle,fill=orange, minimum size = 1cm] 
            (c) at (0.5,-1){\faSuitcase};   
        \draw[orange, thick] (c.0) -- (\textwidth,-1);  % <<< NEW (Q3)
        \node at (4.5,-.8) {\MakeUppercase{work experiences}};% <<< (Q2) almost
    \end{tikzpicture}
        
    \vspace{1.5cm} 
        
    \MySection{Feb.--Mar. 2021}{}{Visiting Researcher}{Sapienza University}{Rome, ITALY}{Space Engineering}{\newline \lipsum[4]}
    \end{minipage}} 
    \newpage
 
\end{document}

相关内容