Friday, November 24, 2006

Latex: \headheight is too small

You never know what you will meet when you use Latex, luckily, we can search Google or Yahoo to find the answer. However, it cannot help all the times. There is a problem you may come across using package fancyhdr:

Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 14.49998pt.
We now make it that large for the rest of the document.

It was not easy to find the answer via either Google or Yahoo. Here is the solution. Insert

\setlength{\headheight}{15pt}

in the preamble, i.e. before \begin{document}.

Tips:
  • \headheight defines the height of the header.

  • \setlength{len-cmd}{length}
The \setlength command is used to set the value of a length command, len-cmd, which is specified as the first argument. The length argument can be expressed in any terms of length LaTeX understands, i.e., inches (in), millimeters (mm), points (pt), etc.

95 comments:

  1. Thanks a lot, spend some time on that..

    ReplyDelete
  2. thanks, that was useful to me too.
    when a few days are left for completing my thesis, I googled my headheight problem and found this post

    ReplyDelete
  3. Thank you so much, thank you so much.

    ReplyDelete
  4. Thank you for your help! :)

    ReplyDelete
  5. I never thought I would find a LaTeX answer this perfect for my problem. Thank you!

    ReplyDelete
  6. Thanks for sharing that solution!

    ReplyDelete
  7. This trick should be mentionned in every documentation or web site that deals with the package 'fancyhdr'. Unfortunately, it's not! Thanks a lot for sharing your knowledge.

    ReplyDelete
  8. Dude, you rock ! I've spent a LOT of time on this...

    ReplyDelete
  9. Great I was trying to solve the problem for quiete a long time.
    Many thanks

    ReplyDelete
  10. One more anonymous thank you !! .. :-)

    ReplyDelete
  11. So perfect.
    If solutions like this were open to newbies like me, it could change people´s mind about LATEX.

    Thanks a lot!

    ReplyDelete
  12. thanks a lot!!!

    I've this problem for a couple of days and almost become crazy

    ReplyDelete
  13. thanks a lot, i found this page on first result on google. This help me.

    merci beaucoup

    ReplyDelete
  14. Thank you very much, I was going insane with this :)

    ReplyDelete
  15. Yet another thank you! I wonder why fancyhdr doesn't do this itself..!

    ReplyDelete
  16. Thanks a lot for sharing this!

    ReplyDelete
  17. wonderful! Thanks for the trick!

    ReplyDelete
  18. Do you know how much you've cut down on my error messages with this fix? Thank you so much!! :-D

    ReplyDelete
  19. I was passing by and though of saying a "thank you" as a return to the pain that you relieved when I came across to your post.

    ReplyDelete
  20. Another thank you :)

    ReplyDelete
  21. You know, now Google can answer this problem too! Thanks btw :)

    ReplyDelete
  22. yeah, I was just gonna say the same thing :)

    ReplyDelete
  23. Thanks a lot, the information was very helpfull!

    My warning is gone, but I admit I see no difference... :-)

    ReplyDelete
  24. Thanks a lot! I love google!!!

    ReplyDelete
  25. thanks thanks thanks... !!

    ReplyDelete
  26. Thank you!

    ReplyDelete
  27. Thanks. It made the warning dissappear, but how about you tell us what the command actually does?

    ReplyDelete
  28. Thank you!! Finally somebody knows how to fix it

    ReplyDelete
  29. appreciating your help!

    ReplyDelete
  30. thank you very much, very useful

    ReplyDelete
  31. OK, this solution removes the warning, but it causes that the header is not in the right place (the header is located far below). It is more interesting why mentioned warning appears when generated PDF document seems to look correctly.

    ReplyDelete
  32. Hi, Czlowiek, it depends how do you generate the PDF. This method not only removes the warning, but also generates the PDF as it should be.

    ReplyDelete
  33. Hi wenbin,

    I mean that with the warning my PDF looks like I intended. After setting headheight, the warning disappears but the header is located e.g. 27 points below its previous location (unwanted).

    I wonder why this warning appears in a situation in which I'm happy with appearance of the document (header doesn't obscure the text below).

    ReplyDelete
  34. Hi, Czlowiek,
    Do you use GhostScript or Acrobat Distiller to convert from PS to PDF? Or you use PDFLatex?

    ReplyDelete
  35. This solution works well for dvi-->ps-->PDF

    ReplyDelete
  36. many thanks!

    ReplyDelete
  37. +1 I tried first \renewcommand\ kind of solution, then I tried google :D

    ReplyDelete
  38. thanks, you saved my time!

    ReplyDelete
  39. Still helping people!

    ReplyDelete
  40. Thanks a lot, I suppose this saved me lot of searching!

    ReplyDelete
  41. I came here to say thank you, only noticing that I had already replied here because I had the same problem in the past and I had forgotten the solution. That's what happens when you change templates!

    ReplyDelete
  42. Yeah! Thanks a lot ;)

    ReplyDelete
  43. A very helpful post!

    ReplyDelete
  44. thanks, very useful!!!

    ReplyDelete
  45. perfect. thanks.

    ReplyDelete
  46. Really good! Thanks for this!

    ReplyDelete
  47. To Czlowiek and wenbin:
    I do not know if you still follow it, but I had exactly the same problem as Czlowiek. When I generated .pdf there was too much space at the top and I could not change by \setlength{...}{...} nothing was helping, but than I found this:
    http://en.wikibooks.org/wiki/LaTeX/Page_Layout
    more specificely they say that if you want to be sure to have a good transformation from PS to PDF it is better to include a sice of the page at the beginning of your document. Which means to insert this:
    \documentclass[...,a4paper,...]{...}
    \special{papersize=210mm,297mm}
    I included a4paper as it is suggested and introduced the second line as well and it is working perfectly now!!

    Good luck you all with searching for info, I think it takes half of my time during writing the PhD:-).

    Cunik16

    ReplyDelete
  48. Hi, Cunik16,
    Your problem seems to be caused by that when you generate a letter size dvi but want a a4 pdf. Change the setting to suit your need.

    ReplyDelete
  49. Thank you very much.I have saved a lot of time thanks to your post.

    Max

    ReplyDelete
  50. Buenísimo este tip. Gracias (desde Venezuela)

    ReplyDelete
  51. Thanks a lot! (Obrigada do Brasil)

    ReplyDelete
  52. Glad I googled this, these fancyhdr warnings had always gotten on my nerves, but I learned to live with it. Kind of like a wart. Now, my template is perfect.

    ReplyDelete
  53. Thanks a lot, mate!

    ReplyDelete
  54. Yet another anonymous thank you!

    ReplyDelete
  55. Thank you!

    ReplyDelete
  56. Grazie mille :-)

    ReplyDelete
  57. Thanks a lot for the time you saved me!

    ReplyDelete
  58. Thanks thanks thanks

    ReplyDelete
  59. Million thanks

    ReplyDelete
  60. It just helped me. Thanks!!!

    ReplyDelete
  61. Thank you!

    ReplyDelete
  62. Thank you!

    ReplyDelete
  63. Thank you very much! Clear and efficient.

    ReplyDelete
  64. Thanks also ! Helped us in our thesis

    ReplyDelete
  65. Thank you so much for sharing this! You've made my day! :)

    ReplyDelete
  66. This is the best answer I have ever found for a query on LATEX.

    ReplyDelete
  67. Life saver. Thanks :-)

    ReplyDelete
  68. Epic winning! Thanks!

    ReplyDelete
  69. Thanks mayne, this fixed a problem I had with fancyhdr overlapping the first line of my body text, though I don't think I got a warning.

    ReplyDelete
  70. Thank you, for sharing this solution!

    ReplyDelete
  71. Muchas gracias!!

    ReplyDelete
  72. I love you!!

    ReplyDelete
  73. Thank you! I was looking for this.

    ReplyDelete
  74. You saved my day.. Thanks very much.

    ReplyDelete
  75. God bless you! Do same always!

    ReplyDelete
  76. love u maaaan thanks a lot

    ReplyDelete