1

I'm kinda new to latex and try to align a minipage to the top-line of a multiline section heading. image of layouting problem

The code to produce a new entry is:

 %%% When? - Where? - What? - Details? %%%
\newcommand{\datedsubsectionmod}[4]{%   
    \cvsubsection[#2]{#3 \hfill \small{\textlf{\scshape{#2}}}}%
    \begin{minipage}[b][][t]{5cm}
        \vspace*{-.7ex}\hspace*{-3cm}\footnotesize #1
    \end{minipage}
    \raggedright
        
    \begin{small}
        #4
    \end{small}
}

Does someone with more Latex experience can does have an idea how to achieve this?

Thanks everyone in advance! :)

Backstory

I'm trying to use Latex for my next CV and used the following template I found on Overleaf. I need to make some adjustments to account for an CV entry where the title spans over multiple lines. The date to the relevant entry is aligned at the bottom but I would be nicer to have it at the top.

The template uses a minipage to place the data next to it. I tried to change the b and t modifies however had no luck with it.

The cvsubsection seems to define a section-like command, however I'm new to Latex and I might guess wrong here. The definition is:

\newcounter{cvsubsection}
\titleclass{\cvsubsection}{straight}[\part]
\titleformat{\cvsubsection}         
    {\raggedright} 
    {}{0em}                      
    {}                           
\titlespacing*{\cvsubsection}{0pt}{3.5ex plus 1ex minus .2ex}{-2.5ex}

Update

I found a way to achieve kinda the layout I was looking for. Instead of placing the name of the university in the heading I put it in a separate minipage. This now has the effect that the heading stays within one line and the minipages are right below and can be top-aligned to each other. Then, by experimenting with negative \vspace{} something good looking can be produced.

The modified command is

\newcommand{\datedsubsectionmod}[4]{%   
    \cvsubsection[#2]{#3}% \hfill \small{\textlf{\scshape{#2}}}}%
    \begin{minipage}[t][][t]{5cm}
        \vspace*{-1.7ex}\hspace*{-3cm}\footnotesize #1
    \end{minipage}%
    \hspace*{0.5cm}%
    \begin{minipage}[t][][t]{8cm}
    \begin{flushright}
        \vspace*{-1.7ex}\small{\textlf{\scshape{#2}}}
    \end{flushright}
    \end{minipage}\vspace*{.7ex}
    \raggedright
        
    \begin{small}
        #4
    \end{small}
}

which produces this result

improved result

1
  • See also \hfill, \hspace{\fill} and \raggedright. Aug 7, 2022 at 12:59

1 Answer 1

0
\documentclass[12pt]{article}
\usepackage{lmodern}
\usepackage{lipsum}

\begin{document}
2021\hspace{1cm}\begin{minipage}[t]{0.5\textwidth}
\lipsum[1]
\end{minipage}
\end{document}

You can use the option t for the minipage environnement to achieve what you are trying to do here.

I recommend for your first LaTeX CV the moderncv class. It is very easy to use and you can produce the almost the same result.

1
  • Hey Elyo, thanks for the answer. In this case the minipage seems to be aligned at the last line that is used. I worked around it by removing it from the heading and adding the multi-line university section in a minipage as well.
    – Ben K
    Aug 8, 2022 at 19:49

You must log in to answer this question.

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