summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/aeguill/aeguill.sty
blob: 51748e40f2d28ec3a5e7d88fea27250811a6722a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
%% This is file `aeguill.sty' 
% This file gives french guillemets (and not guillemots!)
% built with the LatinModern fonts (default),
% the Polish CMR fonts, WNCYR fonts, 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(le) 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 (but not the frenchle package), 
% to type << or >>.
%
% By default, you get the LatinModern guillemets; if this package is loaded
% with the `pl' option, you get the Polish guillemets;
% with the `cm' option, you get the LASY guillemets; with `ec' you
% get the EC guillemets, and with `cyr' you get the cyrillic guillemets.
%
% In verbatim mode, you always get the EC/TT guillemets.
%
% The default option is interesting in conjunction with PDF,
% because LatinModern is a Type 1 font close to CMR
% and whose guillemets are very close in shape to the EC guillemets.
% 
%
% Support for Polish CMR guillemets was kindly provided by 
% Rolf Niepraschk <niepraschk@ptb.de> in version 0.99 (2000/05/22).
% Bernd Raichle provided extensive simplifications to the code
% for version 1.00.
%
% This package is released under the LPPL.
%
% Changes:
%   Date        version
%   2001/04/12  1.01    the frenchle and french package are now distinguished.
%   2003/08/02  1.02    support for the new LatinModern fonts (suggested by Daniel Flipo)
%                       the default has been changed to LatinModern guillemets
%                       (this is an unfortunate, but in my view necessary, incompatibility)
%                       (I do not plan to change this default ever, as LatinModern is
%                       supposed to become standard, and eventually make ae/ec obsolete)
%
\def\fileversion{1.02}
\def\filedate{2003/08/02}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{aeguill}[2003/08/02 1.02 %
AE fonts with french guillemets (D. Roegel)]
\RequirePackage{ae}

\newcommand{\@ae@switch}[5]{#5}
\DeclareOption{ec}{\renewcommand\@ae@switch[5]{#1}}
\DeclareOption{cm}{\renewcommand\@ae@switch[5]{#2}}
\DeclareOption{cyr}{\renewcommand\@ae@switch[5]{#3}}
\DeclareOption{pl}{\renewcommand\@ae@switch[5]{#4}}
\DeclareOption{lm}{\renewcommand\@ae@switch[5]{#5}}
\ExecuteOptions{lm}
\ProcessOptions

%
% Load necessary packages
%
\@ae@switch{% ec
  % do nothing
}{% cm
  \RequirePackage{latexsym}%
}{% cyr
  \RequirePackage[OT2,T1]{fontenc}%
}{% pl
  \RequirePackage[OT4,T1]{fontenc}%
}{% lm
  % do nothing
}

% The following command will be compared to \frenchname,
% as defined in french.sty and frenchle.sty.
\def\aeguillfrenchdefault{french}%

\let\guill@verbatim@font\verbatim@font
\def\verbatim@font{\guill@verbatim@font\ecguills{cmtt}%
                   \let\guillemotleft\@oguills\let\guillemotright\@fguills}

\begingroup \catcode`\<=13 \catcode`\>=13
\def\x{\endgroup
 \def\ae@lfguill{<<}%
 \def\ae@rfguill{>>}%
}\x

\newcommand{\ecguills}[1]{%
  \def\selectguillfont{\fontencoding{T1}\fontfamily{#1}\selectfont}%
  \def\@oguills{{\selectguillfont\symbol{19}}}%
  \def\@fguills{{\selectguillfont\symbol{20}}}%
  } 

\newcommand{\aeguills}{%
  \ae@guills
  % 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 % neither french.sty nor frenchle.sty
                      \else
                         \ifx\aeguillfrenchdefault\frenchname
                           \ae@lfguill  % french.sty
                         \else
                           \@oguills    % frenchle.sty
                         \fi
                      \fi}%
  \gdef\guillemotright{\ifx\auxWARNINGi\undefined
                         \@fguills % neither french.sty nor frenchle.sty
                       \else
                         \ifx\aeguillfrenchdefault\frenchname
                           \ae@rfguill  % french.sty
                         \else
                           \@fguills    % frenchle.sty
                         \fi
                       \fi}%
  }

%
% Depending on the class option
% define the internal command \ae@guills
\@ae@switch{% ec
  \newcommand{\ae@guills}{%
    \ecguills{cmr}}%
}{% cm
  \newcommand{\ae@guills}{%
    \def\selectguillfont{\fontencoding{U}\fontfamily{lasy}%
            \fontseries{m}\fontshape{n}\selectfont}%
    \def\@oguills{\leavevmode\nobreak
                \hbox{\selectguillfont (\kern-.20em(\kern.20em}\nobreak}%
    \def\@fguills{\leavevmode\nobreak
                \hbox{\selectguillfont \kern.20em)\kern-.2em)}%
                \ifdim\fontdimen\@ne\font>\z@\/\fi}}%
}{% cyr
  \newcommand{\ae@guills}{%
    \def\selectguillfont{\fontencoding{OT2}\fontfamily{wncyr}\selectfont}%
    \def\@oguills{{\selectguillfont\symbol{60}}}%
    \def\@fguills{{\selectguillfont\symbol{62}}}}
}{% pl
  \newcommand{\ae@guills}{%
    \def\selectguillfont{\fontencoding{OT4}\fontfamily{cmr}\selectfont}%
    \def\@oguills{{\selectguillfont\symbol{174}}}%
    \def\@fguills{{\selectguillfont\symbol{175}}}}
}{% lm
  \newcommand{\ae@guills}{%
    \ecguills{lmr}}%
}


\AtBeginDocument{%
  \ifx\GOfrench\undefined
    \aeguills
  \else
    \let\aeguill@GOfrench\GOfrench
    \gdef\GOfrench{\aeguill@GOfrench \aeguills}%
  \fi
  }

\endinput