Page Layoutfancyhdr | Create unsual custom Header

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
skwateur
Posts: 14
Joined: Thu Jun 21, 2012 9:24 pm

fancyhdr | Create unsual custom Header

Post by skwateur »

Hi everyone,

I'm trying to make a very simple header like this :
(left) xxxxx (right) yyyyyyyy
(center) zzzzzzz

I'm using fancyhdr.

The problem is that I don't know how to write something under the headrule...

Do you have any ideas ?

Thank you :D

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

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

fancyhdr | Create unsual custom Header

Post by Stefan Kottwitz »

In this case, I would not use the standard headrule. You could make a header with two lines and make the horizontal rule yourself. For example, you could place a {tabular} environment in the header with \hrule between the rows.

Stefan
LaTeX.org admin
skwateur
Posts: 14
Joined: Thu Jun 21, 2012 9:24 pm

Re: fancyhdr | Create unsual custom Header

Post by skwateur »

smart !

But I can't make a table with three columns of the same size with a left item flushed on the left, a middle item centered and a right item flushed on the right..

I've been trying to do that for a few hours now... and still can't make it.

Do you have a sample code please ?
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

fancyhdr | Create unsual custom Header

Post by cgnieder »

Hi,

you can use tabularx:

Code: Select all

\documentclass{article}
\usepackage{showframe}% visualize the page dimensions
\usepackage{tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\begin{document}

\noindent
\begin{tabularx}{\linewidth}{@{}LCR@{}}
 left & centered & right
\end{tabularx}

\end{document}
Regards
site moderator & package author
skwateur
Posts: 14
Joined: Thu Jun 21, 2012 9:24 pm

Re: fancyhdr | Create unsual custom Header

Post by skwateur »

:shock: perfect. You're a pro dude, thanks a lot !
Post Reply