% \iffalse meta-comment
%
% Copyright 1989-2004 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 LaTeX base distribution 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{336}
% \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<*dtx>
\ProvidesFile{italian.dtx}
%</dtx>
%<code>\ProvidesLanguage{italian}
%\fi
%\ProvidesFile{italian.dtx}
        [2004/02/19 v1.2p Italian support from the babel system]
%\iffalse
%% File `italian.dtx'
%% Babel package for LaTeX version 2e
%% Copyright (C) 1989 - 2004
%%           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 Italian language definition file.
%    The original version of this file was written by Maurizio
%    Codogno, (mau@beatles.cselt.stet.it). Several features were added
%    by Claudio Beccari, (beccari@polito.it).
%<*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{italian.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{italian.dtx}
%
% \changes{italian-0.99}{1990/07/11}{First version, from english.doc}
% \changes{italian-1.0}{1991/04/23}{Modified for babel 3.0}
% \changes{italian-1.0a}{1991/05/23}{removed typo}
% \changes{italian-1.0b}{1991/05/29}{Removed bug found by van der Meer}
% \changes{italian-1.0e}{1991/07/15}{Renamed \file{babel.sty} in
%    \file{babel.com}}
% \changes{italian-1.1}{1992/02/16}{Brought up-to-date with babel 3.2a}
% \changes{italian-1.2}{1994/02/09}{Update for\ LaTeXe}
% \changes{italian-1.2e}{1994/06/26}{Removed the use of \cs{filedate}
%    and moved identification after the loading of \file{babel.def}}
% \changes{italian-1.2f}{1995/05/28}{Updated for babel 3.5}
% \changes{italian-1.2i}{1996/10/10}{Replaced \cs{undefined} with
%    \cs{@undefined} and \cs{empty} with \cs{@empty} for consistency
%    with \LaTeX, moved the definition of \cs{atcatcode} right to the
%    beginning.}
% \changes{italian-1.2l}{1999/04/24}{Added \cs{unit}, \cs{ap}, and
%    \cs{ped} macros}
% \changes{italian-1.2m}{2000/01/05}{Added support for etymological
%    hyphenation}
% \changes{italian-1.2n}{2000/02/02}{Completely modified etymological
%    hyphenation facility}
% \changes{italian-1.2n}{2000/05/28}{Added several commands for the
%   caporali double quotes and for simplifying the accented vowel input}
% \changes{italian-1.2o}{2000/12/12}{Added \cs{glossaryname}}
% \changes{italian-1.2p}{2002/07/10}{Removed redefinition of
%    \cs{add@acc} since its functionality has been introduced into the
%    kernel of LaTeX 2001/06/01}
%  \section{The Italian 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 Maurizio Codogno,
%    (\texttt{mau@beatles.cselt.stet.it}). It has been largely revised
%    by Johannes Braams and Claudio Beccari} defines all the
%    language-specific macros for the Italian language.
%
%    The features of this language definition file are the following:
%    \begin{enumerate}
%    \item The Italian hyphenation is invoked, provided that file
%      \texttt{ithyph.tex} was loaded when the \LaTeXe\ format was
%      built; in case it was not, read the information coming with your
%      implementation of the \TeX\ software and the \babel\
%      documentation.
%    \item The language dependent fixed words to be inserted by such
%      commands as |\chapter|, |\caption|, |\tableofcontents|,
%      etc. are redefined in accordance with the Italian
%      typographical practice.
%    \item Since Italian can be easily hyphenated and Italian practice
%      allows to break a word before the last two letters, hyphenation
%      parameters have been set accordingly, but a very high demerit
%      value has been set in order to avoid word breaks in the
%      penultimate line of a paragraph. Specifically the |\clubpenalty|,
%      and the |\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.
%    \item Some language specific shortcuts have been defined so as to
%      allow etymological hyphenation, specifically |"| inserts a
%      break point in any word boundary that the typesetter chooses,
%      provided it is not followed by and accented letter (very unlikely
%      in Italian, where compulsory accents fall only on the last and
%      ending vowel of a word, but may take place with compound words
%      that include foreign roots), and \verb="|= when the desired break
%      point falls before an accented letter.
%    \item The shortcut |""| introduces the raised (English) opening
%      double quotes; this shortcut proves its usefulness when one
%      reminds that the Italian keyboard misses the backtick key, and
%      the backtick on a Windows based platform may be obtained only by
%      pressing the \texttt{Alt} key while inputting the numerical code
%      0096; very, very annoying!
%    \item The shortcuts |"<| and |">| insert the French guillemots,
%      sometimes used in Italian typography; with the T1 font encoding
%      the ligatures |<<| and |>>| should insert such signs directly,
%      but not all the  virtual fonts that claim to follow the T1 font
%      encoding actually contain the guillemots; with the OT1 encoding
%      the guillemots are not available and must be faked in some
%      way. By using the |"<| and |">| shortcuts (even with the T1
%      encoding) the necessary tests are performed and in case the
%      suitable glyphs are taken from other fonts normally available
%      with any good, modern \LaTeX\ distribution.
%    \item Three new specific commands |\unit|, |\ped|, and |\ap| are
%      introduced so as to  enable the correct composition of technical
%      mathematics according to the ISO~31/XI recommendations.
%    \end{enumerate}
%
%    For this language a limited number of shortcuts has been defined,
%    table~\ref{t:itshrtct}, some of which are used to overcome
%    certain limitations of the Italian keyboard; in
%    section~\ref{s:itkbd} there are other comments and hints in order
%    to overcome some other keyboard limitations.
%
%    \begin{table}[htb]\centering
%    \begin{tabular}{cp{80mm}}
%    |"|    & inserts a compound word mark where hyphenation is legal;
%             it allows etymological hyphenation which is recommended
%             for technical terms, chemical names and the like; it
%             does not work if the next character is represented with
%             a control sequence or is an accented character.\\
%    \texttt{\string"\string|}
%           & the same as the above without the limitation on
%            characters represented with control sequences or accented
%            ones.\\
%    |""|   & inserts open quotes ``.\\ %^^A'' emacs matching
%    |"<|   & inserts open guillemots.\\
%    |">|   & inserts closed guillemots.\\
%    |"/|   & equivalent to |\slash|
%    \end{tabular}
%    \caption{Shortcuts for the Italian language}\label{t:itshrtct}
%    \end{table}
%
% \StopEventually{%
%    \begin{thebibliography}{1}
%    \bibitem{CBec} Beccari C., ``Computer Aided Hyphenation for
%    Italian and Modern Latin'', \textsf{TUGboat} vol.~13, n.~1,
%    pp.~23-33 (1992).
%    \bibitem{Becc2} Beccari C., ``Typesetting mathematics for science
%    and technology according to ISO\,31/XI'', \textsf{TUGboat}
%    vol.~18, n.~1, pp.~39-48 (1997).
%    \end{thebibliography}}
%
%    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{italian-1.2i}{1996/11/03}{Now use \cs{LdfInit} to perform
%    initial checks}
% \changes{italian-1.2j}{1996/12/29}{Added braces around second arg of
%    \cs{LdfInit}}
%    \begin{macrocode}
%<*code>
\LdfInit{italian}{captionsitalian}%
%    \end{macrocode}
%
%    When this file is read as an option, i.e. by the |\usepackage|
%    command, \texttt{italian} will be an `unknown' language in which
%    case we have to make it known.  So we check for the existence of
%    |\l@italian| to see whether we have to do something here.
%
% \changes{italian-1.0}{1991/04/23}{Now use \cs{adddialect} if
%    language undefined}
% \changes{italian-1.0h}{1991/10/08}{Removed use of \cs{@ifundefined}}
% \changes{italian-1.1}{1992/02/16}{Added a warning when no
%    hyphenation patterns were loaded.}
% \changes{italian-1.2e}{1994/06/26}{Now use \cs{@nopatterns} to
%    produce the warning}
%    \begin{macrocode}
\ifx\l@italian\@undefined
    \@nopatterns{Italian}%
    \adddialect\l@italian0\fi
%    \end{macrocode}
%
%    The next step consists of defining commands to switch to (and
%    from) the Italian language.
%
% \begin{macro}{\captionsitalian}
%    The macro |\captionsitalian| defines all strings used
%    in the four standard document classes provided with \LaTeX.
% \changes{italian-1.0c}{1991/06/06}{Removed \cs{global} definitions}
% \changes{italian-1.0c}{1991/06/06}{\cs{pagename} should be
%    \cs{headpagename}}
% \changes{italian-1.0d}{1991/07/01}{`contiene' substitued by `Allegati'
%    as suggested by Marco Bozzo (\texttt{BOZZO@CERNVM}).}
% \changes{italian-1.1}{1992/02/16}{Added \cs{seename}, \cs{alsoname}
%    and \cs{prefacename}}
% \changes{italian-1.1}{1993/07/15}{\cs{headpagename} should be
%    \cs{pagename}}
% \changes{italian-1.2b}{1994/05/19}{Changed some of the words
%    following suggestions from Claudio Beccari}
% \changes{italian-1.2g}{1995/07/04}{Added \cs{proofname} for
%    AMS-\LaTeX}
% \changes{italian-1.2h}{1995/07/27}{Added translation of `Proof'}
%    \begin{macrocode}
\addto\captionsitalian{%
  \def\prefacename{Prefazione}%
  \def\refname{Riferimenti bibliografici}%
  \def\abstractname{Sommario}%
  \def\bibname{Bibliografia}%
  \def\chaptername{Capitolo}%
  \def\appendixname{Appendice}%
  \def\contentsname{Indice}%
  \def\listfigurename{Elenco delle figure}%
  \def\listtablename{Elenco delle tabelle}%
  \def\indexname{Indice analitico}%
  \def\figurename{Figura}%
  \def\tablename{Tabella}%
  \def\partname{Parte}%
  \def\enclname{Allegati}%
  \def\ccname{e~p.~c.}%
  \def\headtoname{Per}%
  \def\pagename{Pag.}%    % in Italian the abbreviation is preferred
  \def\seename{vedi}%
  \def\alsoname{vedi anche}%
  \def\proofname{Dimostrazione}%
  \def\glossaryname{Glossario}%
  }%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dateitalian}
%    The macro |\dateitalian| redefines the command
%    |\today| to produce Italian dates.
% \changes{italian-1.0c}{1991/06/06}{Removed \cs{global} definitions}
%    \begin{macrocode}
\def\dateitalian{%
  \def\today{\number\day~\ifcase\month\or
    gennaio\or febbraio\or marzo\or aprile\or maggio\or giugno\or
    luglio\or agosto\or settembre\or ottobre\or novembre\or
    dicembre\fi\space \number\year}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\italianhyphenmins}
% \changes{italian-1.2b}{1994/05/19}{Added setting of left and
%    righthyphenmin according to Claudio Beccari's suggestion}
%
%    The italian hyphenation patterns can be used with both
%    |\lefthyphenmin| and |\righthyphenmin| set to~2.
% \changes{italian-1.2m}{2000/09/22}{Now use \cs{providehyphenmins} to
%    provide a default value}
%    \begin{macrocode}
\providehyphenmins{\CurrentOption}{\tw@\tw@}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\extrasitalian}
% \begin{macro}{\noextrasitalian}
%
% \changes{italian-1.2b}{1994/05/19}{Added setting of club- and
%    widowpenalty}
%    Lower the chance that clubs or widows occur.
%    \begin{macrocode}
\addto\extrasitalian{%
  \babel@savevariable\clubpenalty
  \babel@savevariable\widowpenalty
  \clubpenalty3000\widowpenalty3000}%
%    \end{macrocode}
%
% \changes{italian-1.2b}{1994/05/19}{Added setting of
%    finalhyphendemerits}
%
%    Never ever break a word between the last two lines of a paragraph
%    in italian texts.
%    \begin{macrocode}
\addto\extrasitalian{%
  \babel@savevariable\finalhyphendemerits
  \finalhyphendemerits50000000}%
%    \end{macrocode}
%
% \changes{italian-1.2h}{1995/11/10}{Now give the apostrophe a
%    lowercase code}
% \changes{italian-1.2l}{1999/04/5}{Changed example ``begl'italiani''
%    (obsolete spelling) with another, ``nell'altezza'', that behaves
%    the same way}
%    In order to enable the hyphenation of words such as
%    ``nell'altezza'' we give the \texttt{'} a non-zero lower case
%    code. When we do that \TeX\ finds the following hyphenation
%    points |nel-l'al-tez-za| instead of none.
%    \begin{macrocode}
\addto\extrasitalian{%
  \lccode`'=`'}%
\addto\noextrasitalian{%
  \lccode`'=0}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{italian-1.2m}{2000/01/05}{Support for etymological
%    hyphenation}
%
%   \subsection{Support for etymological hyphenation}
%
%    In his article on Italian hyphenation \cite{CBec} Beccari pointed
%    out that the Italian language gets hyphenated on a phonetic
%    basis, although etymological hyphenation is allowed; this is in
%    contrast with what happens in Latin, for example, where
%    etymological hyphenation is always used. Since the patterns for
%    both languages would become too complicated in order to cope with
%    etymological hyphenation, in his paper Beccari proposed the
%    definition of an active character `|_|' such that it could insert
%    a ``soft'' discretionary hyphen on the compound word
%    boundary. For several reasons that idea and the specific active
%    character proved to be unpractical and was abandoned.
%
%    This problem is so important with the majority of the European
%    languages, that \textsf{babel} from the very beginning developed
%    the tradition of making the |"| character active so as to perform
%    several actions that turned useful with every language.
%    One of these actions consisted in defining the shortcut \verb="|=
%    that was extensively used in German and in many other languages
%    in order to insert a discretionary hyphen such that hyphenation
%    would not be precluded in the rest of the word as it happens with
%    the standard \TeX\ command |\-|.
%
%    Meanwhile the \texttt{ec} fonts with the double Cork encoding
%    (thus formerly called the \texttt{dc} fonts) have become more or
%    less standard and are widely used by virtually all Europeans that
%    write languages with many special national characters; by so
%    doing they avoid the use of the |\accent| primitive which would
%    be required with the standard \texttt{cm} fonts; with the latter
%    fonts the primitive command |\accent| is such that hyphenation
%    becomes almost impossible, in any case strongly impeached.
%
%    The \texttt{ec} fonts contain a special character, named
%    ``compound word mark'', that occupies position 23 in the font
%    scheme and may be input with the sequence |^^W|. Up to now,
%    apparently, this special character has never been used in a
%    practical way for the typesetting of languages rich of compound
%    words; also it has never been inserted in the hyphenation pattern
%    files of any language. Beccari modified his pattern file
%    \file{ithyph.tex v4.8b} for Italian so as to contain five new
%    patterns that involve |^^W|, and he tried to give the
%    \textsf{babel} active character |"|  a new shortcut definition,
%    so as to allow the insertion of the ``compound word mark'' in the
%    proper place within any word where two semantic fragments join
%    up. With such facility for marking the compound word boundaries,
%    etymological hyphenation becomes possible even if the patterns
%    know nothing about etymology (but the typesetter hopefully
%    does!).
%    In Italian such etymological hyphenation is desirable with
%    technical terms, chemical names, and the like.
%
%    Even this solution proved to be inconvenient on certain UN*X
%    platforms, so Beccari resorted to another approach that uses the
%    \textsf{babel} active character |"| and relies on the category
%    code of the character that follows |"|.
%
%    \changes{italian-1.2n}{2000/02/02}{Completely new etymological
%    hyphenation facility}
%
%    \begin{macrocode}
\initiate@active@char{"}%
\addto\extrasitalian{\bbl@activate{"}\languageshorthands{italian}}%
%    \end{macrocode}
%    \begin{macro}{\it@cwm}
%    The active character |"| is now defined for language |italian| so
%    as to perform different actions in math mode compared to text
%    mode; specifically in math mode a double quote is inserted so as
%    to produce a double prime sign, while in text mode the temporary
%    macro |\it@next| is defined so as to defer any further action
%    until the next token category code has been tested.
%    \begin{macrocode}
\declare@shorthand{italian}{"}{%
\ifmmode
    \def\it@next{''}%
\else
    \def\it@next{\futurelet\it@temp\it@cwm}%
\fi
\it@next
}%
%    \end{macrocode}
%    \begin{macro}{\it@cwm}
%    The \cs{it@next} service control sequence is such that upon its
%    execution a temporary variable \cs{it@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{it@cwm}
%    and if it is found to be a letter token, then it introduces a
%    compound word separator control sequence \cs{it@allowhyphens}
%    whose expansion introduces a discretionary hyphen and an
%    unbreakable space; in case the token is not a letter, then it is
%    tested against \verb=|=$_{12}$: if so a compound word separator
%    is inserted and the \verb=|= token is removed, otherwise another
%    test is performed so as to see if another double quote sign
%    follows: in this case a double open quote mark is inserted,
%    otherwise two other tests are performed so as to see if
%    guillemots have to be inserted, otherwise nothing is done.
%    The double quote shortcut for inserting a double open quote sign
%    is useful for people who are inputting Italian text by means of
%    an Italian keyboard that unfortunately misses the grave or
%    backtick key.
%    By this shortcut |""| becomes equivalent to |``| for inserting
%    raised open high double quotes.
%    \begin{macrocode}
\def\it@@cwm{\nobreak\discretionary{-}{}{}\hskip\z@skip}%
\DeclareRobustCommand*{\it@cwm}{\let\it@@next\relax
\ifcat\noexpand\it@temp a%
    \def\it@@next{\it@@cwm}%
\else
    \if\noexpand\it@temp \string|%
        \def\it@@next{\it@@cwm\@gobble}%
    \else
        \if\noexpand\it@temp \string<%
            \def\it@@next{\it@ocap\@gobble}%
        \else
            \if\noexpand\it@temp \string>%
                \def\it@@next{\it@ccap\@gobble}%
            \else
                \if\noexpand\it@temp\string/%
                    \def\it@next{\slash\@gobble}%
                \else
                    \ifx\it@temp"%
                        \def\it@@next{``\@gobble}%
                    \fi
                \fi
            \fi
        \fi
    \fi
\fi
\it@@next}%
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%
%   \begin{sloppypar}
%    By this definition of |"| if one types |macro"istruzione| the
%    possible break points become \textsf{ma-cro-istru-zio-ne}, while
%    without  the |"| mark they would be \textsf{ma-croi-stru-zio-ne},
%    according to the phonetic rules such that the |macro| prefix is
%    not taken as a unit.
%    A chemical name such as \texttt{des"clor"fenir"amina"cloridrato}
%    is breakable as \textsf{des-clor-fe-nir-ami-na-clo-ri-dra-to}
%    instead of \textsf{de-sclor-fe-ni-ra-mi-na-...}
%
%    In other language description files a shortcut is defined so as
%    to allow a break point without actually inserting any hyphen
%    sign; examples are given such as \mbox{entrada/salida}; actually
%    if one wants to allow a breakpoint after the slash, it is much
%    clearer to type |\slash| instead of |/| and \LaTeX\ does
%    everything by itself; here the shortcut |"/| was introduced to
%    stand for |\slash| so that one can type |input"/output| and allow
%    a line break after the slash.
%    This shortcut works only for the slash, since in Italian such
%    constructs are extremely rare.
%   \end{sloppypar}
%
%    Attention: the expansion of |"| takes place before the actual
%    expansion of OT1 or T1 accented sequences such as |\`{a}|;
%    therefore this etymological hyphenation facility works as it
%    should only when the semantic word fragments \textit{do not
%    start} with an accented letter; this in Italian is always
%    avoidable, because compulsory accents fall only on the last
%    vowel, but it may be necessary to mark a compound word where one
%    or more components come from a foreign language and contain
%    diacritical marks according to the spelling rules of that
%    language. In this case the special shorthand \verb!"|! may be
%    used that performs exactly as |"| normally does, except that the
%    \verb!|! sign is removed from the token input list:
%    \verb!kilo"|{\"o}rsted! gets hyphenated as
%    \texttt{ki-lo-\"or-sted}.
%
%    \changes{italian-1.2l}{1999/04/05}{Added useful macros for
%    fulfilling ISO 31/XI regulations}
%
%   \subsection{Facilities required by the ISO 31/XI regulations}
%    The ISO 31/XI regulations require that units of measure are
%    typeset in upright font in any circumstance, math or text, and
%    that in text mode they are separated from the  numerical
%    indication of the measure with an unbreakable (thin) space.
%
%    The same regulations require also that super and subscripts
%    (apices and pedices) are in upright font, \emph{not in math
%    italics}, when they represent ``adjectives'' or appositions to
%    mathematical or physical variables that do not represent
%    countable or measurable entities such as, for example,
%    $V_{\mathrm{max}}$ or $V_{\mathrm{rms}}$ for a maximum or a root
%    mean square voltage, compared to $V_i$  or $V_T$ as the $i$-th
%    voltage in a set, or a voltage that depends on the thermodynamic
%    temperature $T$. See \cite{Becc2} for a complete description of
%    the ISO regulations in connection with typesetting.
%
%    More rarely it happens to use superscripts that are not
%    mathematical variables, such as the notation
%    $\mathbf{A}^{\!\mathrm{T}}$ to denote the transpose of matrix
%    $\mathbf{A}$; text superscripts are useful also as ordinals or
%    in old fashioned abbreviations in text mode; for example the
%    feminine ordinal $1^{\mathrm{a}}$ or the  old fashioned obsolete
%    abbreviation F$^{\mathrm{lli}}$ for \mbox{Fratelli} in company
%    names (compare with ``Bros.'' for \underline{bro}ther\underline{s}
%    in American English); text subscripts are mostly used in logos.
%
%    \begin{macro}{\unit}
%    \begin{macro}{\ap}
%    \begin{macro}{\ped}
%    First we define the new (internal) commands |\bbl@unit|, |\bbl@ap|,
%    and |\bbl@ped| as robust ones.
%    \begin{macrocode}
\DeclareRobustCommand*{\bbl@unit}[1]{%
  \textormath{\,\mbox{#1}}{\,\mathrm{#1}}}%
\DeclareRobustCommand*{\bbl@ap}[1]{%
  \textormath{\textsuperscript{#1}}{^{\mathrm{#1}}}}%
\DeclareRobustCommand*{\bbl@ped}[1]{%
  \textormath{$_{\mbox{\fontsize\sf@size\z@
        \selectfont#1}}$}{_\mathrm{#1}}}%
%    \end{macrocode}
%    Then we can use |\let| to define the user level commands, but in
%    case the macros already have a different meaning before entering
%    in Italian mode typesetting, we first memorize their meaning so
%    as to restore them on exit.
%    \begin{macrocode}
\addto\extrasitalian{%
  \babel@save\unit\let\unit\bbl@unit
  \babel@save\ap\let\ap\bbl@ap
  \babel@save\ped\let\ped\bbl@ped
  }%
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
% \subsection{Accents}\label{s:itkbd}
%    Most of the other language description files introduce a number
%    of shortcuts for inserting accents and other language specific
%    diacritical marks in a more comfortable way compared with the
%    lengthy standard \TeX\ conventions. When an Italian keyboard is
%    being used on a Windows based platform, it exhibits such
%    limitations that up to now no convenient shortcuts have been
%    developed; the reason lies in the fact that the Italian keyboard
%    lacks the grave accent (also known as ``backtick''), which is
%    compulsory on all accented vowels except the `e',  but, on the
%    opposite, it carries the keys with all the accented lowercase
%    vowels; the keyboard lacks also the tie |~| (tilde) key, while
%    the curly braces require pressing three keys simultaneously.
%
%    The best solution Italians have found so far is to use a smart
%    editor that accepts shortcut definitions such that, for example,
%    by striking |"(| one gets directly |{| on the screen and the same
%    sign is saved into the \file{.tex} file; the same smart editor
%    should be capable of translating the accented characters into the
%    standard \TeX\ sequences when writing a file to disk (for the
%    sake of file portability), and to transform the standard \TeX\
%    sequences into the corresponding signs when loading a \file{.tex}
%    file from disk to memory. Such smart editors do exist and can be
%    downloaded from the \textsc{ctan} archives.
%
% \changes{italian-1.2p}{2002/07/10}{Removed redefinition of \cs{add@acc} since its
%    functionality has been introduced into the kernel of LaTeX 2001/06/01}
%
%    For what concerns the missing backtick key,
%    which is used also for inputting the open quotes, it must be
%    noticed that the shortcut |""| described above completely solves
%    the problem for \textit{double} raised open quotes; according to
%    the traditions of particular publishing houses, since there are
%    no  compulsory regulations on the matter, the French guillemots
%    may be used; in this case the T1 font encoding solves the problem
%    by means of its built in ligatures |<<| and |>>|. But\dots
%
%    \subsection{\emph{Caporali} or French double quotes}
%    Although the T1 font encoding ligatures solve the problem, there
%    are some circumstances where even the T1 font encoding cannot be
%    used, either because the author\slash typesetter wants to use the
%    OT1 encoding, or because he\slash she uses a font set that does
%    not comply completely with the T1 font encoding; some virtual
%    fonts, for example, are supposed to implement the double Cork
%    font encoding  but actually miss some glyphs; one such virtual
%    font set is given by the \texttt{ae} virtual fonts, because they
%    are supposed to implement such double font encoding simply using
%    the \texttt{cm} fonts, of which the type~1 PostScript version
%    exist  and is freely available. Since guillemots (in Italian
%    \emph{caporali}) do not exist in any \texttt{cm} latin font,
%    their glyphs must be substituted with something else that
%    approaches them.
%
%    Since in French typesetting guillemots are compulsory, the French
%    language definition file resorts to a clever font substitution;
%    such file exploits the \LaTeXe\ font selection machinery so as to
%    get the guillemots from the Cyrillic fonts, because it suffices
%    to locally change the default encoding. There are several sets of
%    Cyrillic fonts, but the ones that obey the OT2 font encoding are
%    generally distributed with  all recent implementations of the
%    \TeX\ software; they are part of the American Mathematical
%    Society fonts and come both as \textsf{METAFONT} source files and
%    Type~1 PostScript \texttt{.pfb} files. The availability of such
%    fonts should be guaranteed by the presence of the
%    \texttt{OT2cmr.fd} font description file. Actually the presence
%    of this file does not guarantee the completeness of your \TeX\
%    implementation; should \LaTeX\ complain about a missing Cyrillic
%    \texttt{.tfm} file (that kind of file that contains the font
%    metric parameters) and/or about missing Cyrillic \texttt(.mf)
%    files, then your \TeX\ system is \emph{incomplete} and you should
%    download such fonts from the \textsc{ctan} archives. Temporarily
%    you may issue the command |\LtxSymbCaporali| so as to approximate
%    the missing glyphs with the \LaTeX\ symbol fonts. In some case
%    warning messages are issued so as to inform the typesetter about
%    the necessity of resorting to some \emph{poor man} solution.
%
%    \begin{macro}{\LtxSymbCaporali}
%    \begin{macro}{\it@ocap}
%    \begin{macro}{\it@ccap}
%    The ``safety'' macro |\LtxSymbCaporali|, to be issued by the
%    typesetter when he\slash she lacks the proper fonts, is very
%    similar to the corresponding French one except that is not tied
%    to any particular font encoding:
%    \begin{macrocode}
\def\LtxSymbCaporali{%
     \DeclareRobustCommand*{\it@ocap}{\mbox{%
        \fontencoding{U}\fontfamily{lasy}\selectfont(\kern-0.20em(}%
        \ignorespaces}%
     \DeclareRobustCommand*{\it@ccap}{\ifdim\lastskip>\z@\unskip\fi
     \mbox{%
        \fontencoding{U}\fontfamily{lasy}\selectfont)\kern-0.20em)}}%
}%
%    \end{macrocode}
%
%    Actually the above macro simply defines the aliases for the
%    shortcuts |"<| and |">| so as to avoid all the warning messages
%    that are being issued if the T1 encoded fonts in use lack the
%    guillemots or if the Cyrillic font encoding OT2 settings can't be
%    defined. Beware, though, that if you are using some T1 encoded
%    fonts, and you don't know if they are complete as the \texttt{ec}
%    fonts are, and you type directly |<<| or |>>|, you miss all the
%    testing and the warning messages that Italian shortcuts |"<| and
%    |">| offer and you might end up with little squares in place of
%    the missing guillemots.
%
%    The other two macros |\it@ocap| and |\it@ccap| differ from the
%    corresponding French ones in the sense that in Italian typography
%    no space must be inserted between the \emph{caporali} quotes and
%    the text they enclose; if any space is incorrectly inserted by
%    the typesetter after the open guillemots or before the closed
%    ones, the macros for Italian remove this erroneous space;
%    furthermore the Italian \babel\  option is supposed to work only
%    with \LaTeXe, therefore it is not necessary to test the \TeX\
%    format name.
%
%    We start with some operations that can be done once for all; we
%    define a new boolean |@CyrEncKnown| in order to know if we can
%    resort to the Cyrillic fonts
%    \begin{macrocode}
\newif\if@CyrEncKnown
\IfFileExists{ot2cmr.fd}%
    {\@CyrEncKnowntrue\DeclareFontEncoding{OT2}{}{}}%
    {\@CyrEncKnownfalse}%
%    \end{macrocode}
%    Then we define an option warning so as to inform the typesetter
%    on the ``poor man'' substitution we make
%    \begin{macrocode}
\DeclareRobustCommand*{\ItalianWarning}{%
    \GenericWarning{(Italian Option)\space\space}%
       {Italian Option Warning: No Cyrillic fonts available\MessageBreak
       LaTeX Symbol approximation will be used for caporali}}%
%    \end{macrocode}
%    Now we need the actual commands for the substituted caporali
%    \begin{macrocode}
\DeclareRobustCommand*{\CapAperti}{%
   \if@CyrEncKnown
       {\fontencoding{OT2}\fontfamily{wncyr}\selectfont\char60}%
   \else
       \ItalianWarning
       {\fontencoding{U}\fontfamily{lasy}\selectfont(\kern-0.20em(}%
   \fi
}%
\DeclareRobustCommand*{\CapChiusi}{%
   \if@CyrEncKnown
       {\fontencoding{OT2}\fontfamily{wncyr}\selectfont\char62}%
   \else
       \ItalianWarning
       {\fontencoding{U}\fontfamily{lasy}\selectfont)\kern-0.20em)}%
   \fi
}%
%    \end{macrocode}
%    Finally we define the alias commands for the Italian shortcuts
%    |"<| and |">|.
%    Before we need some device to spot if the assumed T1 complying
%    font really contains the guillemots; unfortunately virtual fonts
%    have black boxes in place of the missing characters, for which,
%    in any case the corresponding \TeX\ metrics are given; therefore
%    we cannot test if the font misses the guillemots by ``measuring''
%    their width. Up to now the only fonts I (CB) know that claims to
%    comply to the T1 encoding, but misses the guillemots is the group
%    of \texttt{ae} font families and shapes, that are a virtualized
%    256 glyph strict version of the \texttt{cm fonts}; since the
%    latter do not contain the guillemots, neither do the former. I
%    decided then to examine the first two characters of the font
%    family; if they are `ae', then we are working with such
%    incomplete font set; otherwise we assume the guillemots are
%    present.
%    \begin{macrocode}
\newif\ifT@one@noCap
\def\get@ae#1#2#3!{\def\bbl@ae{#1#2}}%
\def\set@T@one@noCap{\expandafter\get@ae\f@family!%
\def\bbl@temp{ae}\ifx\bbl@ae\bbl@temp\T@one@noCaptrue\else
    \T@one@noCapfalse\fi}%
%    \end{macrocode}
%    Now we are ready to define the real code:
%    \begin{macrocode}
\DeclareRobustCommand*{\it@ocap}{%
\leavevmode
\ifx\cf@encoding\bbl@t@one
    {\set@T@one@noCap
    \ifT@one@noCap
        \CapAperti
    \else
        <<%
    \fi}%
\else
    \CapAperti
\fi\ignorespaces}%
\DeclareRobustCommand*{\it@ccap}{\ifdim\lastskip>\z@\unskip\fi%
\ifx\cf@encoding\bbl@t@one
    {\set@T@one@noCap
    \ifT@one@noCap
        \CapChiusi
    \else
        >>%
    \fi}%
\else
    \CapChiusi
\fi}%
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%    \subsection{Finishing commands}
%    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{italian-1.2i}{1996/11/03}{Now use \cs{ldf@finish} to wrap
%    up}
%    \begin{macrocode}
\ldf@finish{italian}%
%</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
