TransWikia.com

Remove blank line in moderncv

TeX - LaTeX Asked on September 28, 2021

I’m currently creating a CV with moderncv in Overleaf. I’m using pdfLaTeX and the 2014 (Legacy) version of TeX Live. (I am trying to reuse a template from my professor which displays incorrectly if using a more recent version). There are still a few problems I am having with getting my output to display correctly. Here is my code:

documentclass[11pt,a4paper,roman]{moderncv}
moderncvstyle{banking}
moderncvcolor{black}
usepackage[utf8]{inputenc}
usepackage[scale=0.76]{geometry}
name{John}{Doe}
title{Resumé tite}
address{street and number}{postcode city}{country}
phone[mobile]{+1~(234)~567~890}
phone[fixed]{+2~(345)~678~901}
phone[fax]{+3~(456)~789~012}
email{[email protected]}

begin{document}
makecvtitle

section{EMPLOYMENT}
vspace{1pt}
cventry{}{}{Assistant Professor}{Since March 2020}{}{Department 
        of LaTeX, Science University}{}

% --------------------------------------------------------------------
section{EDUCATION}
vspace{1pt}
cventry{}{}{PhD, Science University}{2019}{}
        {Thesis title: textit{Lorem Ipsum}  Supervisor: Jacob Smith}{}


end{document}

enter image description here

I would like to be able to increase the vertical space between the title line and the address line. I would also like to remove the blank lines between the bolded text and the normal text underneath (e.g. "Assistant Professor" and "Department of LaTeX, Science University").

One Answer

I would like to be able to increase the vertical space between the title line and the address line.

If you are using banking style of moderncv, the definition of makehead is defined in moderncvheadiii.sty as follows:

@initializecommand{makehead}{%
  setlength{makeheaddetailswidth}{0.8textwidth}%
  hfil%
  parbox{makeheaddetailswidth}{%
    centering%
    namestyle{@firstname~@lastname}%
    ifthenelse{equal{@title}{}}{}{titlestyle{~|~@title}}
    if@details{%
      addressfontcolor{color2}%
      ifthenelse{isundefined{@addressstreet}}{}{addtomakeheaddetails{addresssymbol@addressstreet}%
        ifthenelse{equal{@addresscity}{}}{}{addtomakeheaddetails[~--~]{@addresscity}}%
        ifthenelse{equal{@addresscountry}{}}{}{addtomakeheaddetails[~--~]{@addresscountry}}%
        
...

}

So all what you need to do is to hack this to insert some vertical space between and if@details. This is all the hack you need to do around makecvtitle in your document:

begin{document}
makeatletter
letif@detailsoriginalif@details
defif@details{vskip1.0baselineskipif@detailsoriginal}
makecvtitle
letif@detailsif@detailsoriginal
makeatother

You can change the space amount by modifying the value of 1.0baselineskip.

Result: Reult


I would also like to remove the blank lines between the bolded text and the normal text underneath (e.g. "Assistant Professor" and "Department of LaTeX, Science University").

If you are using banking style of moderncv, the definition of cventry is defined in moderncvbodyiii.sty as follows:

renewcommand*{cventry}[7][.25em]{
  begin{tabular*}{maincolumnwidth}{l@{extracolsep{fill}}r}%
    {bfseries #4} & {bfseries #5}%
    {itshape #3ifthenelse{equal{#6}{}}{}{, #6}} & {itshape #2}%
  end{tabular*}%
        
  ...
  
  }

You see a tabular* environment inside. So what you need to do is to change arraystretch. For example, if you write this in your preamble you can smash the interline between the bolded text and the normal text by setting the stretch zero:

letcventryoriginalcventry
defcventry#1#2#3#4#5#6#7{bgrouprenewcommandarraystretch{0}cventryoriginal{#1}{#2}{#3}{#4}{#5}{#6}{#7}egroup}

Result: Result

Again, you can change the amount of vertical space by modifying the value of arraystretch{0}.


Update: as for moderncv 2012 ver.

The title command makecvtitle calls for maketitle which is defined in moderncvstylebanking.sty as follows:

renewcommand*{maketitle}{%
  setlength{maketitlewidth}{0.8textwidth}%
  hfil%
  parbox{maketitlewidth}{%
    centering%
    namestyle{@firstname~@familyname}%
    ifthenelse{isundefined{@title}}{}{titlestyle{~|~@title}}%
    addressfontcolor{color2}%
    ifthenelse{isundefined{@addressstreet}}{}{addtomaketitle{addresssymbol@addressstreet}%
      ifthenelse{equal{@addresscity}{}}{}{addtomaketitle[~--~]{@addresscity}}flushmaketitle@firstmaketitleelementtrue}

...

}

So all what you need to do is to hack this to insert some vertical space between and addressfont. This is all the hack you need to do around makecvtitle in your document:

begin{document}
letaddressfontoriginaladdressfont
defaddressfont{vskip1.0baselineskipaddressfontoriginal}
makecvtitle
letaddressfontaddressfontoriginal

You can change the space amount by modifying the value of 1.0baselineskip.

Correct answer by domperor on September 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP