-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheaders.tex
528 lines (463 loc) · 20 KB
/
headers.tex
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
%%%%%%%%%%%%%%% INDICES %%%%%%%%%%%%%%%
\usepackage{imakeidx}
\indexsetup{level=\section*,toclevel=section,noclearpage,othercode=\footnotesize\thispagestyle{empty}}
\makeindex[name=L,title=Index des livres bibliques, columns=2,columnseprule,options=-s custom]
\makeindex[name=F,title=Index des jours liturgiques, columns=2,columnseprule, options=-s custom]
\newcommand{\fullbook}{DEFAULTBOOK}
\newcommand{\bookorder}{ZZ}
\newcommand{\booklookup}[4]{%
\IfSubStr{#2}{#1}{ \renewcommand{\fullbook}{#3}\renewcommand{\bookorder}{#4} }{}%
}%
\newcommand{\customreadingindex}[3]{%
\renewcommand{\fullbook}{DEFAULTBOOK}%
\renewcommand{\bookorder}{ZZ}
\booklookup{#1}{Gn}{Livre de la Genèse}{AA}
\booklookup{#1}{Ex}{Livre de l’Exode}{AB}
\booklookup{#1}{Lv}{Livre du Lévitique}{AC}
\booklookup{#1}{Nb}{Livre des Nombres}{AD}
\booklookup{#1}{Dt}{Livre du Deutéronome}{AE}
\booklookup{#1}{Jos}{Livre de Josué}{AF}
\booklookup{#1}{Jg}{Livre des Juges}{AG}
\booklookup{#1}{Rt}{Livre de Ruth}{AH}
\booklookup{#1}{1 S}{Premier livre de Samuel}{AJ}
\booklookup{#1}{2 S}{Deuxième livre de Samuel}{AK}
\booklookup{#1}{1 R}{Premier livre des Rois}{AL}
\booklookup{#1}{2 R}{Deuxième livre des Rois}{AM}
\booklookup{#1}{1 Ch}{Premier livre des Chroniques}{AN}
\booklookup{#1}{2 Ch}{Deuxième livre des Chroniques}{AP}
\booklookup{#1}{Esd}{Livre d’Esdras}{AQ}
\booklookup{#1}{Ne}{Livre de Néhémie}{AR}
\booklookup{#1}{Tb}{Livre de Tobie}{AS}
\booklookup{#1}{Jdt}{Livre de Judith}{AT}
\booklookup{#1}{Est}{Livre d’Esther}{AU}
\booklookup{#1}{1 M}{Premier Livre des Martyrs d’Israël}{AV}
\booklookup{#1}{2 M}{Deuxième Livre des Martyrs d’Israël}{AX}
\booklookup{#1}{Jb}{Livre de Job}{AY}
\booklookup{#1}{Pr}{Livre des Proverbes}{AZ}
\booklookup{#1}{Qo}{L'ecclésiaste}{BA}
\booklookup{#1}{Ct}{Cantique des cantiques}{BB}
\booklookup{#1}{Sg}{Livre de la Sagesse}{BC}
\booklookup{#1}{Si}{Livre de Ben Sira le Sage}{BD}
\booklookup{#1}{Is}{Livre d’Isaïe}{BE}
\booklookup{#1}{Jr}{Livre de Jérémie}{BF}
\booklookup{#1}{Lam}{Livre des lamentations de Jérémie}{BG}
\booklookup{#1}{Ba}{Livre de Baruch}{BH}
\booklookup{#1}{Ep Jr}{Lettre de Jérémie}{BJ}
\booklookup{#1}{Ez}{Livre d’Ézékiel}{BK}
\booklookup{#1}{Dn}{Livre de Daniel}{BL}
\booklookup{#1}{Os}{Livre d’Osée}{BM}
\booklookup{#1}{Jl}{Livre de Joël}{BN}
\booklookup{#1}{Am}{Livre d’Amos}{BP}
\booklookup{#1}{Abd}{Livre d'Abdias}{BQ}
\booklookup{#1}{Jon}{Livre de Jonas}{BR}
\booklookup{#1}{Mi}{Livre de Michée}{BS}
\booklookup{#1}{Na}{Livre de Nahum}{BT}
\booklookup{#1}{Ha}{Livre d’Habaquc}{BU}
\booklookup{#1}{So}{Livre de Sophonie}{BV}
\booklookup{#1}{Ag}{Livre d’Aggée}{BX}
\booklookup{#1}{Za}{Livre de Zacharie}{BY}
\booklookup{#1}{Ml}{Livre de Malachie}{BZ}
\booklookup{#1}{Mt}{Évangile de Jésus-Christ selon saint Matthieu}{CA}
\booklookup{#1}{Mc}{Évangile de Jésus-Christ selon saint Marc}{CB}
\booklookup{#1}{Lc}{Évangile de Jésus-Christ selon saint Luc}{CC}
\booklookup{#1}{Jn}{Évangile de Jésus-Christ selon saint Jean}{CD}
\booklookup{#1}{Ac}{Livre des Actes des Apôtres}{CE}
\booklookup{#1}{Rm}{Lettre de saint Paul Apôtre aux Romains}{DA}
\booklookup{#1}{1 Co}{Première lettre de saint Paul Apôtre aux Corinthiens}{DB}
\booklookup{#1}{2 Co}{Deuxième lettre de saint Paul Apôtre aux Corinthiens}{DC}
\booklookup{#1}{Ga}{Lettre de saint Paul Apôtre aux Galates}{DD}
\booklookup{#1}{Ep}{Lettre de saint Paul Apôtre aux Ephésiens}{DE}
\booklookup{#1}{Ph}{Lettre de saint Paul Apôtre aux Philippiens}{DF}
\booklookup{#1}{Col}{Lettre de saint Paul Apôtre aux Colossiens}{DG}
\booklookup{#1}{1 Th}{Première lettre de saint Paul Apôtre aux Thessaloniciens}{DH}
\booklookup{#1}{2 Th}{Deuxième lettre de saint Paul Apôtre aux Thessaloniciens}{DJ}
\booklookup{#1}{1 Tm}{Première lettre de saint Paul Apôtre à Timothée}{DK}
\booklookup{#1}{2 Tm}{Deuxième lettre de saint Paul Apôtre à Timothée}{DL}
\booklookup{#1}{Tt}{Lettre de saint Paul Apôtre à Tite}{DM}
\booklookup{#1}{Phm}{Lettre de saint Paul Apôtre à Philémon}{DN}
\booklookup{#1}{He}{Lettre aux Hébreux}{DP}
\booklookup{#1}{Jc}{Lettre de saint Jacques Apôtre}{DQ}
\booklookup{#1}{1 P}{Première lettre de saint Pierre Apôtre}{DR}
\booklookup{#1}{2 P}{Deuxième lettre de saint Pierre Apôtre}{DS}
\booklookup{#1}{1 Jn}{Première lettre de saint Jean}{DT}
\booklookup{#1}{2 Jn}{Deuxième lettre de saint Jean}{DU}
\booklookup{#1}{3 Jn}{Troisième lettre de saint Jean}{DV}
\booklookup{#1}{Jd}{Lettre de saint Jude}{DX}
\booklookup{#1}{Ap}{Livre de l’Apocalypse}{DZ}
\index[L]{\bookorder@\fullbook!#2}
\ifblank{#3}{}{\index[L]{\bookorder@\fullbook!#3}}
}%
%%%%%%%%%%%%%%% STANDARD PACKAGES %%%%%%%%%%%%%%%
%% Smaller format for the convenience of not redoing all the gregorio size tweaks, to be printed on KDP standard 8.25in x 11in or larger.
%\usepackage[paperwidth=165mm, paperheight=220mm]{geometry}
%% Normal scale
%\usepackage[paperwidth=8.25in, paperheight=11in]{geometry}
%% Slightly smaller format
\usepackage[paperwidth=180mm, paperheight=240mm]{geometry}
\usepackage{fontspec}
\usepackage[nolocalmarks]{polyglossia}
\usepackage[table]{xcolor}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage{expl3}
\usepackage{hyperref}
\usepackage{refcount}
\usepackage{needspace}
\usepackage{etoolbox}
\usepackage{enumitem}
%%%%%%%%%%%%%%% HYPHENATION AND TYPOGRAPHICAL CONVENTIONS %%%%%%%%%%%%%%
\setdefaultlanguage[variant=french, frenchitemlabels=false]{french}
%%%%%%%%%%%%%%% GEOMETRY %%%%%%%%%%%%%%%
%% Margin targets on KDP standard 8.25in x 11in = 209.6mm x 279.4mm : inner = 25mm, outer = 12mm, top = 12mm, bottom = 12mm
%% Calculated margins for 165x220: inner = 22.9, outer=top=bottom=11.4 (with some margin of error)
\geometry{
inner=25mm,
outer=12mm,
top=18mm,
bottom=15mm,
headsep=6mm,
}
%% General scale of all graphical elements.
%% Values different from 1 are largely untested.
%% Used in those commands (e.g. everything FontSpec) that use a scale parameter.
\newcommand{\customscale}{1}
%% Provide the command \fpevalc as a copy of the code-level \fp_eval:n.
%% \fpevalc allows to evaluate floating point calculation for scaled parameters, e.g. \setSomeStretchFactor{\fpevalc{0,6 * \customscale}}
\ExplSyntaxOn
\cs_new_eq:NN \fpevalc \fp_eval:n
\ExplSyntaxOff
%% No indentation of paragraphs. This is extremely important for both hymns, readings, gregorio scores, etc. to be displayed properly.
\setlength{\parindent}{0mm}
%% We want to allow large inter-words space
%% to avoid overfull boxes in two-columns rubrics.
%\sloppy %% this is commented out for books that are mainly one-column to help detect badly formatted lines
%%%%%%%%%%%%%%% GREGORIO CONFIG %%%%%%%%%%%%%%%
\usepackage[autocompile]{gregoriotex}
%% text above lines shall be of color gregoriocolor
\grechangestyle{abovelinestext}{\color{gregoriocolor}\footnotesize}
%% fine-tuning of space beween the staff and the text above lines
\newcommand{\altraise}{-1.4mm} %% default is -0.1cm
\grechangedim{abovelinestextraise}{\altraise}{scalable}
\grechangedim{abovelinestextheight}{6mm}{scalable}
%% fine-tuning of space between the staff and the lyrics
\newcommand{\textraise}{2.8ex} %% default is 3.48471 ex
\grechangedim{spacelinestext}{\textraise}{scalable}
%% fine-tuning of space between the initial and the annotations
\newcommand{\annraise}{0mm} %% default is -0.2mm
\grechangedim{annotationraise}{\annraise}{scalable}
%% \officepartannotation converts a letter (IHARPT) into the office part to be printed as annotation,
%% storing the result into \result.
\newcommand{\result}{}
\newcommand{\lookup}[3]{%
\IfSubStr{#2}{#1}{ \renewcommand{\result}{#3} }{}%
}%
\newcommand{\officepartannotation}[1]{%
\renewcommand{\result}{#1}%
\lookup{#1}{T}{}%
\lookup{#1}{H}{Hymn.}%
\lookup{#1}{A}{Ant.}%
\lookup{#1}{P}{}%
\lookup{#1}{R}{Resp.}%
\lookup{#1}{I}{Invit.}%
\result%
}%
%% header capture setup for the mode
\newcommand{\defaultannotationshift}{-2mm}
\newcommand{\modeannotation}[1]{\greannotation{\hspace{\defaultannotationshift}#1}}
\gresetheadercapture{mode}{modeannotation}{string}
%% outputs a score with no label, indexing, initials or annotations
%% for
\newcommand{\unindexedscore}[1]{
\gresetinitiallines{0}
%% the use of a directory called "gabc" is linked
%% to the management of gabc files by the website: do not change
%% without also changing the website static files structure
\gregorioscore{gabc/#1}
\gresetinitiallines{1}
}
%% outputs a score with label, indexing, and annotations. no initials if [n] is passed
\makeatletter
\newcommand{\gscore}[5][y]{
%% #1 (passed as option) : y = initial, n = no initial
%% #2 : name of the score file, should be a code, e.g. Q4F4A3 or 1225N1R1
%% #3 : office-part among the values: T, H, A, P, R, I (toni communes, hy., ant., psalmus, resp., invit.)
%% #4 : if applicable, a number between 1 and 9 (rank of the ant./resp.) - else: empty
%% #5 : the indexed name of the piece
%% this prevents page breaks between the phantom section and its label, and the actual score.
\needspace{4\baselineskip}
\protected@edef\@currentlabelname{#5}
\phantomsection
\label{#2}
%% we add the office part, and number of that ant. or resp. in the current office, if applicable
%% todo : the negative hspace is here because somehow the initial and annotation (first line only) are misaligned by 1mm _with this initial font size_.
%% this should probably be fixed in a more elegant way.
\greannotation[c]{\hspace{-1.4mm}\hspace{\defaultannotationshift}\officepartannotation{#3}#4}
%% if #5 (indexed name) is blank, nothing is indexed.
%% this is for pieces that are repetitions of another piece (antiphons after psalms)
\ifblank{#5}{}{\index[#3]{#5}}
%% if optional arg #1 has been passed as 'n', set no initial
\ifx n#1\gresetinitiallines{0}\fi
%% the use of a directory called "gabc" is linked
%% to the management of gabc files by the website: do not change
%% without also changing the website static files structure
\gregorioscore{gabc/#2}
%% if optional arg #1 has been passed as 'n', unset no initial
\ifx n#1\gresetinitiallines{1}\fi
\vspace{1mm}
}
\makeatother
\newcommand{\chantedscripturereading}[1]{
\gregorioscore{scriptura/#1}
}
%%%%%%%%%%%%%%% FONTS %%%%%%%%%%%%%%%
%%%%%%%%%%%%%%% Main font
\setmainfont[Ligatures=TeX, Scale=\customscale]{Charis SIL}
%\setmainfont[Ligatures=TeX, Scale=\customscale]{TeXGyreBonum-Regular}
\setstretch{\fpevalc{1.05 * \customscale}}
%%%%%%%%%%%%%%% Score initials
%% \initialsize resizes the initials, with one argument (size in points)
\newcommand{\initialsize}[1]{
\grechangestyle{initial}{\fontspec{Zallman Caps}\fontsize{#1}{#1}\selectfont}
}
%% default initial size is 32 points
\newcommand{\defaultinitialsize}{28}
\initialsize{\defaultinitialsize}
%% spacing before and after initials to kern the Zallman Caps.
%% this should be changed if we move away from Zallman Caps.
\newcommand{\initialspace}[2]{
\grechangedim{afterinitialshift}{#2}{scalable}
\grechangedim{beforeinitialshift}{#1}{scalable}
}
%% default space before and after initials is 0mm to the left and 2mm to the right.
\newcommand{\defaultinitialspace}{\initialspace{0mm}{-\defaultannotationshift}}
\defaultinitialspace{}
%%%%%%%%%%%%%%% Score annotations
\grechangestyle{annotation}{\small}
%%%%%%%%%%%%%%% GRAPHICAL ELEMENTS %%%%%%%%%%%%%%%
%% V/, R/, A/ and + signs for in-line use (\vv \rr \aa \cc)
\newcommand{\specialcharhsep}{3mm} % space after invoking R/ or V/ or A/ outside rubrics
\newcommand{\vv}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{Charis SIL}℣.\hspace{\specialcharhsep}}}
\newcommand{\rr}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{Charis SIL}℟.\hspace{\specialcharhsep}}}
\renewcommand{\aa}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{Charis SIL}\Abar.\hspace{\specialcharhsep}}}
\newcommand{\cc}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{FreeSerif}\symbol{"2720}~}}
%% Same special characters, for in-score use (<sp>V/ R/ A/ +</sp>)
\gresetspecial{V/}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{Charis SIL}℣.~}}
\gresetspecial{R/}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{Charis SIL}℟.~}}
\gresetspecial{A/}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{Charis SIL}\Abar.~}}
\gresetspecial{+}{{\fontspec[Scale=\customscale]{FreeSerif}†~}}
\gresetspecial{*}{\gresixstar}
%% Same special characters, for use in rubrics (no space, and no red command since it will be reddified with the rest)
\newcommand{\vvrub}{{\fontspec[Scale=\customscale]{Charis SIL}℣.~}}
\newcommand{\rrrub}{{\fontspec[Scale=\customscale]{Charis SIL}℟.~}}
\newcommand{\aarub}{{\fontspec[Scale=\customscale]{Charis SIL}\Abar.~}}
%% the asterisk as found in the mediants of text-only psalms
\newcommand{\psstar}{\GreSpecial{*}}
\newcommand{\pscross}{\GreSpecial{+}}
%% also, most psalms do not call those but use † and * - todo
%% Roman Numerals
\usepackage{modroman}
\newcommand{\Rnum}[1]{\nbRoman{#1}}
\newcommand{\rnum}[1]{\nbshortroman{#1}}
%% Macro to print versicles
\newcommand{\versiculus}[2]{\par\vv #1 \\ \rr #2\par}
\newcommand{\versiculustpall}[2]
{\versiculus{#1 \rubric{(T.P.} Allelúja. \rubric{)}}{#2 \rubric{(T.P.} Allelúja. \rubric{)}}}
%% Macro to print rubrics
\newcommand{\rubric}[1]{\textcolor{gregoriocolor}{\emph{#1}}}
%% Macro to print the name of a score in normal characters inside a \rubric
\newcommand{\normaltext}[1]{{\normalfont\normalcolor #1}}
\newcommand{\scorename}[1]{\normaltext{\nameref{M-#1}}}
%% Macro to print a full reference to a responsory
%% #1 is the R/ number in the feast, #2 is the R/ code, #3 is an optional additional text, like "sine Gloria Patri".
\newcommand{\respref}[3]{\rubric{%
\rrrub #1 \scorename{#2}, pag.\ \pageref{M-#2}%
\if\relax\detokenize{#3}\relax%
.%
\else%
, #3.%
\fi%
}}
\newcommand{\resprefcumgp}[2]
{\respref{#1}{#2}{sed cum \normaltext{Glória Patri} in fine}}
\newcommand{\resprefsinegp}[2]
{\respref{#1}{#2}{sine \normaltext{Glória Patri}}}
%% Macro to print the common rubric that signals the Te Deum
\newcommand{\tedeumrubric}{\rubric{Lectione ultima peracta Hymnus \normaltext{Te Deum} cantatur.}}
%% Macros to print common incipits of gospels
\newcommand{\encetemps}{En ce temps-là,}
\newcommand{\jesusdisciples}{Jésus dit à ses disciples:}
\newcommand{\jesuspharisiens}{Jésus dit aux pharisiens:}
\newcommand{\jesusfoulejuifs}{Jésus dit à la foule des Juifs:}
\newcommand{\jesusfoules}{Jésus dit aux foules:}
\newcommand{\jesusdisciplesparabole}{Jésus dit à ses disciples cette parabole:}
\newcommand{\jesuspharisiensparabole}{Jésus dit aux pharisiens cette parabole:}
%%% Macro to print a reading
\newcommand{\reading}[7]{
%% #1 : reading code (unique), normally unused except for consistency checks
%% #2 : source file name (no extension), which should match the reading code except when the reading is a duplicate
%% #3 : the reading incipit
%% #4 : the rubric (normally indicating the book from which the reading is)
%% #5 : the index book, if an index entry must be created
%% #6 : the index chapter, if applicable
%% #7 : a second index chapter, if applicable (no reading can be from two different books: for gospel incipits, they are separate)
\needspace{8\baselineskip} % break page if less than 8 lines are available
\phantomsection
\label{#1}
\ifblank{#5}{}{
\customreadingindex{#5}{#6}{#7}
%\index[L]{#5!#6}
}
\ifblank{#3}{
\vspace{5mm}
}{
\begin{center}
#3\par
\end{center}
}
\ifblank{#4}{}{
\rubric{#4}\par
}
% this next part makes the tab character active, I think by making it lowercase ~ and defining it as such (because \def<tab>{something} does not work)
\begingroup
\begingroup
\lccode`\~=9\relax
\lowercase{%
\endgroup
\def~%
}{\hspace{8mm}}%
\catcode9=\active
\obeylines\input{scriptura/#2.tex}%
\endgroup
}
%%%%%%%%%%%%%%% COLUMN MANAGEMENT %%%%%%%%%%%%%%%
\usepackage{parcolumns}
\setlength\columnseprule{0.4pt}
\newcommand{\twocolrubric}[2]{
\begin{parcolumns}[rulebetween]{2}
\colchunk{%
\rubric{#1}
}
\colchunk{%
\rubric{#2}
}
\end{parcolumns}
}
\usepackage{paracol} % worse than parcolumns in terms of space management, but can do facing pages
\twosided[pm]
%%%%%%%%%%%%%%% HEADER STYLES %%%%%%%%%%%%%%%
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{20pt}
\fancyhead[RO]{\small\rightmark\hspace{1cm}\thepage}
\fancyhead[LE]{\small\thepage\hspace{1cm}\leftmark}
% this command is called every time the left and right header texts are set (e.g. by calling \feast)
% the hyphenpenalty override is needed only on older versions of gregorio which do not reset it correctly after typesetting the score.
% see https://tex.stackexchange.com/questions/581013/lualatex-hyphenation-issue-in-fancyhdr-with-gregoriotex-and-multicols-latin-te
\newcommand{\setheaders}[2]{
\renewcommand{\rightmark}{\hyphenpenalty=50{\sc#2}}
\renewcommand{\leftmark}{\hyphenpenalty=50{\sc#1}}
}
\setheaders{}{}
%%%%%%%%%%%%%%% TITLE STYLES %%%%%%%%%%%%%%%
%% Titles are centered and small-caps
\titleformat{\chapter}[block]{\Large\filcenter\sc}{}{}{}
\titleformat{\section}[block]{\large\filcenter\sc}{}{}{}
\titleformat{\subsection}[block]{\filcenter\sc}{}{}{}
\setcounter{secnumdepth}{0}
%% Fine-tuning of space around titles
\titlespacing*{\paragraph}{0pt}{1ex}{.6ex}
%% Typesets all titles throughout the NR except Nocturn titles and a few special titles.
%% Using a continuation is necessary because there are 11 arguments.
%% Only \feast, \nocturn, \intermediatetitle and \smalltitle should ever be used.
\newcommand{\feast}[6]{
%% #1: feast code, e.g. 1225 or A1F1
%% #2: feast title
%% #3: left header title
%% #4: right header title
%% #5: title level
%% title level 1 : full page width, a few major feasts + titles of temporale, sanctorale, etc.
%% title level 2 : all feasts, sundays and major ferias
%% title level 3 : ferias
%% #6: incipit date (goes above feast title)
%% cont'd #1: 1954 rank
%% cont'd #2: 1960 rank
%% cont'd #3: name of the feast as it shows up in the index
%% cont'd #4: 1945 feast-wide rubrics
%% cont'd #5: 1960 feast-wide rubrics
%% needspace: should be barely more than the vertical space for the titles, rubrics excluded.
%% this is to ensure that the page does not get cut after the title or the phantomsection.
\needspace{15\baselineskip}
%% phantomsection is to allow the label to attach to the title and not the previous counter object.
\phantomsection
\label{#1}
\begin{center}
%% we typeset a line for the date if the date is not blank
\ifblank{#6}{}{
{\large #6}\\%
}%
%% the actual title
\ifx 1#5{\setstretch{1.2}\sc\huge #2\par}\fi
\ifx 2#5{\Large #2\par}\fi
\ifx 3#5{\large #2\par}\fi
\end{center}
%% If this is a level 1 title, empty pagestyle
\ifx 1#5\thispagestyle{empty}\fi
%% we define the header titles manually
\setheaders{#3}{#4}
%% moving on to a continuation macro to unpack the last 5 arguments
\feastcontinued
}
\newcommand{\feastcontinued}[5]
{
%% we name the last 5 arguments
\def\oldrank{#1}%
\def\newrank{#2}%
\def\indexfeastname{#3}%
\def\oldrubric{#4}%
\def\newrubric{#5}%
%% we index the feast if the indexing name is given
\ifblank{#3}{}{
\index[F]{\indexfeastname}
}
%% we typeset a two-column rank & rubrics block if one rank is filled in
\ifblank{#1}{}{%
\begin{parcolumns}[rulebetween]{2}
\colchunk{%
{\centering\oldrank\par}%
\ifblank{#4}{}{\rubric{\oldrubric}}
}
\colchunk{%
{\centering\newrank\par}%
\ifblank{#5}{}{\rubric{\newrubric}}
}
\end{parcolumns}
\vspace{2mm}
}
}
\newcommand{\smalltitle}[1]{
\par{\centering\textbf{#1}\par}
}
\newcommand{\intermediatetitle}[1]{
\begin{center}
{\large #1}
\end{center}
}
\newcommand{\nocturn}[1]{
\needspace{8\baselineskip}
\intermediatetitle{In \Rnum{#1} Nocturno}
}
%% For parts of the book that are typeset with bilingual facing pages, this allows to skip to the next left-hand page at the beginning of such a part.
\newcommand*\cleartoleftpage{%
\clearpage
\ifodd\value{page}\hbox{}\newpage\fi
}
%% command to wrap printindex and set the headers for indices
\newcommand{\cprintindex}[2]{
\setheaders{Index}{#2}
\pagestyle{fancy}
\thispagestyle{empty}
\printindex[#1]
}