GeneralHow to do a simple header & footer

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
sugarat
Posts: 9
Joined: Sat Nov 21, 2009 4:36 pm

How to do a simple header & footer

Post by sugarat »

Hi all,

I'm looking for a simple explanation of how to do a centered header & footer on every page of a document (probably using fancyhdr?). I have the fancyhdr documentation but I can't quite get it to work.

All I need is a string such as "RESTRICTED" as a centered header & footer on every page. Can anyone offer any advice?

I prefer to use Lyx but presumably I can just insert the necessary code into the preamble of the LyX document.

Many thanks

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

How to do a simple header & footer

Post by gmedina »

Hi,

a simple example using fancyhdr:

Code: Select all

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{lipsum}% just to generate some text

\fancyhf{}
\fancyhead[C]{RESTRICTED}
\fancyfoot[C]{RESTRICTED}
\renewcommand\headrulewidth{0pt}
\pagestyle{fancy}

\begin{document}
  \lipsum[1-20]
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
sugarat
Posts: 9
Joined: Sat Nov 21, 2009 4:36 pm

Re: How to do a simple header & footer

Post by sugarat »

That is absolutely just what I wanted! Thank you so much for your help!
Post Reply