summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/paresse/paresse.dtx
blob: 7b413fdbcb3c0f5fe92ba34ba311fa73247da28b (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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
% \iffalse meta-comment
%-*- coding: iso-8859-15 -*-
% Time-stamp: <2013-02-16 10:32:18 novatux>
% --------------------------------------------------------------------
% 
% Copyright (C) 2011, 2013 
% by Yvon Henel alias le TeXnicien de surface
% <le.texnicien.de.surface@wanadoo.fr>
%
% --------------------------------------------------------------------
% 
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% 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.2 or later is part of all distributions of LaTeX 
% version 1999/12/01 or later.
% \fi
%
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<*common>
\def\fileversion{v4.1}  
\def\filedate{2013/02/16}
\def\fileinfo{fichier paresse par le TeXnicien de surface}
%</common>
%<*package>
\ProvidesPackage{paresse}
   [\filedate\space\fileversion\space\fileinfo] 
%</package>
% \fi
% \iffalse
%<*driver>
\documentclass[a4paper]{ltxdoc}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}  
\usepackage[tame]{paresse}
\usepackage{xspace,url,array, ifthen}
\IfFileExists{lmodern.sty}{\usepackage{lmodern}}{}
\usepackage[frenchb,english]{babel}
\usepackage{hypdoc,hologo}

\newcommand*\PS{\texttt{\S}\xspace}
\newcommand*\PSVerb[1]{\texttt{\S #1}}
\newcommand\BOP{\discretionary{}{}{}}
\newcommand\Option[1]{\textsc{#1}}
\newcommand\Pkg[1]{\textsf{#1}}
\newcommand\NOUVO[1][1]{%
  \ifthenelse
  {\equal{#1}{4.1}}
  {\marginpar{\hspace*{\stretch{1}}%
      \textbf{N (v4.1)}\hspace*{.5em}}}%
  {}} 

% commentez la ligne suivante pour avoir un document avec le code
% \OnlyDescription
% comment the preceding line to obtain a document with the code
% puis cherchez \StopEventually pour d'éventuels réglages
% then look for \StopEventually to make a bit of setup
\EnableCrossrefs
\CodelineIndex
\RecordChanges

\begin{document}
  \DocInput{paresse.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{592}
%
% \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         \~}
%
%
% \changes{v0.0}{2004/02/07}{New name, some redefinitions,
% first public version}
% \changes{v1}{2004/04/17}{Documentation updated}
% \changes{v1a}{2005/03/01}{Correction of a bug in Infofile which prevented the loading of the package}
% \changes{v2}{2008/08/13}{A useless macro is deleted}
% \changes{v2}{2008/08/13}{Documentation reorganised}
% \changes{v2}{2008/08/13}{New wrapping to provide a tds.zip.}
% \changes{v2.1}{2008/08/16}{Correction of a bug in Infofile, once again} 
% \changes{v3}{2010/03/19}{Option for Sylvio \textsc{Levi}'s encoding}
% \changes{v4}{2011/04/16}{Documentation of the code in English}
% \changes{v4}{2011/04/16}{paresse goes utf8}
% \changes{v4.1}{2013/02/16}{Using skeyval-bc instead of (moving forward) skeyval}
%
% \GetFileInfo{paresse.sty}
%
% \DoNotIndex{\newcommand,\newenvironment,\i,\ae,\oe,\DeclareOption,^^A
%   \ifthenelse,\if,\else,\fi,\tr@@c,\ExecuteOptions,\ProcessOptions,^^A
%   \relax,\MessageBreak,\CurrentOption,\RequirePackage,\PackageError,^^A
%   \def,\endinput,\let,\boolean,\newboolean,\setboolean,\renewcommand,^^A
%   \afterassignment,\global,\aftergroup,\bgroup,\egroup,\csname,^^A
%   \endcsname,\emph,\catcode,\space,\string,\next,\active,\rmfamily,\rule,^^A
%   \textsl,\upshape, \alpha, \beta, \gamma, \delta, \epsilon, ^^A
%   \varepsilon, \zeta, \eta, \theta, \vartheta, \iota, \kappa, ^^A
%   \lambda, \mu, \nu, \xi, \pi, \varpi, \rho, \varrho, \sigma, ^^A
%   \varsigma, \tau, \upsilon, \phi, \varphi, \chi, \psi, \omega, ^^A
%   \Delta, \Gamma, \Theta, \Lambda, \Xi, \Pi, \Sigma, \Upsilon, ^^A
%   \ExecuteOptionsX,\ProcessOptionsX,\DeclareOptionX,^^A
%   \DeclareUnicodeCharacter, \parse@XML@charref, ^^A
%   \parse@UTFviii@a, \parse@UTFviii@b, \AtBeginDocument, ^^A
%   \@eha, \@firstofone, \@gobble,\@toks, \@latex@error, ^^A
%   \begingroup, \endgroup, \gdef, \IeC, \ifcat, \ifcsname, ^^A
%   \ifluatex, \ifxetex, \iftogoff, \iftogon, \UTFviii@tmp, ^^A
%   \UTFviii@four@octets, \UTFviii@three@octets, \UTFviii@two@octets,^^A
%   \ifx, \the, \wlog, \togoff, \togon, \@ifpackageloaded, ^^A
%   \expandafter, \futurelet, \makeatletter, \makeatother, ^^A
%   \inputencodingname, \InputIfFileExists, \PackageInfo,^^A
%   \PackageWarning, \newtog, \ProvidesFile, \PS, \PSVerb, ^^A 
%   \stop, \S, \usepackage, \temp@a, \define@bitogkeys, ^^A
%   \Phi, \Psi, \Omega, \newif, \ifnum, \count@, \ensuremath, ^^A
%   \~, \", \^} ^^A
%
% \title{The package \Pkg{paresse}\thanks{This document corresponds
% to file \Pkg{paresse.sty}~\fileversion, dated \filedate.}}
% \author{Le \TeX nicien de surface\\
%   \href{mailto:le.texnicien.de.surface@wanadoo.fr}%
%   {le.texnicien.de.surface@wanadoo.fr}} 
%
% \maketitle
% \begin{abstract}
%   This package implements an example from T.~\textsc{Lachand-Robert}
%   in~\cite{tlachand}. It provides a means of typing isolated greek
%   letters with the character \PS activated and redefined. Instead of
%   |\(\alpha\)| one types \PSVerb{a} to obtain \(\alpha\).
%
%   \textbf{Important}: You have to load it \textbf{after} the
%   \Pkg{inputenc} package if the latter is used. Moreover the sign
%   \PS must be a letter for \TeX.
% 
%   \textbf{New}: with this version~4, one can use this package even
%   with utf8-encoded source for \hologo{LaTeX}, \hologo{LuaLaTeX}, or
%   \hologo{XeLaTeX}.
% 
%   The English documentation for the final user of the package
%   \Pkg{paresse} is available in the file \texttt{paresse-en.pdf}.
% 
% \end{abstract}
% \begin{otherlanguage}{french}
%   \begin{abstract}
%     Ce module, reprenant un exemple de T.~\textsc{Lachand-Robert}
%     dans~\cite{tlachand}, fournit un moyen de taper des lettres
%     grecques isolées à l'aide du caractère \PS actif et redéfini. Au
%     lieu de |\(\alpha\)| ou tape \PSVerb{a} pour obtenir
%     \(\alpha\). 
%
%     \textbf{Important} : Il doit être chargé \textbf{après}
%     \Pkg{inputenc} si ce dernier est utilisé. De plus, il faut
%     que le signe \PS soit une lettre pour \TeX.
% 
%     \textbf{Nouveau}: avec cette version~4, on peut utiliser cette
%     extension même dans un source codé en utf-8 avec \hologo{LaTeX},
%     \hologo{LuaLaTeX} ou \hologo{XeLaTeX}.
% 
%     La documentation française pour l'utilisateur de l'extension
%     \Pkg{paresse} est disponible sous le nom de
%     \texttt{paresse-fr.pdf}.
%   \end{abstract}
% \end{otherlanguage}
% 
% \tableofcontents{}
%
% \StopEventually{
% \begin{thebibliography}{99}
% \addcontentsline{toc}{section}{Bibliographie}
% \bibitem{tlachand} T.~\textsc{Lachand-Robert}.
% \emph{La maîtrise de \TeX{} et \LaTeX{}}.
% Masson, Paris, Milan, Barcelone, \oldstylenums{1995}.\\
% \textsc{isbn} : \texttt{2-225-84832-7}.
% \end{thebibliography}
% \PrintChanges \PrintIndex}
% \iffalse
%<*package> 
% \fi
% \section{The code}
% 
% 
% \subsection{The sty file}
% 
% From the 4th version, I have used \Pkg{skeyval} for it provides
% toggle-keys. But times are a-changing and so is \Pkg{skeyval}.
% From this version 4.1, I use \Pkg{skeyval-bc} which retains the old
% ways of \Pkg{skeyval}.  \Pkg{skeyval-bc} loads \Pkg{xkeyval} the
% macros of which I use to manage options.
% 
% \Pkg{ifluatex} and \Pkg{ifxetex} are required to take care of
% \hologo{LuaLaTeX} and \hologo{XeLaTeX} respectively.
% 
%    \begin{macrocode}
\RequirePackage{skeyval-bc}
\RequirePackage{ifluatex}
\RequirePackage{ifxetex}
%    \end{macrocode}
% 
% With \cmd{\define@bitogkeys}, from \Pkg{skeyval-bc}, I define nine
% pairs of complementary toggle keys. If one of the pair is set to
% \texttt{true}, the other will be automatically set to \texttt{false}
% and vice-versa.
%    \begin{macrocode}
\define@bitogkeys[GA]{paresse.sty}[GA@]{legacy}[true]{levi}{}{}
\define@bitogkeys[GA]{paresse.sty}[GA@]{wild}[true]{tame}{}{}
\define@bitogkeys[GA]{paresse.sty}[GA@]{ttau}[true]{ttheta}{}{}
\define@bitogkeys[GA]{paresse.sty}[GA@]{varepsilon}[true]{epsilon}{}{}
\define@bitogkeys[GA]{paresse.sty}[GA@]{varphi}[true]{phi}{}{}
\define@bitogkeys[GA]{paresse.sty}[GA@]{pi}[true]{varpi}{}{}
\define@bitogkeys[GA]{paresse.sty}[GA@]{sigma}[true]{varsigma}{}{}
\define@bitogkeys[GA]{paresse.sty}[GA@]{rho}[true]{varrho}{}{}
\define@bitogkeys[GA]{paresse.sty}[GA@]{theta}[true]{vartheta}{}{}
%    \end{macrocode}
% 
% I set the behaviour of the package in case of an unknown option
% with \cmd{\DeclareOptionX*}, from \Pkg{xkeyval}.
%    \begin{macrocode}
\DeclareOptionX*{\PackageError{paresse} {The option "\CurrentOption"
    is not known!\MessageBreak The default options are:\MessageBreak
    legacy, varepsilon, theta, pi, rho, sigma, and varphi.}%
  {Choose between `wild' (for an active Paresse in all the document)
    \MessageBreak and `tame', so that the character obtained by
    \string\S\MessageBreak prints the section symbol \string\S).
    \MessageBreak See the documentation for other options.}}
%    \end{macrocode}
% 
% The default options are: |legacy|, |wild|, |varepsilon|,
% |theta|, |pi|, |rho|, |sigma|, and |varphi|.
% \changes{v3}{2010/03/20}{Default option |legacy| added}
%    \begin{macrocode}
\ExecuteOptionsX[GA]{legacy,wild,varepsilon,theta,pi,rho,sigma,varphi}
\ProcessOptionsX[GA]\relax
%    \end{macrocode}
% 
% The prefix of the \emph{secret} macros of this package is
% |GA@|. Here I define the macros which will print the correct
% character according to the chosen options. \cs{iftogon} is provided
% by \Pkg{skeyval-bc}.
%    \begin{macrocode}
\iftogon{GA@varepsilon}{%
  \def\GA@epsilon{\varepsilon}}{\def\GA@epsilon{\epsilon}}
\iftogon{GA@vartheta}{\def\GA@theta{\vartheta}}{\def\GA@theta{\theta}}
\iftogon{GA@varpi}{\def\GA@pi{\varpi}}{\def\GA@pi{\pi}}
\iftogon{GA@varrho}{\def\GA@rho{\varrho}}{\def\GA@rho{\rho}}
\iftogon{GA@varsigma}{\def\GA@sigma{\varsigma}}{\def\GA@sigma{\sigma}}
\iftogon{GA@varphi}{\def\GA@phi{\varphi}}{\def\GA@phi{\phi}}
%    \end{macrocode}
% 
% 
% I test the engine, it it is \hologo{XeTeX} or \hologo{LuaTeX}, the
% file \texttt{paresseold.sto} is loaded. 
%    \begin{macrocode}
\ifluatex
  \PackageInfo{paresse}{compiling with luatex}
  \InputIfFileExists{paresseold.sto}{%
    \PackageInfo{paresse}{paresseold loaded}}{%
    \PackageInfo{paresse}{paresseold not loaded}}
\else
  \ifxetex
    \PackageInfo{paresse}{compiling with xetex}
    \InputIfFileExists{paresseold.sto}{%
      \PackageInfo{paresse}{paresseold loaded}}{%
      \PackageInfo{paresse}{paresseold not loaded}}
  \else
%    \end{macrocode}
% We arrive here if the working engine is good old \hologo{TeX} (in
% fact, good not so old \hologo{eTeX} I hope for some things could
% depend on \hologo{eTeX}-nical internals). 
% 
% First some useful macros to take care of the encoding. The macros
% have been given to me by Christian \textsc{Tellechea} I do heartily
% thank for his kindness.
% 
% The first one takes care of problems of encoding.
%    \begin{macrocode}
\newcommand\encoding@error{%
  \@latex@error{%
    paresse needs inputenc loaded with option "utf8"
    or option such as "latin1" (8 bits encodign).}{}\stop}
%    \end{macrocode}
% The second checks that \Pkg{inputenc} has been loaded before
% \Pkg{paresse}. 
%    \begin{macrocode}
\@ifpackageloaded{inputenc}\relax
{\PackageError{paresse}{%
    Please, load inputenc package before paresse}{%
  With LaTeX, "paresse" needs to know the encoding to work well and so
  the package "inputenc" must be loaded, with \string\usepackage, before
  loading "paresse" itself}}
%    \end{macrocode}
% The test for \Pkg{inputenc} and encoding is delayed at the beginning
% of the document where all things about encoding should be settled.
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{inputenc}\find@encoding\encoding@error}
%    \end{macrocode}
% I create a new toggle |GA@utf8| and set it to \texttt{false}. It
% will be used later to chose the correct action. 
%    \begin{macrocode}
\newtog[GA@]{utf8}[false]
%    \end{macrocode}
% A bit of code to find the declared encoding and set up the toggle
% |GA@utf8| accordingly. There again work by Christian
% \textsc{Tellechea}. 
%    \begin{macrocode}
\newcommand\find@encoding{%
  \begingroup
  \def\utf@encoding{utf8}%
  \def\temp@a{\togoff{GA@utf8}%
    \PackageInfo{paresse}{8-bit encoding expected\@gobble}}
  \ifx\utf@encoding\inputencodingname
  \def\temp@a{\togon{GA@utf8}%
    \PackageInfo{paresse}{utf8 encoding detected\@gobble}}
  \fi
  \expandafter\endgroup\temp@a}
%    \end{macrocode}
% 
% The main action is then delayed at the beginning of the document for
% reasons already given above. In case the utf8 encoding has been
% detected, the file \texttt{paresseutf8.sto} is loaded, otherwise it
% is \texttt{paresseold.sto} once again.
% 
% \cs{makeatletter} is needed to mimic the loading of a \texttt{sty}
% file for, at the beginning of the document, |@| is no more a
% letter. Naturally, we must revert |@| to its non-letter status at
% the end of the loading.
%    \begin{macrocode}
\AtBeginDocument{%
  \makeatletter
  \iftogoff{GA@utf8}{%
    \InputIfFileExists{paresseold.sto}{%
      \PackageInfo{paresse}{old loaded\@gobble}}{%
      \PackageError{paresse}{paresseold.sto not found}{%
        The package "paresse" needs to load the file "paresseold.sto"
        but can't find it. Something seems to be broken in your TeX
        system}}}{%
    \InputIfFileExists{paresseutf8.sto}{%
    \PackageInfo{paresse}{utf8 loaded\@gobble}}{%
    \PackageError{paresse}{paresseutf8 not found}{%
        The package "paresse" needs to load the file "paresseutf8.sto"
        but can't find it. Something seems to be broken in your TeX
        system}}}
  \makeatother}
\fi
\fi
%    \end{macrocode}
% 
% And that's all for the main file.
% \iffalse
%</package>
% \fi
% \iffalse
%<*oldpack>
% \fi
% 
%\subsection{The file paresseold.sto}
%
% This file will be loaded in all cases except when the working engine is
% \hologo{LaTeX} with |[utf8]{inputenc}| loaded. |^^a7| is \TeX nical
% code for the character I type, on my French keypad, with key \S.
% 
% This is almost the content of the version~3 of
% \texttt{paresse.sty}. The changes are the use of toggles provided by
% \Pkg{skeyval-bc} and the appearance of \PSVerb{Z} to obtain \S ---
% which is always available through \cs{S}\footnote{So could I speak
%   of \PSVerb{Z} in terms of ``shortcut''?}.
% 
%    \begin{macrocode}
\ProvidesFile{paresseold.sto}
%    \end{macrocode}
% Presentations made, I save the current category code (catcode) of
% the character \PS and its definition in \cs{GA@LaVieilleParesse}.
%    \begin{macrocode}
\count@=\catcode`\^^a7
\let\GA@LaVieilleParesse= ^^a7
%    \end{macrocode}
% For sake of convienience, \PS is def'ed as |\S|.
%    \begin{macrocode}
\def\^^a7{\S}
%    \end{macrocode}
% 
% Come some end-user macros. \cs{makeparesseletter} changes the
% \DescribeMacro{\makeparesseletter} catcode of \PS to~\(11\) which is
% the code of letter and \DescribeMacro{\makeparesseother}
% \cs{makeparesseother} changes that code to~\(12\) the code of other
% characters.
%    \begin{macrocode}
\newcommand{\makeparesseletter}{\catcode `\^^a7=11\relax}
\newcommand{\makeparesseother}{\catcode `\^^a7=12\relax}
%    \end{macrocode}
% \cs{GA@MakeParesseActive} is an internal macro to activate \PS. 
% \DescribeMacro{\GA@MakeParesseActive}
% Then come two macros to activate \PS for the remaining part of the
% file. On of them is applied according to the catcode of \PS at the
% beginning --- catcode saved in |\count@|.
%    \begin{macrocode}
\newcommand{\GA@MakeParesseActive}{\catcode `\^^a7=\active}
\def\GA@ActiveLaParessexii{\catcode `\^^a7=\active}
\def\GA@ActiveLaParessexiii{\catcode `\^^a7=\active
  \def^^a7##1{\ensuremath{\csname \string^^a7##1\endcsname}}}
\ifnum\count@=12
  \let\GA@ActiveLaParesse \GA@ActiveLaParessexii
\else
  \let\GA@ActiveLaParesse \GA@ActiveLaParessexiii
\fi
%    \end{macrocode}
% 
% It's time to provide one end-user macro and one environment useful
% \DescribeMacro{\ActiveLaParesse}
% \DescribeEnv{ParesseActive}
% when the package has been loaded with option \Option{tame} to
% locally activate \PS.
%    \begin{macrocode}
\newcommand{\ActiveLaParesse}{\GA@ActiveLaParesse}
\newenvironment{ParesseActive}{\GA@ActiveLaParesse}{}
%    \end{macrocode}
% 
% Now come the definitions of the meanings of the \PS-macros. For
% these definitions to work, \PS is made a letter.
%    \begin{macrocode}
\makeparesseletter
\def\^^a7a {\alpha}
\def\^^a7b {\beta}
\def\^^a7g {\gamma}
\def\^^a7d {\delta}
\def\^^a7e {\GA@epsilon}
\def\^^a7z {\zeta}
\def\^^a7h {\eta}
\def\^^a7i {\iota}
\def\^^a7k {\kappa}
\def\^^a7l {\lambda}
\def\^^a7m {\mu}
\def\^^a7n {\nu}
\def\^^a7x {\xi}
\def\^^a7p {\GA@pi}
\def\^^a7r {\GA@rho}
\def\^^a7s {\GA@sigma}
\def\^^a7u {\upsilon}
\def\^^a7f {\GA@phi}
\def\^^a7w {\omega}
%    \end{macrocode}
% In case of option \Option{legacy}, definitions of \PSVerb{v},
% \PSVerb{y}, \PSVerb{c}, and \PSVerb{q} as in the first two versions
% of this package. 
%    \begin{macrocode}
\iftogon{GA@legacy}{%
  \def\^^a7v {\GA@theta}
  \def\^^a7y {\tau}
  \def\^^a7c {\chi}
  \def\^^a7q {\psi}
%    \end{macrocode}
% Care is taken of options \Option{ttau} and \Option{ttheta}.
%    \begin{macrocode}
  \iftogon{GA@ttau}{\def\^^a7t {\tau}}{\def\^^a7t {\GA@theta}}}{%
%    \end{macrocode}
% Definitions of the same \PSVerb{v}, \PSVerb{y}, \PSVerb{c}, and
% \PSVerb{q} with option \Option{levi}. In that case, options
% \Option{ttau} and \Option{ttheta} are no-op.
%    \begin{macrocode}
  \def\^^a7j {\GA@theta}
  \def\^^a7t {\tau}
  \def\^^a7q {\chi}
  \def\^^a7y {\psi}
  \def\^^a7c {\varsigma}}
%    \end{macrocode}
% Upper case letters are treated thence: 
%    \begin{macrocode}
\def\^^a7G {\Gamma}
\def\^^a7D {\Delta}
\def\^^a7L {\Lambda}
\def\^^a7P {\Pi}
\def\^^a7S {\Sigma}
\def\^^a7U {\Upsilon}
\def\^^a7F {\Phi}
\def\^^a7X {\Xi}
\def\^^a7W {\Omega}
%    \end{macrocode}
% Once again \Option{legacy} vs. \Option{levi}: 
%    \begin{macrocode}
\iftogon{GA@legacy}{%
  \def\^^a7V {\Theta}
  \def\^^a7T {\Theta}
  \def\^^a7Q {\Psi}
}{%
  \def\^^a7J {\Theta}
  \def\^^a7Y {\Psi}
}%
% \changes{va4}{2011/04/17}{\PSVerb{Z} added to produce \PS}
\def\^^a7Z {\S}
%    \end{macrocode}
% 
% The end is near! \PS is made active and the \PS-macros defined. This
% is old code --- directly from~\cite{tlachand}.
%    \begin{macrocode}
\catcode `\^^a7=\active
\def^^a7#1{\ensuremath{\csname \string^^a7#1\endcsname}}
%    \end{macrocode}
% In case option \Option{tame} is chosen, \PS is given its first
% catcode and meaning back.
%    \begin{macrocode}
\iftogon{GA@tame}{%
  \catcode`\^^a7=\count@
  \ifnum\count@=13 \let ^^a7=\GA@LaVieilleParesse \fi
}%
%    \end{macrocode}
% 
% And that's all for \texttt{paresseold.sto}.
% 
% \iffalse
%</oldpack>
% \fi
% \iffalse
%<*utf8pack>
% \fi
%
%\subsection{The file paresseutf8.sto}
% 
% This part is brand new. It deals with the document encoded in utf8
% via |\usepackage[utf8]{fontenc}| and compiled with \hologo{LaTeX}. 
% 
% It is at the request of Christian \textsc{Tellechea} that this
% package now deals with such source. Most of the macros of this part
% were created by the same Christian.
%
% First a bit of identification
%    \begin{macrocode}
\ProvidesFile{paresseutf8.sto}
%    \end{macrocode}
% followed by code partially taken from \texttt{utf8.def} for I wanted
% to implement the option \Option{tame} and, to do so, needed to
% redeclare the character \PS. Four macros are used in such a
% redeclaration and they are made unavailable outside preamble in
% \texttt{utf8.def}.
% 
% The original \cs{DeclareUnicodeCharacter} depends on
% \cs{parse@XML@charref} which itself depends on \cs{parse@UTFviii@a}
% and \cs{parse@UTFviii@b}. Those two last macros are defined in terms
% of accessible macros. Therefore, I first create an alias of the last
% two and then define \cs{declareunicodecharacter} and
% \cs{GA@parse@XML@charref} in terms of the \emph{localised} version
% of \cs{parse@UTFviii@a} and \cs{parse@UTFviii@b}.
% 
% To be on the safe side, I repeat the invocations of catcode of
% \texttt{utf8.def}.
%    \begin{macrocode}
\begingroup
\catcode`\"=12
\catcode`\<=12
\catcode`\.=12
\catcode`\,=12
\catcode`\;=12
\catcode`\!=12
\catcode`\~=13
\global\let\GA@parse@UTFviii@a=\parse@UTFviii@a
\global\let\GA@parse@UTFviii@b=\parse@UTFviii@b
\gdef\declareunicodecharacter#1#2{%
   \count@"#1\relax
   \wlog{\space\space Redefining Unicode char U+#1 (decimal \the\count@)}%
   \begingroup
    \GA@parse@XML@charref
    \def\UTFviii@two@octets##1##2{\csname u8:##1\string##2\endcsname}%
    \def\UTFviii@three@octets##1##2##3{\csname u8:##1%
      \string##2\string##3\endcsname}%
    \def\UTFviii@four@octets##1##2##3##4{\csname u8:##1%
      \string##2\string##3\string##4\endcsname}%
    \expandafter\expandafter\expandafter
    \expandafter\expandafter\expandafter
    \expandafter
    \gdef\UTFviii@tmp{\IeC{#2}}%
    \endgroup}
\gdef\GA@parse@XML@charref{%
  \ifnum\count@<"A0\relax
     \PackageError{inputenc}{Cannot\space define\space Unicode\space
       char\space value\space <\space 00A0}\@eha
  \else\ifnum\count@<"800\relax
     \GA@parse@UTFviii@a,%
     \GA@parse@UTFviii@b C\UTFviii@two@octets.,%
  \else\ifnum\count@<"10000\relax
     \GA@parse@UTFviii@a;%
     \GA@parse@UTFviii@a,%
     \GA@parse@UTFviii@b E\UTFviii@three@octets.{,;}%
   \else
     \GA@parse@UTFviii@a;%
     \GA@parse@UTFviii@a,%
     \GA@parse@UTFviii@a!%
     \GA@parse@UTFviii@b F\UTFviii@four@octets.{!,;}%
    \fi
  \fi
\fi}
\endgroup
%    \end{macrocode}
% Here ends the \emph{localisation}. 
% 
% I provide the same macros as in the preceding case but in such a
% context \cs{makeparesseother} doesn't make sense. It just produces a
% warning.
%    \begin{macrocode}
\newcommand{\makeparesseletter}{\DeclareUnicodeCharacter{00A7}\S}
\newcommand{\makeparesseother}{%
  \PackageWarning{paresse}{%
    Command \string\makeparesseother disabled}{%
    The command \string\makeparesseother would have been meaningless
    in the current context}}
%    \end{macrocode}
% 
% The end-user macro \cs{ActiveLaParesse} and the corresponding
% environment |ParesseActive|.
% 
% The Unicode character of code \texttt{00A7} is made equal to the
% macro \cs{@paresse}. 
%    \begin{macrocode}
\newcommand{\ActiveLaParesse}{\declareunicodecharacter{00A7}\@paresse}
\newenvironment{ParesseActive}{\ActiveLaParesse}{}
%    \end{macrocode}
% 
% It's time to prepare the definition of the \PS-macros. To begin with
% we activate the character \PS.
%    \begin{macrocode}
\ActiveLaParesse
%    \end{macrocode}
% 
% And now for the \emph{working} code: when the paresse is active, the
% byte \texttt{00A7} is an alias for \cs{@paresse} and, because of the
% following, the code \cs{@paresse}\meta{token} is changed into
% \cs{@i@paresse}\meta{token} with the side effect that \cs{@toks} is
% let to \meta{token}.
%    \begin{macrocode}
\def\@paresse{\futurelet\@toks\@i@paresse}
%    \end{macrocode}
% Then if \meta{token}, now ``in'' \cs{@toks}, has the same category
% than \texttt{a} --- hopefully a letter --- then we obtain
% \cs{@ii@paresse} else \cs{S}.
% 
%    \begin{macrocode}
\def\@i@paresse{%
  \csname\ifcat a\@toks @ii@paresse\else S\fi\endcsname}
%    \end{macrocode}
% At that point, the code which was \cs{@paresse}\meta{token} is
% either \cs{S}\meta{token} or \cs{@ii@paresse} which awaits for an
% argument. That argument will be the still present \meta{token}.
% 
% If the command \cs{@paresse@}\meta{token} is defined then it does
% its job, else we obtain \cs{S}\meta{token}.
%    \begin{macrocode}
\def\@ii@paresse#1{%
  \ifcsname @paresse@#1\endcsname
    \csname @paresse@#1\endcsname\expandafter\@gobble
  \else
    \expandafter\@firstofone
  \fi{\S#1}}
%    \end{macrocode}
% 
% The next macro is used to define the \PS-macros.
% 
% I have not used it in \texttt{paresseold.sto} for that definition
% prevent a feature I'm attached to, to wit, obtaining
% \(\alpha^{\beta}\) with |\(|\PSVerb{a}|^|\PSVerb{b}|\)|. I would
% have been loath to force some of the users to change their until now
% working sources.
%    \begin{macrocode}
\def\define@paresse@car#1#2{%
  \expandafter\def\csname @paresse@#1\endcsname{\ensuremath{#2}}}
%    \end{macrocode}
% 
% From now on, there are just definitions of \PS-macros. 
% 
% The first one, \PSVerb{Z} is new.
%    \begin{macrocode}
\define@paresse@car Z\S
\define@paresse@car a\alpha
\define@paresse@car b\beta
\define@paresse@car g\gamma
\define@paresse@car d\delta
\define@paresse@car e\GA@epsilon
\define@paresse@car z\zeta
\define@paresse@car h\eta
\define@paresse@car i\iota
\define@paresse@car k\kappa
\define@paresse@car l\lambda
\define@paresse@car m\mu
\define@paresse@car n\nu
\define@paresse@car x\xi
\define@paresse@car p\GA@pi
\define@paresse@car r\GA@rho
\define@paresse@car s\GA@sigma
\define@paresse@car u\upsilon
\define@paresse@car f\GA@phi
\define@paresse@car w\omega
\iftogon{GA@legacy}{%
  \define@paresse@car v\GA@theta
  \define@paresse@car y\tau
  \define@paresse@car c\chi
  \define@paresse@car q\psi
  \iftogon{GA@ttau}{%
    \define@paresse@car t\tau}{%
    \define@paresse@car t\GA@theta}}{%
  \define@paresse@car j\GA@theta
  \define@paresse@car t\tau
  \define@paresse@car q\chi
  \define@paresse@car y\psi
  \define@paresse@car c\varsigma}
\define@paresse@car G\Gamma
\define@paresse@car D\Delta
\define@paresse@car L\Lambda
\define@paresse@car P\Pi
\define@paresse@car S\Sigma
\define@paresse@car U\Upsilon
\define@paresse@car F\Phi
\define@paresse@car X\Xi
\define@paresse@car W\Omega
\iftogon{GA@legacy}{%
  \define@paresse@car V\Theta
  \define@paresse@car T\Theta
  \define@paresse@car Q\Psi}{%
  \define@paresse@car J\Theta
  \define@paresse@car Y\Psi}%
%    \end{macrocode}
% 
% At the end of the package, if the option \Option{tame} is chosen, \PS
% is made a letter again.
%    \begin{macrocode}
\iftogon{GA@tame}{\makeparesseletter}
%    \end{macrocode}
% 
% And that's all for the file \texttt{paresseutf8.sto}.
% \iffalse
%</utf8pack>
% \fi
% \Finale
\endinput
%%% Local Variables: 
%%% mode: doctex
%%% fill-column: 70
%%% coding: iso-8859-15
%%% TeX-master: t
%%% End: