summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/bosisio/accenti.dtx
blob: 6f6ab9a78df0af90156e4e0976e76194a494aeb5 (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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
%\iffalse % MetaComment
%%
%% + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
%% |            Copyright(C) 1997-2010 by F. Bosisio             |
%% |                                                             |
%% | This program can be redistributed and/or modified under	 |
%% | the terms 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 LaTeX distributions |
%% | version 2005/12/01 or later.                                |
%% |                                                             |
%% | This work has the LPPL maintenance status `maintained'.     |
%% | The Current Maintainer of this work is F. Bosisio.          |
%% |                                                             |
%% | This work consists of files accenti.dtx and accenti.html    |
%% | and of the derived files accenti.sty and accenti.pdf.       |
%% |                                                             |
%% | E-mail:   fbosisio@bigfoot.com                              |
%% | CTAN location: macros/latex/contrib/bosisio/                |
%% + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
%%
%%	If you make any improvment, find any bug or have
%%	any suggestion, please let me know about it.
%%
%<*package,driver>
%\fi
%
\def\FileName{accenti}
%\iffalse % MetaComment
%</package,driver>
%<*package>
%\fi
\def\fileversion{2.3}
\def\filedate{2005/04/02}
\def\docdate{2005/04/09}
\def\filedescr{Commands to make accents (FB)}
%
%\iffalse % MetaComment
%</package>
%<*dtx>
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%		This section is the installation driver
%
\def\batchfile{\FileName.dtx}
%
\input docstrip
%
\keepsilent
% \askforoverwritefalse
%
\generateFile{\FileName.sty}{f}{\from{\FileName.dtx}{package}}
%
\generateFile{\FileName.drv}{f}{\from{\FileName.dtx}{driver}}
%
\Msg{******************************************************}
\Msg{*}
\Msg{* To produce the documentation run the}
\Msg{* file `\FileName.drv' through LaTeX.}
\Msg{*}
\Msg{******************************************************}
%
\endbatchfile
%
%		End of the installation driver
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%</dtx>
%
%		This section is the documentation driver
%
%<+driver>\documentclass[12pt,a4paper]{ltxdoc}
%<+driver>  \EnableCrossrefs
%<+driver>  \CodelineIndex
%<+driver>  \RecordChanges
%<+driver>  %\OnlyDescription	% Uncomment not to see the implementation
%<+driver>\begin{document}
%<+driver>  \DocInput{\FileName.dtx}
%<+driver>  \PrintIndex
%<+driver>  \PrintChanges
%<+driver>\end{document}
%
%		End of the documentation driver
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%<*package>
%\fi
%
% \changes{v0.1}{4 May 1997}{First release (basic accents-command)}
% \changes{v0.2}{20 August 1997}{Added extended-chars handling}
% \changes{v1.0}{5 September 1997}{Documentation added}
% \changes{v1.1}{7 November 1997}{Fixed a bug in the options}
% \changes{v2.0}{20 December 1997}{Separated from package ``quotes''}
% \changes{v2.1}{5 March 1999}{Added copyright notice and changed addresses}
% \changes{v2.2}{2 April 2005}{All commands made robust}
%\iffalse % MetaComment
% The previous change was requested by Robin Fairbains (robin.fairbains@cl.cam.ac.uk)
%\fi
% \changes{v2.3}{9 April 2005}{Usage of the double-quote character (") avoided}
%
% \MakeShortVerb{\|}
%
% \title{Package \texttt{\FileName}\thanks{This is version \fileversion,
% last revised \filedate; documentation date \docdate}}
% \author{F. Bosisio\\\normalsize E-mail: \texttt{fbosisio@bigfoot.com}}
% \date{\filedate}
% \maketitle
%
% \begin{abstract}
%       Documentation for the package \texttt{\FileName}.
% \end{abstract}
%
% \section{Introduction}
%       This package provides a shorter version of some accents-making
%	commands, particularly suited for italian language.
%
%       In particular some commands are redefined, so care should be
%       taken, expecially when including this package in an already
%       existent \LaTeX{} file.
%
%       \noindent
%       The redefined commands are:\\
%	``|\a|'', ``|\i|'', ``|\o|'' and ``|\u|'',\\
%	whose job can now be done by the commands\\
%	``|\oFinnick|'' (finnick ``o'' bar),
%	``|\DotlessI|'' (dotless ``i'', for accents),
%	``|\aAccent|'' (for accents in |tabbing| environment)
%	and ``|\uAccent|'' (upsidedown ``hat'' accent).
%
% \section{Obsolete package}
%
%	This package is \emph{obsolete}, as it has been superseeded by
%	the standard ``|inputenc|'' package: indeed, the declaration\\
%	\mbox{}\qquad |\usepackage[latin1]{inputenc}|\\
%	directly allows the use of the characters ``\`a'', ``\`e'',
%	``\`\i'', ``\`o'', ``\`u'' and ``\'e'' in the document, which
%	is extremly useful with an italian keyboard.
%
% \section{Required packages}
%
%	This package requires the ``|\xspace|'' command provided by
%	the ``|xspace|'' package.
%
% \section{Options}
%
%	This package provides the options ``|ExtdChar|'' and
%	``|ExtdCharOnly|'' which allow the use of the special
%	characters ``\`a'', ``\`e'', ``\`\i'', ``\`o'', ``\`u'' and ``\'e''
%	as accents-making commands.
%	The second option also inhibits the definitions of
%	``|\a|'', ``|\e|'', ``|\i|'', ``|\o|'', ``|\u|'', ``|\ee|''
%	and ``|\che|'' as short forms of the accent-commands
%	(it is particularly useful for non-Italian documents).
%
% \section{Accents}
%
%	Unless you specify the ``|ExtdCharOnly|'' option, the
%	commands ``|\a|'', ``|\e|'', ``|\i|'', ``|\o|'', ``|\u|'' and ``|\E|''
%       prints the corresponding letter with a grave accent;
%       the commands ``|\ee|'' and ``|\che|'' print the letter ``|e|''
%       or the three letters ``|che|'' with an acute accent (i.e. ``\'e''
%	and ``ch\'e'').
%
%	Moreover, if the ``|ExtdChar|'' or ``|ExtdCharOnly|'' option was
%	used, the chars ``\`a'', ``\`e'', ``\`\i'', ``\`o'', ``\`u'' and ``\'e''
%	are equivalent to the commands ``|\`a|'', ``|\`e|'', ``|\`\i|'',
%	``|\`o|'', ``|\`u|'' and ``|\'e|''.
%
% \StopEventually{}
% \newpage
% \section{Implementation}
%
%    \begin{macrocode}
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{\FileName}[\filedate\space v\fileversion\space\filedescr]
\RequirePackage{xspace}[1996/12/06 v1.05]
%%
\newif\if@ExtendedAccChar\@ExtendedAccCharfalse
\DeclareOption{ExtdChar}{\@ExtendedAccChartrue}
%%
\newif\if@NotOnlyExtended@\@NotOnlyExtended@true
\DeclareOption{ExtdCharOnly}{\@NotOnlyExtended@false}
%%
\ProcessOptions
%%
%    \end{macrocode}
%
%	\begin{macro}{\a,\e,\i,\o,\u,\ee,\che,\E}
%
%	The original commands ``|\a|'', ``|\i|'', ``|\o|'' and ``|\u|'' are
%	saved before being redefined.
%	The combined use of an intermediate internal command and of
%	``|\DeclareRobustCommand*|'', allow for all the commands of the
%	package to be robust (even the saved original ones).
%
%    \begin{macrocode}
%%
\let\a@RIGINAL=\a
\let\i@RIGINAL=\i
\let\o@RIGINAL=\o
\let\u@RIGINAL=\u
%%
\DeclareRobustCommand*\aAccent{\a@RIGINAL}
\DeclareRobustCommand*\DotlessI{\i@RIGINAL}
\DeclareRobustCommand*\oFinnick{\o@RIGINAL}
\DeclareRobustCommand*\uAccent{\u@RIGINAL}
%    \end{macrocode}
%
%	The commands ``|\a|'', ``|\e|'', ``|\i|'', ``|\o|'', ``|\u|'' and ``|\E|''
%	prints the corresponding letter with a grave accent;
%	the commands ``|\ee|'' and ``|\che|'' print the letter ``|e|''
%	or the three letters ``|che|'' with an acute accent (i.e. ``\'e''
%	and ``ch\'e'').
%	The definitions are deferred at the ``|\begin{document}|''
%	in order to avoid conflicts with other packages.
%
%    \begin{macrocode}
%%
\if@NotOnlyExtended@	%-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\
  \AtBeginDocument{%
    \renewcommand*\a{\`a\xspace}%
    \newcommand*\e{\`e\xspace}%
    \renewcommand*\i{\`\DotlessI\xspace}%
    \renewcommand*\o{\`o\xspace}%
    \renewcommand*\u{\`u\xspace}%
    \newcommand*\E{\`E\xspace}%
    \newcommand*\ee{\'e\xspace}%
    \newcommand*\che{ch\'e\xspace}%
  }
\fi	%-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
%    \end{macrocode}
%	\end{macro}
%
%	\begin{macro}{Accents}
%	A trick adapted from the |doc| package (which, perhaps, may be
%	done in a better way) is used (if the ``|ExtdChar|'' option was
%	selected) to associate the extended-ASCII chars which represents
%	accents with the corresponding accent-making commands.
%
%    \begin{macrocode}
%%
\if@ExtendedAccChar	%-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\
%%
%%	%%%%%%%%%%
%%	% à = \a %
%%	%%%%%%%%%%
\begingroup
  \catcode`\~\active  \lccode`\~`\à%
  \lowercase{%
  \global\expandafter\let
     \csname ac\string\à\endcsname~%
  \gdef~{\`a}}%
\endgroup
\global\catcode`\à\active
%%
%%	%%%%%%%%%%
%%	% è = \e %
%%	%%%%%%%%%%
\begingroup
  \catcode`\~\active  \lccode`\~`\è%
  \lowercase{%
  \global\expandafter\let
     \csname ac\string\è\endcsname~%
  \gdef~{\`e}}%
\endgroup
\global\catcode`\è\active
%%
%%	%%%%%%%%%%%
%%	% é = \ee %
%%	%%%%%%%%%%%
\begingroup
  \catcode`\~\active  \lccode`\~`\é%
  \lowercase{%
  \global\expandafter\let
     \csname ac\string\è\endcsname~%
  \gdef~{\'e}}%
\endgroup
\global\catcode`\é\active
%%
%%	%%%%%%%%%%
%%	% ì = \i %
%%	%%%%%%%%%%
\begingroup
  \catcode`\~\active  \lccode`\~`\ì%
  \lowercase{%
  \global\expandafter\let
     \csname ac\string\ì\endcsname~%
  \gdef~{\`\DotlessI}}%
\endgroup
\global\catcode`\ì\active
%%
%%	%%%%%%%%%%
%%	% ò = \o %
%%	%%%%%%%%%%
\begingroup
  \catcode`\~\active  \lccode`\~`\ò%
  \lowercase{%
  \global\expandafter\let
     \csname ac\string\ò\endcsname~%
  \gdef~{\`o}}%
\endgroup
\global\catcode`\ò\active
%%
%%	%%%%%%%%%%
%%	% ù = \u %
%%	%%%%%%%%%%
\begingroup
  \catcode`\~\active  \lccode`\~`\ù%
  \lowercase{%
  \global\expandafter\let
     \csname ac\string\ù\endcsname~%
  \gdef~{\`u}}%
\endgroup
\global\catcode`\ù\active
%%
\fi	%-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
%    \end{macrocode}
%	\end{macro}
%
%\iffalse % MetaComment
%<*package>
%\fi
%
% \CheckSum{271}
% \Finale
%
\endinput