aboutsummaryrefslogtreecommitdiff
path: root/templates/ef/grid.tex
blob: 9b7a3efc837457955de8f997c3b2463cac19bf22 (plain) (blame)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
% 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.
%
% Border clipping, fixed: the original \daycell put \vfill directly inside
% the \cellh-tall parbox, so the rank line's own text sat flush against the
% box's bottom edge -- the identical edge \hline draws the cell's bottom
% rule along -- and printed as if sliced in half by the rule. The fix
% keeps the OUTER parbox exactly \cellh tall (every cell in a row must
% still be identical height, or the table stops being a grid), but nests a
% SECOND parbox inside it that is only \cellh minus \cellpad tall and
% carries the actual \vfill. That leaves a strip of \cellpad, genuinely
% blank, between the last line of content and the rule -- not merely
% smaller type or a hopeful \strut. \strut on both bottom lines is kept
% too, belt and suspenders, so a line with no descenders still reserves a
% descender's worth of depth.
%
% Sigla, compactly: each cell also carries the day's Epistle and Gospel
% references (view fields first/gospel), joined by a centred dot rather
% than repeating "Ep."/"Ev." labels -- the same choice ordo.tex already
% made between rank_name and colour_name, kept consistent rather than
% invented a second way. A cell is only about 3.5cm wide, and Holy Week's
% own citations run to 20-30 characters each (a Passion narrative spanning
% several chapters), so "rank_name . first . gospel" does not fit one
% \tiny line together in the worst case -- measured against the rendered
% width, not assumed. The rank line and the sigla therefore get their OWN
% line each rather than being crammed onto one and shrunk past \tiny:
% \cellh leaves ample vertical room (about eleven \tiny lines per cell),
% so two short lines cost far less than illegible type would. Both first
% and gospel are wrapped in their own conditional section (mirroring
% ordo.tex's own idiom) so a day missing either (there is none in the
% shipped EF lectionary, but a future rite or overlay is not guaranteed to
% keep that invariant) prints no stray separator.
\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}
\newlength{\cellpad}\setlength{\cellpad}{1.5mm}
\newcommand{\daycell}[4]{%
  \parbox[t][\cellh][t]{\cellw}{%
    \parbox[t][\dimexpr\cellh-\cellpad\relax][t]{\cellw}{%
      \raggedright\textbf{#1}\ \footnotesize #2\par\vfill
      \tiny #3\strut\par
      \tiny #4\strut
    }%
  }%
}
\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}} }{ {{#first}}{{first}}{{/first}}{{#gospel}}{{#first}}\ \textperiodcentered\ {{/first}}{{gospel}}{{/gospel}} }{{/in_month}}{{^last}} & {{/last}}{{/days}} \\ \hline
{{/weeks}}
\end{tabular}
\clearpage
{{/months}}
\end{document}