TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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'm currently writing a latex code generator to make invoices and I have a problem with my headers. I'm using fancy headers to make my headers and I'm using the output of the compiler to set the height of the header and the text. My problem is that my header is not at the same position on the first and the second page. It is higher on the first page and I don't find any solution to this problem.

Here is the code :

% setting language                                                                          

% geometry --> margin ++                                                                    



\newcommand\VRule[1][\arrayrulewidth]{\vrule width #1}                                                                                                                                                  


         Left part                                          
         Right part       
\fancyhead[R]{ \vtop{\begin{tabular}{l} \textbf{Devis n° 5}\\\textbf{Original}\\Page  \end{tabular}}}                                                           
\fancyfoot[C]{\textbf{Masidaso Consulting - N° TVA :BE0834757576}\\}                        


% début du corps                                                                            



        \begin{tabularx}{\linewidth}{!{\VRule[2pt]}X!{\VRule[2pt]}X!{\VRule[2pt]}X!{\VRule[2pt]}}  \specialrule{2pt}{0pt}{0pt} Client & Intelocuteur & Page \\   \specialrule{2pt}{0pt}{0pt} 2 - Minou Chat & Mr le vendeur & page \\  \specialrule{2pt}{0pt}{0pt} \end{tabularx}                                                                                  

share|improve this question
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. – N.N. Jan 13 '12 at 15:18
try adding \thispagestyle{fancy} after \begin{document} but before anything else is set. – barbara beeton Jan 13 '12 at 15:28
Ok I wont thank people in advance next :-) You guys are quite fast! @barbara beeton : your solution does not work but the one given below does. – Thibault Dory Jan 13 '12 at 16:47
This is a lot of code. Even though you already got an answer, it'd be nice if you could remove everything from the code that's not related to your problem to make it a so-called minimal working example (MWE), that people can copy and compile to reproduce your problem. This way, your problem becomes relevant for a wider audience. All the tables and font definitions have nothing to do with the headers. If you need filler text, you can use e.g. the lipsum package. – doncherry Jan 13 '12 at 17:27
I've updated the code to remove what's not related to the problem. Nevertheless, I still need at least one table in the document section for the \renewcommand{\arraystretch}{X} to be relevant. I hope it's short enough. If there are other concerns, just tell me and I'll try to fix them :-) – Thibault Dory Jan 13 '12 at 18:59
up vote 2 down vote accepted

The problem is that you're changing \arraystretch in the middle of the document, and this is reflected in the typesetting of the headers. Add \renewcommand{\arraystretch}{1} in the fields \fancyhead where you use tabulars. However the definitions seem quite complicated; the following code seems simpler.

    \chancery{\textbf{\LARGE Masidaso Consulting}}\\
    E-mail :  \href{mailto:minou@gmail.com}{minou@gmail.com}\\
    Tel : 0486609929\\
    ligne \\ ligne \\ ligne \\ ligne \\ ligne
    \textbf{Devis n° 5}\\
    Page \thepage{} / \pageref{LastPage}

For this header, fancyhdr reports a height of 102pt.

share|improve this answer
It works perfectly! Could you tell me how you get the height of the header with fancyhdr? For the moment I simply run the compiler and get the height from the warning in the log. – Thibault Dory Jan 13 '12 at 17:11
@ThibaultDory The same method I used: I put no setting of \headheight and compiled. :) – egreg Jan 13 '12 at 17:16

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.