In this sample MWE below, I create a slighty large header to the first page (using thispagestyle) but in next pages even not drawing the header latex still keeps account of the headheight. That is around 12 pt (afaik).

Also it triggers a warning about the header length that should be at least ~ 77pt. If I set with \setlength{\headheight}{77pt} the situation is even worse in next pages, of course because it instead the default 12 pt, it uses 77pt to all headers, even the empty ones in page 2 and greater. My questions are:

1. How to set the headerheight only to page 1; and
2. How to remove completely the headerheight where no headers are being displayed?
    \documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{graphicx}

\fancyhf{}
\hspace{-1cm}%
\includegraphics[height=5\baselineskip,width=5\baselineskip]{example-image-a}
\hspace{\baselineskip}%
\begin{minipage}[b][5\baselineskip][c]{.5\textwidth}\sffamily
University of \LaTeX \\
Institute of Typography \\
Department of Humanistic Computing \\
Professor: A good fellow \\
History of Latex 101
\end{minipage}}
\fancyfoot[c]{\thepage}
}

\title{MWE}
\author{Some student}
\date{December 2020}

\begin{document}

\maketitle

\lipsum

\lipsum

\end{document}


PS: Also setting \headheight to 77pts pushes the text down, that pushes footer (and \thepage) down leaving almost no breath space in bottom margin, because of that I need to counterweight with:

\addtolength{\textheight}{-65pt}

Since 77-12 = 65.

Any better solutions to this issue ? (if it is an issue).

• Rather than thinking in terms of changing the header height on page 1, why not just insert/remove space at the top of the text block on page block as necessary? Dec 4, 2020 at 21:11
• can you please show me?
– Lin
Dec 4, 2020 at 21:14

Since you only want to insert a logo and some attached text at the top of the first page, it is better to do just that.

With the xcoffin package, you put the content into boxes (Set), assemble the boxes(Join), and write the result (Typeset) to the current insertion point plus some X-Y offsets. \Framex collects the logo and text boxes and places them in the upper upper corner of the page.

\maketitle issues a new page so we need to avoid that. Also uses the plain style, which is fine.

Then you can use the fancy style, according to your specifications, for the rest of the document.

Please note that the content of the boxes is separated from the layout design. So if later you want, lets say, to put the assembly in the right side or where the text is placed in relation with the logo, only the \JoinCoffins and/or the offsets will need to be modified.

A larger explanation of how xcoffins works is in this answer

https://tex.stackexchange.com/a/572407/161015

and of course in the package documentation.

https://ctan.org/pkg/xcoffins?lang=en

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{graphicx}

%\pagestyle{fancy}
\fancyhf{}

\NewCoffin\Framex
\NewCoffin\Logox
\NewCoffin\Affilx

\title{MWE}
\author{Some student}
\date{December 2020}

\begin{document}

\SetHorizontalCoffin\Logox{% the logo
\includegraphics[height=5\baselineskip,width=5\baselineskip]{example-image-a}
}

\SetVerticalCoffin\Affilx{.5\textwidth}{% the text
\sffamily\noindent
University of \LaTeX \\
Institute of Typography \\
Department of Humanistic Computing \\
Professor: A good fellow \\
History of Latex 101
}

\JoinCoffins*\Framex[hc,vc]\Logox[l,t](-30pt, 80pt) % XY offset to put on the left top corner of the page
\JoinCoffins*\Framex[\Logox-r,\Logox-vc]\Affilx[l,vc](15pt,0pt) %X offset between logo and text
\noindent \TypesetCoffin\Framex

{\let\newpage\relax\maketitle} % to avoid \newpage from \maketitle. The page is in style plain

\pagestyle{fancy}
\section{One}

\lipsum

\lipsum

\section{Two}

\lipsum

\end{document}


I do not fully understand your second question.

If you use the geometry package you can reduce the header space for all pages of the document, maximizing the text area, as shown next.

Alternatively using only fancyhdr with the style plain, no headers will be printed (the page number has to be somewhere) but the header space will remain. Since \maketitle uses the plain style no further styles are needed for the rest of the document.

The page number on the first page can be suppress using \thispagestyle{empty} after \maketitle.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{graphicx}

\NewCoffin\Framex
\NewCoffin\Logox
\NewCoffin\Affilx

\title{MWE}
\author{Some student}
\date{December 2020}

\begin{document}

\SetHorizontalCoffin\Logox{% the logo
\includegraphics[height=5\baselineskip,width=5\baselineskip]{example-image-a}
}

\SetVerticalCoffin\Affilx{.5\textwidth}{% the text
\sffamily\noindent
University of \LaTeX \\
Institute of Typography \\
Department of Humanistic Computing \\
Professor: A good fellow \\
History of Latex 101
}

\JoinCoffins*\Framex[hc,vc]\Logox[l,t](-10pt, 20pt) % XY offset to put on the left top corner of the page
\JoinCoffins*\Framex[\Logox-r,\Logox-vc]\Affilx[l,vc](15pt,0pt) %X offset between logo and text
\noindent \TypesetCoffin\Framex

\vspace{4\baselineskip}

{\let\newpage\relax\maketitle} % to avoid \newpage from \maketitle. The page is in style plain