3

I am using a template for a CV in LaTeX and I am facing certian difficulties in getting things aligned properly.

The code I am referring to is

\newcommand{\NewEntry}[3]{% Define a command for each new block - change spacing and font sizes here: #1 is the left margin, #2 is the italic date field and #3 is the position/employer/location field
    \noindent\hangindent=0em\hangafter=0
    \parbox{\datebox}{\small\textit{#1}}
    \hspace{1em} #2 #3
    }

enter image description here

As you can see, "Feb'14--current" is getting displayed in two lines instead of one. Is there a way I can edit the \newcommnad instruction so that I can get the desired result, i.e in one single line.

Ruben
  • 13,448
Morpheus
  • 947
  • 3
    It would be helpful to see a full working example. But from what you've shown, \datebox would appear to be a width, which is too small to allow the text to fit. You could increase the size of \datebox, you could replace its appearance in this macro by an explicitly larger length. If neither of those options are available (for other reasons), you could replace \textit{#1} with \makebox[0pt][l]{\textit{#1}}, though this latter brute force approach runs the risk of overlap. – Steven B. Segletes Dec 28 '14 at 15:25
  • the bruteforce method worked for now. i still would like to kno how to increase the length of \datebox – Morpheus Dec 28 '14 at 15:34
  • \setlength{\datebox}{<length>}. Most likely you don't know how big the longest entry will be in the first place. So, first of all I would call the parbox with the optional parameter "t", like \parbox[t].... – Ruben Dec 28 '14 at 15:36

2 Answers2

3

As suggested in my comment, it would be good to know more about the CV style. But the problem is that the length \datebox is not sufficient to hold the string. You can increase \datebox, or manually force the string to overrun the allocated space (at the risk of overlap).

The original size of \datebox=.7in was pulled out of thin air for this MWE, merely to show a size that doesn't work with the input data. Your CV style would need to be consulted to determine the actual length allocated for it.

I also made the \parbox with the [t] option, so that any overrun, if allowed, would not change the vertical placement of the datebox text.

\documentclass{article}
\newlength\datebox
\datebox=.7in\relax% OR PREFERABLY \setlength{\datebox}{0.7in}
\newcommand{\NewEntry}[3]{\noindent\hangindent=0em\hangafter=0 %
  \parbox[t]{\datebox}{\small\textit{#1}}\hspace{1em} #2 #3 }
\begin{document}
\parindent 0in\parskip 1ex
AS IS (approximately):

\NewEntry{Feb'14--current}{Technical Service Manager}{Blah}

INCREASING datebox:

\datebox=.9in
\NewEntry{Feb'14--current}{Technical Service Manager}{Blah}

BRUTE FORCE:

\datebox=.7in% RESTORE ORIGINAL
\renewcommand{\NewEntry}[3]{\noindent\hangindent=0em\hangafter=0 %
  \parbox[t]{\datebox}{\small\makebox[0pt][l]{\textit{#1}}}\hspace{1em} #2 #3 }
\NewEntry{Feb'14--current}{Technical Service Manager}{Blah}

\end{document}

enter image description here

  • here is the template http://www.latextemplates.com/template/classicthesis-styled-cv for you perusal – Morpheus Dec 28 '14 at 15:51
2

I wouldn't recommend to use this template anayway. But, your problem is solvable within the given setting: You need to set the \datebox width to your longest date caption. Assuming that this is the problematic "Feb'14--current" you would say

\settowidth{\datebox}{Feb'14--current}

enter image description here

In case you really want to use the template you should strongly consider to take over my adjustments (see the complete code below).

\documentclass{scrartcl}
\usepackage[nochapters]{classicthesis}
\usepackage[LabelsAligned]{currvita}
  \renewcommand{\cvheadingfont}{\LARGE\color{Maroon}}
\usepackage{hyperref}
  \hypersetup{colorlinks,breaklinks,urlcolor=Maroon,linkcolor=Maroon}

\reversemarginpar

\newlength{\datebox}
\settowidth{\datebox}{Feb'14--current}

\newcommand{\MarginText}[1]{\marginpar{\raggedleft\itshape\small#1}}
\newcommand{\NewEntry}[3]{%
  \par\noindent\hangindent=2em\hangafter=0
  \parbox[t]{\datebox}{\small \textit{#1}}
  \hspace{1.5em} #2 #3
  \vspace{0.5em}
  \par}
\newcommand{\Description}[1]{%
  \par\noindent\hangindent=2em\hangafter=0
  {\raggedright\footnotesize #1\par}
  \vspace{1em}
  \par}

\begin{document}

\begin{cv}{\spacedallcaps{John Smith}}\vspace{1.5em} % Your name

\section*{Personal Information}

\NewEntry{}{\textit{Born in Canada,}}{20 November 1987} % Birthplace and date

\NewEntry{email}{\href{mailto:john@smith.com}{john@smith.com}} % Email address

\NewEntry{website}{\href{http://www.johnsmith.com}{http://www.johnsmith.com}} % Personal website

\NewEntry{phone}{(H) +1 (000) 111 1111\ \ $\cdotp$\ \ (M) +1 (000) 111 1112} % Phone number(s)

\vspace{1em} % Extra white space between the personal information section and goal


\section*{Goal}

\Description{Gain fundamental experience in my area of interest and expertise.}\vspace{2em}


\section*{Work Experience}

\NewEntry{2012--Present}{1\textsuperscript{st} Year Analyst, \textsc{Lehman Brothers}}

\Description{%
  \MarginText{Lehman Brothers}%
  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 Reference: John \textsc{McDonald}\ \ $\cdotp$\ \ +1 (000) 111 1111\ \ $\cdotp$\ \ \href{mailto:john@lehman.com}{john@lehman.com}}

\NewEntry{2010--2011}{Summer Intern, \textsc{Initech Inc}  --- Chicago}

\Description{%
  \MarginText{Initech Inc}%
  Rated "truly distinctive" for Analytical Skills and Teamwork.
  \newline Reference: Bill \textsc{Lumbergh}\ \ +1 (000) 111 1111\ \ $\cdotp$\ \ \href{mailto:bill@initech.com}{bill@initech.com}}

\NewEntry{Feb'14--current}{Technical Service Manager, \textsc{Gilette, PnG}}

\Description{%
  \MarginText{Buy More}%
  Worked in the Nerd Herd and helped to solve computer problems by asking customers to turn their computers off and on again.
  \newline Reference: Big \textsc{Mike}\ \ +1 (000) 111 1111\ \ $\cdotp$\ \ \href{mailto:mike@buymore.com}{mike@buymore.com}}

\end{cv}
\end{document}

Note. Changes to the template include hard-coding issues, e.g. replacing \noindent\spacedlowsmallcaps{<heading text>} with \section*{<heading text>}, misuse of the \footnotesize macro and a better handling of the spacing.

Addendum

To be 100% sure that no "date-item" will clip with the border of its box, you could measure each item and set \datebox to the widest measured width automatically. There is an answer whose method could be applied to this question too:

Maintaining structure Workbook style

An alternative approach is to check each item and to write the biggest value into the main auxiliary file, and retrieve this value at the beginning - which requires two compiling cycles to see actual changes:

\documentclass{scrartcl}
\usepackage[nochapters]{classicthesis}
\usepackage[LabelsAligned]{currvita}
  \renewcommand{\cvheadingfont}{\LARGE\color{Maroon}}
\usepackage{hyperref}
  \hypersetup{colorlinks,breaklinks,urlcolor=Maroon,linkcolor=Maroon}

\reversemarginpar

\newdimen\datebox
\newdimen\tempdima \tempdima0pt
\newdimen\maxdatedimen \maxdatedimen30pt%default value

\newcommand{\NewEntry}[3]{%
  \settowidth\tempdima{#1}%
  \ifdim\tempdima>\maxdatedimen%
    \global\maxdatedimen\the\tempdima\fi%
  \par\noindent\hangindent=2em\hangafter=0
  \parbox[t]{\datebox}{\small \textit{#1}}
  \hspace{1.5em} #2 #3
  \vspace{0.5em}
  \par}
\newcommand{\MarginText}[1]{\marginpar{\raggedleft\itshape\small#1}}
\newcommand{\Description}[1]{%
  \par\noindent\hangindent=2em\hangafter=0
  {\raggedright\footnotesize #1\par}
  \vspace{1em}
  \par}

\usepackage{atveryend}

\makeatletter
\AtBeginDocument{%
  \settowidth{\datebox}{\hbox to \the\maxdatedimen{\hfil}}
  \maxdatedimen0pt}
\AfterLastShipout{%
  \if@filesw
    \immediate\write\@mainaux{%
      \global\string\maxdatedimen=\the\maxdatedimen\relax
    }%
  \fi}
\makeatother

\begin{document}

\begin{cv}{\spacedallcaps{John Smith}}\vspace{1.5em} % Your name

\section*{Personal Information}

\NewEntry{}{\textit{Born in Canada,}}{20 November 1987} % Birthplace and date

\NewEntry{email}{\href{mailto:john@smith.com}{john@smith.com}} % Email address

\NewEntry{website}{\href{http://www.johnsmith.com}{http://www.johnsmith.com}} % Personal website

\NewEntry{phone}{(H) +1 (000) 111 1111\ \ $\cdotp$\ \ (M) +1 (000) 111 1112} % Phone number(s)

\vspace{1em} % Extra white space between the personal information section and goal


\section*{Goal}

\Description{Gain fundamental experience in my area of interest and expertise.}\vspace{2em}


\section*{Work Experience}

\NewEntry{2012--Present}{1\textsuperscript{st} Year Analyst, \textsc{Lehman Brothers}}

\Description{%
  \MarginText{Lehman Brothers}%
  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 Reference: John \textsc{McDonald}\ \ $\cdotp$\ \ +1 (000) 111 1111\ \ $\cdotp$\ \ \href{mailto:john@lehman.com}{john@lehman.com}}

\NewEntry{2010--2011}{Summer Intern, \textsc{Initech Inc}  --- Chicago}

\Description{%
  \MarginText{Initech Inc}%
  Rated "truly distinctive" for Analytical Skills and Teamwork.
  \newline Reference: Bill \textsc{Lumbergh}\ \ +1 (000) 111 1111\ \ $\cdotp$\ \ \href{mailto:bill@initech.com}{bill@initech.com}}

\NewEntry{Feb'14--current}{Technical Service Manager, \textsc{Gilette, PnG}}

\Description{%
  \MarginText{Buy More}%
  Worked in the Nerd Herd and helped to solve computer problems by asking customers to turn their computers off and on again.
  \newline Reference: Big \textsc{Mike}\ \ +1 (000) 111 1111\ \ $\cdotp$\ \ \href{mailto:mike@buymore.com}{mike@buymore.com}}

\end{cv}
\end{document}

The result is the same as in the above screenshot, but everything is accomplished automatically now.

Ruben
  • 13,448