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.

How can I insert a rule in the header of all pages without the fancyhdr package? Is it necessary to use the fancyhdr package?

share|improve this question
2  
Welcome to TeX.SE. It is always best to compose a fully compilable MWE that illustrates the problem so that the solution can be customized to your situation. Basically, show us that you have so far. –  Peter Grill Feb 25 '12 at 21:39
    
"doesn't have the same length of the text": is this the only reason why you don't want to use fancyhdr? I don't see anything wrong with the length of the header rules when I use fancyhdr. –  JohnJamesSmith Feb 25 '12 at 22:06

1 Answer 1

up vote 4 down vote accepted

Perhaps, in an attempt to diagnose the problem prematurely (and too long for a comment without visualization), here's a possible scenario causing the difference in length between the header rule and the text block: Choosing the page style before modifying the page layout dimensions.

In the minimal example below, the page style is set to fancy (from the fancyhdr package) before using geometry to set the page layout.

enter image description here

\documentclass{article}%
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\renewcommand{\headrulewidth}{0.4pt}%
\pagestyle{fancy}
\usepackage{geometry}% http://ctan.org/pkg/geometry
\begin{document}
\lipsum[1-20]
\end{document}

Setting the page style to fancy after loading geometry yields

enter image description here

share|improve this answer
    
Great, that is the point! Thank you very much! –  matt Feb 25 '12 at 22:19

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.