I'm looking for a placeholder/calculation/code-piece to put as the headheight value for a LaTeX document within the geometry package:

\usepackage[inner=1cm,outer=1cm,top=1cm,bottom=1cm,
]{geometry}


The reason for this special requirement is that I am not in knowledge of the amount of text content in the header (or not the resulting header size at least), because the complete LaTeX file is generated and thus I cannot predict the number of lines the text in the header will occupy.

I have considered the topic Calculating required headheight for fancyhdr, unexpectedly not linear preliminary to writing this question, but due to the fact that I don't have the number of lines within my header this does not suit my problem.

Minimum work example

\documentclass[a4paper,fontsize=8pt,pdftex,landscape]{scrbook}
\usepackage[inner=1cm,outer=1cm,top=1cm,bottom=1cm,
showframe]{geometry}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
%\renewcommand*\oldstylenums[1]{\carlitoOsF #1}
%\usepackage[sfdefault,lf]{carlito}
\usepackage{multicol}
\usepackage[most]{tcolorbox}
%\usepackage{MnSymbol}

% changed to scrlayer-scrpage
\usepackage{scrlayer-scrpage}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, adjusted title=Placeholder]
Placeholder box with a long content that does push the boundaries of a one-liner
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\end{tcbraster}
}
% footer
\ofoot{}
\ifoot{}
\cfoot{\pagemark}

\begin{document}
\Large
\begin{multicols*}{5}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\columnbreak
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\newpage
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\end{multicols*}
\end{document}


For even more context please have a look at my initial post.

• Is it possible to give the header contents to a special macro? So can I wrap the header setting in something like \addtomyheader{left}{center}{right}? Will a two-run solution be ok? Do you have to use fancyhdr or is KOMA's mechanism for headers fine, too? How are the headers to be set? Can you please give a minimal working example (MWE) in this question? – Skillmon Jun 14 '18 at 11:21
• Do the headers change throughout the document or do they get set up once and stay? – Skillmon Jun 14 '18 at 11:36
• @Skillmon Yes, the header content is fix after it was generated and is identical over all pages (if even necessary to have more than one). I added the MWE. A two-run is no option I think because I have no possibility of changing the latex document after it was generated – mgessenich Jun 14 '18 at 13:20
• No wait, I think I can regex-search for the headheight and replace the headheight by the needed value.. but how to find that out? – mgessenich Jun 14 '18 at 13:32
• A two run solution would be easily possible, as I could write something to the .aux file. I'd have done this combined with the wrapping macro if the header had been subject to changes, so that the first run would determine the maximum header size and every following run would use the size determined by the previous run. If the header doesn't change this is over complicating stuff. esdd's answer works in that case. – Skillmon Jun 15 '18 at 8:17

If the header content is fix for all pages, then you can save it into a box and measure up its height:

\documentclass[fontsize=8pt,landscape]{scrbook}
\usepackage[margin=1cm,
showframe
]{geometry}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{multicol}
\usepackage[most]{tcolorbox}

\clearmainofpairofpagestyles
\cfoot{\pagemark}

\AtBeginDocument{%
\begin{tcbraster}[raster columns=3]
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, adjusted title=Placeholder]
Placeholder box with a long content that does push the boundaries of a one-liner
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\end{tcbraster}%
}%

• For generalization, perhaps it is clever to also include \dp\headerbox in the set headheight. – Skillmon Jun 15 '18 at 8:18
• The content of the header is fix. At the beginning of the document - before the first page starts - it is set to a box. The height and the depth of this box is used to adjust headheight before the first page starts. So \headheight is big enough that no warning is produced. – esdd Jun 18 '18 at 9:01