4

I've written a hodge-podge of LaTeX2e and expl3 to produce the following effect:

output

What I have is ugly and ideologically incorrect. I'm looking for a better way to do the same thing. I think coffins would come in handy here, but I'm not certain how this could be put together.

\documentclass{article}
\usepackage{xparse,xcolor}

\ExplSyntaxOn
\box_clear_new:N \g_jakecv_group_start_box
\hbox_set:Nn \g_jakecv_group_start_box
 {
  \makebox[0pt]{\rule[-40.5pt]{1mm}{\dimexpr40.5pt+1mm\relax}}
  \makebox[0pt][l]{\rule{\dimexpr\textwidth+3mm\relax}{1mm}}
 }

\NewDocumentCommand \Position { mmmm } {
  \group_begin:
  \color{black!20!white}
  \smash{\raisebox{1ex}{
      \hspace{\dimexpr -1ex - 1mm\relax}
      \box_use:N \g_jakecv_group_start_box}}
  \group_end:
  \group_begin:
  \par\noindent\large #1 \quad #2 \newline
  \group_end:
  #3 \newline #4
}

\ExplSyntaxOff

\begin{document}
\Position{2020--2025}{Some Position Title}{Some Super Long Organization Name}{Some City, BC}
\end{document}
2
  • 3
    May be wipet can do it without coffins, just \pdfliteral{ wi th 5 o m 3 m 46 i c }.
    – Manuel
    May 10 '15 at 1:30
  • We love you, wipet :) May 10 '15 at 6:30
5

Coffins were definitely the right answer! Putting things together like this with relative positions is exactly what the package was created for.

output

No arbitrary measurements, no guesswork:

\documentclass{article}
\usepackage{xparse,xcolor}

\ExplSyntaxOn
\coffin_new:N \l_jakecv_position_info_coffin

\NewDocumentCommand \Position { mmmm } {
  \group_begin:
  \vcoffin_set:Nnn \l_jakecv_position_info_coffin {\textwidth} {
    \group_begin:
    \par\noindent\large #1 \quad #2 \newline
    \group_end:
    #3 \newline #4
  }
  \hcoffin_set:Nn \l_tmpa_coffin {
    \color{black!20!white}
    \rule{1mm} { \dim_eval:n { 4mm +
        \coffin_ht:N \l_jakecv_position_info_coffin }}
  }
  \coffin_attach:NnnNnnnn
    \l_jakecv_position_info_coffin {l}{B}
    \l_tmpa_coffin {r}{b}
    {-3mm}{0pt}

  \hcoffin_set:Nn \l_tmpa_coffin {
    \color{black!20!white}
    \rule{\dim_eval:n { 4mm + \textwidth }}{1mm}
  }
  \coffin_attach:NnnNnnnn
    \l_jakecv_position_info_coffin {l}{t}
    \l_tmpa_coffin {l}{b}
    {-4mm}{3mm}

  \coffin_typeset:Nnnnn \l_jakecv_position_info_coffin {l}{t}{0pt}{0pt}
  \group_end:
}

\ExplSyntaxOff

\begin{document}
\Position{2020--2025}{Some Position Title}{Some Super Long Organization Name}{Some City, BC}
\end{document}
3
  • I just want to note that this answer is testimony purely to the usefulness of thinking through your question enough to write it. It's also a very good basic but practical example of how to use coffins :) May 10 '15 at 0:11
  • beware \par\noindent\large #1 \quad #2 \newline \group_end: is setting large text on a normal baseline, you might want to use \par not \newline (although it's probably safe enough here, restricted to top line) May 10 '15 at 0:15
  • @DavidCarlisle Whoops, right :) I made this MWE from a much more complex document; a couple things got jumbled around :) May 10 '15 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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