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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if there are any way to set the background color of the header part (the one that contains personal info) of a file that uses moderncv in order to visually differentiate the header and the content.

I tried with minipage, \hfill and so on but I guess that moderncv uses a heavily customized template and everything I've tried so far lead to a compile error.

share|improve this question
What do you mean with the "header" part? Is it the header as in headers/footers of a document or is it the part containing the name and personal information? Which theme (casual, classic) are you using? – Gonzalo Medina Mar 5 '14 at 23:54
I mean the part containing personal info. Currently I'm using the classic theme. – Ketouem Mar 6 '14 at 0:00
up vote 9 down vote accepted

One option using the tikzmark library:


\address{\tikzmark{start}street and number}{postcode city}{country}
\extrainfo{additional information\tikzmark{end}}
\quote{Some quote}


\begin{tikzpicture}[remember picture,overlay]
  (current page.north west) rectangle ([yshift=-1cm]current page.east|-{pic cs:end});



\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  \cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{description}{Short thesis abstract}

\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
  \item Sub-achievement (c);
\item Achievement 3.


enter image description here

You place some mark(s) using \tikzmark and then use those marks to draw a rectangle filled with the desired color. In my example code I used

\begin{tikzpicture}[remember picture,overlay]
  (current page.north west) rectangle ([yshift=-1cm]current page.east|-{pic cs:end});

which draws a rectangle having opposite vertices in (current page.north west) (i.e., the upper left corner of the page) and in the point with coordinates ([yshift=-1cm]current page.east|-{pic cs:end}) (this means 1cm below the point that has the same x-coordinate as the leftmost end of the page and the y-coordinate of the point marked end); the end mark was placed inside \extrainfo which was the lowest element used in the personal information. I also placed a start mark in the upper field of the personal information, but I never used this mark.

Feel free to change the colors, and position of the colored background, according to your needs.

share|improve this answer
Awesome results, great explanations. You sir, deserves an upvote ! – Ketouem Mar 6 '14 at 0:18

Your Answer


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.