2

I'm using Modern CV to create my cv : http://www.latextemplates.com/template/moderncv-cv-and-cover-letter

As you can see from the example of this page (John Smith) , each section (like "Education") is preceded by a line in bold. I would like to :

  • reduce or increase the length / size of this line
  • highlight each section such as underlining "Education" or adding a local font

Is that possible to do that ? Any example would be welcome !

Edit : an example would be :

\documentclass[11pt,a4paper,sans]{moderncv} 

\moderncvstyle{casual} 
\moderncvcolor{blue} 

\usepackage[scale=0.75]{geometry} 

%----------------------------------------------------------------------------------------
%   NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------

\firstname{John} % Your first name
\familyname{Smith} % Your last name

% All information in this block is optional, comment out any lines you don't need
\title{Curriculum Vitae}
\address{123 Broadway}{City, State 12345}
\mobile{(000) 111 1111}
\phone{(000) 111 1112}
\fax{(000) 111 1113}
\email{[email protected]}
\homepage{staff.org.edu/~jsmith}{staff.org.edu/$\sim$jsmith}

%----------------------------------------------------------------------------------------

\begin{document}

\makecvtitle % Print the CV title

%----------------------------------------------------------------------------------------
%   EDUCATION SECTION
%----------------------------------------------------------------------------------------

\section{Education}

\end{document}

So I would like to underline "Education" in the same color than text and to reduce bold line size / length on the left

2
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – Adam Liter
    Dec 15, 2014 at 17:56
  • You can have a look at our starter guide to familiarize yourself further with our format. Dec 15, 2014 at 18:36

1 Answer 1

5

Add the following lines in your preamble:

\makeatletter
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{\underline{#1}}}}
\RenewDocumentCommand{\section}{sm}{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#2}%
  \parbox[t]{3em}{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{3em}{0.55ex}}}%
  \hspace{\separatorcolumnwidth}%
  \parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#2}}%
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

This re-defines the way the section title is typeset as you've requested:

enter image description here

Complete code:

\documentclass[11pt,a4paper,sans]{moderncv}

\moderncvstyle{casual}
\moderncvcolor{blue}

\makeatletter
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{\underline{#1}}}}
\RenewDocumentCommand{\section}{sm}{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#2}%
  \parbox[t]{3em}{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{3em}{0.55ex}}}%
  \hspace{\separatorcolumnwidth}%
  \parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#2}}%
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

\usepackage[scale=0.75]{geometry}

%----------------------------------------------------------------------------------------
%   NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------

\firstname{John} % Your first name
\familyname{Smith} % Your last name

% All information in this block is optional, comment out any lines you don't need
\title{Curriculum Vitae}
\address{123 Broadway}{City, State 12345}
\mobile{(000) 111 1111}
\phone{(000) 111 1112}
\fax{(000) 111 1113}
\email{[email protected]}
%\homepage{staff.org.edu/~jsmith}{staff.org.edu/$\sim$jsmith}

%----------------------------------------------------------------------------------------

\begin{document}

\makecvtitle % Print the CV title

%----------------------------------------------------------------------------------------
%   EDUCATION SECTION
%----------------------------------------------------------------------------------------

\section{Education}

\end{document} 

EDIT

If, instead of underlining the section title, you want it boxed, substitute the line

\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{\underline{#1}}}}

with

\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{\fbox{#1}}}}

and the result will be

enter image description here


EDIT #2

If you want to completely remove the line before the section title, delete the lines

  \parbox[t]{3em}{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{3em}{0.55ex}}}%
  \hspace{\separatorcolumnwidth}%

and you'll get

enter image description here

P.S. I wouldn't increase the width of the box, otherwise it is too heavy looking...

4
  • Hi karlkoeller thanks for yout answer. Then : how could I do same but by underlining in BOLD ? How could I do same by using some kind of double line (like \uuline) ? And finally I was wondering if I could surround the text with a rectangle or similar ?
    – abel
    Dec 15, 2014 at 18:44
  • @abel See the edit. Dec 15, 2014 at 19:15
  • Thanks karlkoeller. In order to box or underline in bold I would need to redefine something but I don't know how. On the other hand, do you know how I could simply suppress bold line on the left of education ?
    – abel
    Dec 15, 2014 at 19:23
  • @abel See the edit #2 Dec 15, 2014 at 20:01

You must log in to answer this question.

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