如何将文本与前面的行对齐并在 CV 中创建单行、右对齐的日期?

如何将文本与前面的行对齐并在 CV 中创建单行、右对齐的日期?

我是 Tex 的新手,这是我的第一篇帖子,因此,任何关于如何改进我的代码或这篇文章的格式的一般性评论(以及关于如何解决以下问题的任何具体答案)都将不胜感激!

我正在尝试在 Overleaf 中创建简历(匿名代码如下所示),但遇到了两个问题:

  1. 几乎所有日期都落在第一行,显示不整齐。我怎样才能将它们放在一行上,就像“利益和职责”部分中的日期那样?(我查看了有关类似问题的帖子,但只找到了使用该moderncv软件包创建的简历的材料。)
  2. 在“技能”部分,有关编程的详细信息占用了多行。这没问题,但我希望第二行有一个缩进,以便第二行关于编程技能的开头与第一行关于编程技能的描述的开头对齐。我该怎么做?(我找到的最接近的帖子是如何在不枚举的情况下将多行对齐到相同的缩进上,但我不确定这是否以及如何应用于我的情况。)


\documentclass[paper=a4,fontsize=11pt]{scrartcl} % KOMA-article class

\usepackage[english]{babel} \usepackage[utf8x]{inputenc} \usepackage[protrusion=true,expansion=true]{microtype} \usepackage{amsmath,amsfonts,amsthm} % Math packages \usepackage{graphicx} % Enable pdflatex \usepackage[svgnames]{xcolor} % Colors by their 'svgnames' \usepackage{geometry} \textheight=700px % Saving trees ;-) \usepackage{url}

\frenchspacing % Better looking spacings after periods \pagestyle{empty} % No pagenumbers/headers/footers

%%% Custom sectioning (sectsty package) %%% ------------------------------------------------------------ \usepackage{sectsty}

\sectionfont{% % Change font of \section command \usefont{OT1}{phv}{b}{n}% % bch-b-n: CharterBT-Bold font \sectionrule{0pt}{0pt}{-5pt}{3pt}}

%%% Macros %%% ------------------------------------------------------------ \newlength{\spacebox} \settowidth{\spacebox}{8888888888} % Box to align text \newcommand{\sepspace}{\vspace*{1em}} % Vertical space macro

\newcommand{\MyName}1{ % Name \noindent \Huge \usefont{OT1}{phv}{b}{n} #1 \par\normalsize \normalfont}

\newcommand{\MyEmail}1{ % Email (optional) \noindent \large \usefont{T1}{phv}{m}{n} #1 \par\normalsize \normalfont}

\newcommand{\MyMobile}1{ % MyMobile (optional) \noindent \large \usefont{OT1}{phv}{m}{n} #1 \par\normalsize \normalfont}

\newcommand{\MyAddress}1{ % MyAddress (optional) \noindent \large \usefont{OT1}{phv}{m}{n} #1 \par\normalsize \normalfont}

\newcommand{\NewPart}1{\section*{\uppercase{#1}}}

\newcommand{\PersonalEntry}[2]{ \noindent\hangindent=2em\hangafter=0 % Indentation \parbox{\spacebox}{ % Box to align text \textit{#1}} % Entry name (birth, address, etc.) \hspace{1.5em} #2 \par} % Entry value

\newcommand{\SkillsEntry}[2]{ % Same as \PersonalEntry \noindent\hangindent=2em\hangafter=0 % Indentation \parbox{\spacebox}{ % Box to align text \textit{#1}} % Entry name (birth, address, etc.) \hspace{1.5em} #2 \par} % Entry value

\newcommand{\EducationEntry}[4]{ \noindent \textbf{#1} \hfill % Study \colorbox{White}{% \parbox{6em}{% \hfill\color{Black}#2}} \par % Duration \noindent \textit{#3} \par % School \noindent\hangindent=2em\hangafter=0 \small #4 % Description \normalsize \par}

\newcommand{\WorkEntry}[4]{ % Same as \EducationEntry \noindent \textbf{#1} \hfill % Jobname \colorbox{White}{\color{Black}#2} \par % Duration \noindent \textit{#3} \par % Company \noindent\hangindent=2em\hangafter=0 \small #4 % Description \normalsize \par}

\newcommand{\Responsibilities}[4]{ % Same as \EducationEntry \noindent \textbf{#1} \hfill % Title \colorbox{White}{\color{Black}#2} \par % Duration \noindent \textit{#3} \par % Company \noindent\hangindent=2em\hangafter=0 \small #4 % Description \normalsize \par}

%%% Begin Document %%% ------------------------------------------------------------ \begin{document}

\MyName{My name} \MyAddress{My address} \MyEmail{{My email}}

%%% Education %%% ------------------------------------------------------------ \NewPart{Education}{}

\EducationEntry{Education}{Sep xxxx-Present}{My university} {\begin{itemize} \item Details \item Details \end{itemize}}

\EducationEntry{More education}{Sep xxxx-Jun xxxx}{Institution} {\begin{itemize} \item Details \end{itemize}}

\EducationEntry{More education}{Sep xxxx-Jun xxxx}{Institution} {\begin{itemize} \item Details \end{itemize}}

%%% Work experience %%% ------------------------------------------------------------ \NewPart{Work experience}{}

\EducationEntry{Role}{Aug xxxx-Aug xxxx}{Organisation} {\begin{itemize} \item Details

\item Details \item Details \end{itemize}} \EducationEntry{Role}{Feb xxxx-Dec xxxx}{Organisation} {\begin{itemize} \item Details \end{itemize} } %%% Responsibilities %%% ------------------------------------------------------------ \NewPart{Interests and positions of responsibility}{} \Responsibilities{Role}{Mar xxxx-Mar xxxx}{Organisation} {\begin{itemize} \item Details \end{itemize} } %%% Skills %%% ------------------------------------------------------------ \NewPart{Skills}{} \SkillsEntry{Programming}{Some text regarding programming skills, that spans more than one line} \SkillsEntry{Systems}{Details} \SkillsEntry{Languages}{Details} \flushleft\sepspace References available on request \end{document}

答案1

您可以加载eqparbox包并将定义替换\EducationEntry

\newcommand{\EducationEntry}[4]{
        \noindent \textbf{#1} \hfill % Study
        \colorbox{White}{%
            \eqmakebox[duration][r]{%
            \color{Black}#2}} \par % Duration 
        \noindent \textit{#3} \par % School
        \noindent\hangindent=2em\hangafter=0 \small #4 % Description
        \normalsize \par}

对于悬挂缩进问题,请使用以下命令:

\newcommand{\SkillsEntry}[2]{ % Same as \PersonalEntry
        \noindent\hangindent=2em\hangafter=-2% Indentation
        \parbox{\spacebox}{ % Box to align text
        \textit{#1}} % Entry name (birth, address, etc.)
        \hspace{1.5em} #2 \par} % Entry value

最后说明:在代码中\colorbox{White}{\color{Black}#2}\color{Black} 不需要,因为\colorbox{some colour} 只改变背景的颜色。

在此处输入图片描述

相关内容