1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
% colitur wall calendar -- A4 landscape, one month per page. flavour: latex
% Build: colitur table --year 2027 --template grid.tex > grid.tex && pdflatex grid.tex
% This template has no table of contents and no cross-references (unlike
% ordo.tex), so a single pdflatex pass is enough -- there is nothing for a
% second pass to resolve.
%
% The grid must FILL the page, not sit in its top quarter: \arraystretch
% alone only pads a row's NATURAL height, it cannot make a table taller
% than its own content wants to be, which is exactly why the previous
% version floated at the top with the rest of the page blank. The fix is
% to compute an explicit row height from the text height itself (\cellh
% below) and give every cell a fixed-height parbox of that size, so the
% table's total height is dictated by the page, not by its content. Every
% month in the 1583-9999 domain has either 5 or 6 Sunday-started weeks
% (never fewer), so dividing the available height by 6 fills at least 5/6
% of it on a 5-week month and all of it on a 6-week one -- never a quarter.
%
% Real names, not slugs: the observed day's own display name is a PLAIN
% resolved string (View.of_days, Task 5), interpolated directly as a plain
% var below -- there is no dotted-la-with-slug-fallback idiom left to
% write (see ordo.tex's own header comment for the full reasoning; it
% applies here unchanged).
%
% The weekday header row comes from the view's top-level weekday_headings
% list (name/last objects), not a hard-coded "Dom Lun Mar" row: the engine
% rejects an EMPTY tag path -- a bare dot inside a section, on its own --
% as a parse error, so the loop below must name a field on each heading
% object rather than interpolate the section's own value directly, and a
% hard-coded row would not be localised anyway. Every cell (day and
% heading alike) also carries a last flag, true on the seventh of its row:
% a LaTeX table row needs the ampersand separator BETWEEN cells, not after
% the last one, and the engine has no unless-last construct, so the flag
% is data -- rendered only when NOT last. A trailing ampersand gives eight
% columns for seven cells and pdflatex rejects the file outright.
\documentclass[11pt,landscape]{article}
\usepackage[a4paper,margin=10mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[table]{xcolor}
\usepackage{array}
\definecolor{cwhite}{HTML}{FFFFFF}
\definecolor{cred}{HTML}{F8DCDC}
\definecolor{cgreen}{HTML}{DDEEDD}
\definecolor{cviolet}{HTML}{E6DAF0}
\definecolor{crose}{HTML}{FADCE8}
\definecolor{cblack}{HTML}{DCDCDC}
\setlength{\parindent}{0pt}
\pagestyle{empty}
% Seven equal columns filling the text width, and rows stretched so six
% possible week rows fill the text height -- see the header comment above
% for why a fixed row height, not \arraystretch, is what makes this work.
\newlength{\cellw}\setlength{\cellw}{\dimexpr(\textwidth-14\tabcolsep-8\arrayrulewidth)/7\relax}
\newlength{\cellh}\setlength{\cellh}{\dimexpr(\textheight-18mm)/6\relax}
\newcommand{\daycell}[3]{\parbox[t][\cellh][t]{\cellw}{\raggedright\textbf{#1}\ \footnotesize #2\par\vfill\tiny #3}}
\begin{document}
{{#months}}
{\LARGE\bfseries {{name}} {{year}}}\par\vspace{2mm}
\renewcommand{\arraystretch}{1}
\begin{tabular}{|*{7}{p{\cellw}|}}\hline
{{#weekday_headings}}\textbf{ {{name}} }{{^last}} & {{/last}}{{/weekday_headings}} \\ \hline
{{#weeks}}{{#days}}{{#in_month}}\cellcolor{c{{colour}}}\daycell{ {{dom}} }{ {{name}} }{ {{rank_name}} }{{/in_month}}{{^last}} & {{/last}}{{/days}} \\ \hline
{{/weeks}}
\end{tabular}
\clearpage
{{/months}}
\end{document}
|