TikZ / calendar: Kalender zu groß - seltsame Leerseiten werden eingefügt
In meinem Kalender erzeuge ich Monatsseiten per foreach-Schleife.
Dummerweise wird pro Monat eine Leerseite eingefügt. <br>
Kann mir evtl. jmd. helfen und mir sagen, wie ich das verhindern kann?
**€dit:** Es liegt wohl an dem `\newpage` ganz am Schluss. Aber wenn ich das rausnehme, verschwindet auch der *head*...
**€dit 2:** Es liegt wohl an den Maßen des Kalenders. Dieser soll genau den Textkörper einnehmen.
Weiß jmd. evtl. wie ich das richtig einstelle?
**PS:** Es fehlt ohnehin noch eine Unterscheidungsmethode, ob der Kalendermonat 4, 5 oder 6 Wochenzeilen einnimmt. Dafür habe ich gerade noch keine Lösung.
[![alt text][1]][1]
**Vollständiger Code:**
\documentclass[landscape,ngerman]{scrartcl}
% Inputs:
\def\Margin{2.75cm}
\def\Year{2018}
\def\Margin{1.75cm}
\def\Year{2010}
\def\Month{11}
\def\CalendarNumbersFont{\Huge\sffamily}%\bfseries
\def\WeekDayNamesFont{\bfseries\sffamily}%\bfseries
\usepackage{lmodern}
\renewcommand*{\familydefault}{\sfdefault}
\setparsizes{0pt}{0pt}{0pt plus 1fil}
\usepackage[showframe=true,
%headsep=0mm, includehead,
%margin=\Margin
]{geometry}
\newcommand\changehead[1]{
\newgeometry{headheight=#1, % local
margin=\Margin, includehead, headsep=0mm, includehead,
margin=\Margin
]{geometry}
nofoot, % global
}}
\usepackage{scrlayer-scrpage}
\setkomafont{pagehead}{\normalfont}
\cfoot{}% 'show no foot'
\usepackage{calc} % for '\settototalheight'
\usepackage{tikz}
\usepackage[]{babel}
\usepackage{translator}
\usetikzlibrary{calendar}
\usepackage[]{babel}
\usepackage{translator}
\pgfkeys{tikz/.cd,
InnerSep/.store in =\InnerSep,
InnerSep=3pt,
DayCellWidth/.store in =\DayCellWidth,
DayCellWidth=(\textwidth-\pgflinewidth)/7,
DayCellHeight/.store in =\DayCellHeight,
DayCellHeight=(\textheight-\pgflinewidth-1\WeekDayNamesHeight)/5+\InnerSep/5,
}
% Inhat Inhalt 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%
\CalendarNumbersFont\pgfmathsetlengthmacro{\DayLetterHeight}{height("1 \newlength\DayLetterHeight%
%\CalendarNumbersFont%
\settototalheight\DayLetterHeight{\vbox{\CalendarNumbersFont 1 2 3 4 5 6 7 8 9 0 M")}\normalsize\normalfont%
%DayLetterHeight: \DayLetterHeight
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%
\settoheight\weekdaynamesheight{\pgfcalendarweekdayname{0}}%
\newlength\weekdaynamesheight
%\WeekDayNamesFont%
\settototalheight\weekdaynamesheight{\vbox{\WeekDayNamesFont\pgfcalendarweekdayname{0}}}%
\pgfmathsetlengthmacro{\WeekDayNamesHeight}{\weekdaynamesheight}%
\normalsize\normalfont%
%WeekDayNamesHeight %\normalsize\normalfont%
WeekDayNamesHeight (from \pgfcalendarweekdayname{0}): \the\weekdaynamesheight / \WeekDayNamesHeight
Titelseite \newpage
% Calendar
Calendar % 01,02,03,04,05,06,07,08,09,10,11,12
\foreach \Month in {10,11}{%%%%%%%%%%%%%%%%%%%
{01,02,03,04,05,06,07,08,09,10,11,12}{%%%%%%%%%%%%%%%%%%%
\def\Head{\parbox[b]{\linewidth}{\strut neu \\ head \Month \\ {\Huge\bfseries \pgfcalendarmonthname{\Month} \Year}\\ head \strut}}%
\settototalheight\HeadHeight{\vbox{\Head}} % Kopfhöhe messen
\newgeometry{headheight=\HeadHeight,
headsep=0mm, \changehead{\HeadHeight}
%\newgeometry{headheight=\HeadHeight,
%headsep=0mm, includehead,
margin=\Margin}%
%margin=\Margin}%
\ihead{\Head}%
%HeadHeight \the\HeadHeight
%\centering Inhalt \Month \\
%
% Number of week rows: ===============
\newcount\JulianDateNo
\pgfcalendardatetojulian{\Year-\Month-last}{\JulianDateNo}
%Julianische Tage: \the\JulianDateNo
%
\pgfcalendarjuliantodate{\JulianDateNo}{\theyear}{\themonth}{\DaysOfMonth}
%Datum letzter Monatstag: \theyear-\themonth-\DaysOfMonth~
%Anzahl Monatstage: \DaysOfMonth
%
\pgfcalendardatetojulian{\Year-\Month-01}{\JulianDateNo}
%Julianische Tage: \the\JulianDate
\newcount\WeekDayNo
\pgfcalendarjuliantoweekday{\JulianDateNo}{\WeekDayNo}
%Wochentagnummer Monatserster: \the\WeekDayNo
%
\pgfmathsetmacro\WeekRowsNo{
\DaysOfMonth == 31 && \WeekDayNo >= 5 ? 6 : (
\DaysOfMonth == 30 && \WeekDayNo == 6 ? 6 : (
\DaysOfMonth == 28 && \WeekDayNo == 0 ? 4 : 5))
}
%Wochenzeilen: \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,% <- eingefügt
day yshift=\DayCellHeight,% <- eingefügt
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,%<-geändert
minimum width=\DayCellWidth,
minimum height=\WeekDayNamesHeight,%<-geändert
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}%
%\pgfmathparse{\DayNames[\the\daynocount]}\pgfmathresult%
\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) {Das ist ein langer Text. Das ist ein langer Text. \\Termin\\ Termin};
%\input{SeitengeometrieZeigen.tex}
\end{tikzpicture}
\newpage
}%%%%%%%%%%%%%%%%%%%%%%%
%
\end{document}
[1]: https://texwelt.de/wissen/upfiles/55555555_297.png