3

I try to create my CV with Modern CV. Here is a small code :

\documentclass[10pt,a4paper]{moderncv}
\moderncvtheme[blue]{classic}                
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amssymb}

\usepackage[inner=1.2cm,outer=1.2cm,top=0.4cm,bottom=0.4cm]{geometry}

\usepackage{sourcesanspro}
\renewcommand*{\sectionfont}{\Large\bfseries\scshape}

\firstname{\Large{Aaaa}}
\familyname{\Large{\textsc{Bbbb}}}
\title{\normalsize Iiiiiiiiiiiii }
\address{\textbf{113 iiiii}}{\textbf{000 Vvvvv}}  
\mobile{\textbf{0000000}}             
\email{aaaaaa@aaa.fr} 
\extrainfo{\textbf{bla bla}}  

\begin{document}
\pagestyle{empty}
\maketitle

\section{Experience}
\end{document}

As you can see "Experience" section is preceded by a huge blue line. I would like the same line to appear after "Experience" and to expand as long as I want (until it reaches the margin as a limitation). Is that possible ?

3

Add the following lines in your preamble

\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}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}%
  \hspace{\separatorcolumnwidth}%
  \parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#2}\hspace{\separatorcolumnwidth}%
    \strut\raisebox{\baseletterheight}{\color{color1}\rule{\maincolumnwidth-\widthof{\sectionstyle{#2}}-\separatorcolumnwidth}{0.95ex}}}%
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

to achieve what you want.

MWE (notice that I've added the option sans to moderncv since you're loading sourcesanspro):

\documentclass[10pt,a4paper,sans]{moderncv}
\moderncvtheme[blue]{classic}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amssymb}

\usepackage[inner=1.2cm,outer=1.2cm,top=0.4cm,bottom=0.4cm]{geometry}

\usepackage{sourcesanspro}
\renewcommand*{\sectionfont}{\Large\bfseries\scshape}

\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}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}%
  \hspace{\separatorcolumnwidth}%
  \parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#2}\hspace{\separatorcolumnwidth}%
    \strut\raisebox{\baseletterheight}{\color{color1}\rule{\maincolumnwidth-\widthof{\sectionstyle{#2}}-\separatorcolumnwidth}{0.95ex}}}%
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

\firstname{\Large{Aaaa}}
\familyname{\Large{\textsc{Bbbb}}}
\title{\normalsize Iiiiiiiiiiiii }
\address{\textbf{113 iiiii}}{\textbf{000 Vvvvv}}
\mobile{\textbf{0000000}}
\email{aaaaaa@aaa.fr}
\extrainfo{\textbf{bla bla}}

\begin{document}
\pagestyle{empty}
\maketitle

\section{Experience}
\end{document} 

Output

enter image description here

|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.