1 The Galician language

The file galician.dtx^{1} defines all the language definition macros for the Galician language.

For this language the characters ' ~ and " are made active. In table 1 an overview is given of their purpose. These active accents character behave according

"| disable ligature at this position.

"- an explicit hyphen sign, allowing hyphenation in the

rest of the word. \- like the old \-, but allowing hyphenation in the rest

of the word. 'a an accent that allows hyphenation. Valid for all vow-

els uppercase and lowercase. 'n a n with a tilde. This is included to improve compatibility with FTC. Works for uppercase too.

"u a u with dieresis allowing hyphenation.
"a feminine ordinal as in 1^{\underline{a}}.
"o masculine ordinal as in 1^{\underline{o}}.
~n a n with tilde. Works for uppercase too.

Table 1: The extra definitions made by galician.ldf

to their original definitions if not followed by one of the characters indicated in that table.

The macro \LdfInit takes care of preventing that this file is loaded more than once, checking the category code of the @ sign, etc.

1 ⟨∗code⟩

 2 \LdfInit{galician}\captionsgalician

When this file is read as an option, i.e. by the \usepackage command, galician could be an ‘unknown’ language in which case we have to make it known. So we check for the existence of \l@galician to see whether we have to do something here.

 3 \ifx\l@galician\@undefined
 4 \@nopatterns{Galician}
 5 \adddialect\l@galician0\fi

The next step consists of defining commands to switch to (and from) the Galician language.

\captionsgalician The macro \captionsgalician defines all strings used in the four standard documentclasses provided with L^{A}TEX.

 6 \addto\captionsgalician{%
 7 \def\prefacename{Prefacio}%
 8 \def\refname{Referencias}%
 9 \def\abstractname{Resumo}%
10 \def\bibname{Bibliograf\'{\i}a}%
11 \def\chaptername{Cap\'{\i}tulo}%
12 \def\appendixname{Ap\'endice}%

1The file described in this section has version number v1.2g and was last revised on 1997/01/15.

13 \def\contentsname{\'Indice Xeral}%
14 \def\listfigurename{\'Indice de Figuras}%
15 \def\listtablename{\'Indice de T\'aboas}%
16 \def\indexname{\'Indice de Materias}%
17 \def\figurename{Figura}%
18 \def\tablename{T\'aboa}%
19 \def\partname{Parte}%
20 \def\enclname{Adxunto}%
21 \def\ccname{Copia a}%
22 \def\headtoname{A}%
23 \def\pagename{P\'axina}%
24 \def\seename{v\'exase}%
25 \def\alsoname{v\'exase tam\'en}%
26 \def\proofname{Proof}%  <-- Needs Translation!

27 }

\dategalician The macro \dategalician redefines the command \today to produce Galician dates.

28 \def\dategalician{%
29 \def\today{\number\day~de\space\ifcase\month\or
30  xaneiro\or febreiro\or marzo\or abril\or maio\or xu\~no\or
31  xullo\or agosto\or setembro\or outubro\or novembro\or decembro\fi
32  \space de~\number\year}}

\extrasgalician \noextrasgalician The macro \extrasgalician will perform all the extra definitions needed for the Galician language. The macro \noextrasgalician is used to cancel the actions

of \extrasgalician.

For Galician, some characters are made active or are redefined. In particular, the " character and the ~ character receive new meanings this can also happen for the ' character when the option activeacute is specified.

33 \addto\extrasgalician{\languageshorthands{galician}}
34 \initiate@active@char{"}
35 \initiate@active@char{~}
36 \addto\extrasgalician{%
37 \bbl@activate{"}\bbl@activate{~}}
38 \@ifpackagewith{babel}{activeacute}{%
39 \initiate@active@char{'}}{}
40 \@ifpackagewith{babel}{activeacute}{%
41 \addto\extrasgalician{\bbl@activate{'}}}{}
42 %\addto\noextrasgalician{%
43 %  \bbl@deactivate{"}\bbl@deactivate{~}\bbl@deactivate{'}}

Apart from the active characters some other macros get a new definition. Therefore we store the current one to be able to restore them later.

44 \addto\extrasgalician{%
45 \babel@save\"\babel@save\~%
46 \def\"{\protect\@umlaut}%
47 \def\~{\protect\@tilde}}
48 \@ifpackagewith{babel}{activeacute}{%
49 \babel@save\'%
50 \addto\extrasgalician{\def\'{\protect\@acute}}
51 }{}

All the code above is necessary because we need a few extra active characters. These characters are then used as indicated in table 1.

This option includes some support for working with extended, 8-bit fonts, if available. This assumes that the user has some macros predefined. For instance, if the user has a \@ac@a macro defined, the sequence \'a or 'a will both expand to whatever \@ac@a is defined to expand, presumably á. The names of these macros are the same as those in Ferguson’s ML-TEX compatibility package on purpose. Using this method, and provided that adequate hyphenation patterns exist, it is possible to get better hyphenation for Galician than before. If the user has a terminal able to produce these codes directly, it is possible to do so. If the need arises to send the document to someone who does not have such support, it is possible to mechanically translate the document so that the receiver can make use of it.

To be able to define the function of the new accents, we first define a couple of ‘support’ macros.

\dieresis \textacute \texttilde The original definition of \" is stored as \dieresis, because the definition of \" might not be the default plain TEX one. If the user uses PostScript fonts with the Adobe font encoding the " character is not in the same position as in Knuth’s font encoding. In this case \" will not be defined as \accent"7F #1, but as \accent'310 #1. Something similar happens when using fonts that follow the Cork encoding. For this reason we save the definition of \" and use that in the definition of other macros. We do likewise for \' and \~.

52 \let\dieresis\"
53 \let\texttilde\~
54 \@ifpackagewith{babel}{activeacute}{\let\textacute\'}{}

\@umlaut \@acute \@tilde If the user setup has extended fonts, the Ferguson macros are required to be defined. We check for their existance and, if defined, expand to whatever they are defined to. For instance, \'a would check for the existance of a \@ac@a macro. It is assumed to expand to the code of the accented letter. If it is not defined, we assume that no extended codes are available and expand to the original definition but enabling hyphenation beyond the accent. This is as best as we can do. It is better if you have extended fonts or ML-TEX because the hyphenation algorithm can work on the whole word. The following macros are directly derived from ML-TEX.^{2}

55 \def\@umlaut#1{\allowhyphens\dieresis{#1}\allowhyphens}
56 \def\@tilde#1{\allowhyphens\texttilde{#1}\allowhyphens}
57 \@ifpackagewith{babel}{activeacute}{%
58 \def\@acute#1{\allowhyphens\textacute{#1}\allowhyphens}}{}

Now we can define our shorthands: the umlauts,

59 \declare@shorthand{galician}{"-}{\allowhyphens-\allowhyphens}
60 \declare@shorthand{galician}{"|}{\discretionary{-}{}{\kern.03em}}

2A problem is perceived here with these macros when used in a multilingual environment where extended hyphenation patterns are available for some but not all languages. Assume that no extended patterns exist at some site for French and that french.sty would adopt this scheme too. In that case, 'e in French would produce the combined accented letter, but hyphenation around it would be suppressed. Both language options would need an independent method to know whether they have extended patterns available. The precise impact of this problem and the possible solutions are under study.

61 \declare@shorthand{galician}{"u}{\@umlaut{u}}
62 \declare@shorthand{galician}{"U}{\@umlaut{U}}

ordinals^{3},

63 \declare@shorthand{galician}{"o}{%
64 \leavevmode\raise1ex\hbox{\underbar{\scriptsize o}}}
65 \declare@shorthand{galician}{"a}{%
66 \leavevmode\raise1ex\hbox{\underbar{\scriptsize a}}}

acute accents,

67 \@ifpackagewith{babel}{activeacute}{%
68 \declare@shorthand{galician}{'a}{\textormath{\@acute a}{^{\prime} a}}
69 \declare@shorthand{galician}{'e}{\textormath{\@acute e}{^{\prime} e}}
70 \declare@shorthand{galician}{'i}{\textormath{\@acute\i{}}{^{\prime}i}}
71 \declare@shorthand{galician}{'o}{\textormath{\@acute o}{^{\prime} o}}
72 \declare@shorthand{galician}{'u}{\textormath{\@acute u}{^{\prime} u}}
73 \declare@shorthand{galician}{'A}{\textormath{\@acute A}{^{\prime} A}}
74 \declare@shorthand{galician}{'E}{\textormath{\@acute E}{^{\prime} E}}
75 \declare@shorthand{galician}{'I}{\textormath{\@acute I}{^{\prime} I}}
76 \declare@shorthand{galician}{'O}{\textormath{\@acute O}{^{\prime} O}}
77 \declare@shorthand{galician}{'U}{\textormath{\@acute U}{^{\prime} U}}

tildes,

78 \declare@shorthand{galician}{'n}{\textormath{\~n}{^{\prime} n}}
79 \declare@shorthand{galician}{'N}{\textormath{\~N}{^{\prime} N}}

the acute accent,

80 \declare@shorthand{galician}{''}{%
81  \textormath{\textquotedblright}{\sp\bgroup\prim@s'}}
82 }{}
83 \declare@shorthand{galician}{~n}{\textormath{\~n}{\@tilde n}}
84 \declare@shorthand{galician}{~N}{\textormath{\~N}{\@tilde N}}

\- All that is left now is the redefinition of \-. The new version of \- should indicate an extra hyphenation position, while allowing other hyphenation positions to be generated automatically. The standard behaviour of TEX in this respect is unfortunate for Galician but not as much as for Dutch or German, where long compound words are quite normal and all one needs is a means to indicate an extra hyphenation position on top of the ones that TEX can generate from the hyphenation patterns. However, the average length of words in Galician makes this desirable and so it is kept here.

85 \addto\extrasgalician{%
86 \babel@save{\-}%
87 \def\-{\allowhyphens\discretionary{-}{}{}\allowhyphens}}

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 @ to its original value.

88 \ldf@finish{galician}

89 ⟨/code⟩

3The code for the ordinals was taken from the answer provided by Raymond Chen (raymond@math.berkeley.edu) to a question by Joseph Gil (yogi@cs.ubc.ca) in comp.text.tex.