Document ClassesHow to highlight header using fancyhdr package.

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
centurion555
Posts: 6
Joined: Thu Nov 06, 2008 1:15 pm

How to highlight header using fancyhdr package.

Post by centurion555 »

Hi all, I'm using the fancyhdr package to get headers on each page of my document. I've successfully created the headers but I am unable to highlight the headers. I want to highlight the headers as shown in attached picture or on second page of this pdf file:

http://homepage.boku.ac.at/imrannad/instruct.pdf

Any help will be highly appreciated.
Centurion555
Attachments
header.gif
header.gif (7.29 KiB) Viewed 3336 times

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

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

How to highlight header using fancyhdr package.

Post by Juanjo »

Load fancyhdr and color. Then add to the preamble something like:

Code: Select all

\definecolor{LightGray}{gray}{0.8}
\newcommand{\BigBox}[2][c]{\makebox[\dimexpr\textwidth-2\fboxsep-2\fboxrule][#1]{#2}}
\fancyhead{}
\fancyhead[C]{\addtolength{\fboxsep}{5pt}%
   \colorbox{LightGray}{\BigBox{\sffamily Proceedings ISARS 1998 Vienna}}}
\renewcommand{\headrulewidth}{0pt}
You will surely need to increase the value of \headheight, for example:

Code: Select all

\addtolength{\headheight}{15pt}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
centurion555
Posts: 6
Joined: Thu Nov 06, 2008 1:15 pm

Re: How to highlight header using fancyhdr package.

Post by centurion555 »

Hi Juanjo,
Thanks a lot. It worked after slight modifications.
Regards, Nadeem
bkarpuz
Posts: 124
Joined: Thu Dec 18, 2008 4:53 pm

Re: How to highlight header using fancyhdr package.

Post by bkarpuz »

do you mind sharing the codes with us?
Post Reply