1

I'm currently updating my CV using a very cool template I found on the Internet quite a long time ago (a user-defined CV class + the template itself). During these years, I've been more or less able to tweak both the .cls and the .tex files according to my needs, but now I'm facing a challenge I cannot solve on my own. At some point in the .cls, a new environment called entrylist is defined.

Consider now the MWE below. With the entrylist environment as it is defined (notice that it's just a somewhat fancy tabular enviornment), the content of the first column is not justified (see output below). I have tried many things to justify the content of the first column, but I haven't succeeded so far. In different words, the goal is to get "short name or date" and "much much longer name or date" both justified. Thus, does anyone how to justify only the content of the first column?

\documentclass{article}

\setlength{\tabcolsep}{0pt}
\newenvironment{entrylist}{%
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
  \end{tabular*}
}
\renewcommand{\bfseries}{}
\newcommand{\entry}[4]{%
  #1&\parbox[t]{7.00cm}{%
    \textbf{#2}%
    \hfill%
    {\footnotesize #3}\\%
    #4\vspace{\parsep}%
  }\\}


\begin{document}

  \begin{entrylist}

  \vspace{5pt}
  \entry
    {Short name or date}
    {WHATEVER}
    {Whatever}
    {Whatever}

  \vspace{5pt}
  \entry
    {much much longer name or date}
    {WHATEVER}
    {Whatever}
    {Whatever}

\end{entrylist}


\end{document}

current output

PS: feel free either to comment on the warnings or to ignore them -I'll be dealing with them as soon as possible.

Thank you all for your time and effort!

EDIT! After David Carlisle's answer, I noticed that I need any possible solution to be compatible with the package ragged2e. In different words, I still need to get that column justified while the rest of the document is affected by [document]ragged2e. Is this possible? (maybe using the array package...?)

  • Thank you very much, but I'm afraid I'm not fully getting your comment. I have just been playing with \setlength\parfillskip{0pt} and I saw no major change in the desired direction. As you mention, what I want is to over-stretch the short sentence: namely, I want the "short name or date" to be as long as "much much longer name or date", if possible. – Héctor Feb 7 at 13:43
  • Okai: I now get that it's using the standard justification. What I don't yet get is how to over-stretch what I need... What do you exactly mean by "then set parfillskip to 0pt inside the parbox"? I'm sorry for being so slow. – Héctor Feb 7 at 13:48
  • 1
    no you were not slow, you are not using a parbox in that column, I misread, I'll post in a bt – David Carlisle Feb 7 at 13:49
  • @DavidCarlisle: I have modified my question requiring, if possible, any solution to be compatible with \RequirePackage[document]{ragged2e}. Is this possible? Any help would be greatly appreciated. PS: I'm sorry for not including this requirement in my initial question --my bad. – Héctor Feb 7 at 14:46
2

enter image description here

You need to remove the \hfil glue added by the l column specification so:

\documentclass{article}

\setlength{\tabcolsep}{0pt}
\newenvironment{entrylist}{%
  \noindent
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
  \end{tabular*}
}
\renewcommand{\bfseries}{}
\newcommand{\entry}[4]{%
  \spaceskip0pt\xspaceskip0pt % for ragged2e document settting
  #1\hspace*{0pt plus -1fil}\mbox{}&\parbox[t]{7.00cm}{%
    \textbf{#2}%
    \hfill%
    {\footnotesize #3\par}%no!\\%
    #4\vspace{\parsep}%
  }\\}


\begin{document}

  \begin{entrylist}

  \vspace{5pt}
  \entry
    {Short name or date}
    {WHATEVER}
    {Whatever}
    {Whatever}

  \vspace{5pt}
  \entry
    {much much longer name or date}
    {WHATEVER}
    {Whatever}
    {Whatever}

\end{entrylist}


\end{document}
  • Why did you comment "no!" after {\footnotesize #3\par}? – Héctor Feb 7 at 14:01
  • 1
    @Héctor ending a font size without a para causes issues with line spacing, see tex.stackexchange.com/a/36459/1090 (although actually you don't have a paragraph before the size change either so perhaps you do want small text on a normal baseline (in which case ignore my comment:-) – David Carlisle Feb 7 at 14:11
  • Thanks for your comment. Although your answer works fine in the MWE, it does not work when I embed it into the .cls file, which is where I need it. Commenting \RequirePackage[document]{ragged2e} in the .cls file made it work. But then, the entire document is justified, which is something I don't want. Can I get your (or any other) solution to work while using \RequirePackage[document]{ragged2e}? – Héctor Feb 7 at 14:22
  • 1
    @Héctor I added a line for \RequirePackage[document]{ragged2e} – David Carlisle Feb 7 at 16:59
  • Perfect, that made it work! Thank you very much. ^^ – Héctor Feb 7 at 17:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.