Quick Tips: Adding a Fancy Header in Latex

I’ve recently been pumping out a lot of technical report versions of my papers to add to our department’s library. Here is some code I copied from a former student in my lab to produce fancy headers at the top of each page in a latex document.  This would probably work well for adding copyright notifications as well.


\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancypagestyle{plain}{% define header for first page of document
\fancyhead[L]{University of XXX, Technical Report 2009-YY}
\fancyhead[R]{\thepage}
}
%Header for remaining pages in document
\fancyhead[L]{University of XXX, Technical Report 2009-YY}
\fancyhead[R]{\thepage}

You can replace the “University of XXX” bit with whatever you want to appear at the top of each page.  The first declaration defines the header for the document’s title page, the second is used for all remaining pages. More details on the fancyhdr package are here.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>