1

I am working on a CV and I would like to put the year of activity xyz in the top right corner of each paragraph. Normally, I would use \hfill, but for my longer entries, the year overflows the next line when I would prefer that the text description of each activity wrap around instead.

    \section{\textnormal{\textbf{RANDO}}}
    \emph{HONOR HONOR HONOR} used for study in Harvard University's Business            
    Economics Program \hfill 2016-present \\ [0.1cm]
    \emph{HONOR HONOR HONOR 2} for Yale University's doctorate in finance           
    (declined) \hfill 2016

What I want is to guarantee that each date is on the top line of its paragraph on the right hand side of the page.

7
  • Welcome to TeX SX! Could you post an example of the code you have so far?
    – Bernard
    Sep 4, 2016 at 22:07
  • Are you sure you want the year on the right? This is very unusual. Did you take a look at the different cv packages that exist in distributions, TeX Live as well as MiKTeX. One of the most popular is moderncv.
    – Bernard
    Sep 4, 2016 at 22:31
  • To be frank, I don't think this is very unusual at all for an academic CV (at least in finance). Here is the CV of the former editor of the Journal of Finance, for instance: bus.miami.edu/_assets/files/faculty-cv/finance/…, and here is the CV of Nobel Laureate Bob Shiller capitalism.columbia.edu/files/ccs/person/cv/2015/…. I looked at the other CV formats, and found nothing that met my needs.
    – h8r
    Sep 4, 2016 at 22:54
  • But in these exaples, no year is at the rightmost top corner of each paragraph! Or did I misunderstand what you want?
    – Bernard
    Sep 4, 2016 at 22:59
  • Technically, both lines in the MWE are in the same paragraph. I take it you want the text to wrap around the date, or do you want the date to be outside the right margin? Sep 4, 2016 at 23:03

1 Answer 1

1

If you are using a special \documentclass, you may need to enlarge \marginparwidth.

\documentclass{article}
\begin{document}
\section{\textnormal{\textbf{RANDO}}}\leavevmode
    \marginpar{\hfill 2016-present}%
    \emph{HONOR HONOR HONOR} used for study in Harvard University's Business            
    Economics Program\\[0.1cm]
    \marginpar{\hfill 2016}%
    \emph{HONOR HONOR HONOR 2} for Yale University's doctorate in finance           
    (declined)
\end{document}

You can also use tabularx:

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\section{\textnormal{\textbf{RANDO}}}
\begin{tabularx}{\textwidth}{@{}Xp{1in}@{}}
    \emph{HONOR HONOR HONOR} used for study in Harvard University's Business            
    Economics Program & 2016-present \\[0.1cm]
    \emph{HONOR HONOR HONOR 2} for Yale University's doctorate in finance           
    (declined) & 2016
\end{tabularx}
\end{document}

You can flow the text around the date using \hangindent. For convenience, I created the length \datewidth and the macro \myformat.

\documentclass{article}
\usepackage{blindtext}

\newlength{\datewidth}
\setlength{\datewidth}{1in}

\newcommand{\myformat}[1]% #1 = date field
{\par\hangindent=-\datewidth
 \hangafter=-1
 \noindent\rlap{\hspace{\dimexpr \textwidth-\datewidth}\makebox[\datewidth][r]{#1}}%
}
\begin{document}
\section{\textnormal{\textbf{RANDO}}}
    \myformat{2016-present}%
    \emph{HONOR HONOR HONOR} used for study in Harvard University's Business            
    Economics Program \blindtext
    \vspace{0.1cm}\myformat{2016}%
    \emph{HONOR HONOR HONOR 2} for Yale University's doctorate in finance           
    (declined)
\end{document}

This variant uses a variable width date field.

\documentclass{article}
\usepackage{blindtext}

\newsavebox{\datebox}% \hangindent global

\newcommand{\myformat}[1]% #1 = date field
{\savebox{\datebox}{\hspace{1em}\textbf{#1}}%
  \par\hangindent=-\wd\datebox
  \hangafter=-1
  \noindent\rlap{\hspace{\dimexpr \linewidth-\wd\datebox}\usebox{\datebox}}%
}
\begin{document}
\section{\textnormal{\textbf{RANDO}}}
    \myformat{2016-present}%
    \emph{HONOR HONOR HONOR} used for study in Harvard University's Business            
    Economics Program \blindtext
    \vspace{0.1cm}\myformat{2016}%
    \emph{HONOR HONOR HONOR 2} for Yale University's doctorate in finance           
    (declined)
\end{document}
4
  • This answer is sufficient for my needs but does not actually answer the question. I want it to be possible for the text describing each activity to wrap underneath the year (this is what makes the question different from previous CV solutions I found on StackOverflow), but neither of your solutions allow for that.
    – h8r
    Sep 5, 2016 at 17:06
  • I suspected as much, but this was a lot easier. Sep 5, 2016 at 19:40
  • Your addendum has two problems in my ShareLaTeX setup. First, it seems to start each activity with "-=-1" and second, the text of the activity overlaps the date. Screenshot attached with \blindtext removed for readability: drive.google.com/file/d/0B02KoGnAn1VOWVR4WWduSXQ5Snc/…
    – h8r
    Sep 5, 2016 at 20:38
  • Do you get any error mesages? If \hangindent or \hangafter are undefined, or \datewidth is already defined, that might explain the behavior described. Sep 6, 2016 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .