-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tex
312 lines (255 loc) · 7.66 KB
/
main.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
% This file should be compiled with XeLaTeX.
\documentclass{memoir}
% Font and typesetting
\usepackage[final]{microtype}
% Multiple languages
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{greek}
\setmainfont{Junicode}[
Extension=.ttf,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic]
\newfontfamily\greekfont{Times New Roman}
\usepackage[usenames,dvipsnames]{xcolor}
% 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.
\pagestyle{myheadings}
\aliaspagestyle{plain}{empty}% Remove footers from title pages
\makeoddhead{myheadings}{}{\thechapter}{\thepage}
\makeevenhead{myheadings}{\thepage}{The Old Germanic Scoldship}{}
% Bibliography and citations
\usepackage[style=apa]{biblatex}
\addbibresource{bibliography.bib}
\DefineBibliographyStrings{english}{%
sequens = {f\adddot},
sequentes = {ff\adddot},
}
\newbibmacro*{textciteshorttitle}{% Cite short titles. 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]{shorttitle}%
\iffieldundef{postnote}{}{%
\ifnumequal{\value{citecount}}{\value{citetotal}}{%
\printunit{\global\booltrue{cbx:parens}\addspace\bibopenparen}
}{}%
}%
}%
\DeclareCiteCommand{\textciteshorttitle}
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{textciteshorttitle}}
{}
{\usebibmacro{textcite:postnote}%
\usebibmacro{cite:post}}
% Critical edition
\usepackage[parapparatus, series={A,B}]{reledmac}
% Define verse and prose counters
\newcounter{versea}
\newcounter{verseb}
\newcounter{prosea}
% Various packages
\usepackage{xparse}% For better document commands
\usepackage{graphicx}% For rotating characters (used when citing runic inscriptions)
\usepackage{hyperref}% For index links
\usepackage{longtable}% Long tables.
\usepackage{tabu}% Table management
\usepackage{tipa}% IPA
\begin{document}
% 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{verseb}{0}%
\setcounter{prosea}{0}%
\stepcounter{section}%
\IfNoValueF{#1}{%
\begin{center}%
\textbf{#2. \arabic{section}} \\
{#1}\end{center}%
}%
}
\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{#1 \emph{(#2)}}%
}{%
\chapter*{#1}%
\def\booktitle{#1}%
}%
\addcontentsline{toc}{chapter}{\booktitle}
\setcounter{section}{0}% Set chapter count to zero.
\chapterStart{}%
}
% Verse format commands
\numberstanzatrue% Use reledmac stanza numbering
\NewDocumentCommand{\bvg}{o}{% Begin verse group
\vspace{1cm}%
\begin{ledgroup}%
\beginnumbering%
\setcounter{footnoteB}{0}%
}
\NewDocumentCommand{\bva}{o o}{% Begin verse a
\IfValueT{#2}{% Optional line number
\setlinenum{#2}%
}%
\IfValueTF{#1}{%
\numberstanzafalse% If optional verse number exists or is 0 we disable numbering
}{%
\numberstanzatrue%
}%
\begin{large}\begin{stanza}%
\IfValueT{#1}{%
\IfEq{#1}{0}{}{% If optional verse number is NOT 0 we show it with flag.
\flagstanza{\textbf{#1}}%
}%
}%
}
\NewDocumentCommand{\eva}{o}{% End verse a
\& \end{stanza}\end{large}% End reledmac stanza
\vspace{1.5mm}% Vertical space
}
\NewDocumentCommand{\bvb}{o}{% Begin verse b (see above)
\IfNoValueTF{#1}{%
\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\end{ledgroup}% End numbering and ledgroup
}
% Prose format commands
\NewDocumentCommand{\bpg}{o}{% Begin prose group
\vspace{1cm}%
\begin{ledgroup}\beginnumbering%
\setcounter{footnoteB}{0}%
}
\NewDocumentCommand{\bpa}{o}{% Begin prose a
\setlength{\leftskip}{1cm}% Indent hack
\pstart%
\noindent% No indent (is this bad)
\begin{large}% Begin large text
\IfNoValueTF{#1}{% Add prose number according to counter
\stepcounter{prosea}% Step prose counter
\flagstanza{\textbf{P\arabic{prosea}}} %
}{\IfEq{#1}{0}{}{% If optional prose number is NOT 0 we show it.
\flagstanza{\textbf{P#1}}%
}}%%
}
\NewDocumentCommand{\epa}{o}{% End prose a
\end{large}% End large
\pend
\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\end{ledgroup}% End numbering and ledgroup
}
% 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{\textnormal{#1} ‘#2’}#3}%
}
% Manuscript note
\leftnoteupfalse\rightnoteupfalse% Make the notes flow downwards
\NewDocumentCommand{\mssnote}{m}{%
\ledinnernote{[{#1}]}%
}
\NewDocumentCommand{\speakernote}{m}{%
\ledouternote{\small{#1}}%
}
% Sidenote margin
\setlength{\ledlsnotesep}{2 \ledlsnotesep}
% Make A footnotes paragraphs
\Xarrangement[A]{paragraph}
% Make A footnotes italicized
% \Xwrapcontent[A]{\emph}
% Make numbering of B footnotes roman
\renewcommand*{\thefootnoteB}{\alph{footnoteB}}
\fnpos{% Footnote order
{B}{familiar},%
{A}{familiar},% No such notes should exist but the entry is needed.
{A}{critical},%
{B}{critical},%
}
% Poem formatting
% First line number at 2
\firstlinenum{2}
\linenumincrement{2}
% Stanza indentation (required by reledmac)
\setstanzaindents{5, 2, 2}
\setcounter{stanzaindentsrepetition}{2}
% Line numbers directly under verse number (kind of a hack)
\setlength{\linenumsep}{-1.62pc}
% Mark cæsuræ. Bullet point ( • ), interpunct: ( · )
\newcommand{\hld}{ \textbf{·} }%
% Indent lines (in Ljóðaháttr or Galdralag).
\newcommand{\ind}{%
\hspace{1.5em}%
}
% Mark alliteration. This might not be present in the final version.
% Update: It's very useful and definitely will.
\NewDocumentCommand{\alst}{m}{%
% \underline{#1}% Underline.
% \textbf{#1}% Bold font.
\textcolor{Red}{#1}% Red font. Uses xcolor package.
}
% Translation formatting
%Line
\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⟩
}%
% Encyclopedia commands
\NewDocumentCommand{\inx}{o m O{#2}}{% Encyclopedia link (type, link, optional alt display)
\IfNoValueTF{#1}{% TODO: phase this out
ERRORERRORERROR%
}{% Proper noun
\hyperref[#1:#2]{#3\textsuperscript{#1}}%
}%
}
\NewDocumentCommand{\inxitem}{o m}{% Encyclopedia label (type, word)
\item[\textbf{#2}]%
\phantomsection\label{#1:#2}%
}
% Sigla
\input{sigla.tex}%
% Render books
\input{books.tex}%
\end{document}