4

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?

4

Here you go:

\RenewDocumentCommand{\section}{sm}{%
  \strut\sectionstyle{#2\hfill}%
  \par\nobreak\addvspace{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}{%
  \strut\sectionstyle{#2\hfill}%
  \par\nobreak\addvspace{1ex}\@afterheading
  }

\RenewDocumentCommand{\subsection}{sm}{
  \strut\subsectionstyle{#2}{\color{color1}{\subsectionfill}}%
  \par\nobreak\addvspace{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

| improve this answer | |
  • Thank you! Can you pls me, where I have to put in the first Codex? The ModernCV file or the style file? – Aline May 24 '14 at 12:59
  • The first code must be put after your \usepackages commands , it has to begin with \makeatletter , then the code , followed by \makeatother. Then, your commands for the title like \name etc, then \begin{document} and end{document}. See the MWE for reference.@Aline – subham soni May 24 '14 at 13:04
1

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}{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#2}%
  \parbox[t]{\hintscolumnwidth}{\strut\raggedleft\raisebox{\baseletterheight}{\rule{\hintscolumnwidth}{0ex}}}%
  \hspace{\separatorcolumnwidth}%
  \parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#2}}%
  \par\nobreak\addvspace{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}{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#2}%
  {\strut\sectionstyle{#2}}%
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

for removing the bar completely.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.