0

I'm using a template to write my resume (unfortunately I cannot find the source anymore, but I think it's a variation of liantze/AltaCV), and I wanted to extend it with a section formatted for projects, using minipages.

I'd like to get 3 columns:

  • left one, containing the project title and some other info (date, course etc.);
  • center one, containing the project description;
  • right one, containing an image.

However, for some reason I can't figure out, the image is getting displayed above the other minipages.

What I'm getting

enter image description here

Desired result

enter image description here

Code

Class file (.cls)

I added the following:

\newcommand{\mygraphic}[1]{
  \includegraphics[width=.5\linewidth]{#1}}

\newlength{\projectExtendedLeft} \newlength{\projectExtendedCenter} \newlength{\projectExtendedRight} \setlength{\projectExtendedLeft}{0.2\textwidth} \setlength{\projectExtendedCenter}{0.49\textwidth} \setlength{\projectExtendedRight}{0.3\textwidth} \newcommand{\projectExtended}[5]{% \begin{minipage}[t]{\projectExtendedLeft}% minipage for left column with name/date/course % PROJECT TITLE --------------------------------------------------------------- \begin{minipage}[t]{\projectExtendedLeft} {\Large \color{emphasis} #1} \end{minipage} \vspace{0.5em} \par % PROJECT DATE ---------------------------------------------------------------- \begin{minipage}[t]{3mm}% wrap marker in minipage to allow multi-line dates \makebox[3mm][c]{\faCalendar} \end{minipage}% \hspace{0.5 em}% \begin{minipage}[t]{\dimexpr \projectExtendedLeft-3mm-0.5em}% wrap date in minipage to allow multi-line dates #2 \end{minipage}% \par \vspace{0.1em} % PROJECT COURSE -------------------------------------------------------------- \begin{minipage}[t]{3mm}% wrap marker in minipage to allow multi-line courses \makebox[3mm][c]{\faBook} \end{minipage}% \hspace{0.5em}% \begin{minipage}[t]{\dimexpr \projectExtendedLeft-3mm-0.5em}% wrap place in minipage to allow multi-line courses #3 \end{minipage}% \end{minipage}% \hspace{1em}% % PROJECT DESCRIPTION ------------------------------------------------------------- \begin{minipage}[t]{\projectExtendedCenter}% minipage for description #4 \par \normalsize \vspace{0.5em} \end{minipage}\hfill % PROJECT IMAGE ------------------------------------------------------------------- \begin{minipage}[t]{\projectExtendedRight}% minipage for picture \centering \mygraphic{#5} \label{fig:prova} \end{minipage}% }

Main (.tex)

\section{Other Projects}
    \projectExtended{\href{https://github.com/mikyll}{\textbf{Project Name}}}
        {From - To}
        {\href{https://www.unibo.it/}{Course Name}}
        {Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.}
        {gfx/walle-placeholder.jpg}

I'm not much experienced in LaTeX, so let me know if you need further details to investigate the problem.

mikyll98
  • 123
  • 5
  • 2
    The baseline of a \includegraphics is at the bottom of the image. Alignment t for minipage or \parbox does mean: align the baseline of the top element with the baseline outside the box. So you need to move the baseline of the \includegraphics upwards. You can do this either using \raisebox or using package adjustbox. See also https://tex.stackexchange.com/q/34166/277964 – cabohah May 07 '23 at 14:22
  • 1
    Also related: https://tex.stackexchange.com/q/15853/277964 – cabohah May 07 '23 at 14:27
  • @cabohah thank you so much – mikyll98 May 07 '23 at 14:42

1 Answers1

0

Problem

As suggested by cabohah (thank you so much ), the problem was that with minipage [t] option the baseline of the top element gets aligned with the baseline outside the box, and \includegraphics baseline is at the bottom of the image.

Solution

In order to align the image with other minipages, I needed to move its baseline upwards (for example using \raisebox command). Therefore, I obtained the desired result by wrapping \includegraphics in a \raisebox{-\height} command which raised the picture by its height:

\newcommand{\mygraphic}[1]{
  \raisebox{-\height}{\includegraphics[width=.5\linewidth]{#1}}}

Result

enter image description here

mikyll98
  • 123
  • 5