% \iffalse meta-comment
%
% Copyright 1989-2021 Johannes L. Braams, Javier Bezos, 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 Javier Bezos.
% 
% 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
% \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<*dtx>
\ProvidesFile{portuges.dtx}
%</dtx>
%<code>\ProvidesLanguage{portuges}
%\fi
%\ProvidesFile{portuges.dtx}
        [2021/07/09 v1.2t Portuguese support from the babel system]
%\iffalse
%% File `portuges.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989 - 2021
%%           by Johannes Braams, Javier Bezos
%
%% Portuguese Language Definition File
%% Copyright (C) 1989 - 2021
%%           by Johannes Braams, Javier Bezos
%
%    This file is part of the babel system, it provides the source
%    code for the Portuguese language definition file.  The Portuguese
%    words were contributed by Jose Pedro Ramalhete, (JRAMALHE@CERNVM
%    or Jose-Pedro_Ramalhete@MACMAIL).
%
%    Arnaldo Viegas de Lima <arnaldo@VNET.IBM.COM> contributed
%    brasilian translations and suggestions for enhancements.
%<*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}}
\begin{document}
 \DocInput{portuges.dtx}
\end{document}
%</filedriver>
%\fi
%
% \GetFileInfo{portuges.dtx}
%
% \changes{portuges-1.0a}{1991/07/15}{Renamed \file{babel.sty} in
%    \file{babel.com}}
% \changes{portuges-1.1}{1992/02/16}{Brought up-to-date with babel 3.2a}
% \changes{portuges-1.2}{1994/02/26}{Update for \LaTeXe}
% \changes{portuges-1.2d}{1994/06/26}{Removed the use of \cs{filedate}
%    and moved identification after the loading of \file{babel.def}}
% \changes{portuges-1.2g}{1995/06/04}{Enhanced support for brasilian}
% \changes{portuges-1.2j}{1996/07/11}{Replaced \cs{undefined} with
%    \cs{@undefined} and \cs{empty} with \cs{@empty} for consistency
%    with \LaTeX} 
% \changes{portuges-1.2j}{1996/10/10}{Moved the definition of
%    \cs{atcatcode} right to the beginning.}
%
%  \section{The Portuguese language}
%
%    The file \file{\filename}\footnote{The file described in this
%    section has version number \fileversion\ and was last revised on
%    \filedate.  Contributions were made by Jose Pedro Ramalhete
%    (\texttt{JRAMALHE@CERNVM} or
%    \texttt{Jose-Pedro\_Ramalhete@MACMAIL}) and Arnaldo Viegas de
%    Lima \texttt{arnaldo@VNET.IBM.COM}.}  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~\ref{tab:port-quote} an overview is given of its purpose.
%
%    \begin{table}[htb]
%     \centering
%     \begin{tabular}{lp{8cm}}
%       \verb="|= & disable ligature at this position.\\
%        |"-| & an explicit hyphen sign, allowing hyphenation
%               in the rest of the word.\\
%        |""| & like \verb="-=, 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. \\
%     \end{tabular}
%     \caption{The extra definitions made by \file{portuges.ldf}}
%     \label{tab:port-quote}
%    \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.
% \changes{portuges-1.2j}{1996/11/03}{Now use \cs{LdfInit} to perform
%    initial checks} 
%    \begin{macrocode}
%<*code>
\LdfInit\CurrentOption{captions\CurrentOption}
%    \end{macrocode}
%
%    When this file is read as an option, i.e. by the |\usepackage|
%    command, \texttt{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: \Lopt{portuges}, \Lopt{portuguese},
%    \Lopt{brazil} and \Lopt{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.
%
% \changes{portuges-1.0b}{1991/10/29}{Removed use of cs{@ifundefined}}
% \changes{portuges-1.1}{1992/02/16}{Added a warning when no
%    hyphenation patterns were loaded.}
% \changes{portuges-1.2d}{1994/06/26}{Now use \cs{@nopatterns} to
%    produce the warning}
%    \begin{macrocode}
\ifx\l@portuges\@undefined
  \ifx\l@portuguese\@undefined
    \ifx\l@brazil\@undefined
      \ifx\l@brazilian\@undefined
        \@nopatterns{Portuguese}
        \adddialect\l@portuges0
      \else
        \let\l@portuges\l@brazilian
      \fi
    \else
      \let\l@portuges\l@brazil
    \fi
  \else
    \let\l@portuges\l@portuguese
  \fi
\fi
%    \end{macrocode}
%    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.
%    \begin{macrocode}
\expandafter\ifx\csname l@\CurrentOption\endcsname\relax
  \expandafter\let\csname l@\CurrentOption\endcsname\l@portuges
\fi
%    \end{macrocode}
%
%    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@tempb|
%    empty. 
%    \begin{macrocode}
\def\bbl@tempa{portuguese}
\ifx\CurrentOption\bbl@tempa
  \let\bbl@tempb\@empty
\else
  \def\bbl@tempa{portuges}
  \ifx\CurrentOption\bbl@tempa
    \let\bbl@tempb\@empty
  \else
    \def\bbl@tempb{brazil}
  \fi
\fi
\ifx\bbl@tempb\@empty
%    \end{macrocode}
%
%    The next step consists of defining commands to switch to (and from)
%    the Portuguese language.
%
% \begin{macro}{\captionsportuges}
%    The macro |\captionsportuges| defines all strings used
%    in the four standard documentclasses provided with \LaTeX.
% \changes{portuges-1.1}{1992/02/16}{Added \cs{seename}, \cs{alsoname}
%    and \cs{prefacename}}
% \changes{portuges-1.1}{1993/07/15}{\cs{headpagename} should be
%    \cs{pagename}}
% \changes{portuges-1.2e}{1994/11/09}{Added a few missing
%    translations}
% \changes{portuges-1.2h}{1995/07/04}{Added \cs{proofname} for
%    AMS-\LaTeX}
% \changes{portuges-1.2i}{1995/11/25}{Substituted `Prova' for `Proof'}
%    \begin{macrocode}
  \@namedef{captions\CurrentOption}{%
    \def\prefacename{Pref\'acio}%
    \def\refname{Refer\^encias}%
    \def\abstractname{Resumo}%
    \def\bibname{Bibliografia}%
    \def\chaptername{Cap\'{\i}tulo}%
    \def\appendixname{Ap\^endice}%
%    \end{macrocode}
%    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:
%    \begin{quote}
%      The whole issue is that some books without a real index at the
%      end misused the term `\'Indice' as table of contents. Then,
%      what happens is that some books apeared with `\'Indice' at the
%      begining and a `\'Indice 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\'ario' and
%      `\'Indice Remissivo'. In Portugal this seems not to be very
%      common, therefore we chose `\'Indice' instead of `\'Indice
%      Remissivo'.
%    \end{quote}
%    \begin{macrocode}
    \def\contentsname{Conte\'udo}%
    \def\listfigurename{Lista de Figuras}%
    \def\listtablename{Lista de Tabelas}%
    \def\indexname{\'Indice}%
    \def\figurename{Figura}%
    \def\tablename{Tabela}%
    \def\partname{Parte}%
    \def\enclname{Anexo}%
    \def\ccname{Com c\'opia a}%
    \def\headtoname{Para}%
    \def\pagename{P\'agina}%
    \def\seename{ver}%
    \def\alsoname{ver tamb\'em}%
%    \end{macrocode}
%    An alternate term for `Proof' could be `Prova'.
% \changes{portuges-1.2m}{2000/09/20}{Added \cs{glossaryname}}
% \changes{portuges-1.2p}{2003/05/23}{Substituted `Gloss\'ario' for
%    `Glossary'}
%    \begin{macrocode}
    \def\proofname{Demonstra\c{c}\~ao}%
    \def\glossaryname{Gloss\'ario}%
    }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dateportuges}
%    The macro |\dateportuges| redefines the command |\today| to
%    produce Portuguese dates.
% \changes{portuges-1.2k}{1997/10/01}{Use \cs{edef} to define
%    \cs{today} to save memory}
% \changes{portuges-1.2k}{1998/03/28}{use \cs{def} instead of
%    \cs{edef}} 
% \changes{portuges-1.2n}{2001/01/27}{Removed spurious space after
%    Dezembro}
%    \begin{macrocode}
  \@namedef{date\CurrentOption}{%
    \def\today{\number\day\space de\space\ifcase\month\or
      janeiro\or fevereiro\or mar\c{c}o\or abril\or maio\or junho\or
      julho\or agosto\or setembro\or outubro\or novembro\or dezembro%
      \fi
      \space de\space\number\year}}
\else
%    \end{macrocode}
% \end{macro}
%
%    For the Brasilian version of these definitions we just add a
%    ``dialect''. 
%    \begin{macrocode}
  \expandafter
    \adddialect\csname l@\CurrentOption\endcsname\l@portuges
%    \end{macrocode}
%
% \begin{macro}{\captionsbrazil}
% \changes{portuges-1.2g}{1995/06/04}{The captions for brasilian and
%    portuguese are different now}
%
%    The ``captions'' are different for both versions of the language,
%    so we define the macro |\captionsbrazil| here.
% \changes{portuges-1.2i}{1995/11/25}{Added \cs{proofname} for
%    AMS-\LaTeX}
% \changes{portuges-1.2m}{2000/09/20}{Added \cs{glossaryname}}
% \changes{portuges-1.2q}{2008/03/18}{Substituted `Gloss\'ario' for
%    `Glossary'}
%    \begin{macrocode}
  \@namedef{captions\CurrentOption}{%
    \def\prefacename{Pref\'acio}%
    \def\refname{Refer\^encias}%
    \def\abstractname{Resumo}%
    \def\bibname{Refer\^encias Bibliogr\'aficas}%
    \def\chaptername{Cap\'{\i}tulo}%
    \def\appendixname{Ap\^endice}%
    \def\contentsname{Sum\'ario}%
    \def\listfigurename{Lista de Figuras}%
    \def\listtablename{Lista de Tabelas}%
    \def\indexname{\'Indice Remissivo}%
    \def\figurename{Figura}%
    \def\tablename{Tabela}%
    \def\partname{Parte}%
    \def\enclname{Anexo}%
    \def\ccname{C\'opia para}%
    \def\headtoname{Para}%
    \def\pagename{P\'agina}%
    \def\seename{veja}%
    \def\alsoname{veja tamb\'em}%
    \def\proofname{Demonstra\c{c}\~ao}%
    \def\glossaryname{Gloss\'ario}%
    }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\datebrazil}
%    The macro |\datebrazil| redefines the command
%    |\today| to produce Brasilian dates, for which the names
%    of the months are not capitalized.
% \changes{portuges-1.2k}{1997/10/01}{Use \cs{edef} to define
%    \cs{today} to save memory}
% \changes{portuges-1.2k}{1998/03/28}{use \cs{def} instead of
%    \cs{edef}} 
% \changes{portuges-1.2n}{2001/01/27}{Removed spurious space after
%    dezembro}
%    \begin{macrocode}
  \@namedef{date\CurrentOption}{%
    \def\today{\number\day\space de\space\ifcase\month\or
      janeiro\or fevereiro\or mar\c{c}o\or abril\or maio\or junho\or
      julho\or agosto\or setembro\or outubro\or novembro\or dezembro%
      \fi
      \space de\space\number\year}}
\fi
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\portugeshyphenmins}
% \changes{portuges-1.2g}{1995/06/04}{Added setting of hyphenmin
%    values}
%    Set correct values for |\lefthyphenmin| and |\righthyphenmin|.
% \changes{portuges-1.2m}{2000/09/22}{Now use \cs{providehyphenmins} to
%    provide a default value}
% \changes{portuges-1.2o}{2001/02/16}{Set \cs{righthyphenmin} to 3 if
%    not provided by the pattern file.}
%    \begin{macrocode}
\providehyphenmins{\CurrentOption}{\tw@\thr@@}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\extrasportuges}
% \changes{portuges-1.2g}{1995/06/04}{Added the definition of some
%    \texttt{"} shorthands}
% \begin{macro}{\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 \texttt{"} character is made active. This is
%    done once, later on its definition may vary. Other languages in
%    the same document may also use the \texttt{"} character for
%    shorthands; we specify that the portuguese group of shorthands
%    should be used.
%
%    \begin{macrocode}
\initiate@active@char{"}
\@namedef{extras\CurrentOption}{\languageshorthands{portuges}}
\expandafter\addto\csname extras\CurrentOption\endcsname{%
  \bbl@activate{"}}
%    \end{macrocode}
%    Don't forget to turn the shorthands off again.
% \changes{portuges-1.2m}{1999/12/17}{Deactivate shorthands ouside of
%    Basque}
%    \begin{macrocode}
\addto\noextrasportuges{\bbl@deactivate{"}}
%    \end{macrocode}
%    First we define access to the guillemets for quotations,
% \changes{portuges-1.2k}{1997/04/03}{Removed empty groups after
%    guillemot characters}
%    \begin{macrocode}
\declare@shorthand{portuges}{"<}{%
  \textormath{\guillemotleft}{\mbox{\guillemotleft}}}
\declare@shorthand{portuges}{">}{%
  \textormath{\guillemotright}{\mbox{\guillemotright}}}
%    \end{macrocode}
%    then we define two shorthands to be able to specify hyphenation
%    breakpoints that behave a little different from |\-|.
%    \begin{macrocode}
\declare@shorthand{portuges}{"-}{\nobreak-\bbl@allowhyphens}
\declare@shorthand{portuges}{""}{\hskip\z@skip}
%    \end{macrocode}
%    And we want to have a shorthand for disabling a ligature.
% \changes{portuges-1.2s}{2021/02/06}{Adapted this shorthand to changes in hyperref}
% To avoid problems in bookmarks the shorthand should be hyperref aware.
%    \begin{macrocode}
\providecommand\texorpdfstring[2]{#1}
\declare@shorthand{portuges}{"|}{%
  \texorpdfstring{\textormath{\discretionary{-}{}{\kern.03em}}{}}{}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%  \begin{macro}{\-}
%
%    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.
%    \begin{macrocode}
\expandafter\addto\csname extras\CurrentOption\endcsname{%
  \babel@save\-}
\expandafter\addto\csname extras\CurrentOption\endcsname{%
  \def\-{\allowhyphens\discretionary{-}{}{}\allowhyphens}}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\ord}
% \changes{portuges-1.2g}{1995/06/04}{Added macro}
%  \begin{macro}{\ro}
% \changes{portuges-1.2g}{1995/06/04}{Added macro}
%  \begin{macro}{\orda}
% \changes{portuges-1.2g}{1995/06/04}{Added macro}
%  \begin{macro}{\ra}
% \changes{portuges-1.2g}{1995/06/04}{Added macro}
%    We also provide an easy way to typeset ordinals, both in the male
%    (|\ord| or |\ro|) and the female (|orda| or |\ra|) form.
%    \begin{macrocode}
\def\ord{$^{\mathrm o}$}
\def\orda{$^{\mathrm a}$}
\let\ro\ord\let\ra\orda
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%    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.
% \changes{portuges-1.2j}{1996/11/03}{ow use \cs{ldf@finish} to wrap
%    up} 
%    \begin{macrocode}
\ldf@finish\CurrentOption
%</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
