Debian Codegraph @

texmf-dist/tex/latex/polyglossia/gloss-latin.ldf

raw
1 % Language definition file (part of polyglossia v2.10 -- 2026/04/18)
2 %
3 \ProvidesFile{gloss-latin.ldf}[polyglossia: module for Latin]
4
5 \ExplSyntaxOn
6
7 \PolyglossiaSetup {latin}
8 {
9 bcp47 = la,
10 bcp47-language = la,
11 bcp47-script = Latn,
12 hyphenmins = {2,2},
13 frenchspacing = true,
14 langtag = LAT
15 }
16
17 % BCP-47 compliant aliases
18 \setlanguagealias*{latin}{la}
19 \setlanguagealias*[variant=classic]{latin}{la-x-classic}
20 \setlanguagealias*[variant=ecclesiastic]{latin}{la-x-ecclesia}
21 \setlanguagealias*[variant=medieval]{latin}{la-x-medieval}
22
23 % Babel aliases
24 \setlanguagealias[variant=classic]{latin}{classicallatin}
25 \setlanguagealias[variant=classic]{latin}{classiclatin}
26 \setlanguagealias[variant=ecclesiastic]{latin}{ecclesiasticallatin}
27 \setlanguagealias[variant=ecclesiastic]{latin}{ecclesiasticlatin}
28 \setlanguagealias[variant=medieval]{latin}{medievallatin}
29
30
31 %%%%% Variables and commands concerning spelling
32
33 \bool_new:N \l_polyglossia_latin_use_j_bool
34 \bool_new:N \l_polyglossia_latin_use_v_bool
35 \bool_new:N \l_polyglossia_latin_use_ligatures_bool
36 \bool_new:N \l_polyglossia_latin_capitalize_month_bool
37 \bool_new:N \l_polyglossia_latin_babelshorthands_bool
38 \bool_new:N \l_polyglossia_latin_prosodic_shorthands_bool
39 \bool_new:N \l_polyglossia_latin_ecclesiastic_footnotes_bool
40
41 \DeclareUppercaseMapping[la-x-classic]{`u}{V}
42 \DeclareLowercaseMapping[la-x-classic]{`V}{u}
43 % The mapping of u and V for medieval Latin is part of the l3text module,
44 % which is part of the LaTeX format (see source3.pdf).
45 \DeclareUppercaseMapping[la-x-classic]{`ú}{\a'{V}}
46 \DeclareUppercaseMapping[la-x-classic]{`ū}{\a={V}}
47 \DeclareUppercaseMapping[la-x-classic]{`ŭ}{\u{V}}
48 \DeclareUppercaseMapping[la-x-medieval]{`ú}{\a'{V}}
49 \DeclareUppercaseMapping[la-x-medieval]{`ū}{\a={V}}
50 \DeclareUppercaseMapping[la-x-medieval]{`ŭ}{\u{V}}
51
52 %%%%% Messages and commands concerning hyphenation
53
54 \msg_new:nnn {polyglossia} {latin / missing modern patterns}
55 {
56 The~hyphenation~patterns~for~modern~Latin~were~not~found~\msg_line_context:.
57 }
58
59 \msg_new:nnn {polyglossia} {latin / missing patterns}
60 {
61 The~"#1"~hyphenation~patterns~were~not~found~\msg_line_context:.~
62 I~will~use~the~patterns~for~modern~Latin~instead.
63 }
64
65 \cs_new:Npn \polyglossia_latin_use_modern_patterns:
66 {
67 \IfLanguageDefinedTF {latin}
68 {
69 \def \latin@language
70 {
71 \SetupPolyglossiaLangPatterns {latin}
72 \str_case:Vn \l_polyglossia_latin_variant_str
73 {
74 {classic} { \adddialect \l@classiclatin \l@latin }
75 {medieval} { \adddialect \l@medievallatin \l@latin }
76 {ecclesiastic} { \adddialect \l@ecclesiasticlatin \l@latin }
77 }
78 }
79 }
80 {
81 \msg_warning:nn {polyglossia} {latin / missing modern patterns}
82 \str_case:Vn \l_polyglossia_latin_variant_str
83 {
84 {classic} { \adddialect \l@classiclatin \l@nohyphenation }
85 {medieval} { \adddialect \l@medievallatin \l@nohyphenation }
86 {modern} { \adddialect \l@latin \l@nohyphenation }
87 {ecclesiastic} { \adddialect \l@ecclesiasticlatin \l@nohyphenation }
88 }
89 }
90 }
91
92 \cs_new:Npn \polyglossia_latin_set_patterns:n #1
93 % #1 may be "classiclatin" or "liturgicallatin"
94 {
95 \IfLanguageDefinedTF {#1}
96 {
97 \def \latin@language
98 {
99 \SetupPolyglossiaLangPatterns {#1}
100 \str_case:Vn \l_polyglossia_latin_variant_str
101 {
102 {classic} {
103 \str_if_eq:nnF {#1} {classiclatin}
104 {
105 \adddialect \l@classiclatin { \use:c {l@#1} }
106 }
107 }
108 {medieval} { \adddialect \l@medievallatin { \use:c {l@#1} } }
109 {modern} { \adddialect \l@latin { \use:c {l@#1} } }
110 {ecclesiastic} { \adddialect \l@ecclesiasticlatin { \use:c {l@#1} } }
111 }
112 }
113 }
114 {
115 \msg_warning:nnn {polyglossia} {latin / missing patterns} {#1}
116 \polyglossia_latin_use_modern_patterns:
117 }
118 }
119
120
121 %%%%% Settings for the spacing of the punctuation for ecclesiastical Latin
122
123 \bool_new:N \g_polyglossia_latin_punctuation_spacing_bool
124
125 \sys_if_engine_luatex:TF
126 {
127 \directlua { require('polyglossia-latin') }
128 }
129 {
130 \newXeTeXintercharclass \g_polyglossia_latin_question_exclamation_class
131 \newXeTeXintercharclass \g_polyglossia_latin_colon_semicolon_class
132 \newXeTeXintercharclass \g_polyglossia_latin_opening_guillemet_class
133 \newXeTeXintercharclass \g_polyglossia_latin_closing_guillemet_class
134 \newXeTeXintercharclass \g_polyglossia_latin_opening_bracket_class
135 \newXeTeXintercharclass \g_polyglossia_latin_closing_bracket_class
136
137 \cs_new:Npn \polyglossia_latin_insert_punctuation_space:
138 {
139 \nobreak
140 \skip_horizontal:n { 0.08333 \fontdimen6 \font } % 1/12 quad
141 }
142 \cs_new:Npn \polyglossia_latin_replace_preceding_space:
143 {
144 \dim_compare:nNnT {\lastskip} > {\c_zero_dim} {\unskip}
145 \polyglossia_latin_insert_punctuation_space:
146 }
147 \cs_new:Npn \polyglossia_latin_replace_following_space:
148 {
149 \polyglossia_latin_insert_punctuation_space:
150 \ignorespaces
151 }
152 }
153
154 \cs_new:Npn \polyglossia_latin_punctuation_spacing:
155 {
156 \sys_if_engine_luatex:TF
157 {
158 \directlua { polyglossia.activate_latin_punct() }
159 }
160 {
161 \XeTeXinterchartokenstate = 1
162 \XeTeXcharclass `\! \g_polyglossia_latin_question_exclamation_class
163 \XeTeXcharclass `\? \g_polyglossia_latin_question_exclamation_class
164 \XeTeXcharclass `\‼ \g_polyglossia_latin_question_exclamation_class
165 \XeTeXcharclass `\⁇ \g_polyglossia_latin_question_exclamation_class
166 \XeTeXcharclass `\⁈ \g_polyglossia_latin_question_exclamation_class
167 \XeTeXcharclass `\⁉ \g_polyglossia_latin_question_exclamation_class
168 \XeTeXcharclass `\‽ \g_polyglossia_latin_question_exclamation_class
169 \XeTeXcharclass `\; \g_polyglossia_latin_colon_semicolon_class
170 \XeTeXcharclass `\: \g_polyglossia_latin_colon_semicolon_class
171 \XeTeXcharclass `\« \g_polyglossia_latin_opening_guillemet_class
172 \XeTeXcharclass `\» \g_polyglossia_latin_closing_guillemet_class
173 \XeTeXcharclass `\‹ \g_polyglossia_latin_opening_guillemet_class
174 \XeTeXcharclass `\› \g_polyglossia_latin_closing_guillemet_class
175 \XeTeXcharclass `\( \g_polyglossia_latin_opening_bracket_class
176 \XeTeXcharclass `\) \g_polyglossia_latin_closing_bracket_class
177 \XeTeXcharclass `\[ \g_polyglossia_latin_opening_bracket_class
178 \XeTeXcharclass `\] \g_polyglossia_latin_closing_bracket_class
179 \XeTeXcharclass `\{ \g_polyglossia_latin_opening_bracket_class
180 \XeTeXcharclass `\} \g_polyglossia_latin_closing_bracket_class
181 \XeTeXcharclass `\⟨ \g_polyglossia_latin_opening_bracket_class
182 \XeTeXcharclass `\⟩ \g_polyglossia_latin_closing_bracket_class
183
184 % question or exclamation mark followed by a closing guillemet
185 \XeTeXinterchartoks \g_polyglossia_latin_question_exclamation_class \g_polyglossia_latin_closing_guillemet_class =
186 {
187 \polyglossia_latin_insert_punctuation_space:
188 }
189 % question or exclamation mark followed by a colon or semicolon
190 \XeTeXinterchartoks \g_polyglossia_latin_question_exclamation_class \g_polyglossia_latin_colon_semicolon_class =
191 {
192 \polyglossia_latin_insert_punctuation_space:
193 }
194 % colon or semicolon followed by a closing guillemet
195 \XeTeXinterchartoks \g_polyglossia_latin_colon_semicolon_class \g_polyglossia_latin_closing_guillemet_class =
196 {
197 \polyglossia_latin_insert_punctuation_space:
198 }
199 % closing bracket followed by a question or exclamation mark
200 \XeTeXinterchartoks \g_polyglossia_latin_closing_bracket_class \g_polyglossia_latin_question_exclamation_class =
201 {
202 \polyglossia_latin_insert_punctuation_space:
203 }
204 % closing bracket followed by a colon or semicolon
205 \XeTeXinterchartoks \g_polyglossia_latin_closing_bracket_class \g_polyglossia_latin_colon_semicolon_class =
206 {
207 \polyglossia_latin_insert_punctuation_space:
208 }
209 % closing bracket followed by a closing guillemet
210 \XeTeXinterchartoks \g_polyglossia_latin_closing_bracket_class \g_polyglossia_latin_closing_guillemet_class =
211 {
212 \polyglossia_latin_insert_punctuation_space:
213 }
214 % opening guillemet followed by a space
215 \XeTeXinterchartoks \g_polyglossia_latin_opening_guillemet_class \e@alloc@intercharclass@top =
216 {
217 \polyglossia_latin_replace_following_space:
218 }
219 % opening guillemet followed by an opening guillemet
220 \XeTeXinterchartoks \g_polyglossia_latin_opening_guillemet_class \g_polyglossia_latin_opening_guillemet_class =
221 {
222 \polyglossia_latin_insert_punctuation_space:
223 }
224 % opening guillemet followed by an ordinary character
225 \XeTeXinterchartoks \g_polyglossia_latin_opening_guillemet_class \z@ =
226 {
227 \polyglossia_latin_insert_punctuation_space:
228 }
229 % closing guillemet followed by a closing guillemet
230 \XeTeXinterchartoks \g_polyglossia_latin_closing_guillemet_class \g_polyglossia_latin_closing_guillemet_class =
231 {
232 \polyglossia_latin_insert_punctuation_space:
233 }
234 % closing guillemet followed by a question or exclamation mark
235 \XeTeXinterchartoks \g_polyglossia_latin_closing_guillemet_class \g_polyglossia_latin_question_exclamation_class =
236 {
237 \polyglossia_latin_insert_punctuation_space:
238 }
239 % closing guillemet followed by a colon or semicolon
240 \XeTeXinterchartoks \g_polyglossia_latin_closing_guillemet_class \g_polyglossia_latin_colon_semicolon_class =
241 {
242 \polyglossia_latin_insert_punctuation_space:
243 }
244 % space followed by a question or exclamation mark
245 \XeTeXinterchartoks \e@alloc@intercharclass@top \g_polyglossia_latin_question_exclamation_class =
246 {
247 \polyglossia_latin_replace_preceding_space:
248 }
249 % space followed by a colon or semicolon
250 \XeTeXinterchartoks \e@alloc@intercharclass@top \g_polyglossia_latin_colon_semicolon_class =
251 {
252 \polyglossia_latin_replace_preceding_space:
253 }
254 % space followed by closing guillemet
255 \XeTeXinterchartoks \e@alloc@intercharclass@top \g_polyglossia_latin_closing_guillemet_class =
256 {
257 \polyglossia_latin_replace_preceding_space:
258 }
259 % ordinary character followed by a question or exclamation mark
260 \XeTeXinterchartoks \z@ \g_polyglossia_latin_question_exclamation_class =
261 {
262 \polyglossia_latin_insert_punctuation_space:
263 }
264 % ordinary character followed by a colon or semicolon
265 \XeTeXinterchartoks \z@ \g_polyglossia_latin_colon_semicolon_class =
266 {
267 \polyglossia_latin_insert_punctuation_space:
268 }
269 % ordinary character followed by closing guillemet
270 \XeTeXinterchartoks \z@ \g_polyglossia_latin_closing_guillemet_class =
271 {
272 \polyglossia_latin_insert_punctuation_space:
273 }
274 }
275 }
276
277 \cs_new:Npn \polyglossia_latin_no_punctuation_spacing:
278 {
279 \sys_if_engine_luatex:TF
280 {
281 \directlua { polyglossia.deactivate_latin_punct() }
282 }
283 {
284 \XeTeXcharclass `\! \z@
285 \XeTeXcharclass `\? \z@
286 \XeTeXcharclass `\‼ \z@
287 \XeTeXcharclass `\⁇ \z@
288 \XeTeXcharclass `\⁈ \z@
289 \XeTeXcharclass `\⁉ \z@
290 \XeTeXcharclass `\‽ \z@
291 \XeTeXcharclass `\; \z@
292 \XeTeXcharclass `\: \z@
293 \XeTeXcharclass `\« \z@
294 \XeTeXcharclass `\» \z@
295 \XeTeXcharclass `\‹ \z@
296 \XeTeXcharclass `\› \z@
297 \XeTeXcharclass `\( \z@
298 \XeTeXcharclass `\) \z@
299 \XeTeXcharclass `\[ \z@
300 \XeTeXcharclass `\] \z@
301 \XeTeXcharclass `\{ \z@
302 \XeTeXcharclass `\} \z@
303 \XeTeXcharclass `\⟨ \z@
304 \XeTeXcharclass `\⟩ \z@
305 \XeTeXinterchartokenstate = 0
306 }
307 }
308
309
310 %%%%% Messages and commands concerning footnotes
311
312 % Save original footnote definition
313 % Do this at the end of the preamble to catch other
314 % packages' footnote changes (#391)
315 \hook_gput_code:nnn { begindocument / before } {.}
316 {
317 \cs_if_exist:NT \@makefntext
318 {
319 \cs_set_eq:NN \polyglossia_latin_original_footnote:n \@makefntext
320 }
321 }
322
323 % This is the footnote style as defined by the "ecclesiastic" package.
324 \cs_new:Npn \polyglossia_latin_variant_footnote:n #1
325 {
326 \parindent 1em
327 \noindent
328 \hbox { \normalfont \@thefnmark . }
329 \enspace #1
330 }
331
332 \msg_new:nnn {polyglossia} {latin / ineffective footnote option}
333 {
334 The~option~"ecclesiasticfootnotes"~is~ineffective~\msg_line_context:
335 \c_space_tl as~Latin~is~not~the~main~language.
336 }
337
338 \cs_new:Npn \polyglossia_latin_apply_footnote_option:
339 {
340 \IfMainLanguageTF {latin}
341 {
342 \cs_if_exist:NT \@makefntext
343 {
344 \bool_if:NTF \l_polyglossia_latin_ecclesiastic_footnotes_bool
345 {
346 \let \@makefntext \polyglossia_latin_variant_footnote:n
347 }
348 {
349 \let \@makefntext \polyglossia_latin_original_footnote:n
350 }
351 }
352 }
353 {
354 \bool_if:NT \l_polyglossia_latin_ecclesiastic_footnotes_bool
355 {
356 \msg_warning:nn {polyglossia} {latin / ineffective footnote option}
357 }
358 }
359 }
360
361 %%%%% Language variants: classic, medieval, modern, and ecclesiastic
362
363 \str_new:N \l_polyglossia_latin_variant_str
364
365 \msg_new:nnn {polyglossia} {latin / language variant}
366 {
367 Activating~Latin~language~variant~"#1"~\msg_line_context:.
368 }
369
370 \msg_new:nnn {polyglossia} {latin / illegal language variant}
371 {
372 The~Latin~language~variant~"#1"~is~undefined~\msg_line_context:.
373 }
374
375 \cs_new:Npn \polyglossia_latin_classic_settings:
376 {
377 \bool_set_false:N \l_polyglossia_latin_use_j_bool
378 \bool_set_false:N \l_polyglossia_latin_use_v_bool
379 \bool_set_false:N \l_polyglossia_latin_use_ligatures_bool
380 \bool_set_true:N \l_polyglossia_latin_capitalize_month_bool
381 \bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool
382 \str_set:Nn \l_polyglossia_latin_variant_str {classic}
383 \SetLanguageKeys {latin} { babelname = classicallatin, bcp47 = la-x-classic, bcp47-extension-x = classic, bcp47-casing = la-x-classic }
384 \polyglossia_latin_set_patterns:n {classiclatin}
385 }
386
387 \cs_new:Npn \polyglossia_latin_medieval_settings:
388 {
389 \bool_set_false:N \l_polyglossia_latin_use_j_bool
390 \bool_set_false:N \l_polyglossia_latin_use_v_bool
391 \bool_set_true:N \l_polyglossia_latin_use_ligatures_bool
392 \bool_set_true:N \l_polyglossia_latin_capitalize_month_bool
393 \bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool
394 \str_set:Nn \l_polyglossia_latin_variant_str {medieval}
395 \SetLanguageKeys {latin} { babelname = medievallatin, bcp47 = la-x-medieval, bcp47-extension-x = medieval, bcp47-casing = la-x-medieval }
396 \polyglossia_latin_use_modern_patterns:
397 }
398
399 \cs_new:Npn \polyglossia_latin_modern_settings:
400 {
401 \bool_set_false:N \l_polyglossia_latin_use_j_bool
402 \bool_set_true:N \l_polyglossia_latin_use_v_bool
403 \bool_set_false:N \l_polyglossia_latin_use_ligatures_bool
404 \bool_set_true:N \l_polyglossia_latin_capitalize_month_bool
405 \bool_set_false:N \l_polyglossia_latin_punctuation_spacing_bool
406 \str_set:Nn \l_polyglossia_latin_variant_str {modern}
407 \SetLanguageKeys {latin} { babelname = latin, bcp47 = la }
408 \polyglossia_latin_use_modern_patterns:
409 }
410
411 \cs_new:Npn \polyglossia_latin_ecclesiastic_settings:
412 {
413 \bool_set_false:N \l_polyglossia_latin_use_j_bool
414 \bool_set_true:N \l_polyglossia_latin_use_v_bool
415 \bool_set_true:N \l_polyglossia_latin_use_ligatures_bool
416 \bool_set_false:N \l_polyglossia_latin_capitalize_month_bool
417 \bool_set_true:N \l_polyglossia_latin_punctuation_spacing_bool
418 \str_set:Nn \l_polyglossia_latin_variant_str {ecclesiastic}
419 \SetLanguageKeys {latin} { babelname = ecclesiasticallatin, bcp47 = la-x-ecclesia, bcp47-extension-x = ecclesia }
420 \polyglossia_latin_use_modern_patterns:
421 }
422
423 %%%%% Hyphenation variants: classic, liturgical, and modern
424
425 \msg_new:nnn {polyglossia} {latin / hyphenation variant}
426 {
427 Activating~hyphenation~patterns~for~#1~Latin~\msg_line_context:.
428 }
429
430 \msg_new:nnn {polyglossia} {latin / illegal hyphenation variant}
431 {
432 The~Latin~hyphenation~variant~"#1"~is~undefined~\msg_line_context:.
433 }
434
435 %%%%% Latin captions and date
436
437 \def \captionslatin
438 {
439 \def \prefacename
440 {
441 \bool_if:NTF \l_polyglossia_latin_use_ligatures_bool {Præfatio} {Praefatio}
442 }
443 \def \refname {Conspectus~librorum}
444 \def \abstractname {Summarium}
445 \def \bibname {Conspectus~librorum}
446 \def \chaptername {Caput}
447 \def \appendixname {Additamentum}
448 \def \contentsname {Index}
449 \def \listfigurename {Conspectus~descriptionum}
450 \def \listtablename {Conspectus~tabularum}
451 \def \indexname {Index~rerum~notabilium}
452 \def \figurename {Descriptio}
453 \def \tablename {Tabula}
454 \def \partname {Pars}
455 \def \enclname {Additur}
456 \def \ccname {Exemplar}
457 \def \headtoname {\ignorespaces}
458 \def \pagename {charta}
459 \def \seename {cfr.}
460 \def \alsoname {cfr.}
461 \def \proofname {Demonstratio}
462 \def \glossaryname {Glossarium}
463 }
464
465 \cs_new:Npn \polyglossia_latin_month_name:
466 {
467 \tl_set:Nx \l_tmpa_tl
468 {
469 \int_case:nn { \month }
470 {
471 {1} { \bool_if:NTF \l_polyglossia_latin_use_j_bool {januarii} {ianuarii} }
472 {2} {februarii}
473 {3} {martii}
474 {4} {aprilis}
475 {5} { \bool_if:NTF \l_polyglossia_latin_use_j_bool {maji} {maii} }
476 {6} { \bool_if:NTF \l_polyglossia_latin_use_j_bool {junii} {iunii} }
477 {7} { \bool_if:NTF \l_polyglossia_latin_use_j_bool {julii} {iulii} }
478 {8} {augusti}
479 {9} {septembris}
480 {10} {octobris}
481 {11} { \bool_if:NTF \l_polyglossia_latin_use_v_bool {novembris} {nouembris} }
482 {12} {decembris}
483 }
484 }
485 \bool_if:NTF \l_polyglossia_latin_capitalize_month_bool
486 {
487 \text_titlecase:n { \l_tmpa_tl }
488 }
489 {
490 \l_tmpa_tl
491 }
492 }
493
494 \def \datelatin
495 {
496 \def \today
497 {
498 \int_to_Roman:n { \day }
499 \c_space_tl
500 \polyglossia_latin_month_name:
501 \c_space_tl
502 \int_to_Roman:n { \year }
503 }
504 }
505
506 \DeclareKeys[polyglossia/gloss/latin]
507 {
508 babelshorthands.bool_set:N = \l_polyglossia_latin_babelshorthands_bool,
509 babelshorthands.default:n = true,
510 prosodicshorthands.bool_set:N = \l_polyglossia_latin_prosodic_shorthands_bool,
511 prosodicshorthands.default:n = true,
512 usej.bool_set:N = \l_polyglossia_latin_use_j_bool,
513 capitalizemonth.bool_set:N = \l_polyglossia_latin_capitalize_month_bool,
514 hyphenation.code =
515 \str_case:nnTF {#1}
516 {
517 {classic} { \polyglossia_latin_set_patterns:n {classiclatin} }
518 {liturgical} { \polyglossia_latin_set_patterns:n {liturgicallatin} }
519 {modern} { \polyglossia_latin_use_modern_patterns: }
520 }
521 {
522 \msg_info:nnn {polyglossia} {latin / hyphenation variant} {#1}
523 }
524 {
525 \msg_warning:nnn {polyglossia} {latin / illegal hyphenation variant} {#1}
526 },
527 variant.code =
528 \str_case:nnF {#1}
529 {
530 {classic}
531 {
532 \msg_info:nnn {polyglossia} {latin / language variant} {classic}
533 \polyglossia_latin_classic_settings:
534 }
535 {medieval}
536 {
537 \msg_info:nnn {polyglossia} {latin / language variant} {medieval}
538 \polyglossia_latin_medieval_settings:
539 }
540 {modern}
541 {
542 \msg_info:nnn {polyglossia} {latin / language variant} {modern}
543 \polyglossia_latin_modern_settings:
544 }
545 {ecclesiastic}
546 {
547 \msg_info:nnn {polyglossia} {latin / language variant} {ecclesiastic}
548 \polyglossia_latin_ecclesiastic_settings:
549 }
550 }
551 {
552 \msg_warning:nnn {polyglossia} {latin / illegal language variant} {#1}
553 },
554 ecclesiasticfootnotes.choices:nn = { true, false }
555 {
556 \ifcase\UseName{l_keys_choice_int}\or
557 \bool_set_true:N \l_polyglossia_latin_ecclesiastic_footnotes_bool
558 \else
559 \bool_set_false:N \l_polyglossia_latin_ecclesiastic_footnotes_bool
560 \fi
561 \xpg_if_in_preamble:TF
562 {
563 % within the preamble
564 % The application of the option has to be postponed as the main
565 % language may be undefined when the option is called.
566 \AtBeginDocument { \polyglossia_latin_apply_footnote_option: }
567 }
568 {
569 % within the document
570 \polyglossia_latin_apply_footnote_option:
571 }
572 },
573 ecclesiasticfootnotes.default:n = true
574 }
575
576 \ifsystem@babelshorthands
577 \SetGlossOptions{latin}{babelshorthands=true}
578 % Register default options
579 \InitializeGlossOptions{latin}{variant=modern,hyphenation=modern,babelshorthands=true,
580 prosodicshorthands=false,ecclesiasticfootnotes=false,
581 usej=false,capitalizemonth=true}
582 \else
583 \SetGlossOptions{latin}{babelshorthands=false}
584 % Register default options
585 \InitializeGlossOptions{latin}{variant=modern,hyphenation=modern,babelshorthands=false,
586 prosodicshorthands=false,ecclesiasticfootnotes=false,
587 usej=false,capitalizemonth=true}
588 \fi
589
590 \ExplSyntaxOff % babelsh.def does not support expl3 syntax
591 \@ifundefined{initiate@active@char}{\input{babelsh.def}}{}
592 \ExplSyntaxOn
593
594 \initiate@active@char {"}
595 \initiate@active@char {'}
596 \initiate@active@char {^}
597 \initiate@active@char {=}
598
599 \shorthandoff {"}
600 \shorthandoff {'}
601 \shorthandoff* {^}
602 \shorthandoff {=}
603
604 % The active = character may cause problems with key=value interfaces.
605 % We have to make sure here that no problems can occur outside a Latin
606 % prosodic shorthand environment.
607 % The active ^ character may cause problems with TeX's ^^xx convention
608 % for hexadecimal input. We have to make sure here that no problems can
609 % occur outside a Latin prosodic shorthand environment.
610 % The active ' character may cause problems with the unicode-math package
611 % (in case Latin is used as a secondary language, see #394). We have to
612 % turn it off if Latin is not the main language.
613
614 % For the aux file:
615 \protected@write \@auxout { }
616 {
617 \ProvideDocumentCommand \shorthandoff{sm}{} % #643
618 \shorthandoff {=}
619 \shorthandoff* {^} % #582
620 }
621
622 \AtBeginDocument
623 {
624 \IfMainLanguageTF {latin}
625 {
626 \bool_if:NF \l_polyglossia_latin_prosodic_shorthands_bool
627 {
628 \shorthandoff {=}
629 \shorthandoff* {^}
630 }
631 }
632 {
633 % The following command should not be called if the main language
634 % defines a = shorthand. However, there are no languages besides
635 % Latin defining such a shorthand in polyglossia.
636 \shorthandoff {=}
637 % The following command should not be called if the main language
638 % defines a ^ shorthand. However, there are no languages besides
639 % Latin defining such a shorthand in polyglossia.
640 \shorthandoff* {^}
641 % The following command should not be called if the main language
642 % defines a ' shorthand. However, there are no languages besides
643 % Latin defining such a shorthand in polyglossia.
644 \shorthandoff {'}
645 }
646 }
647
648 \cs_new:Npn \polyglossia_latin_shorthands:
649 {
650 \def \language@group {latin}
651 \xpg@activate@shorthands ["]
652 \declare@shorthand {latin} {"}
653 {
654 \mode_if_math:TF
655 {
656 \token_to_str:N "
657 }
658 {
659 \polyglossia_latin_apply_quotemark:N
660 }
661 }
662 % The ' shorthand is normally turned off to avoid problems with the unicode-math
663 % package. We have to turn it on here.
664 \shorthandon {'}
665 \xpg@activate@shorthands [']
666 \declare@shorthand {latin} {'}
667 {
668 \mode_if_math:TF
669 {
670 \active@math@prime % defined in "latex.ltx"
671 % This definition is differing from the primes of the unicode-math package.
672 % TO DO: Make sure that the appearance of primes is the same as with the
673 % unicode-math package if this package is loaded.
674 }
675 {
676 \polyglossia_latin_put_acute:N
677 }
678 }
679 }
680
681 \cs_new:Npn \polyglossia_latin_prosodic_shorthands:
682 {
683 \def \language@group {latin}
684 % The '=' and '^' shorthands are normally turned off to avoid problems with
685 % key=value interfaces and TeX's ^^xx convention for hexadecimal input. We
686 % turn them on here to enable prosodic shorthands.
687 \shorthandon {=}
688 \bbl@activate {=}
689 \declare@shorthand {latin} {=}
690 {
691 \mode_if_math:TF
692 {
693 \token_to_str:N =
694 }
695 {
696 \polyglossia_latin_put_macron:N
697 }
698 }
699 \shorthandon {^}
700 \bbl@activate {^}
701 \declare@shorthand {latin} {^}
702 {
703 \mode_if_math:TF
704 {
705 \token_to_str:N ^
706 }
707 {
708 \polyglossia_latin_put_breve:N
709 }
710 }
711 }
712
713 \cs_new:Npn \polyglossia_latin_apply_quotemark:N #1
714 {
715 \str_case:nnF {#1}
716 {
717 {A} { \polyglossia_latin_ligature_shorthand:Nnn E { Æ }
718 {
719 \polyglossia_latin_ligature_shorthand:Nnn e { Æ }
720 {
721 \polyglossia_latin_allow_hyphens: A
722 }
723 }
724 }
725 {a} { \polyglossia_latin_ligature_shorthand:Nnn e { æ }
726 {
727 \polyglossia_latin_allow_hyphens: a
728 }
729 }
730 {O} { \polyglossia_latin_ligature_shorthand:Nnn E { Œ }
731 {
732 \polyglossia_latin_ligature_shorthand:Nnn e { Œ }
733 {
734 \polyglossia_latin_allow_hyphens: O
735 }
736 }
737 }
738 {o} { \polyglossia_latin_ligature_shorthand:Nnn e { œ }
739 {
740 \polyglossia_latin_allow_hyphens: o
741 }
742 }
743 {|} { \polyglossia_latin_allow_hyphens: }
744 {<} { « }
745 {>} { » }
746 }
747 {
748 \tl_if_single_token:nTF {#1}
749 {
750 \token_if_letter:NTF #1 { \polyglossia_latin_allow_hyphens: }
751 {
752 \polyglossia_latin_if_ligature_command:NTF #1 { \polyglossia_latin_allow_hyphens: }
753 {
754 \token_to_str:N "
755 }
756 }
757 }
758 {
759 \token_to_str:N "
760 }
761 #1
762 }
763 }
764
765 \cs_new:Npn \polyglossia_latin_put_acute:N #1
766 {
767 \str_case:nnF {#1}
768 {
769 {A} { \polyglossia_latin_ligature_shorthand:Nnn E { Ǽ }
770 {
771 \polyglossia_latin_ligature_shorthand:Nnn e { Ǽ } { Á }
772 }
773 }
774 {a} { \polyglossia_latin_ligature_shorthand:Nnn e { ǽ } { á } }
775 {E} { É }
776 {e} { é }
777 {I} { Í }
778 {i} { í }
779 {O} { \polyglossia_latin_ligature_shorthand:Nnn E { \'Œ }
780 {
781 \polyglossia_latin_ligature_shorthand:Nnn e { \'Œ } { Ó }
782 }
783 }
784 {o} { \polyglossia_latin_ligature_shorthand:Nnn e { \'œ } { ó } }
785 {U} { Ú }
786 {u} { ú }
787 {V} { \' V } % V may be a vowel, but lowercase v is never used as a vowel.
788 {Y} { Ý }
789 {y} { ý }
790 {Æ} { Ǽ }
791 {æ} { ǽ }
792 {Œ} { \'Œ }
793 {œ} { \'œ }
794 }
795 {
796 \tl_if_single_token:nTF {#1}
797 {
798 \polyglossia_latin_if_ligature_command:NTF #1 { \' }
799 {
800 \token_to_str:N '
801 }
802 }
803 {
804 \token_to_str:N '
805 }
806 #1
807 }
808 }
809
810 \cs_new:Npn \polyglossia_latin_put_macron:N #1
811 {
812 \str_case:nnF {#1}
813 {
814 {A} { \polyglossia_latin_ligature_macron:NNnn AE { Ǣ }
815 {
816 \polyglossia_latin_ligature_macron:NNnn Ae { Ǣ }
817 {
818 \polyglossia_latin_diphthong_macron:NNn AU
819 {
820 \polyglossia_latin_diphthong_macron:NNn Au { Ā }
821 }
822 }
823 }
824 }
825 {a} { \polyglossia_latin_ligature_macron:NNnn ae { ǣ }
826 {
827 \polyglossia_latin_diphthong_macron:NNn au { ā }
828 }
829 }
830 {E} { \polyglossia_latin_diphthong_macron:NNn EU
831 {
832 \polyglossia_latin_diphthong_macron:NNn Eu { Ē }
833 }
834 }
835 {e} { \polyglossia_latin_diphthong_macron:NNn eu { ē } }
836 {I} { Ī }
837 {i} { ī }
838 {O} { \polyglossia_latin_ligature_macron:NNnn OE { \=Œ }
839 {
840 \polyglossia_latin_ligature_macron:NNnn Oe { \=Œ } { Ō }
841 }
842 }
843 {o} { \polyglossia_latin_ligature_macron:NNnn oe { \=œ } { ō } }
844 {U} { Ū }
845 {u} { ū }
846 {V} { \= V } % V may be a vowel, but lowercase v is never used as a vowel.
847 {Y} { Ȳ }
848 {y} { ȳ }
849 }
850 {
851 \tl_if_single_token:nTF {#1}
852 {
853 \polyglossia_latin_if_ligature_command:NTF #1 { \= }
854 {
855 \token_to_str:N =
856 }
857 }
858 {
859 \token_to_str:N =
860 }
861 #1
862 }
863 }
864
865 \cs_new:Npn \polyglossia_latin_put_breve:N #1
866 {
867 \str_case:nnF {#1}
868 {
869 {A} { Ă }
870 {a} { ă }
871 {E} { Ĕ }
872 {e} { ĕ }
873 {I} { Ĭ }
874 {i} { ĭ }
875 {O} { Ŏ }
876 {o} { ŏ }
877 {U} { Ŭ }
878 {u} { ŭ }
879 {V} { \u{V} } % V may be a vowel, but lowercase v is never used as a vowel.
880 {Y} { \u{Y} }
881 {y} { \u{y} }
882 }
883 {
884 \token_to_str:N ^
885 #1
886 }
887 }
888
889
890 \cs_new:Npn \polyglossia_latin_allow_hyphens:
891 {
892 \bbl@allowhyphens
893 \discretionary {-} {} {}
894 \bbl@allowhyphens
895 }
896
897 \cs_new:Npn \polyglossia_latin_ligature_shorthand:Nnn #1#2#3
898 % #1: second letter of ligature (E or e)
899 % #2: ligature character
900 % #3: non-ligature code
901 {
902 \bool_if:NTF \l_polyglossia_latin_use_ligatures_bool
903 {
904 \peek_meaning_remove:NTF #1 {#2} {#3}
905 }
906 {
907 #3
908 }
909 }
910
911 \msg_new:nnn {polyglossia} {latin / no-double-macron-font}
912 {
913 The~combining~double~macron~(U+035E)~is~not~available~in~the~current~
914 font.~The~diphthong~is~typeset~without~macron~ \msg_line_context: .
915 }
916
917 \cs_new:Npn \polyglossia_latin_diphthong_macron:NNn #1#2#3
918 % #1: first character of diphthong
919 % #2: second character of diphthong
920 % #3: non-diphthong code
921 {
922 \peek_meaning:NTF #2
923 {
924 #1
925 \iffontchar \font "35E \relax % U+035E: combining double macron
926 \char "35E \relax
927 \else
928 \msg_warning:nn {polyglossia} {latin / no-double-macron-font}
929 \fi
930 }
931 {
932 #3
933 }
934 }
935
936 \cs_new:Npn \polyglossia_latin_ligature_macron:NNnn #1#2#3#4
937 % #1: first character of diphthong
938 % #2: second character of diphthong
939 % #3: ligature code
940 % #4: false code
941 {
942 \polyglossia_latin_ligature_shorthand:Nnn #2 {#3}
943 {
944 \polyglossia_latin_diphthong_macron:NNn #1 #2 {#4}
945 }
946 }
947
948 % The following conditional tests if the argument is a ligature command (\AE,
949 % \ae, \OE, or \oe).
950 \prg_new_conditional:Npnn \polyglossia_latin_if_ligature_command:N #1 {TF}
951 {
952 \token_if_eq_meaning:NNTF #1 \AE { \prg_return_true: }
953 {
954 \token_if_eq_meaning:NNTF #1 \ae { \prg_return_true: }
955 {
956 \token_if_eq_meaning:NNTF #1 \OE { \prg_return_true: }
957 {
958 \token_if_eq_meaning:NNTF #1 \oe { \prg_return_true: }
959 {
960 \prg_return_false:
961 }
962 }
963 }
964 }
965 }
966
967 \cs_new:Npn \polyglossia_latin_no_shorthands:
968 {
969 \xpg@deactivate@shorthands ["]
970 \xpg@deactivate@shorthands [']
971 }
972
973 \cs_new:Npn \polyglossia_latin_no_prosodic_shorthands:
974 {
975 \bbl@deactivate {=}
976 \bbl@deactivate {^}
977 % The active '=' character may cause problems with key=value interfaces.
978 % We have to make sure here that no problems can occur outside a Latin
979 % prosodic shorthand environment.
980 \shorthandoff {=}
981 % The active '^' character may cause problems with TeX's ^^xx convention
982 % for hexadecimal input. We have to make sure here that no problems can
983 % occur outside a Latin prosodic shorthand environment.
984 \shorthandoff* {^}
985 }
986
987
988 %%%%% Further settings
989
990 \let \xpgla@savedvalues \empty
991
992 \hook_gput_code:nnn { begindocument / before } {.}
993 {
994 \edef \xpgla@savedvalues
995 {
996 \clubpenalty = \the \clubpenalty \space
997 \@clubpenalty = \the \@clubpenalty \space
998 \widowpenalty = \the \widowpenalty \space
999 \finalhyphendemerits = \the \finalhyphendemerits
1000 }
1001 }
1002
1003 \def \noextras@latin
1004 {
1005 \bool_if:NT \l_polyglossia_latin_babelshorthands_bool
1006 {
1007 \polyglossia_latin_no_shorthands:
1008 }
1009 \bool_if:NT \l_polyglossia_latin_prosodic_shorthands_bool
1010 {
1011 \polyglossia_latin_no_prosodic_shorthands:
1012 }
1013 \xpgla@savedvalues
1014 \polyglossia_latin_no_punctuation_spacing:
1015 \bool_if:NF \l_polyglossia_latin_use_v_bool
1016 {
1017 \char_set_lccode:nn {`\V} {`\v}
1018 }
1019 }
1020
1021 \cs_new:Npn \polyglossia_latin_inline_extras:
1022 {
1023 \bool_if:NF \l_polyglossia_latin_use_v_bool
1024 {
1025 \char_set_lccode:nn {`\V} {`\u}
1026 }
1027 \bool_if:NT \l_polyglossia_latin_punctuation_spacing_bool
1028 {
1029 \polyglossia_latin_punctuation_spacing:
1030 }
1031 \bool_if:NTF \l_polyglossia_latin_babelshorthands_bool
1032 {
1033 \polyglossia_latin_shorthands:
1034 }
1035 {
1036 \polyglossia_latin_no_shorthands:
1037 }
1038 \bool_if:NTF \l_polyglossia_latin_prosodic_shorthands_bool
1039 {
1040 \polyglossia_latin_prosodic_shorthands:
1041 }
1042 {
1043 \polyglossia_latin_no_prosodic_shorthands:
1044 }
1045 }
1046
1047 \def \blockextras@latin
1048 {
1049 % The following four values were overtaken from the Italian language module.
1050 % It is unclear why they were chosen.
1051 \clubpenalty = 3000
1052 \@clubpenalty = 3000
1053 \widowpenalty = 3000
1054 \finalhyphendemerits = 50000000
1055 \polyglossia_latin_inline_extras:
1056 }
1057
1058 \def \inlineextras@latin
1059 {
1060 \polyglossia_latin_inline_extras:
1061 }
1062
1063
1064 %% Default settings
1065
1066 \polyglossia_latin_modern_settings:
1067
1068 \ExplSyntaxOff
1069
1070 %% Copyright (C) Claudio Beccari 2013-2016
1071 %% Copyright (C) Élie Roux 2016-2019
1072 %% Copyright (C) Keno Wehr 2019-2025
1073 %%
1074 %% Permission is hereby granted, free of charge, to any person obtaining
1075 %% a copy of this software and associated documentation files
1076 %% (the "Software"), to deal in the Software without restriction, including
1077 %% without limitation the rights to use, copy, modify, merge, publish,
1078 %% distribute, sublicense, and/or sell copies of the Software, and to permit
1079 %% persons to whom the Software is furnished to do so, subject to the following
1080 %% conditions:
1081 %%
1082 %% The above copyright notice and this permission notice shall be included in
1083 %% all copies or substantial portions of the Software.
1084 %%
1085 %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1086 %% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1087 %% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1088 %% THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1089 %% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1090 %% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1091 %% IN THE SOFTWARE.
1092 %%
1093 %% End of file `gloss-latin.ldf'.