Latex - 颜色框的宽度

Latex - 颜色框的宽度

我使用这个模板在 Latex 中制作我的简历:

http://www.howtotex.com/images/latex-plaincv-screen.png

我的问题是工作经历的持续时间。如果我写例如 2013 年 3 月 - 至今,它会被分成两行。我更希望使用一行来让持续时间的框更宽,但我不知道具体该怎么做。

宏创建的工作体验如下:

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

有人可以帮我修改它吗?

答案1

看着那(这简历模板的用途\EducationEntry

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

这将设置彩色框以包含6em较宽的文本。如果提供的文本比该宽度更宽,则它将相应地断开。相反,\WorkEntry没有此段落设置:

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

如果没有这个\parbox(固定宽度),框应该根据其内容的大小进行调整。如果您希望使用固定宽度,请\WorkEntry相应地进行更新以使用预先指定的宽度。或者,只需\EducationExperience像原始模板一样使用您的工作经验即可。

以下是模板进行了一些更新(\EducationEntry\WorkEntry现在都适合10em \parbox):

在此处输入图片描述

%%% LaTeX Template: Curriculum Vitae
%%%
%%% Source: http://www.howtotex.com/
%%% Feel free to distribute this template, but please keep the referal to HowToTeX.com.
%%% Date: July 2011

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

%\usepackage[english]{babel}                                % English language/hyphenation
%\usepackage[protrusion=true,expansion=true]{microtype}     % Better typography
\usepackage{amsmath,amsfonts,amsthm}                    % Math packages
\usepackage[pdftex]{graphicx}                               % Enable pdflatex
\usepackage[svgnames]{xcolor}                           % Colors by their 'svgnames'
\usepackage{geometry}
    \textheight=700px                                   % Saving trees ;-) 
\usepackage{url}                                        % Clickable URL's
\usepackage{wrapfig}                                    % Wrap text along figures

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

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

\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]{
        \Huge \usefont{OT1}{phv}{b}{n} \hfill #1        % Name
        \par \normalsize \normalfont}

\newcommand{\MySlogan}[1]{
        \large \usefont{OT1}{phv}{m}{n}\hfill \textit{#1} % Slogan (optional)
        \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{Black}{%
            \parbox{10em}{%
            \hfill\color{White}#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{Black}{%
            \parbox{10em}{%
            \hfill\color{White}#2}} \par        % Duration
        \noindent \textit{#3} \par                  % Company
        \noindent\hangindent=2em\hangafter=0 \small #4  % Description
        \normalsize \par}



%%% ------------------------------------------------------------
%%% BEGIN DOCUMENT
%%% ------------------------------------------------------------
\begin{document}
\begin{wrapfigure}{l}{0.5\textwidth}
    \vspace*{-2em}
        \includegraphics[width=0.15\textwidth]{photo}
\end{wrapfigure}

\MyName{Your Name}
\MySlogan{Curriculum Vitae}

\sepspace

%%% Personal details
%%% ------------------------------------------------------------
\NewPart{Personal details}{}

\PersonalEntry{Birth}{January 1, 1980} 
\PersonalEntry{Address}{111 First St, New York}
\PersonalEntry{Phone}{(123) 000-0000}
\PersonalEntry{Mail}{\url{[email protected]}}

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

\EducationEntry{MSc. Name of Education}{2010-2012}{Name of
  University}{Descriptive text goes here. In order to maintain a stylish look, try to fill this description with a few lines of text. Do the same for the other entries in the education section.}
\sepspace

\EducationEntry{BSc. Name of Education}{2007-2010}{Name of University}{Descriptive text goes here. In order to maintain a stylish look, try to fill this description with a few lines of text. Do the same for the other entries in the education section.}

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

\EducationEntry{Job name}{March 2013 - Present}{Company Name inc., Full-time}{Job description goes here. To maintain a stylish look, try to fill this description with a few lines of text. Do the same for the other entries in this section.}
\sepspace

\EducationEntry{Job name}{2010-2011}{Company Name inc., Part-time}{Job description goes here. To maintain a stylish look, try to fill this description with a few lines of text. Do the same for the other entries in this section.}

%%% Skills
%%% ------------------------------------------------------------
\NewPart{Skills}{}

\SkillsEntry{Languages}{Dutch (mother tongue)}
\SkillsEntry{}{English (fluent)}
\SkillsEntry{}{German (fluent)} 

\SkillsEntry{Software}{\textsc{Matlab}, \LaTeX, \textsc{Ansys}, \textsc{Comsol}}


%%% References
%%% ------------------------------------------------------------
\NewPart{References}{}
Available upon request
\end{document}

按要求,改编\SkillsEntry,使用

\newcommand{\SkillsEntry}[2]{                       % Same as \PersonalEntry
        \noindent\hangindent=\dimexpr\spacebox+2em\relax\hangafter=1        % Indentation
        \null\hspace*{2em}\makebox[\spacebox][l]{%                     % Box to align text
        \textit{#1}}%                               % Entry name (birth, address, etc.)
        #2 \par}                 % Entry value  

您可以使用

%%% Skills
%%% ------------------------------------------------------------
\NewPart{Skills}{}

\SkillsEntry{Languages}{Dutch (mother tongue)}
\SkillsEntry{}{English (fluent)}
\SkillsEntry{}{German (fluent)} 

\SkillsEntry{Software}{\textsc{Matlab}, \LaTeX, \textsc{Ansys}, \textsc{Comsol},
  and them a large amount of other, obscure languages including \textsc{APL}}

得出

在此处输入图片描述

请注意,第二个参数设置得比原始布局中稍微近一些。我使用了提供的\spacebox尺寸。但是,如果需要,可以更改。例如,改为使用1.2\spacebox以获得更宽敞的视图:

在此处输入图片描述

答案2

我正在使用上面描述的 \EducationEntry...它导致不同时间段的字距调整很奇怪(参见此处:https://www.dropbox.com/s/jrdv2psaot02vyl/Screenshot%202020-08-31%20at%2008.47.41.png?dl=0)有什么建议我可以如何解决这个问题?

相关内容