-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.tex
More file actions
461 lines (383 loc) · 11.7 KB
/
main.tex
File metadata and controls
461 lines (383 loc) · 11.7 KB
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
% NOTE: This file should be compiled with XeLaTeX.
\documentclass[9pt]{memoir}
% Various packages
\usepackage{xparse}% For better document commands
\usepackage{graphicx}% For rotating characters (used when citing runic inscriptions) and images
\graphicspath{ {./img/} }
%NOTE: Continuous figure numbering is after mainmatter
%\usepackage[inline]{showlabels}% For debugging labels
\usepackage{longtable}% Long tables.
\usepackage{tabu}% Table management
\usepackage{rotating}
\usepackage{tipa}% IPA
\usepackage{marginnote}
% TODO: Underline that does not skip descender?
% Should be called \nsunderline
% ^ The point of this would have been to make the alliteration marking nicer. But it'd be bad since certain consonants (p, g, j, q) would simply not be marked.
% Headers.
\def\booktitle{}
\pagestyle{myheadings}
\aliaspagestyle{plain}{empty}% Remove footers from title pages
\makeoddhead{myheadings}{}{\emph{\booktitle}}{\thepage}
\makeevenhead{myheadings}{\thepage}{The Northern Epics}{}
\PassOptionsToPackage{hyphens}{url}\usepackage[hidelinks=true]{hyperref}% For linking within the pdf
% Critical edition
\usepackage[parapparatus, series={A,B}]{reledmac}
\newcounter{prosea}
%\def\critfootnotes{}%NOTE: experimental, if we want critical notes in footnotes
% Font and typesetting
\usepackage[a5paper, %Geometry
bindingoffset=0.2in,
left=1in,
right=1in,
top=0.9in,
bottom=0.8in,
footskip=.25in]{geometry}
\usepackage{microtype}
\usepackage{fontspec}
\usepackage{wasysym}
\setmainfont{Junicode}
\usepackage[usenames,dvipsnames]{xcolor}
\definecolor{myRed}{RGB}{178, 0, 0}
\definecolor{myBlack}{RGB}{33, 37, 41}
\color{myBlack}
\usepackage{tikz}% For drawing figures
\usetikzlibrary{positioning, calc}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{greek, russian, hebrew, latin}
\newfontfamily\greekfont{Junicode}
\newfontfamily\cyrillicfont{Times New Roman}
\newfontfamily\hebrewfont{Ezra SIL}[Script=Hebrew]
% Bibliography and citations
\usepackage{csquotes}
\usepackage[style=apa]{biblatex}
\addbibresource{bibliography.bib}
\DefineBibliographyStrings{english}{%
sequens = {f\adddot},
sequentes = {ff\adddot},
}
\DeclareFieldFormat{plain}{#1}
\renewbibmacro*{begentry}{%
\iffieldundef{shorthand}
{} % Do nothing if there is no shorthand
{\printfield[plain]{shorthand}%
\printunit*{\addspace=\space}}%
}
\DeclareSortingTemplate{includeshorthands}{
\sort{
\field{shorthand}
\field{shorttitle}
\name{author}
\name{editor}
\field{title}
}
\sort{
\field{year}
}
}
\ExecuteBibliographyOptions{sorting=includeshorthands}
\newbibmacro*{textciteshorthand}{% Cite short hands. From Stack Exchange: https://tex.stackexchange.com/questions/489928/biblatex-apa-textcite-with-shorttitle
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}%
{}%
\setunit{\compcitedelim}%
\printfield[bibhyperref]{shorthand}%
\iffieldundef{postnote}{}{%
\ifnumequal{\value{citecount}}{\value{citetotal}}{%
\printunit{\global\booltrue{cbx:parens}\addspace\bibopenparen}
}{}%
}%
}%
\DeclareCiteCommand{\textciteshorthand}
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{textciteshorthand}}
{}
{\usebibmacro{textcite:postnote}%
\usebibmacro{cite:post}%
}
\newbibmacro*{parenciteshorthand}{%
\printfield[bibhyperref]{shorthand}%
}
\DeclareCiteCommand{\parenciteshorthand}[\mkbibparens]
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{parenciteshorthand}}
{\multicitedelim}
{\usebibmacro{postnote}%
\usebibmacro{cite:post}}
\begin{document}
% language handling
\NewDocumentCommand{\textoi}{m}{%
\emph{#1}%
}
\let\oldtextlatin\textlatin% NOTE: Wrap textlatin in \emph{}
\renewcommand{\textlatin}[1]{\emph{\oldtextlatin{#1}}}
% Book and chapter commands
\setsecnumdepth{none}% Disable numbering of sections
\maxsecnumdepth{none}% Disable numbering of sections
\NewDocumentCommand{\chapterStart}{o O{Chap}}{% Command at the start of chapter
\setcounter{stanza}{0}%
\setcounter{prosea}{0}%
\stepcounter{section}%
\IfNoValueF{#1}{%
\begin{center}%
\textbf{#2. \arabic{section}} \\
{#1}\end{center}%
}%
}
\def\thisBookCode{INTERNALERROR}%
\NewDocumentCommand{\setBookCode}{m}{
\def\thisBookCode{#1}%
\phantomsection\label{#1}%
}
\NewDocumentCommand{\bookStart}{m o}{% Command at the start of book
% arg 1 (mandatory): English title
% arg 2 (optional): Original title
\IfValueTF{#2}{%
\chapter*{#1 \\ \emph{(#2)}}%
\def\booktitle{#2}%
}{%
\chapter*{#1}%
\def\booktitle{#1}%
}%
\addcontentsline{toc}{chapter}{\booktitle}
\setcounter{section}{0}% Set chapter count to zero.
\chapterStart{}%
}
\Xlemmaseparator{~|}% Use vertical bar instead of right bracket ] to break lemmas
\Xinplaceofnumber{0pt}% for ALL-notes to work properly
\ifdefined\critfootnotes% Print stanza number
\Xstanza
\Xstanzaonlyfirst
\Xnolinenumberifannotation
\Xstanzaseparator{/}
\fi
% Verse format commands
\numberstanzatrue% Use reledmac stanza numbering
\NewDocumentCommand{\textlink}{m o o}{%
% NOTE: Link to any poem using the bookcode and stanza number, e.g.
% \textlink{Vafthrudnismal}[11].
% #3 is an optional display number
\IfNoValueTF{#2}{%
\hyperref[#1]{\csname#1\endcsname}%
}{%
\IfNoValueTF{#3}{%
\hyperref[#1:#2]{\csname#1\endcsname\ #2}%
}{%
\hyperref[#1:#2]{\csname#1\endcsname\ #3}%
}%
}%
}
\NewDocumentCommand{\bvg}{o}{% Begin verse group
\vspace{0.3cm}%
\ifx\critfootnotes\undefined \begin{ledgroup}\fi%
\beginnumbering%
}
\NewDocumentCommand{\bva}{o o}{% Begin verse a
\IfValueT{#1}{% Optional stanza number
\IfEq{#1}{0}{}{% If optional stanza number is NOT 0 we show it instead of expected number
\renewcommand{\thestanza}{\textbf{#1}}%
}%
}%
\begin{large}\begin{stanza}%
\IfValueT{#2}{% Optional line number to start on (otherwise we start on 1)
\setline{#2}%
}%
\IfValueTF{#1}{% Make labels
\IfEq{#1}{0}{}{%
\phantomsection\edef\temp{\noexpand\label{\thisBookCode:#1}}\temp%
}%
}{%
\phantomsection\edef\temp{\noexpand\label{\thisBookCode:\arabic{stanza}}}\temp%
}%
}
\NewDocumentCommand{\eva}{o}{% End verse a
\&%
\end{stanza}\end{large}% End large and stanza
\vspace{1.5mm}% Vertical space
%
}
\NewDocumentCommand{\bvb}{o}{% Begin verse b (see above)
% \IfNoValueTF{#1}{% NOTE: Not currenly numbering these.
% \stepcounter{verseb}%
% \textbf{\arabic{verseb} }%
% }{\IfEq{#1}{0}{}{%
% \textbf{\textbf{#1}}
% }}%
\noindent%
}
\NewDocumentCommand{\evb}{o}{% End verse b
% Nothing (for now?)
}
\NewDocumentCommand{\evg}{o}{% End verse group
\endnumbering%
\ifx\critfootnotes\undefined \end{ledgroup}\fi%
\vspace{0.3cm}%
}
% Prose format commands
\NewDocumentCommand{\bpg}{o}{% Begin prose group
\vspace{0.3cm}%
\ifx\critfootnotes\undefined \begin{ledgroup}\fi%
\beginnumbering%
}
\NewDocumentCommand{\bpa}{o o}{% Begin prose a
\setlength{\leftskip}{\stanzaindentbase}% Get some indentation to agree with stanza indent
\begin{large}\pstart% Start large and prose
\noindent% No indent (is this bad)
\IfValueT{#2}{% Optional line number to start on (otherwise we start on 1)
\setline{#2}%
}%
\IfNoValueTF{#1}{% Add prose number according to counter
\stepcounter{prosea}% Step prose counter
\phantomsection\edef\temp{\noexpand\label{\thisBookCode:P\arabic{prosea}}}\temp%
\flagstanza{\textbf{P\arabic{prosea}}}%
}{\IfEq{#1}{0}{}{% If optional prose number is NOT 0 we show it.
\IfEq{#1}{0}{}{%
\phantomsection\edef\temp{\noexpand\label{\thisBookCode:P#1}}\temp%
}%
\flagstanza{\textbf{P#1}}%
}}%%
}
\NewDocumentCommand{\epa}{o}{% End prose a
\pend\end{large}% End large and prose
\numberpstartfalse%
\setlength{\leftskip}{0cm}%
\vspace{1.5mm}% Vertical space
}
\NewDocumentCommand{\bpb}{o}{% Begin prose b (see above)
\noindent%
}
\NewDocumentCommand{\epb}{o}{% End prose b
% nothing (for now?)
}
\NewDocumentCommand{\epg}{o}{% End verse group
\endnumbering%
\ifx\critfootnotes\undefined \end{ledgroup}\fi%
\vspace{0.3cm}%
}
% Formatting of footnotes and critical apparatus
% Edtext with automatic translation
% EXAMPLE: \edtrans{orðinn}{become}{\Afootnote{borinn ‘borinn’ \Hauksbok}}
\NewDocumentCommand{\edtrans}{m m +m}{%
\edtext{#1}{\lemma{\let\alst\relax #1 ‘#2’}#3}%
}
% All note
\NewDocumentCommand{\Ballnote}{+m}{%
\ifdefined\critfootnotes%
\edtext{}{\linenumannotation{ALL}\Bfootnote{{#1}}}%
\else%
\edtext{}{\lemma{ALL}\Bfootnote[nonum]{{#1}}}%
\fi
}
\NewDocumentCommand{\Aallnote}{m}{%
\ifdefined\critfootnotes%
\edtext{}{\linenumannotation{ALL}\Afootnote{{#1}}}%
\else%
\edtext{}{\lemma{ALL}\Afootnote[nonum]{{#1}}}%
\fi
}
% Manuscript note
\leftnoteupfalse\rightnoteupfalse% Make the notes flow downwards
\NewDocumentCommand{\mssnote}{m}{%
\ledrightnote{[{#1}]}%
% \begingroup
% \renewcommand{\thefootnoteA}{}%
% \footnoteA{\emph{Mss.: } #1}%
% \endgroup%
% \edtext{}{\lemma{Mss.:}\Afootnote[nonum]{#1}}%
}
\NewDocumentCommand{\speakernote}{m}{%
\ledleftnote{{#1}}%
}
\reversemarginpar%Use left margin instead.
\NewDocumentCommand{\speakernoteb}{m}{%
% \marginnote{\small{#1}}%
}
% Sidenote margin
\setlength{\ledlsnotesep}{1.5 \ledlsnotesep}
% Make A footnotes paragraphs
\Xarrangement[A]{paragraph}
% Make A footnotes italicized
\Xwrapcontent[A]{\emph}
% Make numbering of B footnotes roman. Disabled since value cannot be higher than "z".
% \renewcommand*{\thefootnoteB}{\alph{footnoteB}}
\mpfnpos{% Footnote order
{B}{familiar},%
{A}{familiar},%
{A}{critical},%
{B}{critical},%
}
% Poem formatting
% First line number at 2
\firstlinenum{2}
\linenumincrement{2}
% Stanza indentation (required by reledmac)
% \setlength{\stanzaindentbase}{20pt}
\setstanzaindents{5, 1}
\setcounter{stanzaindentsrepetition}{1}
\sublinenumberstyle{alph}
% \renewcommand{\stanzanumwrapper}[1]{%
% \flagstanza[35pt]{#1}%
% }%
% Line numbers directly under verse number (kind of a hack)
% \setlength{\linenumsep}{-0.5pc}
% Mark cæsuræ. Bullet point ( • ), interpunct: ( · )
\NewDocumentCommand{\hld}{o}{%
\IfNoValueTF{#1}{ · }{%
{\small ({#1})}%
}%
}%
% Indent lines (in Ljóðaháttr or Galdralag).
\newcommand{\ind}{%
\hspace*{1.5em}%
}
% Mark alliteration.
\NewDocumentCommand{\alst}{m}{%
% \underline{#1}% Underline.
% \textbf{#1}% Bold font. To be used if printing in black and white.
\textcolor{myRed}{#1}% Red font. Uses xcolor package.
}
% Translation formatting
\newcommand{\bce}{%
\textsc{bce}%
}
\newcommand{\ce}{%
\textsc{ce}%
}
%Line. NOTE: Commented out for now
\newcommand{\sectionline}{%
% \begin{center}\line(1,0){5em}\end{center}%
}
% Mark kennings.
\NewDocumentCommand{\ken}{sm}{%
% No small caps; text inside the brackets.
\IfBooleanTF{#1}{% No small caps
{[{#2}]}% EXAMPLE: [= Wooden]
}{%
\textsc{[{#2}]}% EXAMPLE: [ETTIN]
}%
}%
% Mark names with angular brackets.
\NewDocumentCommand{\name}{m}{%
% Text inside the brackets.
⟨{#1}⟩% EXAMPLE: ⟨ettin⟩
}%
% Index commands
\NewDocumentCommand{\inx}{o m O{#2}}{% Index link (type, link, optional alt display)
\IfNoValueTF{#1}{% TODO: phase this out
ERRORERRORERROR%
}{% Proper noun
\hyperref[#1:#2]{#3}%NOTE \hyperref[#1:#2]{#3\textsuperscript{†}}% NOTE \hyperref[#1:#2]{#3\textsuperscript{#1}
}%
}
\NewDocumentCommand{\inxitem}{o m}{% Index label (type, word)
\item[\textbf{#2}]%
\phantomsection\label{#1:#2}%
}
% Render books
\input{books.tex}%
\end{document}