%% This is file `aeguill.sty' 
% This file gives french guillemets (and not guillemots!)
% built with the WNCYR fonts (by default), or the LASY fonts 
% or with the EC fonts. 
% This is useful in conjunction with the ae package
% (this package loads the ae package in case it has not been loaded)
%  and with or without the french package.
%
% In order to get the guillemets, it is necessary to either type
% \guillemotleft and \guillemotright, or to use an 8 bit encoding
% (such as ISO-Latin1) which selects these two commands, 
% or, if you use the french package, to type << or >>.
%
% By default, you get the WNCYR guillemets; if this package is loaded
% with the `cm' option, you get the LASY guillemets, and with `ec,' you
% get the EC guillemets.
%
% In verbatim mode, you always get the EC/TT guillemets.
%
% The default option is interesting in conjunction with PDF,
% because there is a Type 1 version of the WNCYR fonts.
% There is neither a Type 1 version of the LASY fonts, nor of the EC fonts.
%
\def\fileversion{0.97}
\def\filedate{1999/12/21}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{aeguill}[\filedate\space\fileversion\space
AE fonts with french guillemets (D. Roegel)]
\RequirePackage{ae}
\newif\if@ae@ec
\newif\if@ae@cm
\newif\if@ae@cyr
\DeclareOption{ec}{\@ae@ectrue\@ae@cyrfalse}
\DeclareOption{cm}{\@ae@cmtrue\@ae@cyrfalse}
\DeclareOption{cyr}{\@ae@cyrtrue}
\ExecuteOptions{cyr}
\ProcessOptions
\if@ae@cyr
  \RequirePackage[OT2,T1]{fontenc}
\fi
\if@ae@cm
  \RequirePackage{latexsym}
\fi
\let\guill@verbatim@font\verbatim@font
\def\verbatim@font{\guill@verbatim@font\ecguills{cmtt}%
                   \let\guillemotleft\@oguills\let\guillemotright\@fguills}
{\catcode`\<=13
 \catcode`\>=13
 \gdef\ae@lfguill{<<}%
 \gdef\ae@rfguill{>>}%
}
\newcommand{\ecguills}[1]{%
  \def\selectguillfont{\fontencoding{T1}\fontfamily{#1}\selectfont}%
  \def\@oguills{{\selectguillfont\symbol{19}}}%
  \def\@fguills{{\selectguillfont\symbol{20}}}%
  }
\newcommand{\aeguills}{%
  \def\@LP{(}
  \def\@RP{)}
  \def\ly{\fontencoding{U}\fontfamily{lasy}%
          \fontseries{m}\fontshape{n}\selectfont}
  \if@ae@ec
    \ecguills{cmr}%
  \fi
  \if@ae@cyr
    \def\selectguillfont{\fontencoding{OT2}\fontfamily{wncyr}\selectfont}%
    \def\@oguills{{\selectguillfont\symbol{60}}}%
    \def\@fguills{{\selectguillfont\symbol{62}}}%
  \fi
  \if@ae@cm
    \def\@oguills{\nobreak\leavevmode
                \hbox{{\ly\@LP\kern-0.20em\@LP\kern+0.20em}}\nobreak}%
    \def\@fguills{\nobreak\leavevmode
                \hbox{{\ly\kern+0.20em\@RP\kern-0.20em\@RP}}%
                \ifdim\fontdimen\@ne\font>\z@\/\fi}
  \fi
  % We redefine \guillemotleft and \guillemotright
  % in order to catch them when they are used 
  % with \DeclareInputText (in latin1.def for instance)
  % We use \auxWARNINGi as a safe indicator that french.sty is used.
    \gdef\guillemotleft{\ifx\auxWARNINGi\undefined
                           \@oguills
                        \else
                           \ae@lfguill
                        \fi}%
    \gdef\guillemotright{\ifx\auxWARNINGi\undefined
                           \@fguills
                         \else
                           \ae@rfguill
                         \fi}%
  }
\newcommand\@redefGuillInGOfrench{%
   \ifx\GOfrench\undefined
      \aeguills
   \else
      \let\aeguill@GOfrench\GOfrench
      \gdef\GOfrench{\aeguill@GOfrench
                     \aeguills
                     }
   \fi
   }
\AtBeginDocument{\@redefGuillInGOfrench}%
\endinput

