summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/spacingtricks/spacingtricks.dtx
blob: 68a4afbdd9142065f8e25c98b3b02fa9271db11e (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
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
% \iffalse meta-comment
%
% Copyright (C) 2019-2023 by Antoine Missier <antoine.missier@ac-toulouse.fr>
%
% This file 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
% 2005/12/01 or later.
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{spacingtricks.dtx}
%</driver>
%<*package> 
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{spacingtricks}
    [2023/02/27 v1.5 .dtx spacingtricks file]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{mathptmx}
\usepackage[pifont]{spacingtricks}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{sectsty}
\usepackage{xcolor}

\definecolor{darkbrown}{rgb}{0.5,0.1,0.1}
\allsectionsfont{\color{darkbrown}}
\DisableCrossrefs
%\CodelineIndex
%\RecordChanges
\usepackage{hyperref}
\hypersetup{%
    colorlinks,
    linkcolor=blue, %red by default
    citecolor=red, %green by default
    pdftitle={spacingtricks},
    pdfsubject={LaTeX package},
    pdfauthor={Antoine Missier}
}
\begin{document}
\DeleteShortVerb{\|}
\MakeShortVerb{\"}
\DocInput{spacingtricks.dtx}
%\PrintChanges
%\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{242}
%
% \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.1}{2011/12/27}{Initial version}
% \changes{v1.0}{2019/05/04}{dtx and ins files, adding the footnote command}
% \changes{v1.0}{2019/06/16}{English translation of the documentation}
%
% \changes{v1.1}{2019/09/06}{
%    - No automatic line breaking at the end of the centered command,
%    - new length compactitemlist}
%
% \changes{v1.2}{2019/09/09}{
%    - A bug correction in the last update}
%
% \changes{v1.3}{2020/11/02}{
%    - Loading the setspace package, 
%    - small changes in compactlist environment, 
%    - improvement in dualboxes macro}
%
% \changes{v1.4}{2021/09/21}{
%    - A mistake in the documentation is now corrected}
%
% \changes{v1.5}{2023/02/23}{
%    - Changing font to times (with the mathptmx package),
%    - changing pstricks figure to tikz to avoid double compilation,
%    - tests and comments about wrapfig and picinpar packages}
% \changes{v1.5}{2023/02/25}{
%    - adding the centeredline package,
%    - adding the pifont package as option,
%    - taking over the juxtapose environment from Christian Obrecht,
%    - topsep of indentblock environment reduced to zero}
% \changes{v1.5}{2023/02/26}{
%    - Tests and comments about paracol and reledpar packages}
%
% \GetFileInfo{spacingtricks.sty}
%
% \title{The \textsf{spacingtricks} package\thanks{This document
% corresponds to \textsf{spacingtricks}~\fileversion, dated \filedate.}}
% \author{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}}
% \date{February 27, 2023}
% \maketitle
%
% \section{Introduction}
%
% This package offers some macros to deal with spacing issues. Thus:
% \begin{compactlist}
% \item \hyperlink{centered}{\texttt{\bslash centered}} yields good horizontal 
% centering without vertical spacing;
% \item \hyperlink{footnote}{\texttt{\bslash footnote}} has been redefined 
% to avoid unsuitable spacing;
% \item \hyperlink{vstrut}{\texttt{\bslash vstrut}} produces a strut 
% with variable height or depth;
% \item \hyperlink{indent}{\texttt{\bslash indent}} has been redefined 
% to indent a line at the beginning 
% of a particular paragraph even if "\parindent" has been set to 0;
% \item the \hyperlink{indentblock}{\texttt{indentblock}} environment 
% produces indentation of all its content;
% \item the \hyperlink{compactlist}{\texttt{compactlist}} environment 
% yields a compact list, without vertical spacing between the items, like here;
% several \hyperlink{aliases}{aliases} are provided to type some list symbols shorter:
% "\bul", "\dash", "\ddash", "\aster", "\hand", "\checksymb", "\arrowsymb";
% \item common abbreviations \hyperlink{ie-eg}{\ie and \eg} 
% are typeset by the macros "\ie" and "\eg" with correct spacing;
% \item the \hyperlink{dualboxes}{\texttt{\bslash dualboxes}} command attends to place 
% two boxes (figures, tables, text) side by side by adjusting the vertical positioning.
% \end{compactlist}
% 
% \medskip
% Three other ``spacing'' packages are loaded by \textsf{spacingtricks}:
% \hyperlink{setspace}{\textsf{setspace}}~\cite{SETSP} (natively in \LaTeXe), 
% for setting line spacing in a piece of text,
% \textsf{xspace}~\cite{XSP}, which adds an inter-word space unless the macro 
% is followed by a punctuation character,
% and \hyperlink{centeredline}{\textsf{centeredline}}~\cite{CENTER} 
% which gives an interesting alternative 
% to our "\centered" macro (see further).
% We also took over the fine \hyperlink{juxtapose}{\texttt{juxtapose}} environment 
% from the \textsf{mafr}~\cite{MAFR}
% distribution, as another way to place boxes side by side.
%
% Otherwise, we have develop the package \textsf{arraycols}~\cite{ARCOL},
% that allows a good management of spacing in \texttt{tabular} 
% or \texttt{array} environments,
% and \textsf{mismath}~\cite{MSMATH} that provides several macros to improve spacing 
% in mathematical formulas.
%
% \section{Usage}
%
% \hypertarget{centered}{}
% \DescribeMacro{\centered}
% The "\centered"\marg{text} command yields a centered line without vertical spacing.
% It acts like "\centerline" except in lists or tables where its behavior is much better
% (see the following examples).
% Moreover, the line break before (but not after) the macro is automatic.
%
% Here is a comparative example of the centering commands inside a list:
% \begin{enumerate}
% \item Here a centered line with "\centered": 
% \centered{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.}
% \item Here another centered line with "\\ \centerline":\\
% \centerline{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.}
% \item Here another centered line with "\par\centerline":
% \par\centerline{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.}
% \item Here a centered line with the \texttt{center} environment:
% \begin{center} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \end{center}
% \end{enumerate}
%
% After "\centered{...}", the end of line must be explicit, 
% otherwise "\centered" will not work. You can use "\\",
% which is equivalent to "\linebreak", or
% a blank line to begin a new paragraph (equivalent to "\par"). 
% In the former case, no vertical space
% is added after the centered line,  in the latter case, the vertical space
% following the centered line is a bit larger. 
% In the example above, the centered line comes to the end, without line breaking,
% because of the next "\item" command, and the vertical space is set by the
% \texttt{enumerate} environment.
%
% \medskip
% In tables, "\centered" allows to center a particular line in a cell independently of 
% the column alignment
% \footnote{In tables, we can also use the powerful \texttt{\bslash makecell} command
% of the \textsf{makecell} package~\cite{MKCELL}; on the other hand,
% neither \texttt{\bslash centerline} nor \texttt{\bslash centering} commands
% do work for a single line in a cell.},
% here with "\begin{tabular}{|l|r|}":
%
% \begin{center}
% \begin{tabular}{|l|r|}
% \hline
% left aligned column & right aligned column \\
% \hline
% the second cell fixes the width  & \centered{centered cell} \\
% \hline
% \centered{centered cell} & the last cell fixes the width \\
% \hline
% \end{tabular}
% \end{center}
%
% \medskip
% \hypertarget{centeredline}{}
% \DescribeMacro{\centeredline}
% A limitation of our "\centered" macro is that it doesn't allow to use \texttt{\bslash verb}
% commands inside its argument. For this purpose, you get
% the "\centeredline" command, from the package
% \textsf{centeredline} by Jean-François Burnol~\cite{CENTER}. 
% This small package is now loaded by \textsf{spacingtricks}.
% Another advantage of "\centeredline" is that it does not require an explicit
% end, the text can follow the command on the same line, and the line break will
% be automatic.
% Nevertheless, it doesn't work in tables (like in the example above),
% except with \texttt{p} column declaration.
%
% \hypertarget{setspace}{}
% \medskip
% \DescribeEnv{onehalfspace}\DescribeEnv{doublespace}\DescribeEnv{spacing}
% \begin{onehalfspace}
% The \textsf{setspace} package~\cite{SETSP}, loaded by \textsf{spacingtricks}, provides
% environments for changing the spacing between lines. The present paragraph is nested
% in a \texttt{onhalfspace} environment as you can see.
% The \texttt{spacing} environment can be used to get other interline spacing, \eg
% "\begin{spacing}{2.5}".
% \end{onehalfspace}
%
% \hypertarget{footnote}{}
% \medskip
% \DescribeMacro{\footnote}
% The "\footnote" command doesn't have a good management of spacing issues,
% in particular when the \textsf{hyperref} package has been loaded.
% In English tradition, there is no space before numbers (or symbols) of note calls,
% and likewise at the beginning of footnotes,
% text begins immediately after the note number
% \footnote{The typesetting of footnotes and note calls depends on national typographic
% rules which are, in principle, managed by \textsf{babel}.
% For instance, by activating the \texttt{french} option of \textsf{babel},
% a thin space is added before the note calls, and the new \texttt{\bslash footnote}
% macro does not alter this behavior.}.
% To avoid undesirable spaces, we don't have to put some space before 
% or after writing "\footnote{", for instance:
% \begin{center}
% "this is a note\footnote{good spacing} which works fine,"
% \end{center}
% but sometimes, it is convenient to place the "\footnote" command
% on a new line. To achieve this, "\footnote" has been redefined to completely eliminate
% unwanted spaces
% \footnote{Probably it would have been enough to recommend the use of the \% symbol
% at the end of line; its effect is to cancel the space produced by a line break,
% but we do not always think of using it.}.
%
% \medskip
% \noindent\begin{minipage}{5.6cm}
% \begin{verbatim}
%This is a note 
%\footnote{ 
%The old command.}
%with bad spacing.
% \end{verbatim}
% \vspace{-4ex} This a note
% \footnt{
% The old command.}
% with bad spacing.
% \end{minipage}
% \hfill 
% \begin{minipage}{5.6cm}
% \begin{verbatim}
%This is a note
%\footnote{ 
%The new command.}
%with good spacing.
% \end{verbatim}
% \vspace{-4ex} This a note 
% \footnote{ 
% The new command.}
% with good spacing.
% \end{minipage}
%
% \medskip
% \DescribeMacro{\footnotespace} \DescribeMacro{\footenoteindent}
% Like the old one, the new "\footnote" command can take an optional argument
% to force the number of the note.
% Likewise, we have always the customization macros 
% "\footnotesize", "\footnotesep", "\footnoterule",
% but two new macros have been added to manage spacing:
% "\footnotespace" produces the space before the note call symbol
% and "\footnoteindent" produces the space at the beginning of the footnote text.
% For instance, with "\renewcommand{\footnotespace}{\,}" \\
% and "\renewcommand{\footnoteindent}{\enskip}"
% \footnote{\texttt{\bslash enskip} is equivalent to \texttt{\bslash hspace\{0.5em\}}.}
% we get:
% \renewcommand{\footnotespace}{\,}
% \renewcommand{\footnoteindent}{\enskip}
%
% \begin{center}
% \begin{minipage}{7cm}
% This is a note \footnote{en dash spacing at the beginning of the note.}  
% with particular space settings.
% \end{minipage}
% \end{center}
% \renewcommand{\footnotespace}{}
% \renewcommand{\footnoteindent}{}
% 
% \hypertarget{vstrut}{}
% \DescribeMacro{\vstrut} 
% "\vstrut"\oarg{depth}\marg{height} produces a strut with variable height or depth,
% in order to increase the line's height (above the base line) or depth 
% (below the base line, optional);
% this command can be used in a text line, a table, a list, a formula, etc.
% If the values of \meta{height} and \meta{depth} are inferior to the height and depth
% of the current line, the command has no effect.
% Here are some examples.
%
% \noindent
% \begin{minipage}[t]{8cm}
% \begin{verbatim}
%\[\frac{\sqrt{0.5p}}{10} = 
%\frac{\sqrt{\vstrut{1.7ex} 0.5p}}{10}\]
% \end{verbatim}
% \end{minipage}
% \hfill 
% \begin{minipage}[t]{6cm}
% \[\frac{\sqrt{0.5p}}{10} = \frac{\sqrt{\vstrut{1.7ex} 0.5p}}{10}\]
% \end{minipage}
% \\
% "\fbox{\vstrut{2ex}$\sigma(X)=1$}" gives
% \fbox{\vstrut{2ex}$\sigma(X)=1$}
% better than \fbox{$\sigma(X)=1$}.
% 
% \medskip
% \noindent
% The height adjustment is done by trial and error.
% We could also have used a vertical phantom box;
% for example in the previous square root, we get a good result with "\vphantom{\bar{t}}",
% but it's not obvious to know what to put in the phantom box,
% moreover, "\vstrut" allows a finer tuning.
%
% In a table,
% "\renewcommand{\arraystretch}"\marg{stretch}
% allows to increase the height of the rows but this command
% has a global effect, whereas "\vstrut" allows to adjust properly the height of each row, 
% as in the following table:
% \[  
% \begin{array}{|c|}
% \hline
% \text{bad}\\
% \hline
% \displaystyle \lim_{\substack{x \to 1\\x>1}} \ln\left(\dfrac{x^2}{x-1}\right) \\
% \hline
% \dfrac{a}{b} \\
% \hline
% \displaystyle \int_{1}^{X} \frac{1}{t}\, \mathrm{d}t  \\
% \hline
% \end{array}
% \qquad
% \begin{array}{|c|c|}
% \hline
% \multicolumn{2}{|c|}{\text{good}}\\
% \hline
% \displaystyle\lim_{\substack{x \to 1\\x>1}} \ln\left(\dfrac{x^2}{x-1}\right)\vstrut{3.8ex}
% & \mbox{obtained with } "\vstrut{3.8ex}" \\
% \hline
% \dfrac{a}{b} \vstrut[2ex]{3ex} & "\vstrut[2ex]{3ex}" \\
% \hline
% \displaystyle\int_{1}^{X} \frac{1}{t} \, \mathrm{d} t \vstrut[2.5ex]{4.2ex}
% & "\vstrut[2.5ex]{4.2ex}" \\
% \hline
% \end{array}
%\]
% However, for tables, we have the \textsf{arraycols} package~\cite{ARCOL},
% based on \textsf{cellspace}~\cite{CELLSP}, which allows to adjust
% row heights automatically. Nevertheless, "\vstrut" can be useful for fine adjustments. 
%
% In a text line, "\vstrut" can be used in place of "\vspace".
%
% \hypertarget{indent}{}
% \medskip
% \DescribeMacro{\indent} 
% The command "\setlength{\parindent}{0cm}" allow to eliminate any indentation of lines
% at the beginning of every paragraph. 
% But in this case, the "\indent" command does not work anymore
% if we want exceptional indentation of a particular paragraph.
% So, the initial length of "\parindent" has been saved in "\parindentlength"
% \DescribeMacro{\parindentlength} 
% and the command "\indent" has been redefined to still allow indentation
% of length "\parindentlength".
%
% \hypertarget{indentblock}{}
% \medskip
% \DescribeEnv{indentblock}
% The \texttt{indentblock} environment allows indentation of a whole block of lines.
% It has an optional argument which is the length of indentation
% (set by default to "\parindentlength").
% The following lyrics have been indented (and typeset in italic shape) with
% "\begin{indentblock}\itshape" and stanzas 2 and 4 have been affected by
% an additional indentation with "\begin{indentblock}[3em]".
%
% \smallskip
% \begin{indentblock}\itshape
% Overhead the albatross hangs motionless upon the air \\
% And deep beneath the rolling waves in labyrinths of coral caves \\
% The echo of a distant time comes willowing across the sand \\
% And everything is green and submarine 
% \begin{indentblock}[3em]
%    And no one showed us to the land \\
%    And no one knows the where's or why's \\
%    But something stirs and something tries \\
%    Starts to climb towards the light
% \end{indentblock}
% \noindent
% Strangers passing in the street \\
% By chance two separate glances meet \\
% And I am you and what I see is me \\
% And do I take you by the hand \\
% And lead you through the land \\
% And help me understand the best I can?
% \begin{indentblock}[3em]
%    And no one calls us to move on \\
%    And no one forces down our eyes \\
%    No one speaks and no one tries \\
%    No one flies around the sun
% \end{indentblock}
% \end{indentblock}
% 
% \hypertarget{compactlist}{}
% \DescribeEnv{compactlist}
% As its name tells it, the "compactlist" environment allows to create
% a ``compact'' list, \ie without vertical space neither above nor between items.
% As for lists in \LaTeX, items are generated by the "\item" command.
% The environment has an optional argument: "\begin{compactlist}"\oarg{symbol}.
% 
% \hypertarget{aliases}{}
% \medskip
% \DescribeMacro{\bul}\DescribeMacro{\dash}\DescribeMacro{\ddash}\DescribeMacro{\aster}
% The default item symbol is "\textbullet", but can be changed.
% We provide aliases for several symbols commonly used in lists:
% "\bul" \bul\ (alias for "\textbullet"), "\dash" \dash\ (alias for "\textendash"), 
% "\ddash" \ddash\ (alias for "\textemdash"), 
% "\aster" \aster\ ("alias for \textasteriskcentered").
%
% \smallskip
% \DescribeEnv{[pifont]}
% \DescribeMacro{\hand}\DescribeMacro{\checksymb}\DescribeMacro{\arrowsymb}
% Some other common symbols can be found in the \textsf{pifont} package~\cite{PIFONT}.
% Therefore \textsf{spacingtricks} has a \texttt{pifont} option,
% that loads this package and creates the appropriate aliases:
% "\hand" \hand for "\ding{43}", "\checksymb" \checksymb for "\ding{51}"
% and "\arrowsymb" \arrowsymb for "\ding{226}".
%
% \medskip \noindent
% The following example is produced by "\begin{compactlist}[\checksymb]":
% \begin{compactlist}[\checksymb]
% \item First item.
% \item Second item.
% \item Third item.
% \end{compactlist}
% \hand These aliases can also be used directly in text mode, of course.
% For "\hand", "\checksymb" and "\arrowsymb", the symbol is followed by a space
% if there is no punctuation character just after it (thanks to the 
% macro \texttt{xspace} from the \textsf{xspace} package~\cite{XSP}).
%
% \smallskip
% \DescribeMacro{\compactlistindent}
% Indentation length is set by "\compactlistindent" (fixed at 0.5\,em by default) 
% and can be modified with "\setlength".
% Notice that there are several other ways to construct a compact list in particular
% with the \texttt{noitemsep} key of the \textsf{enumitem} package~\cite{ENUM}.
%
% \medskip
% \DescribeEnv{dinglist}
% The \textsf{pifont} package has also a list environment "\begin{dinglist}"\marg{number}
% to typeset a list with normal spacing, using the "\ding"\marg{number} symbol
% for each "\item" (instead of using "\item[\ding"\marg{number}"]"). 
% So "\begin{dinglist}{226}" yields:
% \begin{dinglist}{51}
% \item The first item in the list.
% \item The second item in the list.
% \item The third item in the list.
% \end{dinglist}
%
% \hypertarget{ie-eg}{}
% \medskip
% \DescribeMacro{\ie} \DescribeMacro{\eg}
% In English, at the end of a sentence, the point is followed by an em space
% which is larger than an inter-word space.
% We provide the "\ie" (\textit{id est}) and "\eg" (\textit{exempli gratia}) macros,
% suggested in The \LaTeX\ Companion \cite{COMP},
% to get correct spacing after these abbreviations \eg here.
% In American typography, a comma is often placed after these abbreviations,
% what we can get with "\ie,"
% on the other hand, some authors prefer to typeset \textit{\ie} in italic shape,
% which is always possible with "\textit{\ie}". 
%
% \hypertarget{dualboxes}{}
% \medskip
% \DescribeMacro{\dualboxes}
% Several packages intend to typeset text around a figure or a table,
% but some of them need to give the width of the box containing the figure or the table.
% We provide here another approach with the macro
% "\dualboxes"\oarg{pos}\marg{left}\marg{right},
% which places two boxes, \meta{left} and \meta{right}, side by side.
% These boxes can contain figures, tables, one small line text, 
% parbox text, \texttt{minipage} environments
% (for several paragraphs and lists), etc.
% The optional \meta{pos} parameter sets the vertical level on which the boxes are aligned:
% a number between 0 (bottom) and 1 (top, default value).
%
% Here is a first example in which we have adjusted  the postion
% of the boxes vertically, with "\dualboxes[0.6]".
%
% \def\myfigure{%
% \begin{tikzpicture}[scale=0.6]\tiny 
%     \draw[->] (-4.5,0) -- (4.5,0);
%     \draw[->] (0,-2) -- (0,1.5);
%     \foreach \x in {-4,...,4} {\draw (\x,0.1cm) -- (\x,-0.1cm) node[below] {$\x$};}
%     \foreach \y in {-1,1} {\draw (0.1cm,\y) -- (-0.1cm,\y) node[left] {$\y$};}
%     \draw[domain=-4.5:4.5,samples=100,color=red] plot ({\x},{2*\x/(exp(\x)-\x)});
% \end{tikzpicture}}
%
% \def\mytable{
%     $\begin{array}{|*{6}{c|}} \hline
%         x    & -2    & -1    & 0 & 1    & 2    \\ \hline
%         f(x) & -1,87 & -1,46 & 0 & 1,16 & 0,74 \\ \hline
%     \end{array}$
% }
%
% \medskip
% \dualboxes[0.6]{\scriptsize \mytable}{\myfigure}
%
% \noindent
% The horizontal space is equally shared between left margin, inter-box space 
% and right margin.
% 
% \medskip
% In the following example boxes are aligned by top and
% the right box has been shifted back (left) from 3\,cm
% to make an overlapping with the left one, what \textsf{picins} cannot do. 
% 
% \dualboxes{\scriptsize \mytable}{\mbox{} \hspace{-3cm} \myfigure}
% \begin{verbatim}
% \dualboxes{\scriptsize
%     $\begin{array}{|*{6}{c|}} \hline
%         x    & -2    & -1    & 0 & 1    & 2    \\ \hline
%         f(x) & -1,87 & -1,46 & 0 & 1,16 & 0,74 \\ \hline
%     \end{array}$
% }{\mbox{} \hspace{-3cm}
%     \begin{tikzpicture}[scale=0.6]\tiny
%         \draw[->] (-4.5,0) -- (4.5,0);
%         \draw[->] (0,-2) -- (0,1.5);
%         \foreach \x in {-4,...,4} {
%             \draw (\x,0.1cm) -- (\x,-0.1cm) node[below] {$\x$};}
%         \foreach \y in {-1,1} {
%             \draw (0.1cm,\y) -- (-0.1cm,\y) node[left] {$\y$};}
%         \draw[domain=-4.5:4.5,samples=100,color=red] 
%             plot ({\x},{2*\x/(exp(\x)-\x)});
%     \end{tikzpicture}
% }
% \end{verbatim}
%
% \DescribeMacro{\dualboxes*}
% This command has a starred version that eliminates space before the first box
% and after the second one, but not between them:
% "\dualboxes*"\oarg{pos}\marg{left}\marg{right}.
%
% \smallskip
% \dualboxes*[0.6]{\parbox{6.5cm}{
%     In practice, \texttt{\bslash dualboxes} is suitable for boxes in which 
%     you put figures or tables or small one line text.
%     For longer text, this one must be nested in a paragraph box, \eg 
%     here we used \texttt{\bslash parbox\{6.5cm\}\{...\}}.
%     If you want several paragraphs, a list or a mathematical displayed formula,
%     then you have to put them in a \texttt{minipage} environment.}
% }{\myfigure}
%
% \medskip
% Let us indicate that it is unfortunately not possible to use \texttt{verbatim} environments
% (nor the in-line \texttt{\bslash verb} command)
% within "\dualboxes" arguments,
% as well as it is not possible for footnotes or margin notes.  
%
% \medskip
% For putting two figures side by side, or a table and a figure, "\dualboxes" is perfect.
% But for text around a figure, some other package may be more efficient.
% Les us mention first \textsf{wrapfig}~\cite{WRAPFIG}, one of the easiest, but text must
% contain in a single paragraph (like above), without list or you have to place it in
% a \texttt{minipage} environment.
%
% More sophisticated is the \textsf{picins} package~\cite{PICINS},
% cited in The \LaTeX\ Companion~\cite{COMP}.
% Unlike most others, it can be used with lists,
% nevertheless vertical positioning can be tricky
% and it doesn't belong to common distributions \TeX{}\,Live or MiK\TeX.
% A last one we mention is \textsf{picinpar}~\cite{PICINPAR} in which
% text can begin after the first line and can flow to the two side of the figure.
%
% \hypertarget{juxtapose}{}
% \medskip
% \DescribeEnv{juxtapose}
% As a very interesting alternative, we present the powerful \texttt{juxtapose} environment,
% written by Christian Obrecht in the \texttt{fiche.cls class} file,
% which is part of the \textsf{mafr} distribution~\cite{MAFR}.
% We made small improvements, among others to work correctly with lists and
% get customization of some lengths:
% \DescribeMacro{\juxtopskip}\DescribeMacro{\juxbottomskip}
% \DescribeMacro{\juxsepspace}
% top and bottom lengths are set by default to "\smallskipamount" 
% and separation space is set to 1.5\,em.
% For spacing above or below the environment, if the default length doesn't fit well,
% you can add a "\bigskip" or a "\vspace"\marg{dimen} for example,
% or at worst redefine the length "\juxtopskip" and "\juxbottomskip".
% \begin{juxtapose}
%     In this example the environment begins here.
%     \texttt{juxtapose} can deal with figures, tables, but also:
%     \begin{compactlist}
%         \item verbatim text: "\mytestmacro",
%         \item text with several paragraphs,
%         \item lists, like here (a compact list),
%         \item displayed mathematics as shown on the right side,
%     \end{compactlist} 
%     without the need of \texttt{multipage} environments.

% The two boxes are aligned by their center, but
% unlike "\dualboxes", you cannot adjust vertical positioning.
% 
% \otherside 
%     \myfigure
%     \[ f(x) = \frac{2x}{\mathrm{e}^x-x} \]
%     This is the last line of the environment.
% \end{juxtapose}
%
% Here begins the following text. The syntax of \texttt{juxtapose} is simple: 
% \begin{center}
% "\begin{juxtapose} ... \otherside ... \end{juxtapose}"
% \end{center}
% It has an optional argument "\begin{juxtapose}"\oarg{leftratio}
% where \meta{leftratio} is the width ratio of the left side relatively to "\textwidth"
% (the default value is "0.5" which means "0.5\textwidth"). 
%
% Paragraphs are indented inside each side, except the first one,
% because for a figure, there's no need to shift it to the right
% (from indent length) and otherwise the user may forgot to 
% put "\noindent" before the figure.
% If you still want to indent the first paragraph use "\indent".
% For horizontal alignment inside one side, you can use "\centering" or "\flushright"
% (useful for a figure).
% If you want a global indentation of the first (or the second) box, you
% can put it in an \texttt{indentblock} environment, it works fine!
%
% \medskip
% One may ask why not using multi column environments instead.
% In the classic \textsf{multicol} environment you cannot choose unbalanced
% columns and you cannot choose where to pass to the other column.
%
% Some nice packages improve \textsf{multicols}, \eg \textsf{vwcol}~\cite{VWCOL} in which
% you can fix on the columns width, but unfortunately it doesn't accept
% verbatim text, and doesn't manage correctly lists and figures like above.
%
% Let us mention \textsf{paracol}~\cite{PARA} and \textsf{reledpar}~\cite{RELP},
% which are intended to typeset two column of text in parallel, 
% useful for translation or critical edition of text.
% They work fine with lists, figures, verbatim text, and also footnotes and margin notes,
% but it is not immediate to obtain just a chosen vertical positioning of two boxes.
% They have synchronization mechanisms, convenient for text, but
% not when you place two figures side by side.
% Besides they are a bit oversized for our need. They don't have the same purpose.
% So we can hope \texttt{juxtapose} or "\dualboxes" are useful.
%
% \StopEventually{}
%
% \section{Implementation}
%    \begin{macrocode}
\newif\ifspacingtricks@pifont
\DeclareOption{pifont}{\spacingtricks@pifonttrue}
\ProcessOptions \relax

\RequirePackage{ifthen}
\RequirePackage{calc}
\RequirePackage{setspace}
\RequirePackage{xspace}
\RequirePackage{centeredline}
\ifspacingtricks@pifont \RequirePackage{pifont} \fi

\newcommand*{\centered}[1]{{\setlength{\parskip}{0pt}\par\noindent\hfill
        #1\hfill\mbox{}}}
%    \end{macrocode}
% The double braces are necessary here to ensure that the "\parskip" modification applies
% locally within the command and not globally to the rest of the document. 
% \smallskip
%    \begin{macrocode}
\newcommand{\footnotespace}{}
\newcommand{\footnoteindent}{}
\let\footnt\footnote
\renewcommand{\footnote}[2][]{\unskip\footnotespace%
    \ifthenelse{\equal{#1}{}}{
        \unskip\footnt{\footnoteindent\ignorespaces #2}
    }{
        \unskip\footnt[#1]{\footnoteindent\ignorespaces #2}
    }\unskip
}
%    \end{macrocode}
% "\unskip" eliminates undesirable spaces before and "\ignorespaces" after.
% \smallskip
%    \begin{macrocode}
\newlength{\strutheight}
\newcommand*{\vstrut}[2][0pt]{%
    \setlength{\strutheight}{#2}%
    \addtolength{\strutheight}{#1}%
    \unskip
    \ensuremath{\rule[-#1]{0pt}{\strutheight}}%
    \ignorespaces%
}

\newlength{\parindentlength}
\setlength{\parindentlength}{\parindent}
\renewcommand{\indent}{\hspace{\parindentlength}}

\newenvironment*{indentblock}[1][\parindentlength]{
    \begin{list}{}{% 
        \setlength{\leftmargin}{#1}
        \setlength{\itemsep}{0pt}
        \setlength{\topsep}{0pt} % previously 1ex
        \setlength{\partopsep}{0pt}
    }
    \item[]
}{\end{list}}

\newlength{\compactlistindent}
\setlength{\compactlistindent}{0.5em}
\newenvironment*{compactlist}[1][\textbullet]{
    \par % sometimes necessary
    \begin{list}{#1\unskip}{% \unskip gobbles space created by \xspace
        \setlength{\itemsep}{0pt}
        \setlength{\parsep}{0pt}
        \setlength{\topsep}{0ex}
        \setlength{\partopsep}{0pt}
        \setlength{\labelwidth}{1em}
        \setlength{\leftmargin}{\labelwidth}
        \addtolength{\leftmargin}{\labelsep}
        \addtolength{\leftmargin}{\compactlistindent}
    }
}{\end{list}}

\providecommand{\bul}{\textbullet}
\providecommand{\dash}{\textendash}
\providecommand{\ddash}{\textemdash}
\providecommand{\aster}{\textasteriskcentered}
%    \end{macrocode}
% The command "\asterisk" already exists in the \textsf{mathabx} package.\\
% The following macros need the \textsf{pifont} package.
% \smallskip
%    \begin{macrocode}
\ifspacingtricks@pifont
    \providecommand{\hand}{\ding{43}\xspace}
    \providecommand{\checksymb}{\ding{51}\xspace}
    \providecommand{\arrowsymb}{\ding{226}\xspace}
\fi

\providecommand{\ie}{i.e.\@\xspace}
\providecommand{\eg}{e.g.\@\xspace}

\newcommand{\@@dualboxes}[3][1]{
    \par\noindent
    \raisebox{\depth-#1\totalheight}{#2} \hfill % needs calc
    \raisebox{\depth-#1\totalheight}{#3} \smallskip
}
\newcommand{\@dualboxes}[3][1]{
    \par\noindent \hfill
    \raisebox{\depth-#1\totalheight}{#2} \hfill
    \raisebox{\depth-#1\totalheight}{#3} \hfill\mbox{}\smallskip
}
\newcommand{\dualboxes}{\@ifstar{\@@dualboxes}{\@dualboxes}}

%    \end{macrocode}
%
% The following macro has been found in the \texttt{fiche.cls} file,
% distributed with the \textsf{mafr} package by Christian Obrecht~\cite{MAFR}.
% It had some tiny bugs in spacing.
% I just made small changes: adding some lengths parameters and the "\linewidth"
% instruction (without whom, lists in the first side send the second side out of the page).
%    \begin{macrocode}
\newlength\juxtopskip
\setlength\juxtopskip{\smallskipamount}
\newlength\juxbottomskip
\setlength\juxbottomskip{\smallskipamount}
\newlength\juxsepspace
\setlength\juxsepspace{1.5em}
\newlength\side@width

\newenvironment{juxtapose}[1][0.5]{% left side ratio
    \def\otherside{\egroup % internal function remembers \side@width
        \@tempdima=\side@width
        \side@width=\textwidth
        \advance\side@width by -\@tempdima
        \advance\side@width by -\juxsepspace
        \hskip\juxsepspace
        \linewidth=\side@width % for lists environments
        \vcenter\bgroup\hsize=\side@width\noindent % \ignorespaces useless
        }
    \side@width=#1\textwidth
    \advance\side@width by -0.5\juxsepspace
    \linewidth=\side@width % for lists environments
    \par\vskip\juxtopskip%
    \hbox\bgroup\begin{math}
    \vcenter\bgroup\hsize=\side@width\noindent\ignorespaces
    }{\egroup\end{math}\egroup\vskip\juxbottomskip}

%    \end{macrocode}
%
% \medskip
% \begin{thebibliography}{17}
% \begin{raggedright}
% \bibitem{SETSP} \emph{The \textsf{setspace} Package}, Robin Fairbairns, Geoffrey Tobin,
% CTAN, v9.7b 2022/12/04.
% \bibitem{XSP} \emph{The \textsf{xspace} package}, David Carlisle, Morten Høgholm, 
% CTAN v1.13 2014/10/28.
% \bibitem{CENTER} \emph{\textsf{centeredline} -- A macro for centering lines}, Jean-François
% Burnol, CTAN, v1.2 2022/10/10.
% \bibitem{MAFR} \emph{La distribution \textsf{mafr}}, Christian Obrecht, 
% CTAN, v1.0 17/09/2006.
% \bibitem{ARCOL} \emph{The \textsf{arraycols} package}, Antoine Missier, CTAN, 
% v1.2 2021/09/20.
% \bibitem{MSMATH} \emph{\textsf{mismath} -- Miscellaneous mathematical macros}, 
% Antoine Missier, CTAN, v2.5 2023/02/24.
% \bibitem{MKCELL} \emph{The \textsf{makecell} package}, Olga Lapko, CTAN, v0.1e 2009/08/03.
% \bibitem{CELLSP} \emph{The \textsf{cellspace} package}, Josselin Noirel, CTAN, 
% v1.9.0 2022/01/04.
% \bibitem{PIFONT} \emph{\textsf{pifont} -- Using common PostScript fonts with \LaTeX}, 
% Walter Schmidt, CTAN, v9.3 2020/03/25.
% \bibitem{ENUM} \emph{Customizing lists with the \textsf{enumitem} package}, Javier Bezos, 
% CTAN, v3.9 2019/06/20.
% \bibitem{WRAPFIG} \emph{The \textsf{wrapfig} package}, Donald Arseneau, CTAN, 
% v3.6 2003/01/31.
% \bibitem{PICINS} \emph{Bilder in \LaTeX -Dokumenten -- PicIns-Benutzerhandbuch},
% Joachim Bleser, Edmund Lang, CTAN, v3.0 sept. 1992.
% \bibitem{PICINPAR} \emph{The \textsf{picinpar} package}, Friedhelm Sowa, Stefan Blochwitz, 
% CTAN, v1.3 2022/11/25.
% \bibitem{VWCOL} \emph{The \textsf{vwcol} package}, Will Robertson, CTAN, v0.2 2015/02/10.
% \bibitem{PARA} \emph{Package \textsf{paracol}: Yet Another Multi-Column Package 
% to Typeset Columns in Parallel}, Hiroshi Nakashima, CTAN, v1.35 2018/12/31. 
% \bibitem{RELP} \emph{Parallel typesetting for critical editions:
% the \textsf{reledpar} package}, Maïeul Rouquette, Peter Wilson, Herries Press, CTAN,
% 2.25.3 2022/04/22.
% \bibitem{COMP} \emph{The \LaTeX\ Companion}. Frank Mittelbach, Michel Goossens, 
% Johannes Braams, David Carlisle, Chris Rowley, 2nd edition, Pearson Education, 2004.
% \end{raggedright}
% \end{thebibliography}
%
% \Finale
\endinput