I want the calendar month to take up the entire text body in height and width.
However, I can not do that at height:
How can I get rid of these gaps?
It seems the problem is in the setting
DayCellHeight/.store in =\DayCellHeight,
DayCellHeight=(\textheight-2\pgflinewidth/\WeekRowsNo-\WeekDayNamesHeight-1\InnerSep)/\WeekRowsNo,
Full Code:
\documentclass[paper=A4,landscape, english]{scrartcl}
% Inputs:
\def\Margin{1.75cm}
\def\Year{2018}
%\def\Month{11}
\renewcommand*{\familydefault}{\sfdefault} % \rmdefault % \sfdefault
\def\CalendarNumbersFont{\Huge\sffamily}%\Huge\bfseries\sffamily
\def\WeekDayNamesFont{\Large\bfseries\sffamily}%\bfseries\sffamily
% Advanced Inputs:
\def\NumberOfWeekRows{\WeekRowsNo} % 6 % \WeekRowsNo
% Packages and Settings
\setparsizes{0pt}{0pt}{0pt plus 1fil}
\usepackage{lmodern}
\usepackage[showframe=true,
%headsep=0mm, includehead,
%margin=\Margin
]{geometry}
\newcommand\changehead[1]{
\newgeometry{headheight=#1, % local
margin=\Margin, includehead, headsep=0mm, nofoot, % global
}}
\usepackage{scrlayer-scrpage}
\setkomafont{pagehead}{\normalfont}
\cfoot{}% 'show no foot'
\usepackage{calc} % for '\settototalheight'
\usepackage{tikz}
\usepackage[]{babel}
\usepackage{translator}
\usetikzlibrary{calendar}
% Content Test
\newcommand\Inhalt{%
%$\text{\tikzdaytext\hspace{0.75pt}}%
%\overset%
%%{\parbox{2em}{\tiny Tag der Deutschen}}%
%{\text{\tiny Tag der Deutschen\:Einheit}}%
%{\text{ \tiny (schulfrei) }\hfill}%
%$%
%M%
{\tikzdaytext}%
%\begin{tabular}[b]{>{\tiny}p{1cm}}
%aa aa aaa\\[-3pt]
%bbb
%\end{tabular}
M
}
\begin{document}
\newlength\HeadHeight%
\newlength\DayLetterHeight%
%\CalendarNumbersFont%
\settototalheight\DayLetterHeight{\vbox{\CalendarNumbersFont 1 2 3 4 5 6 7 8 9 0 M}}%
%\settototalheight\DayLetterHeight{\parbox[b]{\linewidth}{\strut 1 2 3 4 5 6 7 8 9 0 M \strut}}%
%\pgfmathsetlengthmacro{\DayLetterHeight}{height("1 2 3 4 5 6 7 8 9 0 M")}% 'same result'
%\normalsize\normalfont%
DayLetterHeight: \the\DayLetterHeight \\
%
\newlength\weekdaynamesheight
%\WeekDayNamesFont%
\settototalheight\weekdaynamesheight{\vbox{\WeekDayNamesFont\pgfcalendarweekdayname{0}}}%
\pgfmathsetlengthmacro{\WeekDayNamesHeight}{\weekdaynamesheight}%
%\normalsize\normalfont%
WeekDayNamesHeight (from \pgfcalendarweekdayname{0}): \the\weekdaynamesheight / \WeekDayNamesHeight
Titelseite \newpage
% Calendar % 01,02,03,04,05,06,07,08,09,10,11,12
\foreach \Month in {01,02,03,04,05,06,07,08,09,10,11,12}{%%%%%%%%%%%%%%%%%%%
\def\Head{\parbox[b]{\linewidth}{\strut {\Huge\bfseries \pgfcalendarmonthname{\Month} \Year}\\ head \strut}}%
\settototalheight\HeadHeight{\vbox{\Head}} % Kopfhöhe messen
\changehead{\HeadHeight}
%\newgeometry{headheight=\HeadHeight,
%headsep=0mm, includehead,
%margin=\Margin}%
\ihead{\Head}%
%HeadHeight \the\HeadHeight
%\centering Inhalt \Month \\
%
% Number of week rows: ===============
\newcount\JulianDateNo
\pgfcalendardatetojulian{\Year-\Month-last}{\JulianDateNo}
%Julian Days: \the\JulianDateNo
%
\pgfcalendarjuliantodate{\JulianDateNo}{\theyear}{\themonth}{\DaysOfMonth}
%Date last Monthday: \theyear-\themonth-\DaysOfMonth~
%Number of Monthdays: \DaysOfMonth
%
\pgfcalendardatetojulian{\Year-\Month-01}{\JulianDateNo}
%Julian Days: \the\JulianDate
\newcount\WeekDayNo
\pgfcalendarjuliantoweekday{\JulianDateNo}{\WeekDayNo}
%Weekdaynumber first day of the month: \the\WeekDayNo
%
\pgfmathsetmacro\WeekRowsNo{
\DaysOfMonth == 31 && \WeekDayNo >= 5 ? 6 : (
\DaysOfMonth == 30 && \WeekDayNo == 6 ? 6 : (
\DaysOfMonth == 28 && \WeekDayNo == 0 ? 4 : 5))
}
%Week rows: \WeekRowsNo
% =============================
% Measures =======================
\pgfkeys{tikz/.cd,
InnerSep/.store in =\InnerSep,
InnerSep=3pt,
DayCellWidth/.store in =\DayCellWidth,
DayCellWidth=(\textwidth-\pgflinewidth)/7,
DayCellHeight/.store in =\DayCellHeight,
DayCellHeight=(\textheight-2\pgflinewidth/\WeekRowsNo-\WeekDayNamesHeight-1\InnerSep)/\WeekRowsNo,
}
% =============================
\begin{tikzpicture}[ % ultra thick, red, opacity=0.5, % for 'showframes'
every day/.append style={
text=black,
font=\CalendarNumbersFont,
draw,
anchor=north west,
inner sep=\InnerSep,
text width=\DayCellWidth-2*\InnerSep, %<-geändert
text depth=\DayCellHeight-\DayLetterHeight-2*\InnerSep,%<-geändert
minimum width=\DayCellWidth,
minimum height=\DayCellHeight,%<-geändert
name=\pgfcalendarsuggestedname,
},
]
\newcount\daynocount
\calendar (cal) [
day xshift=\DayCellWidth,% <-
day yshift=\DayCellHeight,% <-
dates=\Year-\Month-01 to \Year-\Month-last,
week list,
%day code={
%\node[name=\pgfcalendarsuggestedname,every day]{\Huge \tikzdaytext};
%}
]
if (Sunday) [nodes={red, fill=pink}]
if (equals=\Year-\Month-02) [
%nodes={red, fill=pink},
%day code={\node[every day]{ \Tabelle };}
day code={
\node[every day]{\Inhalt};
}
]
%
if (equals=\Year-\Month-07) [
%nodes={red, fill=pink},
%day code={\node[every day]{ };}
]
;
% Weekdaynames
\foreach \i in {1,...,7} {%
\node[anchor=south,
inner sep=\InnerSep,
%text width=\DayCellWidth-2*\InnerSep, %ruiniert Zentrierung
text depth=\WeekDayNamesHeight-2*\InnerSep,%<-
minimum width=\DayCellWidth,
minimum height=\WeekDayNamesHeight,%<
draw,fill=gray, text=white,
font=\WeekDayNamesFont,
] at ([yshift=0ex]cal-\Year-\Month-0\i.north |- cal-\Year-\Month-01.north) {%\vphantom{g}%
\pgfcalendardatetojulian{\Year-\Month-0\i}{\daynocount}%
\pgfcalendarjuliantoweekday{\the\daynocount}{\daynocount}%
\pgfcalendarweekdayname{\the\daynocount}%,\the\daynocount,\i%
};
}%
\fill[red, thick] (cal-\Year-\Month-21) circle (2pt);
\node[red, draw, align =left,
anchor=south,
yshift=\InnerSep,
text width=\DayCellWidth-2*\InnerSep,
inner sep=0pt
] (Termin) at (cal-\Year-\Month-21.south) {This is a long text. This is a long text. \\Termin\\ Termin};
\end{tikzpicture}
\newpage % needed
}%%%%%%%%%%%%%%%%%%%%%%%
%
\end{document}


DayCellHeight=(\textheight-2*\pgflinewidth*\WeekRowsNo-\WeekDayNamesHeight-2*\InnerSep)/\WeekRowsNo? – nidhin Dec 12 '18 at 21:24Overfull \vbox (0.80008pt too high) has occurred while \output is activeand this means:I get an empty page beetween each month :(
– cis Dec 12 '18 at 22:40outer [xy]seps might contribute to thetikzpicture's bounding box. The whole\DayCellHeight(including\pgflinewidth) won't get evaluated until theevery daynode gets typeset where\pgflinewidthmight be different than where it contributes to the bounding box. Your code is a bit too unorganized for me, to delve deep enough in. For inspiration, I've setup a similar "wall calendar" in another recent answer. – Qrrbrbirlbel Jul 31 '22 at 23:28\sbox0{\tikz\draw(0pt,0pt)--(0pt,10pt);}\the\ht0-\the\wd0shows you that the line width factors in in unexpected places. – Qrrbrbirlbel Jul 31 '22 at 23:33