3

How can I add a horizontal line in the footer which spans the entire width of the page?

\renewcommand{\footrulewidth}{0.4pt}

is giving a line which is inside the margin only.

4

You need to update the \footrule macro provided by fancyhdr. Here's a possible way:

\makeatletter
\def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
    \vskip-\footruleskip\vskip-\footrulewidth
    \leavevmode\rlap{\hspace*{-2in}\rule{2\paperwidth}{\footrulewidth}}
    \vskip\footruleskip}}
\makeatother

In a regular document, this should jump left (negative \hspace) far enough to land outside the page border, then set a horizontal \rule of width \footrulewidth that is twice the width of the paper (ensuring it spans across the entire page).

Here's a working example showing a regular page and the updated footer rule on page 2 (the above change is done mid-document, but you'll want to add it to your preamble for a global effect on your document):

enter image description here

\documentclass{article}
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\pagestyle{fancy}
\renewcommand{\footrulewidth}{.4pt}
\begin{document}
Stuff

\clearpage

\makeatletter
\def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
    \vskip-\footruleskip\vskip-\footrulewidth
    \leavevmode\rlap{\hspace*{-2in}\rule{2\paperwidth}{\footrulewidth}}
    \vskip\footruleskip}}
\makeatother

Stuff
\end{document}
|improve this answer|||||

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.