1 The Portuguese language

The file portuges.dtx^{1} defines all the language-specific macros for the Portuguese language as well as for the Brasilian version of this language.

For this language the character " is made active. In table 1 an overview is given of its purpose.

"| disable ligature at this position.

"- an explicit hyphen sign, allowing hyphenation in the

rest of the word. "" like "-, but producing no hyphen sign (for words that should break at some sign such as “entrada/salida.”

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

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

Table 1: The extra definitions made by portuges.ldf

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\CurrentOption{captions\CurrentOption}

When this file is read as an option, i.e. by the \usepackage command, portuges will be an ‘unknown’ language in which case we have to make it known. So we check for the existence of \l@portuges to see whether we have to do something here. Since it is possible to load this file with any of the following four options to babel: portuges, portuguese, brazil and brazilian we also allow that the hyphenation patterns are loaded under any of these four names. We just have to find out which one was used.

 3 \ifx\l@portuges\@undefined
 4 \ifx\l@portuguese\@undefined
 5  \ifx\l@brazil\@undefined
 6  \ifx\l@brazilian\@undefined
 7  \@nopatterns{Portuguese}
 8  \adddialect\l@portuges0
 9  \else
10  \let\l@portuges\l@brazilian
11  \fi
12  \else
13  \let\l@portuges\l@brazil
14  \fi
15 \else
16  \let\l@portuges\portuguese
17 \fi
18 \fi

By now \l@portuges is defined. When the language definition file was loaded under a different name we make sure that the hyphenation patterns can be found.

1The file described in this section has version number v1.2j and was last revised on 1996/12/23. Contributions were made by Jose Pedro Ramalhete (JRAMALHE@CERNVM or Jose-Pedro Ramalhete@MACMAIL) and Arnaldo Viegas de Lima arnaldo@VNET.IBM.COM.

19 \expandafter\ifx\csname l@\CurrentOption\endcsname\relax
20 \expandafter\let\csname l@\CurrentOption\endcsname\l@portuges
21 \fi

Now we have to decide whether this language definition file was loaded for Portuguese or Brasilian use. This can be done by checking the contents of \CurrentOption. When it doesn’t contain either ‘portuges’ or ‘portuguese’ we

make \bbl@tempa empty.
22 \def\bbl@tempa{portuges}
23 \ifx\CurrentOption\bbl@tempa
24 \let\bbl@tempb\@empty
25 \else
26 \def\bbl@tempa{portuguese}
27 \ifx\CurrentOption\bbl@tempa
28  \let\bbl@tempb\@empty
29 \else
30  \def\bbl@tempb{brazil}
31 \fi
32 \fi
33 \ifx\bbl@tempb\@empty

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

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

34 \@namedef{captions\CurrentOption}{%
35  \def\prefacename{Pref\'acio}%
36  \def\refname{Refer\^encias}%
37  \def\abstractname{Resumo}%
38  \def\bibname{Bibliografia}%
39  \def\chaptername{Cap\'{\i}tulo}%
40  \def\appendixname{Ap\^endice}%

Some discussion took place around the correct translations for ‘Table of Contents’ and ‘Index’. the translations differ for Portuguese and Brasilian based the following history:

The whole issue is that some books without a real index at the end misused the term ‘Índice’ as table of contents. Then, what happens is that some books apeared with ‘Índice’ at the begining and a ‘Índice Remissivo’ at the end. Remissivo is a redundant word in this case, but was introduced to make up the difference. So in Brasil people started using ‘Sumário’ and ‘Índice Remissivo’. In Portugal this seems not to be very common, therefore we chose ‘Índice’ instead of ‘Índice Remissivo’.

41  \def\contentsname{Conte\'udo}%
42  \def\listfigurename{Lista de Figuras}%
43  \def\listtablename{Lista de Tabelas}%
44  \def\indexname{\'Indice}%
45  \def\figurename{Figura}%
46  \def\tablename{Tabela}%
47  \def\partname{Parte}%
48  \def\enclname{Anexo}%

49  \def\ccname{Com c\'opia a}%
50  \def\headtoname{Para}%
51  \def\pagename{P\'agina}%
52  \def\seename{ver}%
53  \def\alsoname{ver tamb\'em}%

An alternate term for ‘Proof’ could be ‘Prova’.

54  \def\proofname{Demonstra\c{c}\~ao}%

55 }

\dateportuges The macro \dateportuges redefines the command \today to produce Portuguese dates.

56 \@namedef{date\CurrentOption}{%
57  \def\today{\number\day\space de\space\ifcase\month\or
58  Janeiro\or Fevereiro\or Mar\c{c}o\or Abril\or Maio\or Junho\or
59  Julho\or Agosto\or Setembro\or Outubro\or Novembro\or Dezembro
60  \fi
61  \space de\space\number\year}}
62 \else

For the Brasilian version of these definitions we just add a “dialect”.

63 \expandafter\adddialect\csname l@\CurrentOption\endcsname\l@portuges

\captionsbrazil The “captions” are different for both versions of the language, so we define the

macro \captionsbrazil here.
64 \@namedef{captions\CurrentOption}{%
65  \def\prefacename{Pref\'acio}%
66  \def\refname{Refer\^encias}%
67  \def\abstractname{Resumo}%
68  \def\bibname{Refer\^encias Bibliogr\'aficas}%
69  \def\chaptername{Cap\'{\i}tulo}%
70  \def\appendixname{Ap\^endice}%
71  \def\contentsname{Sum\'ario}%
72  \def\listfigurename{Lista de Figuras}%
73  \def\listtablename{Lista de Tabelas}%
74  \def\indexname{\'Indice Remissivo}%
75  \def\figurename{Figura}%
76  \def\tablename{Tabela}%
77  \def\partname{Parte}%
78  \def\enclname{Anexo}%
79  \def\ccname{C\'opia para}%
80  \def\headtoname{Para}%
81  \def\pagename{P\'agina}%
82  \def\seename{veja}%
83  \def\alsoname{veja tamb\'em}%
84  \def\proofname{Demonstra\c{c}\~ao}%

85 }

\datebrazil The macro \datebrazil redefines the command \today to produce Brasilian dates, for which the names of the months are not capitalized.

86 \@namedef{date\CurrentOption}{%
87  \def\today{\number\day\space de\space\ifcase\month\or
88  janeiro\or fevereiro\or mar\c{c}o\or abril\or maio\or junho\or
89  julho\or agosto\or setembro\or outubro\or novembro\or dezembro

90  \fi
91  \space de\space\number\year}}
92 \fi
\portugeshyphenmins Set correct values for \lefthyphenmin and \righthyphenmin.
93 \@namedef{\CurrentOption hyphenmins}{\tw@\tw@}

\extrasportuges \noextrasportuges The macro \extrasportuges will perform all the extra definitions needed for the Portuguese language. The macro \noextrasportuges is used to cancel the actions

of \extrasportuges.

For Portuguese the " character is made active. This is done once, later on its definition may vary. Other languages in the same document may also use the " character for shorthands; we specify that the portuguese group of shorthands should be used.

94 \initiate@active@char{"}
95 \@namedef{extras\CurrentOption}{\languageshorthands{portuges}}
96 \expandafter\addto\csname extras\CurrentOption\endcsname{%
97 \bbl@activate{"}}
98 %\addto\noextrasportuges{\bbl@deactivate{"}}

First we define access to the guillemets for quotations,

99 \declare@shorthand{portuges}{"<}{%
100 \textormath{\guillemotleft{}}{\mbox{\guillemotleft}}}
101 \declare@shorthand{portuges}{">}{%
102 \textormath{\guillemotright{}}{\mbox{\guillemotright}}}

then we define two shorthands to be able to specify hyphenation breakpoints that behavew a little different from \-.

103 \declare@shorthand{portuges}{"-}{\allowhyphens-\allowhyphens}
104 \declare@shorthand{portuges}{""}{\hskip\z@skip}

And we want to have a shorthand for disabling a ligature.

105 \declare@shorthand{portuges}{"|}{%
106 \textormath{\discretionary{-}{}{\kern.03em}}{}}

\- 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 very unfortunate for languages such as Dutch and 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.

107 \expandafter\addto\csname extras\CurrentOption\endcsname{%
108 \babel@save\-}
109 \expandafter\addto\csname extras\CurrentOption\endcsname{%
110 \def\-{\allowhyphens\discretionary{-}{}{}\allowhyphens}}

\ord \ro \orda \ra We also provide an easy way to typeset ordinals, both in the male (\ord or \ro) and the female (orda or \ra) form.

111 \def\ord{$^{\rm o}$}
112 \def\orda{$^{\rm a}$}
113 \let\ro\ord\let\ra\orda

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.

114 \ldf@finish\CurrentOption

115 ⟨/code⟩