1 The Catalan language

The file catalan.dtx^{1} defines all the language-specific macro’s for the Catalan language.

For this language only the double quote character (") is made active by default. In table 1 an overview is given of the new macros defined and the new meanings of ". Additionally to that, the user can explicitly activate the acute accent or apostrophe (') and/or the grave accent (`) characters by using the activeacute and activegrave options. In that case, the definitions shown in table 2 also become available^{2}.

\lgem geminated-l digraph (similar to l·l). \Lgem produces

the uppercase version. \up Macro to help typing raised ordinals, like 1er. Takes

one argument. \- like the old \-, but allowing hyphenation in the rest

of the word. "i i with diaeresis, allowing hyphenation in the rest of

the word. Valid for the following vowels: i, u (both lowercase and uppercase).

"c c-cedilla (ç). Valid for both uppercase and lowercase

c. "l geminated-l digraph (similar to l·l). Valid for both

uppercase and lowercase l.

"<  French left double quotes (similar to <<).
">  French right double quotes (similar to >>).

"- explicit hyphen sign, allowing hyphenation in the rest

of the word.

"|  disable ligature at this position.

Table 1: Extra definitions made by file catalan.ldf (activated by default)

'e acute accented a, allowing hyphenation in the rest of the word. Valid for the following vowels: e, i, o, u (both lowercase and uppercase).

`a grave accented a, allowing hyphenation in the rest of the word. Valid for the following vowels: a, e, o (both lowercase and uppercase).

Table 2: Extra definitions made by file catalan.ldf (activated only when using the options activeacute and activegrave)

These active accents characters behave according to their original definitions if not followed by one of the characters indicated in that table.

1The file described in this section has version number v2.2h and was last revised on 1997/01/08.

2Please note that if the acute accent character is active, it is necessary to take special care of coding apostrophes in a way which cannot be confounded with accents. Therefore, it is necessary to type l'{}estri instead of l'estri.

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{catalan}\captionscatalan

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

 3 \ifx\l@catalan\@undefined
 4 \@nopatterns{Catalan}
 5 \adddialect\l@catalan0
 6 \fi

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

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

 7 \addto\captionscatalan{%
 8 \def\prefacename{Pr\`oleg}%
 9 \def\refname{Refer\`encies}%
10 \def\abstractname{Resum}%
11 \def\bibname{Bibliografia}%
12 \def\chaptername{Cap\'{\i}tol}%
13 \def\appendixname{Ap\`endix}%
14 \def\contentsname{\'Index}%
15 \def\listfigurename{\'Index de figures}%
16 \def\listtablename{\'Index de taules}%
17 \def\indexname{\'Index alfab\`etic}%
18 \def\figurename{Figura}%
19 \def\tablename{Taula}%
20 \def\partname{Part}%
21 \def\enclname{Adjunt}%
22 \def\ccname{C\`opies a}%
23 \def\headtoname{A}%
24 \def\pagename{P\`agina}%
25 \def\seename{Vegeu}%
26 \def\alsoname{Vegeu tamb\'e}%
27 \def\proofname{Demostraci\'o}%

28 }

\datecatalan The macro \datecatalan redefines the command \today to produce Catalan dates. Months are written in lowercase^{3}.

29 \def\datecatalan{%
30 \def\today{\number\day~\ifcase\month\or
31  de gener\or de febrer\or de mar\c{c}\or d'abril\or de maig\or
32  de juny\or de juliol\or d'agost\or de setembre\or d'octubre\or
33  de novembre\or de desembre\fi
34  \space de~\number\year}}

3This seems to be the common practice. See for example: E. Coromina, El 9 Nou: Manual de redacció i estil, Ed. Eumo, Vic, 1993

\extrascatalan \noextrascatalan The macro \extrascatalan will perform all the extra definitions needed for the Catalan language. The macro \noextrascatalan is used to cancel the actions of

\extrascatalan.

To improve hyphenation we give the grave character (') a non-zero lower case code; when we do that TEX will find more breakpoints in words that contain this character in its rôle as apostrophe.

35 \addto\extrascatalan{%
36 \lccode`'=`'}
37 \addto\noextrascatalan{%
38 \lccode`'=0}

For Catalan, some characters are made active or are redefined. In particular, the " character receives a new meaning; this can also happen for the ' character and the ` character when the options activegrave and/or activeacute are specified.

39 \addto\extrascatalan{\languageshorthands{catalan}}
40 \initiate@active@char{"}
41 \addto\extrascatalan{\bbl@activate{"}}
42 \@ifpackagewith{babel}{activegrave}{%
43 \initiate@active@char{`}}{}
44 \@ifpackagewith{babel}{activegrave}{%
45 \addto\extrascatalan{\bbl@activate{`}}}{}
46 \@ifpackagewith{babel}{activeacute}{%
47 \initiate@active@char{'}}{}
48 \@ifpackagewith{babel}{activeacute}{%
49 \addto\extrascatalan{\bbl@activate{'}}}{}
50 %\addto\noextrascatalan{%
51 %  \bbl@deactivate{"}
52 %  \bbl@deactivate{`}\bbl@deactivate{'}}

Apart from the active characters some other macros get a new definition. Therefore we store the current ones to be able to restore them later. When their current meanings are saved, we can safely redefine them.

We provide new definitions for the accent macros when one or boith of the options activegrave or activeacute were specified.

53 \addto\extrascatalan{%
54 \babel@save\"%
55 \def\"{\protect\@umlaut}}%
56 \@ifpackagewith{babel}{activegrave}{%
57 \babel@save\`%
58 \addto\extrascatalan{\def\`{\protect\@grave}}
59 }{}
60 \@ifpackagewith{babel}{activeacute}{%
61 \babel@save\'%
62 \addto\extrascatalan{\def\'{\protect\@acute}}
63 }{}

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

\dieresis \textacute \textgrave 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 \'.

64 \let\dieresis\"
65 \@ifpackagewith{babel}{activegrave}{\let\textgrave\`}{}
66 \@ifpackagewith{babel}{activeacute}{\let\textacute\'}{}

\@umlaut \@acute \@grave We check the encoding and if not using T1, we make the accents expand but enabling hyphenation beyond the accent. If this is the case, not all break positions will be found in words that contain accents, but this is a limitation in TEX. An unsolved problem here is that the encoding can change at any time. The definitions below are made in such a way that a change between two 256-char encodings are supported, but changes between a 128-char and a 256-char encoding are not properly supported. We check if T1 is in use. If not, we will give a warning and proceed redefining the accent macros so that TEX at least finds the breaks that are not too close to the accent. The warning will only be printed to the log file.

67 \ifx\DeclareFontShape\@undefined
68 \wlog{Warning: You are using an old LaTeX}
69 \wlog{Some word breaks will not be found.}
70 \def\@umlaut#1{\allowhyphens\dieresis{#1}\allowhyphens}
71 \@ifpackagewith{babel}{activeacute}{%
72  \def\@acute#1{\allowhyphens\textacute{#1}\allowhyphens}}{}
73 \@ifpackagewith{babel}{activegrave}{%
74  \def\@grave#1{\allowhyphens\textgrave{#1}\allowhyphens}}{}
75 \else
76 \edef\next{T1}
77 \ifx\f@encoding\next
78  \let\@umlaut\dieresis
79  \@ifpackagewith{babel}{activeacute}{%
80  \let\@acute\textacute}{}
81  \@ifpackagewith{babel}{activegrave}{%
82  \let\@grave\textgrave}{}
83 \else
84  \wlog{Warning: You are using encoding \f@encoding\space
85  instead of T1.}
86  \wlog{Some word breaks will not be found.}
87  \def\@umlaut#1{\allowhyphens\dieresis{#1}\allowhyphens}
88  \@ifpackagewith{babel}{activeacute}{%
89  \def\@acute#1{\allowhyphens\textacute{#1}\allowhyphens}}{}
90  \@ifpackagewith{babel}{activegrave}{%
91  \def\@grave#1{\allowhyphens\textgrave{#1}\allowhyphens}}{}
92 \fi
93 \fi

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.^{4}

Now we can define our shorthands: the diaeresis and “ela geminada” support,

 94 \declare@shorthand{catalan}{"i}{\textormath{\@umlaut\i}{\ddot\imath}}
 95 \declare@shorthand{catalan}{"l}{\lgem{}}
 96 \declare@shorthand{catalan}{"u}{\textormath{\@umlaut u}{\ddot u}}
 97 \declare@shorthand{catalan}{"I}{\textormath{\@umlaut I}{\ddot I}}
 98 \declare@shorthand{catalan}{"L}{\Lgem{}}
 99 \declare@shorthand{catalan}{"U}{\textormath{\@umlaut U}{\ddot U}}

cedille,

100 \declare@shorthand{catalan}{"c}{\textormath{\c c}{^{\prime} c}}
101 \declare@shorthand{catalan}{"C}{\textormath{\c C}{^{\prime} C}}

‘french’ quote characters,

102 \declare@shorthand{catalan}{"<}{%
103 \textormath{\guillemotleft{}}{\mbox{\guillemotleft}}}
104 \declare@shorthand{catalan}{">}{%
105 \textormath{\guillemotright{}}{\mbox{\guillemotright}}}

grave accents,

106 \@ifpackagewith{babel}{activegrave}{%
107 \declare@shorthand{catalan}{`a}{\textormath{\@grave a}{\grave a}}
108 \declare@shorthand{catalan}{`e}{\textormath{\@grave e}{\grave e}}
109 \declare@shorthand{catalan}{`o}{\textormath{\@grave o}{\grave o}}
110 \declare@shorthand{catalan}{`A}{\textormath{\@grave A}{\grave A}}
111 \declare@shorthand{catalan}{`E}{\textormath{\@grave E}{\grave E}}
112 \declare@shorthand{catalan}{`O}{\textormath{\@grave O}{\grave O}}
113 \declare@shorthand{catalan}{``}{\textquotedblleft}
114 }{}

acute accents,

115 \@ifpackagewith{babel}{activeacute}{%
116 \declare@shorthand{catalan}{'a}{\textormath{\@acute a}{^{\prime} a}}
117 \declare@shorthand{catalan}{'e}{\textormath{\@acute e}{^{\prime} e}}
118 \declare@shorthand{catalan}{'i}{\textormath{\@acute\i{}}{^{\prime} i}}
119 \declare@shorthand{catalan}{'o}{\textormath{\@acute o}{^{\prime} o}}
120 \declare@shorthand{catalan}{'u}{\textormath{\@acute u}{^{\prime} u}}
121 \declare@shorthand{catalan}{'A}{\textormath{\@acute A}{^{\prime} A}}
122 \declare@shorthand{catalan}{'E}{\textormath{\@acute E}{^{\prime} E}}
123 \declare@shorthand{catalan}{'I}{\textormath{\@acute I}{^{\prime} I}}
124 \declare@shorthand{catalan}{'O}{\textormath{\@acute O}{^{\prime} O}}
125 \declare@shorthand{catalan}{'U}{\textormath{\@acute U}{^{\prime} U}}
126 \declare@shorthand{catalan}{'|}{%
127  \textormath{\csname normal@char\string'\endcsname}{^{\prime}}}

the acute accent,

128 \declare@shorthand{catalan}{''}{%
129  \textormath{\textquotedblright}{\sp\bgroup\prim@s'}}
130 }{}

4A 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.

and finally, some support definitions

131 \declare@shorthand{catalan}{"-}{\allowhyphens-\allowhyphens}
132 \declare@shorthand{catalan}{"|}{%
133 \textormath{\penalty\@M\discretionary{-}{}{\kern.03em}%
134  \allowhyphens}{}}

\- 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 Catalan 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 Catalan makes this desirable and so it is kept here.

135 \addto\extrascatalan{%
136 \babel@save{\-}%
137 \def\-{\allowhyphens\discretionary{-}{}{}\allowhyphens}}

\lgem \Lgem Here we define a macro for typing the catalan “ela geminada” (geminated l). The macros \lgem and \Lgem have been chosen for its lowercase and uppercase representation, respectively^{5}.

The code used in the actual macro used is a combination of the one proposed by Feruglio and Fuster^{6} and the proposal^{7} from Valiente presented at the TEX Users Group Annual Meeting in 1995. This last proposal has not been fully implemented due to its limitation to CM fonts.

138 \newdimen\leftllkern \newdimen\rightllkern \newdimen\raiselldim
139 \def\lgem{%
140 \ifmmode
141  \csname normal@char\string"\endcsname l%
142 \else
143  \leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
144  \setbox0\hbox{l}\setbox1\hbox{l\/}\setbox2\hbox{.}%
145  \advance\raiselldim by \the\fontdimen5\the\font
146  \advance\raiselldim by -\ht2%
147  \leftllkern=-.25\wd0%
148  \advance\leftllkern by \wd1%
149  \advance\leftllkern by -\wd0%
150  \rightllkern=-.25\wd0%
151  \advance\rightllkern by -\wd1%
152  \advance\rightllkern by \wd0%
153  \allowhyphens\discretionary{l-}{l}%
154  {\hbox{l}\kern\leftllkern\raise\raiselldim\hbox{.}%
155  \kern\rightllkern\hbox{l}}\allowhyphens
156 \fi

157 }

158 \def\Lgem{%
159 \ifmmode
160  \csname normal@char\string"\endcsname L%

5The macro names \ll and \LL were not taken because of the fact that \ll is already used in mathematical mode.

6G. Valiente and R. Fuster, Typesetting Catalan Texts with TEX, TUGboat 14(3), 1993.

7G. Valiente, Modern Catalan Typographical Conventions, TUGboat 16(3), 1995.

161 \else
162  \leftllkern=0pt\rightllkern=0pt\raiselldim=0pt%
163  \setbox0\hbox{L}\setbox1\hbox{L\/}\setbox2\hbox{.}%
164  \advance\raiselldim by .5\ht0%
165  \advance\raiselldim by -.5\ht2%
166  \leftllkern=-.125\wd0%
167  \advance\leftllkern by \wd1%
168  \advance\leftllkern by -\wd0%
169  \rightllkern=-\wd0%
170  \divide\rightllkern by 6%
171  \advance\rightllkern by -\wd1%
172  \advance\rightllkern by \wd0%
173  \allowhyphens\discretionary{L-}{L}%
174  {\hbox{L}\kern\leftllkern\raise\raiselldim\hbox{.}%
175  \kern\rightllkern\hbox{L}}\allowhyphens
176 \fi

177 }

{\l.l \atop \L.L} It seems to be the most natural way of entering the “ela geminda” to use the sequences \l.l and \L.L. These are not really macro’s by themselves but the macros \l and \L with delimited arguments. Therefor we define two macros that check if the next character is a period. If not the “polish l” will be typeset, otherwise a “ela geminada” will be typeset and the next two tokens will be ‘eaten’.

178 \let\lslash\l
179 \let\Lslash\L
180 \DeclareRobustCommand\l{\@ifnextchar.\bbl@l\lslash}
181 \DeclareRobustCommand\L{\@ifnextchar.\bbl@L\Lslash}
182 \def\bbl@l#1#2{\lgem}
183 \def\bbl@L#1#2{\Lgem}

\up A macro for typesetting things like 1er as proposed by Raymon Seroul^{8}.

184 \DeclareRobustCommand*{\up}[1]{\textsuperscript{#1}}

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.

185 \ldf@finish{catalan}

186 ⟨/code⟩

8This macro has been borrowed from francais.dtx