-
Notifications
You must be signed in to change notification settings - Fork 1
/
common_headers.tex
454 lines (384 loc) · 16.3 KB
/
common_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
%%%%%%%%%%%%%%% INDICES %%%%%%%%%%%%%%%
\usepackage{imakeidx}
\indexsetup{level=\section*,toclevel=section,noclearpage,othercode=\footnotesize\thispagestyle{empty}}
\makeindex[name=I,title=Index Invitatoriorum, columns=2,columnseprule]
\makeindex[name=H,title=Index Hymnorum, columns=2,columnseprule]
\makeindex[name=A,title=Index Antiphonarum, columns=2,columnseprule]
\makeindex[name=R,title=Index Responsoriorum, columns=2,columnseprule]
\makeindex[name=P,title=Index Psalmorum, columns=2,columnseprule]
\makeindex[name=T,title=Toni Communes, columns=2,columnseprule]
\makeindex[name=F,title=Index Festorum, columns=2,columnseprule]
%%%%%%%%%%%%%%% STANDARD PACKAGES %%%%%%%%%%%%%%%
%% This is the format of the recent Solesmes books.
\usepackage[paperwidth=135mm, paperheight=205mm]{geometry}
%% This is the format of the 1912 Antiphonale Romanum
%\usepackage[paperwidth=160mm, 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}
\usepackage{lettrine}
%%%%%%%%%%%%%%% HYPHENATION AND TYPOGRAPHICAL CONVENTIONS %%%%%%%%%%%%%%
%\setdefaultlanguage[variant=ecclesiastic, hyphenation=liturgical, usej=true, babelshorthands=false]{latin}
\setdefaultlanguage[variant=french, frenchitemlabels=false]{french}
\setotherlanguage{english}
%% this latin option basically boils down to French with slightly thinner pre-punctuation spaces
%% and slightly different hyphenation (but how different?)
%% for some reason, it produces more underfull hboxes in two-col psalms, than French; and about 0.5% more pages.
%% French is therefore to be kept until further notice.
%\setotherlanguage[variant=ecclesiastic, hyphenation=liturgical, usej=true]{latin}
%%%%%%%%%%%%%%% GEOMETRY %%%%%%%%%%%%%%%
%% This should mimic the layout of the recent Solesmes books.
\geometry{
inner=15mm,
outer=10mm,
top=12mm,
bottom=15mm,
headsep=3mm,
}
%% 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
\setlength{\parindent}{0mm}
%% We want to allow large inter-words space
%% to avoid overfull boxes in two-columns rubrics.
\sloppy
%%%%%%%%%%%%%%% GREGORIO CONFIG %%%%%%%%%%%%%%%
\usepackage[forcecompile]{gregoriotex}
%% this limits how much scores can stretch vertically
%% when they are forced to adhere to the bottom of a page (i.e followed by \pagebreak)
%\grechangedim{baselineskip}{55pt plus 1pt minus 5pt}{scalable}
%% this however has been found to break the page layout of the psalterium festivum, somehow
%% text above lines shall be of color gregoriocolor
\grechangestyle{abovelinestext}{\color{gregoriocolor}\footnotesize\itshape}
%% fine-tuning of space beween the staff and the text above lines
\newcommand{\altraise}{-0.4mm} %% default is -0.1cm
\grechangedim{abovelinestextraise}{\altraise}{scalable}
\grechangedim{abovelinestextheight}{10mm}{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}
%% fine-tuning the behavior of text placed under bars. We use the so-called "new algorithm" which
%% places the bar in the middle of surrounding notes, and the text in the middle of surrounding text.
%% however, we restrict drastically the deviation of the text from the position of the bar.
\grechangedim{maxbaroffsettextleft}{0.5mm}{scalable}
\grechangedim{maxbaroffsettextright}{0.5mm}{scalable}
%% in case we show NABC, font selection
\gresetnabcfont{gresgmodern}{12}
%% \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{\subfix{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{\subfix{gabc/#2}}
%% if optional arg #1 has been passed as 'n', unset no initial
\ifx n#1\gresetinitiallines{1}\fi
\vspace{1mm}
}
\makeatother
%%% We select if we want to show NABC. Here, we don't.
\gresetnabc{1}{invisible}
\gresetnabc{2}{invisible}
%%%%%%%%%%%%%%% 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}℣.\nolinebreak[4]\hspace{\specialcharhsep}\nolinebreak[4]}}
\newcommand{\rr}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{Charis SIL}℟.\nolinebreak[4]\hspace{\specialcharhsep}\nolinebreak[4]}}
\renewcommand{\aa}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{Charis SIL}\Abar.\nolinebreak[4]\hspace{\specialcharhsep}\nolinebreak[4]}}
\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}
\gresetspecial{cross}{\textcolor{gregoriocolor}{\fontspec[Scale=\customscale]{FreeSerif}\symbol{"2720}}}
\gresetspecial{labiacross}{\textcolor{gregoriocolor}{+}}
%% 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úia.\rubric{)}}{#2 \rubric{(T.P.} Allelúia.\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.}}
%% Macro to print the common rubric that signals the Paschaltide three-psalm one-antiphon rule
\newcommand{\tptresrubric}{\rubric{Tempore Paschali tres Psalmi sub hac Antiphona dicuntur.}}
%% Macro to print a separator
\newcommand{\sep}{{\centering\greseparator{3}{20}\par}}
%%%%%%%%%%%%%%% COLUMN MANAGEMENT %%%%%%%%%%%%%%%
\usepackage{multicol}
\usepackage{parcolumns}
\setlength\columnseprule{0.4pt}
\setlength{\multicolsep}{6pt plus 2pt minus 1.5pt}
%% Macro to print a psalm on two columns.
\newcommand{\psalmus}[2]{
\vspace{0.5\baselineskip}
\needspace{5\baselineskip}
\phantomsection
\label{Psalm#1_#2}
\index[P]{#1 (mode #2)}
\smalltitle{Psalmus #1}
\begin{multicols}{2}
\begin{itemize}[
label=\null,
leftmargin=0pt,
itemindent=0pt,
labelsep=0pt,
labelwidth=0pt,
rightmargin=0pt,
parsep=0pt,
itemsep=0pt]
\input{psalmi/#1_#2.tex}
\end{itemize}
\end{multicols}
}
\newcommand{\twocolrubric}[2]{
\begin{parcolumns}[rulebetween]{2}
\colchunk{%
\rubric{#1}
}
\colchunk{%
\rubric{#2}
}
\end{parcolumns}
}
%%%%%%%%%%%%%%% 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 neede 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{8\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]{
\needspace{5\baselineskip}
\par{\centering\textbf{#1}\par}
}
\newcommand{\intermediatetitle}[1]{
\needspace{8\baselineskip}
\begin{center}
{\large #1}
\end{center}
}
\newcommand{\nocturn}[1]{
\intermediatetitle{In \Rnum{#1} Nocturno}
}
%% command to wrap printindex and set the headers for indices
\newcommand{\cprintindex}[2]{
\setheaders{Indices}{#2}
\pagestyle{fancy}
\thispagestyle{empty}
\printindex[#1]
}
%%%%%%%%%%%%%%% SUBFILES %%%%%%%%%%%%%%%
\usepackage{xr}
\usepackage{subfiles}
%% When we start a new subfile (new chapter),
%% we start on a new page (with blank filling on the previous page) and create a corresponding label.
\newcommand{\customsubfile}[1]{\newpage\label{#1}\thispagestyle{empty}\subfile{#1}}