# How do I make a header for whole document?

I was looking for this topic. How could I solve it?

I have an issue with the code, when I define the header:

\documentclass[12pt,a4paper]{book}
\title{\textbf{TITLE}}
\usepackage[spanish]{babel}
\usepackage{pdflscape}
\usepackage{color, colortbl}
\definecolor{Gray}{gray}{0.9}
\usepackage{caption}
\usepackage{enumitem}

\captionsetup[table]{skip=10pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{
\markright{\thesection\ #1}}
\fancyhf{}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{
}

\begin{document}

\maketitle
\newpage
\tableofcontents

\section{RESUMEN EJECUTIVO}
\begin{enumerate}[label=\Alph*]
\item Los Par\'asitos
\item Cuantificar
\end{enumerate}

\end{document}

-
Use fancyhdr. – Harish Kumar Dec 12 '12 at 13:33
Please, give some more information. What class are you using? What form should this header have? – egreg Dec 12 '12 at 13:37
I got an error. This is the code. Is there something wrong? – Isai Dec 12 '12 at 13:38
The in the \renewcommand{\headrulewidth}{Opt}, the last argument should be 0pt (a zero), instead of an uppercase O. Also, if you are writting in spanish, you may want to use the inputenc package: \usepackage[utf8]{inputenc}, so you can write "parásitos" directly. – guillem Dec 12 '12 at 14:01
@guillem Good point, I mean for spanish writing. Thanks a lot. – Isai Dec 12 '12 at 19:09

In this:

\fancypagestyle{plain}{
}


you have an "O" (the vowel) instead of a zero; here's your code with the corrected zero and some other modifications (I increased \headheight conveniently and instead of loading color and colortbl, you can load xcolor with the table option) and suppressed some information that was not relevant to the header issue:

\documentclass[12pt,a4paper]{book}
\usepackage[spanish]{babel}
\usepackage{pdflscape}
\usepackage[table]{xcolor}
\usepackage{caption}
\usepackage{enumitem}
\usepackage{fancyhdr}

\definecolor{Gray}{gray}{0.9}
\captionsetup[table]{skip=10pt}

\pagestyle{fancy}
\fancyhf{}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{
}
\renewcommand{\chaptermark}[1]{
\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{
\markright{\thesection\ #1}}

\begin{document}

\section{RESUMEN EJECUTIVO}
\begin{enumerate}[label=\Alph*]
\item Los Par\'asitos
\item Cuantificar
\end{enumerate}

\end{document}


Note that without a \chapter before \section you'll get an odd numbering.

-
Thanks, I also got it with: \usepackage{fancyhdr} \usepackage{lipsum} \pagestyle{fancy} \headheight=10pt \fancyhf{} \lhead{TITLE} \thispagestyle{fancy} But I have another question: I want a small font for the header. – Isai Dec 12 '12 at 14:02
@Isai use an appropriate font size switch; for example: \fancyhead[LE,RO]{\bfseries\footnotesize\thepage} \fancyhead[LO]{\bfseries\footnotesize\rightmark} \fancyhead[RE]{\bfseries\footnotesize\leftmark}  – Gonzalo Medina Dec 12 '12 at 14:10
@Isai You're welcome! I'm glad I could help. By the way, \fotnotesize does not receive arguments, so you could use \rhead{\footnotesize TITLE\\ \textbf{Title}}. – Gonzalo Medina Dec 12 '12 at 19:16