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.
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.:
\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}
\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?
\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. 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.