# Latex - width of the colorbox

I'm doing my CV in Latex using this template:

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

My problem is the duration of the working experience. If I write for example March 2013 - Present, it is splitted in two rows. I would prefer to have the box with duration wider using one row but I dont know exactly how to do it.

Macro creating working experience looks like that:

\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}


Could somebody help me to modify it?

## migrated from stackoverflow.comJul 23 '13 at 21:22

This question came from our site for professional and enthusiast programmers.

• Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Jul 23 '13 at 21:40

Look at the CV template's use of \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}


This sets the coloured box to contain text that is 6em wide. If anything wider than that is supplied, then it will break like accordingly. In contrast, \WorkEntry doesn't have this paragraph setting:

\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}


Without this \parbox (of fixed width), the box should shape to the size of its contents. If you wish to have a fixed with, update \WorkEntry accordingly to use a pre-specified width. Alternatively, just use \EducationExperience for you work experience as in the original template.

Here's the template with some updates (both \EducationEntry and \WorkEntry now fits an 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
%\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}

\MySlogan{Curriculum Vitae}

\sepspace

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

\PersonalEntry{Birth}{January 1, 1980}
\PersonalEntry{Phone}{(123) 000-0000}
\PersonalEntry{Mail}{\url{me@home.com}}

%%% 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}


As per request, for an adaptation of \SkillsEntry, use

\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


which allows you to use

%%% 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}}


that yields

Note that the second argument is set a little closer than in the original layout. I've used the provided \spacebox measure. However, this can be changed, if needed. For example, use 1.2\spacebox instead to obtain a more spacier view:

• I have one more question: In the skillsentry, if the second column is too long, it breaks the line, but continues in the first column, something like that: dropbox.com/s/b3ao7tkl0budp3c/cv.png I would like to break it in such a way that it continues in the second column. How to achieve that? Thank you! – Kubik Jul 23 '13 at 9:55
• @Kubik: See the updated answer (bottom). – Werner Jul 23 '13 at 19:14