Page LayoutIncrease the space between the end of the header and the text

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Saszalez
Posts: 5
Joined: Wed May 23, 2018 10:40 am

Increase the space between the end of the header and the text

Post by Saszalez »

Hello everyone. I have a header where I use a table that I have to put on all the document sheets. When using a table, the header is slightly higher than usual, and the text overlaps the table. I have tried increasing the size of \headsep but without the expected result. How can I do this?

Code: Select all

\documentclass[english,letterpaper,11pt]{article}
\usepackage{datetime}
\usepackage[T1]{fontenc}
\usepackage{graphicx,algorithmic,algorithm}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{booktabs}

\usepackage{fancyhdr}
\usepackage{lastpage}
%\setlength{\headsep}{-10cm}

\lhead{}
\chead{\begin{tabular}{|c|m{10cm}|c|}
\midrule
\multirow{3}{*}{PROBANDO} & \multicolumn{2}{c|}{\textbf{CÚBICO MEZQUITE PROJECT}} \\
\cmidrule{2-3}
 & \centering Written by ISOBARS team & \thepage \ of \pageref*{LastPage} \\
\cmidrule{2-3}
 & \centering Ref.: 20220801 & August 2022 \\
\midrule
\end{tabular}}
\rhead{}
\renewcommand{\headrulewidth}{0pt}

\pagestyle{fancy}

\begin{document}

%\pagestyle{fancy}

\section{EXECUTIVE SUMMARY}

\lipsum

\end{document}

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Increase the space between the end of the header and the text

Post by Bartman »

Using booktabs and vertical lines gives an unappealing result.

Do you really need the page number in the header and footer?

First adjust the height of the header and then decide if you still want to change the space between it and the text.

A suggestion:

Code: Select all

\documentclass[english,letterpaper,11pt]{article}
%\usepackage{datetime}% obsolete
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{showframe}% draws a diagram of the page layout

% A replacement for the lastpage package if your TeX distribution 
% supports the following command.
% Search and read ltnews34 on texdoc.net to get further information.
\AddToHook{shipout/lastpage}{\label{LastPage}}

%\setlength{\headsep}{-10cm}
\setlength{\headheight}{3\baselineskip}

\fancyhead{}
\chead{\begin{tabularx}{\textwidth}{|c|>{\centering}X|c|}
\hline
 & \multicolumn{2}{c|}{\textbf{CÚBICO MEZQUITE PROJECT}} \\
\cline{2-3}
PROBANDO & Written by ISOBARS team & \thepage{} of \pageref{LastPage} \\
\cline{2-3}
 & Ref.: 20220801 & August 2022 \\
\hline
\end{tabularx}}

\renewcommand{\headrulewidth}{0pt}

\pagestyle{fancy}

\begin{document}
\section{EXECUTIVE SUMMARY}
\lipsum
\end{document}
User avatar
MjK
Posts: 89
Joined: Fri Jan 28, 2022 6:09 pm

Increase the space between the end of the header and the text

Post by MjK »

Increasing the height of the head this way, also decreases the height of the bottom margin. :o
So I really recommend to use geometry to change the head height and the margins. :!:

And reading some typography information about construction of typing areas would also be a good idea … :shock:
My main topics are KOMA-Script and other questions related to my packages. If I reply to any other topic or if you've not yet added a minimal working example, please do not expect any further response. And please don't forget to tag examples as code.
Saszalez
Posts: 5
Joined: Wed May 23, 2018 10:40 am

Increase the space between the end of the header and the text

Post by Saszalez »

Thanks for the answers. Using the geometry package, I thought I could do it quickly, but I have put this, and I don't quite understand the result. I set the sheet size to A4, set the margins to 20mm, and increased the headsep, so there was more space between the bottom of the header and the start of the text. The only thing I get is that the header breaks up off the sheet, not the text goes down. I know I'm doing something wrong, but I can't figure out what. Increase the space between the end of the header and the text.

Code: Select all

\documentclass[english,letterpaper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx,algorithmic,algorithm}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{booktabs}

\usepackage{fancyhdr}
\usepackage{lastpage}

\usepackage{geometry}
\geometry{a4paper,margin=20mm,headsep=30mm}

\lhead{}
\chead{\begin{tabular}{|c|m{10cm}|c|}
\midrule
\multirow{3}{*}{PROBANDO} & \multicolumn{2}{c|}{\textbf{CÚBICO MEZQUITE PROJECT}} \\
\cmidrule{2-3}
 & \centering Written by ISOBARS team & \thepage \ of \pageref*{LastPage} \\
\cmidrule{2-3}
 & \centering Ref.: 20220801 & August 2022 \\
\midrule
\end{tabular}}
\rhead{}
\renewcommand{\headrulewidth}{0pt}

\pagestyle{fancy}

\begin{document}

%\pagestyle{fancy}

\section{EXECUTIVE SUMMARY}

\lipsum

\end{document}
User avatar
MjK
Posts: 89
Joined: Fri Jan 28, 2022 6:09 pm

Increase the space between the end of the header and the text

Post by MjK »

As Bartman already told: headsep is the wrong parameter. I think, you are searching for something like:

Code: Select all

\documentclass[english,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx,algorithmic,algorithm}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{booktabs}

\usepackage{fancyhdr}
\usepackage{lastpage}

\usepackage{geometry}
\geometry{a4paper,margin=20mm,includehead,headheight=20mm}

\lhead{}
\chead{\renewcommand*{\arraystretch}{1.2}
\begin{tabular}{|c|m{10cm}|c|}
\hline
\multirow{3}{*}{PROBANDO} & \multicolumn{2}{c|}{\textbf{CÚBICO MEZQUITE PROJECT}} \\
\cline{2-3}
 & \centering Written by ISOBARS team & \thepage \ of \pageref*{LastPage} \\
\cline{2-3}
 & \centering Ref.: 20220801 & August 2022 \\
\hline
\end{tabular}}
\rhead{}
\renewcommand{\headrulewidth}{0pt}

\pagestyle{fancy}

\begin{document}

\section{EXECUTIVE SUMMARY}

\lipsum

\end{document}
As Bartman also told: Tables with booktabs should not use vertical lines. But because it seems you want to have vertical lines, I've uses standard commands for horizontal lines.
Last edited by MjK on Fri Aug 26, 2022 9:07 am, edited 1 time in total.
My main topics are KOMA-Script and other questions related to my packages. If I reply to any other topic or if you've not yet added a minimal working example, please do not expect any further response. And please don't forget to tag examples as code.
Saszalez
Posts: 5
Joined: Wed May 23, 2018 10:40 am

Increase the space between the end of the header and the text

Post by Saszalez »

Thank you very much, it worked perfectly for me.
Post Reply