6

I'm using moderncv for my CV. I tweaked with moderncvstyleclassic.sty quite a bit and I'm almost there in terms of the result I want. There's just 1 last thing I cannot solve: I would like to add a logo at the right-end side of the \cventry.

At the moment, I created a new command, \cventrylogo:

\renewcommand*{\cventrylogo}[8][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6.}%
    \ifthenelse{\equal{#7}{}}{}{\hfill \includegraphics[scale=0.25]{#7}}%
    \strut%
    \ifx&#8&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#8\end{minipage}}\fi}}

which then I use like this:

\section{Experience}
\cventrylogo{2015}{Short Term Scientific Collaborator}{M\'et\'eosuisse}{Payerne}{Switzerland}{logo_meteosuisse}{}
\cventrylogo{2009--2014}{PhD. in Physical Chemistry}{ETH}{Zurich}{Switzerland}{logo_eth}{}
\cventrylogo{2006--2008}{Process Development Engineer}{STM S.p.A.}{Agrate Brianza}{Italy}{logo_st}{}
\cventrylogo{2004--2005}{Internship}{Alenia Spazio S.p.A.}{Turin}{Italy}{logo_tas}{}

The results is as follows:

enter image description here

I already had a look at similar questions, 1 and 2, but this is not exactly what I want. There are 2 problems. First the images are aligned at the bottom and I would like to have them aligned at the center of the text and second, I would love to have the option of specify the size of the images in the \cventrylogo command, but implement this is beyond my abilities. Any help would be greatly appreciated.


I answered to this question myself with help from Harish Kumar, providing a MWE for use.

7
  • Try \newcommand{\cventrylogo}[9][.25em]{% \cvitem[#1]{#2}{% {\bfseries#3}% \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}% \ifthenelse{\equal{#5}{}}{}{, #5}% \ifthenelse{\equal{#6}{}}{}{, #6}% \ifthenelse{\equal{#7}{}}{}{% \ifthenelse{\equal{#8}{}}{\hfill \raisebox{-0.5\height}{\includegraphics[width=6mm]{#7}}}% {\hfill \raisebox{-0.5\height}{\includegraphics[width=#8]{#7}}}}% \strut% \ifx&#9&% \else{\newline{}\begin{minipage}[t]{\linewidth}\small#9\end{minipage}}\fi} }.
    – user11232
    Commented May 4, 2015 at 0:28
  • @HarishKumar: Thanks for the answer. Unfortunately that does not work. I get this error: ! LaTeX Error: Command \cventrylogo already defined. Furthermore, I do not understand the last bit of it, when you pass the width as a parameter. I should use {\hfill \raisebox{-0.5\height}{\includegraphics[width=6mm]{#7}}} OR {\hfill \raisebox{-0.5\height}{\includegraphics[width=#8]{#7}}}}, right? Commented May 4, 2015 at 18:01
  • Use \renewcommand instead of \newcommand. YoWith above, you should use \cventrylogo{2006--2008}{Process Development Engineer}{STM S.p.A.}{Agrate Brianza}{Italy}{example-image-a}{6mm}{} or \cventrylogo{2004--2005}{Internship}{Alenia Spazio S.p.A.}{Turin}{Italy}{example-image-a}{}{} (with no width).
    – user11232
    Commented May 5, 2015 at 0:20
  • If you give a full mwe (starting from \documentclass) and ending at \end{document}, I can test it.
    – user11232
    Commented May 5, 2015 at 0:21
  • @HarishKumar: I'll try the suggested modification and post a MWE as soon as I get home. Here at work I do not have access to my CV. Thanks for the answer Commented May 5, 2015 at 7:26

1 Answer 1

1

It now works as I wanted, using the command \cventrylogo defined as this:

\renewcommand{\cventrylogo}[9][.25em]{% 
\cvitem[#1]{#2}{% 
  {\bfseries#3}% 
  \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}% 
  \ifthenelse{\equal{#5}{}}{}{, #5}% 
  \ifthenelse{\equal{#6}{}}{}{, #6.}% 
  \ifthenelse{\equal{#7}{}}{}{% 
    \ifthenelse{\equal{#8}{}}{}{\hfill \raisebox{-0.5\height}{\includegraphics[width=#8]{#7}}}}%
  \strut% 
  \ifx&#9&% 
    \else{\newline{}\begin{minipage}[t]{\linewidth}\small#9\end{minipage}}\fi} }

here is the MWE, for further reference for whom it may use it:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue} 
\usepackage[utf8]{inputenc}

\usepackage[scale=0.8]{geometry} 

\name{Riccardo}{I.}
\title{Title title}
\address{XXX}{place ville}{}
\phone[mobile]{+00~(0)~00~000~00~00}    
\email{[email protected]} 

\begin{document}

\makecvtitle

\section{Experience}
\cventrylogo{2015}{Short Term Scientific Collaborator}{M\'et\'eosuisse}{Payerne}{Switzerland}{logo_meteosuisse}{16mm}{}
\cventrylogo{2009--2014}{PhD. in Physical Chemistry}{ETH}{Zurich}{Switzerland}{logo_eth}{25mm}{}
\cventrylogo{2006--2008}{Process Development Engineer}{STM S.p.A.}{Agrate Brianza}{Italy}{logo_st}{18mm}{}
\cventrylogo{2004--2005}{Internship}{Alenia Spazio S.p.A.}{Turin}{Italy}{logo_tas}{20mm}{}

\end{document}

You must log in to answer this question.

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