Discussion:
Vertical alignment in fancyhdr
(too old to reply)
Chris Lieb
2005-11-17 18:22:14 UTC
Permalink
Hi,

I am using the fancyhdr package to put a rather large header in my
document:

\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\lhead{
CACH Load Chart System
\vspace{5pt}
\hrule
\vspace{5pt}
\setstretch{3}
\textbf{
\begin{tabular}{p{7in}}
{\fontsize{36pt}{44pt}\selectfont EARMO T - NGT SORT HUB}
\begin{tabular}{p{6.5in}r}
{\fontsize{30pt}{36pt}\selectfont SLIC
6309}&\includegraphics[height=30pt]{ngt_hot}\\
\end{tabular}
{\fontsize{22pt}{26pt}\selectfont EARTH CITY MO 63000}
\end{tabular}
}
\setstretch{1}
}
\chead{}
\rhead{Page \thepage\ of \pageref{LastPage}}
\lfoot{id: 178}
\cfoot{}
\rfoot{Printed On: \today\\Last Updated: 5/24/2005}

When the document is generated, the page numbering in the right header
is aligned vertical center, which is below the \hrule in the left
header and on top of the graphic in the left header. I would like to
align the right header to the top of the header region instead of the
center. Does anyone know how to achieve this?

Any help is much appreciated.

Chris Lieb
Chris Lieb
2005-11-17 18:42:54 UTC
Permalink
It's not the solution I was looking for, but I ended up changing the
line:

\rhead{Page \thepage\ of \pageref{LastPage}}

to

\rhead{Page \thepage\ of \pageref{LastPage}\vspace{64pt}}

I'll have to modify it every time I have to adjust the header height,
so a simple alignment command will still be preferable.
Ulrike Fischer
2005-11-18 08:51:19 UTC
Permalink
Post by Chris Lieb
When the document is generated, the page numbering in the right header
is aligned vertical center, which is below the \hrule in the left
header and on top of the graphic in the left header. I would like to
align the right header to the top of the header region instead of the
center. Does anyone know how to achieve this?
Any help is much appreciated.
I wasn't able to understand your problem by putting the code in a
simple document.

Make a complete running minimal example. Replace the graphic by a
equivalent \rule-command.
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
Chris Lieb
2005-11-21 15:01:06 UTC
Permalink
Post by Ulrike Fischer
Post by Chris Lieb
When the document is generated, the page numbering in the right header
is aligned vertical center, which is below the \hrule in the left
header and on top of the graphic in the left header. I would like to
align the right header to the top of the header region instead of the
center. Does anyone know how to achieve this?
Any help is much appreciated.
I wasn't able to understand your problem by putting the code in a
simple document.
Make a complete running minimal example. Replace the graphic by a
equivalent \rule-command.
--
Ulrike Fischer
Here is a full sample document with rules in place of images:

\documentclass[letterpaper,oneside]{article}
\raggedright
\usepackage{pslatex}

% Set up page margins
% To make left margin at edge of page, lmargin must be -.25in
% Margins:
% left: .75in
% top: .75in
% right: .75in (letter only)
% bottom: .75in (letter only)
\usepackage[tmargin=.5in,lmargin=.25in,rmargin=.25in,bmargin=1.55in]{geometry}

\usepackage{setspace}
\usepackage[usenames]{color}
\usepackage{supertabular}

% Set graphic reference path
\usepackage{graphicx}
%\graphicspath{
% {/cach/ie/apps/sharedgraphics/}
% %{../../../../cach/ie/apps/sharedgraphics/}
%}

% Setup header and footer
% head: [CACH Load Chart System][][Page x of total]
% foot: [id: SEQ_NUM][][date(NOW)]
% NOTE: File must be processed twice to get correct page count
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\lhead{
CACH Load Chart System
\vspace{5pt}
\hrule
\vspace{5pt}
\setstretch{2.25}
\textbf{
\noindent
\begin{tabular}{@{}p{7.5in}}
{\fontsize{30pt}{35pt}\selectfont EARMO T (TWI) HUB}\\
\noindent
\begin{tabular}{@{}p{7.25in}r@{}}
\noindent
\begin{tabular}{@{}ll@{}}
{\fontsize{22pt}{25pt}\selectfont SLIC
6309}&{\fontsize{22pt}{25pt}\selectfont EARTH CITY MO 63000}
\end{tabular}
&
\rule{40pt}{22pt}
%\includegraphics[height=22pt,width=40pt]{ngt_hot}
\end{tabular}
\end{tabular}
}
\setstretch{1}
}
\chead{}
\rhead{Page \thepage\ of \pageref{LastPage}\vspace{40pt}}
\lfoot{id: 255}
\cfoot{
\textbf{
\setstretch{3}
SERVICE CODES\\
\begin{tabular}{lllllll}
\rule{20pt}{20pt}& &{\fontsize{24pt}{26pt}\selectfont 3}
\end{tabular}
\setstretch{1}
}
}
\rfoot{Printed On: \today\\Last Updated: 11/4/2005}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}
\headheight = 103pt
\footskip = 10pt
\headsep = 5pt

% Start document
\begin{document}
hello
\end{document}

Chris Lieb
Ulrike Fischer
2005-11-21 16:49:00 UTC
Permalink
Post by Ulrike Fischer
Post by Chris Lieb
When the document is generated, the page numbering in the right
header is aligned vertical center, which is below the \hrule in the
left header and on top of the graphic in the left header. I would
like to align the right header to the top of the header region
instead of the center. Does anyone know how to achieve this?
Any help is much appreciated.
I wasn't able to understand your problem by putting the code in a
simple document.
Make a complete running minimal example. Replace the graphic by a
equivalent \rule-command.
[...]

When I try your code (with pdfLaTeX) the page numbering ("Page 1 of 1")
isn't below a \hrule but sits above the rule on the same line as "CACH
Load....". So either I haven't understand your description or
something odd is going on in your system.

Could you put your pdf somewhere on the net?
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
Chris Lieb
2005-11-21 17:25:37 UTC
Permalink
Post by Ulrike Fischer
Post by Ulrike Fischer
Post by Chris Lieb
When the document is generated, the page numbering in the right
header is aligned vertical center, which is below the \hrule in the
left header and on top of the graphic in the left header. I would
like to align the right header to the top of the header region
instead of the center. Does anyone know how to achieve this?
Any help is much appreciated.
I wasn't able to understand your problem by putting the code in a
simple document.
Make a complete running minimal example. Replace the graphic by a
equivalent \rule-command.
[...]
When I try your code (with pdfLaTeX) the page numbering ("Page 1 of 1")
isn't below a \hrule but sits above the rule on the same line as "CACH
Load....".
That is exactly what I want to have happen. I would like to see if I
could find a solution so I could just say align this to the top of the
region instead of having to play around with \vspace every time that I
have to change the layout of the header.

Chris
Ulrike Fischer
2005-11-21 18:42:05 UTC
Permalink
Post by Chris Lieb
Post by Ulrike Fischer
When I try your code (with pdfLaTeX) the page numbering ("Page 1 of 1")
isn't below a \hrule but sits above the rule on the same line as "CACH
Load....".
That is exactly what I want to have happen. I would like to see if I
could find a solution so I could just say align this to the top of the
region instead of having to play around with \vspace every time that I
have to change the layout of the header.
Why don't you put the page number in the left head:

\lhead{CACH Load Chart System\hfill
Page \thepage\ of \pageref{LastPage} ...
--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.
Chris Lieb
2005-11-21 22:40:32 UTC
Permalink
Post by Ulrike Fischer
Post by Chris Lieb
Post by Ulrike Fischer
When I try your code (with pdfLaTeX) the page numbering ("Page 1 of 1")
isn't below a \hrule but sits above the rule on the same line as "CACH
Load....".
That is exactly what I want to have happen. I would like to see if I
could find a solution so I could just say align this to the top of the
region instead of having to play around with \vspace every time that I
have to change the layout of the header.
\lhead{CACH Load Chart System\hfill
Page \thepage\ of \pageref{LastPage} ...
--
Ulrike Fischer
Oh my. I can't belive that I overlooked a simple \hfill! I had been
playing around with \hfill in some tables, but it never occured to me
to use it in the header. I guess that I was so preoccupied with it
being right-aligned that I assumed that it had to be in the right
header.

Thanks Ulrike

Chris Lieb

Loading...