Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using moderncv as follows;

\documentclass{moderncv}

\moderncvtheme[black]{casual}

I'd like to remove the coloured struts/rectangles/boxes, adjacent to section headings, from the output.

Can someone please tell me how to do this? I have previously used latex only for article writing.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Write after your given two lines to change the color of the leading box to white:

\definecolor{mycolor}{rgb}{255,255,255}   % color white
\makeatletter                             % make @ a letter
\renewcommand*{\section}[1]{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#1}%
  \parbox[t]{\hintscolumnwidth}{\strut\raggedleft\raisebox{\baseletterheight}{\color{mycolor}\rule{\hintscolumnwidth}{0.95ex}}}%
  \hspace{\separatorcolumnwidth}%
  \parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#1}}%
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\makeatother

This workaround runs with the styles casual and classic but not with banking. I changed only the used color from \color{color1} to \color{mycolor} and set mycolor to white. The original definition of macro section you can find in the file moderncvstyleclassic.sty.

Have you checked the style banking? This style does not use colored boxes.

share|improve this answer
    
This works perfectly. Many thanks! –  phy5rd Jul 16 '12 at 9:06

Adding

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\patchcmd{\section}% <cmd>
  {\strut}% <search>
  {\strut\renewcommand{\raisebox}[2]{}}% <replace>
  {}{}% <success><failure>

to your document preamble removes the boxes altogether by making the \raisebox command equivalent to a no-op, thereby gobbling its two arguments. This redefinition of \raisebox is local, since it is executing inside a \parbox.

The output below is obtained using the casual template (template.tex) with a black style and using the image example-image-16x10 (from the mwe package) for the \photo:

enter image description here

share|improve this answer
    
Clever workaround! –  Xavier Jun 10 '13 at 3:07
    
This did not work for me, but the other answer did. Any ideas of why this does not work now? Has the moderncv package changed since this was posted? –  matsr Sep 30 '13 at 18:55
    
@matsr: Yes, it seems that way. I'll fix this later. –  Werner Sep 30 '13 at 19:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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