Page Layoutfancyhdr - no footrule

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
hekkendal
Posts: 7
Joined: Mon Oct 11, 2010 1:05 pm

fancyhdr - no footrule

Post by hekkendal »

Hi.
Im trying to use fancyhdr for first time. I cant get the footrule line to show. It seems that the headrule doesnt change size either. Using MikTeX 2.8 and TeXnicCenter 1.0.rc1. Below is my working example.

Code: Select all

\documentclass[12pt,a4paper,norsk]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern,babel,amsmath,amsfonts,amssymb,textcomp,varioref}
\usepackage[pdftex]{color,graphicx}

\usepackage[left=2cm, right=2cm, top=2cm, bottom=2cm]{geometry}

\usepackage{array}
\usepackage{varwidth}

\usepackage{fancyhdr}
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}{
\fancyhf{}
\fancyhead[L]{\bfseries SOME OTHER THING} 
\fancyhead[R]{\slshape \leftmark}
\fancyfoot[L]{\texttt{\copyright{SOMETHING}}}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}

\tolerance = 5000 %for breaking up my language a bit better
\hbadness = \tolerance
\pretolerance = 2000

\title{SOMETHING}
\author{SOMETHING}
\date{\today{}}

\usepackage[bookmarks=true,colorlinks=true,linkcolor=red]{hyperref}

\begin{document}
\maketitle

\newpage
\tableofcontents
\newpage
\section{Something}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

fancyhdr - no footrule

Post by meho_r »

Remove curly brackets after \pagestyle{fancy} and the one after \renewcommand{\footrulewidth}{0.4pt} or create a custom page style with \fancypagestyle{myfancy} instead of \pagestyle{fancy}. E.g.:

Code: Select all

\documentclass[12pt,a4paper,norsk]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern,babel,amsmath,amsfonts,amssymb,textcomp,varioref}
\usepackage[pdftex]{color,graphicx}

\usepackage[left=2cm, right=2cm, top=2cm, bottom=2cm]{geometry}

\usepackage{array}
\usepackage{varwidth}

\usepackage{fancyhdr}
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}% { this curly bracket has to go
\fancyhf{}
\fancyhead[L]{\bfseries SOME OTHER THING} 
\fancyhead[R]{\slshape \leftmark}
\fancyfoot[L]{\texttt{\copyright{SOMETHING}}}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
%} and this one has to go too or:

% create a new page style:

%\fancypagestyle{myfancy}{%
%\fancyhf{}
%\fancyhead[L]{\bfseries SOME OTHER THING} 
%\fancyhead[R]{\slshape \leftmark}
%\fancyfoot[L]{\texttt{\copyright{SOMETHING}}}
%\fancyfoot[C]{\thepage}
%\renewcommand{\headrulewidth}{0.4pt}
%\renewcommand{\footrulewidth}{0.4pt}
%}
%\pagestyle{myfancy}% ...and activate it


\tolerance = 5000 %for breaking up my language a bit better
\hbadness = \tolerance
\pretolerance = 2000

\title{SOMETHING}
\author{SOMETHING}
\date{\today{}}

\usepackage[bookmarks=true,colorlinks=true,linkcolor=red]{hyperref}

\begin{document}
\maketitle

\newpage
\tableofcontents
\newpage
\section{Something}
\end{document}
hekkendal
Posts: 7
Joined: Mon Oct 11, 2010 1:05 pm

fancyhdr - no footrule

Post by hekkendal »

Thanks a lot!
Worked splendid. The howto i read, fancyhdr.pdf, said it should be there. This is posted from page 8 for that ducument:

Code: Select all

\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\bfseries \thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
Shouldnt that have been corrected, or is it a obsolete way to do it?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

fancyhdr - no footrule

Post by gmedina »

hekkendal wrote:Thanks a lot!
Worked splendid. The howto i read, fancyhdr.pdf, said it should be there. This is posted from page 8 for that ducument:

Code: Select all

\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\bfseries \thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
Shouldnt that have been corrected, or is it a obsolete way to do it?
The code you posted only redefines the plain style (used for some special pages like the first page of every chapter).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

fancyhdr - no footrule

Post by meho_r »

Notice the following:

1. Command \pagestyle{name} has only one argument, name and the purpose of the command is to activate page style name. So the second argument (as in \pagestyle{name}{another argument}) is superfluous.

2. Command \fancypagestyle{name}{definition} has two arguments: name for a new page style and definition to, well, define how the style behaves. After you finish with setting up the new style, you also must activate it with \pagestyle{name} command.
Post Reply