2

I'm looking to set up a latex document with a custom made header and encountered some issues doing that. I iterated through many code setup variants, but was not able to produce the result I wanted.
I'm hoping to find someone who maybe had the same problems and solved them or has more understanding of what goes on underneath to help me with my issue.

Current state

In the following I depict and describe the current state of my document, starting with the optical outcome:

First page

First page of minimum example

Second page

Second page of minimum example The above images are the outcome of the following minumum code example:

Minimal 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}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} % clear all fields
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CO,CE]{\begin{tcbraster}[raster columns=1]
\end{tcbraster}
\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
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\end{tcbraster}
}
\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=9.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=9.2cm]
Placeholder box
\end{tcolorbox}
\newpage
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=9.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=9.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=9.2cm]
Placeholder box
\end{tcolorbox}
\end{multicols*}
\end{document}

Issues

The encountered issues within the shown document / minimum example are the following:

  1. The content of the first page does not begin within the defined text border (but on the second page it magically does), how can I fix this?
  2. Despite the fact that I am using the "do not balance the columns"-version of multicol - namely begin{multicols*} [...] \end{multicols*} - it balances the content of the (first) coloumn out to its height, how can I make it not do that?
    Sidenote: it does only do this when using the \columnbreak command which I DO want to use due to the content of my document.
  3. The page content bottom border gets pushed off the actual page size, A4 (probably because the header is bigger than "expected"), how can I make it be the way I declared it in the "geometry"-package include?
1
  1. Your header is higher then a normal one, so you have to set the height with the headheight option for geometry.

  2. The multicols* environment only enables unbalanced columns on the last page. However, you can add \vspace*{\fill} before \columnbreak to make the column unbalanced.

  3. Normally, header and footer are in the margins. And because of your small margins and the fact that you header is very high, they don't fit anymore. You can adjust the top and bottom margin accordingly or just add the option includeheadfoot to geometry. Here I did the latter.

Also, it is not recommended to use the fancyhdr package with Koma Script classes. Instead you can use the scrlayer-scrpage package, which is as easy to use for normal use cases.

The code:

\documentclass[a4paper,fontsize=8pt,pdftex,landscape]{scrbook}
\usepackage[inner=1cm,outer=1cm,top=1cm,bottom=1cm,
            includeheadfoot,% <-- added
            headheight=76.86pt,% <-- added
            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}
\pagestyle{scrheadings}
% header
\ohead{}
\ihead{}
\chead{\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
\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}
\vspace*{\fill}% <-- added
\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}

The result:

enter image description here

  • Just for the record, changeing the options "headsep=0pt" + "footskip=0pt" + "top=16pt" turned out the way I wanted the document to be. Mike just for interest: Is there a way to let the header content consume the complete header instead of having 16pt of margin on top and bottom? (like setting headsep=0 but for the top) – mgessenich Jun 4 '18 at 15:05
  • @mgessenich: adding the options raster before skip=0pt, raster after skip=0pt to the tcbraster environment at least reduces the head height (now 65.48pt). top is the distance from top of the paper to top of the header. You can set it to 0pt, if you want. And caution with footskip=0pt, now the footer (still containing the page number) is in the text body. – Mike Jun 4 '18 at 21:29
  • #1 What numbers did you crunch to calculate the header size? I will be in need to do that due to multiple-line content in some boxes #2 how do I get rid of the italics in the header? – mgessenich Jun 5 '18 at 14:00
  • @mgessenich: #1 I set headheight to a round number (e.g. 10pt), looked at the overfull \vbox error and added the length given there. Since headers usually have a constant height, this has to be done only once. But if you want to have headers with different heights, you would have to set a \newgeometry every time the head height changes. May be, it would be easier to have no header and put in the boxes on top manually. #2 add \setkomafont{pagehead}{\normalfont} to your preamble. – Mike Jun 5 '18 at 20:45
  • Is it possible to calculate the needed header size before actually producing the document? – mgessenich Jun 6 '18 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.