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.

When answering this question: Using fancyhdr to create an image based header and footer

I needed to get the distance from the left edge of the paper to the beginning of \textwidth and the distance from the end of \textwidth to the right edge of the paper. For the distance from the left edge I used \oddsidemargin + \hoffset + 1in to adjust \headwidth via \fancyhfoffset and it put the start of the header on the left edge of the paper. For the distance from the right edge, I thought it was \evensidemargin + \marginparwidth + \marginparsep, but this resulted in the header overshooting the right edge of the page. It appears the correct distance is \evensidemargin + \marginparwidth - \marginparsep.

I think I am missing something about how \marginparsep (or some other page "margin") works.

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{calc}

\fancypagestyle{plain}{%
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
    \fancyhf{}
    \fancyhead[L]{\hrulefill{}}%
    \fancyhead[R]{\hrulefill{}}%
    \fancyfoot[L]{\hrulefill{}}%
    \fancyfoot[R]{\thepage}%
}

\fancyhfoffset[L]{\oddsidemargin + \hoffset + 1in}
\fancyhfoffset[R]{\evensidemargin + \marginparwidth - \marginparsep}

\pagestyle{plain}
\begin{document}
First page

\clearpage

Second page
\end{document}
share|improve this question

1 Answer 1

up vote 5 down vote accepted

The layout package gives you a graphical display and listing of your current layout parameters:

\documentclass[letterpaper,11pt]{article}
\usepackage[margin=1.5in]{geometry}

\usepackage{layout}

\begin{document}

\layout

\end{document}

shows

enter image description here

Does that help?

share|improve this answer
    
It shows the problem. Is the distance between the right edge of the margin notes and the edge of the paper \evensidemargin or is it just some unnamed leftover space? –  StrongBad Jan 26 '12 at 17:07

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.