summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/babel/latin.dtx
blob: 793b65ba2ef42f5fbd2440f61da306e102beec93 (plain)
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
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
% \iffalse meta-comment
%
% Copyright 1989-2005 Johannes L. Braams and any individual authors
% listed elsewhere in this file.  All rights reserved.
% 
% This file is part of the Babel system.
% --------------------------------------
% 
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% The Current Maintainer of this work is Johannes Braams.
% 
% The list of all files belonging to the Babel system is
% given in the file `manifest.bbl. See also `legal.bbl' for additional
% information.
% 
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
% \fi
% \CheckSum{449}
% \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<*dtx>
\ProvidesFile{latin.dtx}
%</dtx>
%<code>\ProvidesFile{latin.ldf}
%\fi
%\ProvidesFile{latin.dtx}%
        [2005/11/17 v2.0g Latin support from the babel system]
%\iffalse
%% File `latin.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989 - 2005
%%           by Johannes Braams, TeXniek
%
%% Please report errors to: J.L. Braams babel at braams.cistron.nl
%%                          Claudio Beccari beccari at polito.it
%
%    This file is part of the babel system, it provides the source
%    code for the Latin language definition file.
%    The original version of this file was written by
%    Claudio Beccari, (claudio.beccari@polito.it) and includes contributions
%    by Krzysztof Konrad \.Zelechowski, (\texttt{kkz@alfa.mimuw.edu.pl}).
%<*filedriver>
\documentclass{ltxdoc}
\newcommand*\TeXhax{\TeX hax}
\newcommand*\babel{\textsf{babel}}
\newcommand*\langvar{$\langle \it lang \rangle$}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}
\newcommand*\file[1]{\texttt{#1}}
\providecommand*\pkg[1]{\textsf{#1}}
\begin{document}
 \DocInput{latin.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{latin.dtx}
%
% \changes{latin-0.99}{1999/12/06}{First version, from italian.dtx (CB)}
% \changes{latin-0.99}{1999/12/06}{Added shortcuts for breve, macron,
%   and etymological hyphenation (CB)}
% \changes{latin-1.2}{2000/01/31}{Added suggestions from Krzysztof 
%     Konrad \.Zelechowski (CB)}
% \changes{latin-2.0}{2000/02/10}{Completely new etymological 
%     hyphenation (CB)}
% \changes{latin-2.0a}{2000/10/15}{Revised by JB}
% \changes{latin-2.0b}{2000/12/13}{Simplified shortcuts for 
%     etymological hyphenation; modified breve and macro shortcuts; 
%     language attribute medieval declared}
% \changes{latin-2.0d}{2001/06/04}{Restored caret and equals sign
%     category codes before exiting}
% \changes{latin-2.0e}{2003/04/11}{Introduced the language attribute 
%     `withprosodicmarks'; modified use of breve and macron shortcuts
%      in order to avoid possible conflicts with other packages}
%
%  \section{The Latin language}
%
%    The file \file{\filename}\footnote{The file described in this
%    section has version number \fileversion\ and was last revised on
%    \filedate. The original author is  Claudio Beccari with
%    contributions by Krzysztof Konrad \.Zelechowski,
%    (\texttt{kkz@alfa.mimuw.edu.pl})} defines all the
%    language-specific macros for the Latin language both in modern
%    and medieval spelling. 
%
%    For this language two ``styles'' of typesetting are implemented:
%    ``regular'' or modern-spelling Latin, and medieval Latin.
%    The medieval Latin specific commands can be activated by means of
%    the language attribute |medieval|; the medieval spelling differs
%    from the modern one by the systematic use of the lower case `u'
%    also where in modern spelling the letter `v' is used; when
%    typesetting with capital letters, on the opposite, the letter 'V'
%    is used also in place of 'U'. 
%    Medieval spelling also includes the ligatures |\ae| (\ae), |\oe|
%    (\oe), |\AE| (\AE), and |\OE| (\OE) that are not used  in modern
%    spelling, nor were used in the classical times.
%
%    Furthermore a third typesetting style |withprosodicmarks| is
%    defined in order to use special shortcuts for inserting breves
%    and macrons when typesetting grammars, dictionaries, teaching
%    texts, and the like, where prosodic marks are important for the
%    complete information on the words or the verses. The shortcuts,
%    listed in table~\ref{t:lashrtct} and described in
%    section~\ref{s:shrtcts}, may interfere with other packages;
%    therefore by default this third style is off and no interference
%    is introduced. If this third style is used and interference is
%    experienced, there are special commands for turning on and off
%    the specific short hand commands of this style.
%
%    For what concerns \textsf{babel} and typesetting with \LaTeX, the
%    differences between the two styles of spelling reveal themselves
%    in the strings used to name for example the ``Preface'' that
%    becomes ``Praefatio'' or ``Pr\ae fatio'' respectively.
%    Hyphenation rules are also different, but the hyphenation pattern
%    file \file{lahyph.tex} takes care of both versions of the
%    language. Needless to say that such patterns must be loaded in
%    the \LaTeX\ format by by running |initex| (or whatever the name
%    of the initializer) on |latex.ltx|.
%
%    The name strings for chapters, figures, tables, etcetera, are
%    suggested by prof. Raffaella Tabacco, a classicist of the
%    University of Turin, Italy, to whom we address our warmest
%    thanks. The names suggested by Krzysztof Konrad \.Zelechowski,
%    when different, are used as the names for the medieval variety,
%    since he made a word and spelling choice more suited for this
%    variety.
%
%    For this language some shortcuts are defined according to
%    table~\ref{t:lashrtct}; all of them are supposed to work with
%    both spelling styles, except where the opposite is explicitly
%    stated.
%    \begin{table}[htb]\centering
%    \begin{tabular}{cp{80mm}}
%    |^i|   & inserts the breve accent as \u{\i}; valid also for the
%             other lowercase vowels, but it does not operate on the
%             medieval ligatures \ae\ and \oe.\\
%    |=a|   & inserts the macron accent as \=a; valid also for the
%             other lowercase vowels, but it does not operate on the
%              medieval ligatures \ae\ and \oe.\\
%    |"|    & inserts a compound word mark where hyphenation is legal;
%             the next character must not be a medieval ligature \ae\
%             or \oe, nor an accented letter (foreign names).\\ 
%    \texttt{\string"\string|}
%           & same as above, but operates also when the next character
%             is a medieval ligature or an accented letter.
%    \end{tabular}
%    \caption[]{Shortcuts defined for the Latin language. The
%               characters \texttt{\string^} and \texttt{\string=} are
%               active only when the language attribute
%               \texttt{withprosodicmarks} has been declared,
%               otherwise they are disabled; see
%               section~\ref{s:shrtcts} for more details.}%
%    \label{t:lashrtct} 
%    \end{table}
% \StopEventually{}
%
%    The macro |\LdfInit| takes care of preventing that this file is
%    loaded more than once, checking the category code of the
%    \texttt{@} sign, etc.
%    \begin{macrocode}
%<*code>
\LdfInit{latin}{captionslatin}
%    \end{macrocode}
%
%    When this file is read as an option, i.e. by the |\usepackage|
%    command, \texttt{latin} will be an `unknown' language in which
%    case we have to make it known.  So we check for the existence of
%    |\l@latin| to see whether we have to do something here.
%
%    \begin{macrocode}
\ifx\l@latin\@undefined
    \@nopatterns{Latin}
    \adddialect\l@latin0\fi
%    \end{macrocode}
%
%
%    Now we declare the |medieval| language attribute.
%    \begin{macrocode}
\bbl@declare@ttribute{latin}{medieval}{%
  \addto\captionslatin{\def\prefacename{Pr{\ae}fatio}}%
  \def\november{Nouembris}%
  \expandafter\addto\expandafter\extraslatin
  \expandafter{\extrasmedievallatin}%
  }
%    \end{macrocode}
%
%    The third typesetting style |withprosodicmarks| is defined here
%    \begin{macrocode}
\bbl@declare@ttribute{latin}{withprosodicmarks}{%
  \expandafter\addto\expandafter\extraslatin
  \expandafter{\extraswithprosodicmarks}%
  }
%    \end{macrocode}
%    It must be remembered that the |medieval| and the |withprosodicmarks|
%    styles may be used together.
%
%    The next step consists of defining commands to switch to (and
%    from) the Latin language\footnote{Most of these names were
%    kindly suggested by Raffaella Tabacco.}.
%
% \begin{macro}{\captionslatin}
%    The macro |\captionslatin| defines all strings used
%    in the four standard document classes provided with \LaTeX.
%    \begin{macrocode}
\@namedef{captionslatin}{%
  \def\prefacename{Praefatio}%
  \def\refname{Conspectus librorum}%
  \def\abstractname{Summarium}%
  \def\bibname{Conspectus librorum}%
  \def\chaptername{Caput}%
  \def\appendixname{Additamentum}%
  \def\contentsname{Index}%
  \def\listfigurename{Conspectus descriptionum}%
  \def\listtablename{Conspectus tabularum}%
  \def\indexname{Index rerum notabilium}%
  \def\figurename{Descriptio}%
  \def\tablename{Tabula}%
  \def\partname{Pars}%
  \def\enclname{Adduntur}%   Or " Additur" ? Or simply Add.?
  \def\ccname{Exemplar}%     Use the recipient's dative
  \def\headtoname{\ignorespaces}% Use the recipient's dative
  \def\pagename{Charta}%
  \def\seename{cfr.}%
  \def\alsoname{cfr.}% R.Tabacco never saw "cfr. atque" or similar forms
  \def\proofname{Demonstratio}%
  \def\glossaryname{Glossarium}%
  }
%    \end{macrocode}
% \end{macro}
%    In the above definitions there are some points that might change
%    in the future or that require a minimum of attention from the
%    typesetter.
%    \begin{enumerate}
%    \item the \cs{enclname} is translated by a passive verb, that
%      literally means ``(they) are being added''; if just one
%      enclosure is joined to the document, the plural passive is not
%      suited any more; nevertheless a generic plural passive might be
%      incorrect but suited for most circumstances. On the opposite
%    ``Additur'', the corresponding singular passive, might be more
%      correct with one enclosure and less suited in general: what
%      about the abbreviation ``Add.'' that works in both cases, but
%      certainly is less elegant?
%    \item The \cs{headtoname} is empty and gobbles the possible
%      following space; in practice the typesetter should use the
%      dative of the recipient's name; since nowadays not all such
%      names can be translated into Latin, they might result
%      indeclinable. The clever use of an appellative by the
%      typesetter such as ``Domino'' or ``Dominae'' might solve the
%      problem, but the header might get too impressive. The typesetter
%      must make a decision on his own. 
%    \item The same holds true for the copy recipient's name in the
%      ``Cc'' field of \cs{ccname}.
%    \end{enumerate}
%
%  \begin{macro}{\datelatin}
%    The macro |\datelatin| redefines the command |\today| to produce
%    Latin dates; the choice of faked small caps  Latin numerals is
%    arbitrary and may be changed in the future. For medieval latin
%    the spelling of `Novembris' should be \textit{Nouembris}. This is
%    taken care of by using a control sequence which can be redefined
%    when the attribute `medieval' is selected.
% \changes{latin-2.0f}{2005/03/30}{Added a comment character to
%    prevent unwanted space} 
%    \begin{macrocode}
\def\datelatin{%
  \def\november{Novembris}%
  \def\today{%
    {\check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont
      \uppercase\expandafter{\romannumeral\day}}\nobreakspace
    \ifcase\month\or
    Ianuarii\or Februarii\or Martii\or Aprilis\or Maii\or Iunii\or
    Iulii\or Augusti\or Septembris\or Octobris\or \november\or
    Decembris\fi
    \space{\uppercase\expandafter{\romannumeral\year}}}}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\romandate}
%    Thomas Martin Widmann (\texttt{viralbus@daimi.au.dk}) developed a
%    macro originally named |\latindate| (but to be renamed
%    |\romandate| so as not to conflict with the standard \babel\
%    conventions) that should compute and translate the current date
%    into a date \textit{ab urbe condita} with days numbered according
%    to the kalendae and idus; for the moment this is a placeholder
%    for Thomas' macro, waiting for a self standing one that keeps
%    local all the intermediate data, counters, etc. If he succeeds,
%    here is the place to add his macro.
% \end{macro}
%
%  \begin{macro}{\latinhyphenmins}
%    The Latin hyphenation patterns can be used with both
%    |\lefthyphenmin| and |\righthyphenmin| set to~2.
% \changes{latin-2.0a}{2000/10/15}{Now use \cs{providehyphenmins} to
%    provide a default value}
%    \begin{macrocode}
\providehyphenmins{\CurrentOption}{\tw@\tw@}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\extraslatin}
% \begin{macro}{\noextraslatin}
%    For this language the |\clubpenalty|, |\widowpenalty| are set to
%    rather high values and |\finalhyphendemerits| is set to such a
%    high value that hyphenation is prohibited between the last two
%    lines of a paragraph. 
%    \begin{macrocode}
\addto\extraslatin{%
  \babel@savevariable\clubpenalty
  \babel@savevariable\widowpenalty
  \clubpenalty3000\widowpenalty3000}
%    \end{macrocode}
%    Never ever break a word between the last two lines of a paragraph
%    in latin texts.
%    \begin{macrocode}
\addto\extraslatin{%
  \babel@savevariable\finalhyphendemerits
  \finalhyphendemerits50000000}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%    With medieval Latin we need the suitable correspondence between
%    upper case V and lower case u, since in that spelling there is
%    only one sign, and the u shape is the (uncial) version of the
%    capital V. Everything else is identical with Latin.
%    \begin{macrocode}
\addto\extrasmedievallatin{%
\babel@savevariable{\lccode`\V}%
\babel@savevariable{\uccode`\u}%
\lccode`\V=`\u \uccode`\u=`\V}
%    \end{macrocode}
%
% \begin{macro}{\SetLatinLigatures}
%    We need also the lccodes for \ae\ and \oe; since they occupy
%    different positions in the OT1 \TeX-fontencoding compared to the
%    T1 one, we must save the lc- and the uccodes for both encodings,
%    but we specify the new lc- and uccodes separately as it appears
%    natural not to change encoding while typesetting the same
%    language. The encoding is assumed to be set before starting to
%    use the Latin language, so that if Latin is the default language,
%    the font encoding must be chosen before requiring the \pkg{babel}
%    package with the |latin| option, in any case before any
%    |\selectlanguage| or |\foreignlanguage| command.
%
%    All this fuss is made in order to allow the use of the medieval
%    ligatures \ae\ and \oe\ while typesetting with the medieval
%    spelling; I have my doubts that the medieval spelling should be
%    used at all in modern books, reports, and the like, as the uncial
%    `u' shape of the lower case `v'  and the above ligatures were
%    fancy styles of the copyists who were able to write faster with
%    those rounded glyphs; with typesetting there is no question of
%    handling a quill penn\dots Since my (CB) opinion may be wrong, I
%    managed to set up the instruments and it is up to the typesetter
%    to use them or not. 
%
%    \begin{macrocode}
\addto\extrasmedievallatin{%
  \babel@savevariable{\lccode`\^^e6}% T1   \ae
  \babel@savevariable{\uccode`\^^e6}% T1   \ae
  \babel@savevariable{\lccode`\^^c6}% T1   \AE
  \babel@savevariable{\lccode`\^^f7}% T1   \oe
  \babel@savevariable{\uccode`\^^f7}% T1   \OE
  \babel@savevariable{\lccode`\^^d7}% T1   \OE
  \babel@savevariable{\lccode`\^^1a}% OT1  \ae
  \babel@savevariable{\uccode`\^^1a}% OT1  \ae
  \babel@savevariable{\lccode`\^^1d}% OT1  \AE
  \babel@savevariable{\lccode`\^^1b}% OT1  \oe
  \babel@savevariable{\uccode`\^^1b}% OT1  \OE
  \babel@savevariable{\lccode`\^^1e}% OT1  \OE
  \SetLatinLigatures}
\providecommand\SetLatinLigatures{%
  \def\@tempA{T1}\ifx\@tempA\f@encoding
    \catcode`\^^e6=11 \lccode`\^^e6=`\^^e6 \uccode`\^^e6=`\^^c6 % \ae
    \catcode`\^^c6=11 \lccode`\^^c6=`\^^e6 % \AE
    \catcode`\^^f7=11 \lccode`\^^f7=`\^^f7 \uccode`\^^f7=`\^^d7 % \oe
    \catcode`\^^d7=11 \lccode`\^^d7=`\^^f7 % \OE
  \else
    \catcode`\^^1a=11 \lccode`\^^1a=`\^^1a \uccode`\^^1a=`\^^1d % \ae
    \catcode`\^^1d=11 \lccode`\^^1d=`\^^1a % \AE (^^])
    \catcode`\^^1b=11 \lccode`\^^1b=`\^^1b \uccode`\^^1b=`\^^1e % \oe
    \catcode`\^^1e=11 \lccode`\^^1e=`\^^1b % \OE (^^^)
  \fi
  \let\@tempA\@undefined
  }
%    \end{macrocode}
%    With the above definitions we are sure that |\MakeUppercase|
%    works properly and |\MakeUppercase{C{\ae}sar}| correctly `yields
%    `C{\AE}SAR''; correspondingly |\MakeUppercase{Heluetia}|
%    correctly yields ``HELVETIA''.
%    \end{macro}
%
%    \section{Latin shortcuts}\label{s:shrtcts}
%    For writing dictionaries or didactic texts we defined a third
%    language attribute, or a third typesetting style, where a couple
%    of other active characters are defined: |^| for marking a vowel
%    with the breve sign, and |=| for marking a vowel with the macro
%    sign. Please take notice that neither the OT1 font encoding, nor
%    the T1 one for most vowels, contain directly the marked vowels,
%    therefore hyphenation of words containing these ``accents'' may
%    become problematic; for this reason the above active characters
%    not only introduce the  required accent, but also the necessary
%    code for allowing hyphenation in the rest of the word.
%
%    It must be remarked that the active characters |^| and |=| may
%    have other meanings in other contexts. For example the equals
%    sign is used by the graphic extensions for specifying keyword
%    options for handling the graphic elements to be included in the
%    document. At the same time, as mentioned in the previous
%    paragraph, diacritical marking in Latin is used only for
%    typesetting certain kind of documents, such as grammars and
%    dictionaries. It is reasonable that the breve and macron active
%    characters may be switched on and off at will, and in particular
%    that they are off by default if the attribute |withprosodicmarks|
%    has not been set.
%
%    \begin{macro}{\ProsodicMarksOn}
%    \begin{macro}{\ProsodicMarksOff}
%    We begin by adding to the normal typesetting style the
%    definitions of the new commands |\ProsodicMarksOn| and
%    |\ProsodicMarksOff| that should produce error messages when the
%    third style is not declared: 
%    \begin{macrocode}
\addto\extraslatin{\def\ProsodicMarksOn{%
\GenericError{(latin)\@spaces\@spaces\@spaces\@spaces}%
            {Latin language error: \string\ProsodicMarksOn\space
            is defined by setting the\MessageBreak
            language attribute to `withprosodicmarks'\MessageBreak
            If you continue you are likely to encounter\MessageBreak
            fatal errors that I can't recover}%
            {See the Latin language description in the babel
            documentation for explanation}{\@ehd}}}
\addto\extraslatin{\let\ProsodicMarksOff\relax}
%    \end{macrocode}
%
%    Then we temporarily set the caret and the equals sign to active
%    characters so that they can receive their definitions:
%    \begin{macrocode}
\catcode`\= \active
\catcode`\^ \active
%    \end{macrocode}
%    and we add the necessary declarations to the macros that are
%    being activated when the Latin language and its typesetting
%    styles are declared:
%    \begin{macrocode}
\addto\extraslatin{\languageshorthands{latin}}%
\addto\extraswithprosodicmarks{\bbl@activate{^}}%
\addto\extraswithprosodicmarks{\bbl@activate{=}}%
\addto\noextraswithprosodicmarks{\bbl@deactivate{^}}%
\addto\noextraswithprosodicmarks{\bbl@deactivate{=}}%
\addto\extraswithprosodicmarks{\ProsodicMarks}
%    \end{macrocode}
%
%    \begin{macro}{\ProsodicMarks}
%    Next we define the defining macro for the active characters
%    \begin{macrocode}
\def\ProsodicMarks{%
\def\ProsodicMarksOn{\catcode`\^ 13\catcode`\= 13\relax}%
\def\ProsodicMarksOff{\catcode`\^ 7\catcode`\= 12\relax}%
%    \end{macrocode}
%    Notice that with the above redefinitions of the commands
%    |\ProsodicMarksOn| and |\ProsodicMarksOff|, the operation of the
%    newly defined shortcuts may be switched on and off at will, so
%    that even if a picture has to be inserted in the document by
%    means of the commands and keyword options of the |graphicx|
%    package, it suffices to switch them off before invoking the
%    picture including command, and switched on again afterwards; or,
%    even better, since the picture very likely is being inserted
%    within a |figure| environment, it suffices to switch them off
%    within the environment, being conscious that their deactivation
%    remains local to the environment.
% \changes{latin-2.0g}{2005/11/17}{changed \cs{allowhyphens} to
%    \cs{bbl@allowhyphens}} 
%    \begin{macrocode}
\initiate@active@char{^}%
\initiate@active@char{=}%
\declare@shorthand{latin}{^a}{%
    \textormath{\u{a}\bbl@allowhyphens}{\hat{a}}}%
\declare@shorthand{latin}{^e}{%
    \textormath{\u{e}\bbl@allowhyphens}{\hat{e}}}%
\declare@shorthand{latin}{^i}{%
    \textormath{\u{\i}\bbl@allowhyphens}{\hat{\imath}}}%
\declare@shorthand{latin}{^o}{%
    \textormath{\u{o}\bbl@allowhyphens}{\hat{o}}}%
\declare@shorthand{latin}{^u}{%
    \textormath{\u{u}\bbl@allowhyphens}{\hat{u}}}%
\declare@shorthand{latin}{=a}{%
    \textormath{\={a}\bbl@allowhyphens}{\bar{a}}}%
\declare@shorthand{latin}{=e}{%
    \textormath{\={e}\bbl@allowhyphens}{\bar{e}}}%
\declare@shorthand{latin}{=i}{%
    \textormath{\={\i}\bbl@allowhyphens}{\bar{\imath}}}%
\declare@shorthand{latin}{=o}{%
    \textormath{\={o}\bbl@allowhyphens}{\bar{o}}}%
\declare@shorthand{latin}{=u}{%
    \textormath{\={u}\bbl@allowhyphens}{\bar{u}}}%
}
%    \end{macrocode}
%    Notice that the short hand definitions are given only for lower
%    case letters; it would not be difficult to extend the set of
%    definitions to upper case letters, but it appears of very little
%    use in view of the kind of documents where prosodic marks are
%    supposed to be used. Nevertheless in those rare cases when it's
%    required to set some uppercase letters with their prosodic
%    marks, it is always possible to use the standard \LaTeX\ commands
%    such as  |\u{I}| for typesetting \u{I}, or |\={A}| for
%    typesetting~\=A.
%
%    Finally we restore the caret and equals sign initial default
%    category codes.
%    \begin{macrocode}
\catcode`\= 12\relax
\catcode`\^ 7\relax
%    \end{macrocode}
%    \end{macro}
%
%  \begin{macro}{\LatinMarksOn}
%  \begin{macro}{\LatinMarksOff}
% \changes{latin-2.0g}{2005/11/17}{Added two commands}
%    We define two new commands so as to switch on and off the breve
%    and macron shortcuts.
%    \begin{macrocode}
\addto\extraslatin{\def\LatinMarksOn{\shorthandon{^}\shorthandon{=}}}
\addto\extraslatin{\def\LatinMarksOff{\shorthandoff{^}\shorthandoff{=}}}
\addtoextraslatin{\LatinMarksOff}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%    It must be understood that by using the above prosodic marks,
%    line breaking is somewhat impeached; since such prosodic marks
%    are used almost exclusively in dictionaries, grammars, and poems
%    (only in school textbooks), this shouldn't be of any importance
%    for what concerns the quality of typesetting.
%    \end{macro}
%    \end{macro}
%
%    \section{Etymological hyphenation}
%    In order to deal in a clean way with prefixes and compound words
%    to be divided  etymologically, the active character |"| is given
%    a special definition so as to behave as a discretionary break
%    with hyphenation allowed after it. 
%    Most of the code for dealing with the active |"| is already
%    contained in the core of \babel, but we are going to use it as a
%    single character shorthand for Latin.
%    \begin{macrocode}
\initiate@active@char{"}%
\addto\extraslatin{\bbl@activate{"}%
}
%    \end{macrocode}
%
%    A temporary macro is defined so as to take different actions in
%    math mode and text mode: specifically in the former case the
%    macro inserts a double quote as it should in math mode, otherwise
%    another delayed macro comes into action.
%    \begin{macrocode}
\declare@shorthand{latin}{"}{%
  \ifmmode
    \def\lt@@next{''}%
  \else
    \def\lt@@next{\futurelet\lt@temp\lt@cwm}%
  \fi
  \lt@@next
}%
%    \end{macrocode}
%    In text mode the \cs{lt@next} control sequence is such that upon
%    its execution a temporary variable \cs{lt@temp} is made
%    equivalent to the next token in the input list without actually
%    removing it. Such temporary token is then tested by the macro
%    \cs{lt@cwm} and if it is found to be a letter token, then it
%    introduces a compound word separator control sequence
%    \cs{lt@allowhyphens} whose expansion introduces a discretionary
%    hyphen and an unbreakable space; in case the token is not a
%    letter, the token is tested again to find if it is the character
%    \texttt{\string|}, in which case it is gobbled and a
%    discretionary break is introduced.
% \changes{latin-2.0g}{2005/11/17}{Added a \cs{nobreak}}
%    \begin{macrocode}
\def\lt@allowhyphens{\nobreak\discretionary{-}{}{}\nobreak\hskip\z@skip}
\newcommand*{\lt@cwm}{\let\lt@n@xt\relax
  \ifcat\noexpand\lt@temp a%
    \let\lt@n@xt\lt@allowhyphens
  \else
    \if\noexpand\lt@temp\string|%
      \def\lt@n@xt{\lt@allowhyphens\@gobble}%
    \fi
  \fi
  \lt@n@xt}%
%    \end{macrocode}
%
%    Attention: the category code comparison does not work if the
%    temporary control sequence \cs{lt@temp} has been let equal to  an
%    implicit character, such as |\ae|; therefore this etymological
%    hyphenation facility does not work with medieval Latin spelling
%    when |"| immediately precedes a ligature. in order to overcome
%    this drawback the shorthand \verb!"|! may be used in such  cases;
%    it behaves exactly as |"|, but it does not test the implicit
%    character control sequence. An input such as
%    \verb!super"|{\ae}quitas!\footnote{This word does not exist in
%    ``regular'' Latin, and it is used just as an example.} 
%    gets hyphenated as \texttt{su-per-{\ae}qui-tas} instead of
%    \texttt{su-pe-r\ae-qui-tas}.
%
%    The macro |\ldf@finish| takes care of looking for a
%    configuration file, setting the main language to be switched on
%    at |\begin{document}| and resetting the category code of
%    \texttt{@} to its original value.
%    \begin{macrocode}
\ldf@finish{latin}
%</code>
%    \end{macrocode}
%
% \Finale
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\endinput