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.

The title is self-explanatory.

In my document's current state, I get this rendering result after compiling with XeLaTeX :

result

Here's a MWE of which packages and commands I use to obtain my current header style :

\documentclass{report}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}

\usepackage{lipsum}% http://www.ctan.org/tex-archive/macros/latex/contrib/lipsum

\usepackage{titlesec}
\usepackage{xcolor}


\renewpagestyle{plain}[\small\sffamily\upshape\color{red}]{
    \headrule
    \sethead{\chaptertitle}{}{Université de la Rochelle}
}


\author{ME}
\title{Bash report}

\pagestyle{plain}
\begin{document}
\maketitle

\tableofcontents
\thispagestyle{empty}

\chapter{Matrices de convolution}
\lipsum

\lipsum
\end{document}

What I actually would like is to color "red" the lines created by the header and footer.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

titlesec defines helper macros to set up the lines, this drops red into the head line

enter image description here

\documentclass{report}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}

\usepackage{lipsum}% http://www.ctan.org/tex-archive/macros/latex/contrib/lipsum

\usepackage{titlesec}
\usepackage{xcolor}

\makeatletter

\newcommand\setheadrule[1]{%
  \ifdim#1=\z@
    \let\makeheadrule\@empty
  \else
    \def\makeheadrule{{\color{red}\rule[-.3\baselineskip]{\linewidth}{#1}}}%
  \fi}

\makeatother


\renewpagestyle{plain}[\small\sffamily\upshape]{
    \headrule
    \sethead{\chaptertitle}{}{Universite de la Rochelle}
}


\author{ME}
\title{Bash report}

\pagestyle{plain}
\begin{document}
\maketitle

\tableofcontents
\thispagestyle{empty}

\chapter{Matrices de convolution}
\lipsum

\lipsum
\end{document}

The foot rule command is by default

\newcommand\setfootrule[1]{%
  \ifdim#1=\z@
    \let\makefootrule\@empty
  \else
    \def\makefootrule{\rule[.7\baselineskip]{\linewidth}{#1}}%
  \fi}

But not apparently used in this MWE so I didn't change it/

share|improve this answer
    
I have an error if I insert the hack that you wrote in my current document state, I get the following compilation error (using XeLaTeX) : ! LaTeX Error: Command \setheadrule already defined. Or name \end... illegal, see p.192 of the manual. –  Oddant Feb 22 '13 at 20:31
    
I just added [pagestyles] to the \usepackage{titlesec} inclusion, works fine now. –  Oddant Feb 22 '13 at 20:38
add comment

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.