I have made a heading for my final degree project where an image appears, my name and the name of the project, but it only appears on the first page of each chapter, in the others the heading that LaTeX puts by default appears. This is the code for my header:

       % Nombre del documento 
         \newcommand{\titulo}{\textsc{Búnker portátil para radiología industrial}}
        % Nombre de la Unidad en concreto
         \newcommand{\autor}{\textsc{Juan Francisco Molina Pérez}}
        % Nombre del módulo (asignatura)
            {\color{light-gray} \footnotesize \titulo} \\
            {\color{light-gray} \footnotesize \autor}  \\
            \color{light-gray} \seccion 
        \let\oldheadrule\headrule % Copy \headrule into \oldheadrule
        \renewcommand{\headrule}{\color{orange}\oldheadrule} % Add colour to \headrule       
        \rfoot{Página \thepage\ de \pageref{LastPage}}  % Número de página
        \cfoot{} %para vaciar número de página que viene por defecto


It should be noted that I have divided the work into parts in LaTeX, making a file only for the header and calling it in the general file of the TFG.

  • 5
    Hello and welcome to Text.Se. The common language used here is english. So please ask your question in english so that other people can help you with your problem.
    – Roland
    Mar 13 at 13:30
  • 1
    ¿Puede por favor, hacer su pregunta en Inglés?
    – Ingmar
    Mar 13 at 13:31
  • I run your text in an online translator. Next time please do it yourself.
    – campa
    Mar 13 at 14:04
  • 3
    Please specify at least what document class you are using. Most document classes specify the plain style only for the first page of a chapter, and a different style (often headers) for all other pages. Mar 13 at 16:05

You are making the adjustments only to the pagestyle plain, which by default appears on title and chapter pages only. There are two options to change where the header appears.


If you want to use your header definition as it is for every page, you can add


after the definition, to make 'normal' pages also use the plain style.


If you want the header to appear on all pages, except at the beginning of a chapter (wich is the default and usually the desired behavior), you can set your header definition for a different style, like in this MWE:



    \lhead{left head}
    \rhead{right head}


I prepared a document with two chapters and seven pages. Usually you define two styles: plain and fancy.

With the standard classes every \chapter invokes the plain style. The fancy style is applied to the normal pages.

You can also define others styles (I used the name withphoto for the third) that can be called in particular pages using \thispagestyle{withphoto}

Choice one: you want your photo at the beginning of every chapter.

You need to define two pagestyles: plain, that is invoked by chapter, and fancy for rest of the pages.

Choice two: you want your photo only at the beginning of the first chapter.

You need three styles: withphoto to be invoked once as \thispagestyle{withphoto}, plain called by every other chapter and fancy the style used by normal pages.



This is the code for the second choice. Note he use of the package geometry to create space for the photo.


\usepackage[top=4cm, bottom=3cm, left=2.5cm, right=2cm, headheight=1.5cm]{geometry}



\usepackage{kantlipsum} % dummy texto

% Nombre del documento 
\newcommand{\titulo}{\textsc{Búnker portátil para radiología industrial}}
% Nombre de la Unidad en concreto
\newcommand{\autor}{\textsc{Juan Francisco Molina Pérez}}
% Nombre del módulo (asignatura)

\let\oldheadrule\headrule% Copy \headrule into \oldheadrule
\renewcommand{\headrule}{\color{red}\oldheadrule}% Add colour to \headrule

\fancypagestyle{plain}{% first page of chapters after the first
    \fancyfoot[R]{Página \thepage\ de \pageref{LastPage}}  % Número de página

\fancypagestyle{fancy}{% normal pages
%\fancyhead[L]{Sección \rightmark}  % ALTERNATIVE
\fancyhead[R]{Página \thepage\ de \pageref{LastPage}}

\fancypagestyle{withphoto}{% only first chapter
        {\color{gray} \footnotesize \titulo} \\
        {\color{gray} \footnotesize \autor}  \\
        {\color{gray} \footnotesize \seccion }
    \fancyfoot[R]{Página \thepage\ de \pageref{LastPage}}  % Número de página

\pagestyle{fancy} % set fancy headers for normal pages

\chapter{El primero}
1.  \kant[1-3]  
2.  \kant[4-8]          
3.  \kant[2-5]  
\chapter{El segundo}    
4.  \kant[9-12]     
5. \kant[15-20] 

If want the Choice one convert withphoto in plain and comment \thispagestyle{withphoto}.


  • Thank you very much for your help! Mar 16 at 18:30
  • I have remake the header how you said to me, but now I have a new probblem. With the new code, Latex say to me this: Timed out. Sorry, your compile took too long to run and timed out. This may be due to a LaTeX error, or a large number of high-res images or complicated diagrams. I have convert the image in the header to pdf, but this not solved the problem. ¿What can I do?. Thanks. Mar 16 at 18:53
  • I think you should ask a new question. The problem you mention is not coming from the image of the header, but form the code you are running. Meanwhile comment it part by part to try to pinpoint the origin. Mar 16 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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