TransWikia.com

ModernCV Remove horizontal line in sections

TeX - LaTeX Asked by Aline on October 11, 2020

I want to write my cv with moderncv-Classic style. Can you tell me, how I can remove the horizontal line in the left of each section?

2 Answers

Here you go:

RenewDocumentCommand{section}{sm}{%
  strutsectionstyle{#2hfill}%
  parnobreakaddvspace{1ex}@afterheading
  }

The above code is the core of what is required. Now time for an MWE:
The MWE

documentclass[12pt,letterpaper]{moderncv}
moderncvstyle{classic}
moderncvcolor{blue}
usepackage{libertine}
usepackage[left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}
usepackage{kantlipsum}

makeatletter
RenewDocumentCommand{section}{sm}{%
  strutsectionstyle{#2hfill}%
  parnobreakaddvspace{1ex}@afterheading
  }

RenewDocumentCommand{subsection}{sm}{
  strutsubsectionstyle{#2}{color{color1}{subsectionfill}}%
  parnobreakaddvspace{0.5ex}@afterheading}
%
makeatother

name{SUBHAM}{SONI}
address{ABC}{XYZ}{PQR}
phone[mobile]{1234567}

begin{document}
makecvtitle
section{CAREER OBJECTIVE}
kant[1]
end{document} 

enter image description here

Answered by subham soni on October 11, 2020

It largely depends on the style you are using (and on the version of moderncv) which is the reason why a MWE would be good.

Assuming you are using the latest version of moderncv and the classic or casual theme you can put

makeatletter
RenewDocumentCommand{section}{sm}{%
  paraddvspace{2.5ex}%
  phantomsection{}% reset the anchor for hyperrefs
  addcontentsline{toc}{section}{#2}%
  parbox[t]{hintscolumnwidth}{strutraggedleftraisebox{baseletterheight}{rule{hintscolumnwidth}{0ex}}}%
  hspace{separatorcolumnwidth}%
  parbox[t]{maincolumnwidth}{strutsectionstyle{#2}}%
  parnobreakaddvspace{1ex}@afterheading}% to avoid a pagebreak after the heading
makeatother

in your preamble (before begin{document}) to get sections with an invisible bar or

makeatletter
RenewDocumentCommand{section}{sm}{%
  paraddvspace{2.5ex}%
  phantomsection{}% reset the anchor for hyperrefs
  addcontentsline{toc}{section}{#2}%
  {strutsectionstyle{#2}}%
  parnobreakaddvspace{1ex}@afterheading}% to avoid a pagebreak after the heading
makeatother

for removing the bar completely.

Answered by Bordaigorl on October 11, 2020

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