-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmicrotype.dtx
20926 lines (20769 loc) · 787 KB
/
microtype.dtx
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
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%\iffalse meta-comment
%
% ------------------------------------------------------------------------
% The `microtype' package
% Subliminal refinements towards typographical perfection
% Copyright (c) 2004--2025 R Schlicht <[email protected]>
%
% This work may be distributed and/or modified under the conditions of the
% LaTeX Project Public License, either version 1.3c of this license or (at
% your option) any later version. The latest version of this license is in:
% https://www.latex-project.org/lppl.txt, and version 1.3c or later is part
% of all distributions of LaTeX version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% This work consists of the files microtype.dtx, microtype-utf.dtx and
% microtype.ins and the derived files microtype.sty, microtype-pdftex.def,
% microtype-luatex.def, microtype-xetex.def, microtype.lua, letterspace.sty
% and microtype-show.sty.
%
% Modified versions of the configuration files (*.cfg) may be distributed
% provided that: (1) the original copyright statement is not removed, and
% (2) the identification string is changed.
% ------------------------------------------------------------------------
%
%<package|letterspace|show>\NeedsTeXFormat{LaTeX2e}
%<*driver>
\ProvidesFile{\jobname.dtx}
%</driver>
%<package|letterspace|show>\ProvidesPackage
%<config|pdf-|lua-|xe->\ProvidesFile
%<package> {microtype}
%<letterspace> {letterspace}
%<show> {microtype-show}
%<m-t> {microtype.cfg}
%<pdf-> {microtype-pdftex.def}
%<lua-> {microtype-luatex.def}
%<xe-> {microtype-xetex.def}
%<*package|letterspace|m-t|pdf-|lua-|xe-|show>
[2025/02/11 v3.2a
%<package> Micro-typographical refinements
%<letterspace> Robust letterspacing
%<show> Visual debugging for the microtype package
%<m-t> microtype main configuration file
%<pdf-|lua-|xe-> Definitions specific to
%<pdf-> pdftex
%<lua-> luatex
%<xe-> xetex
(RS)]
%</package|letterspace|m-t|pdf-|lua-|xe-|show>
%<luafile>microtype = microtype or {}
%<luafile>local microtype = microtype
%<luafile>microtype.module = {
%<luafile> name = "microtype",
%<luafile> version = "3.2a",
%<luafile> date = "2025/02/11",
%<luafile> description = "microtype module.",
%<luafile> author = "E. Roux, R. Schlicht and P. Gesang",
%<luafile> copyright = "E. Roux, R. Schlicht and P. Gesang",
%<luafile> license = "LPPL",
%<luafile>}
%<luafile>luatexbase.provides_module(microtype.module)
%<*config>
%<bch> {mt-bch.cfg}[2007/03/03 v1.5 microtype config. file: Bitstream Charter (RS)]
%<blg> {mt-blg.cfg}[2007/07/14 v1.0 microtype config. file: Bitstream Letter Gothic (RS)]
%<cmr> {mt-cmr.cfg}[2013/05/19 v2.2 microtype config. file: Computer Modern Roman (RS)]
%<ebg> {mt-EBGaramond.cfg}[2021/10/25 v2.0 microtype config. file: EB Garamond / Adobe Garamond (RS)]
%<pmn> {mt-pmn.cfg}[2009/11/14 v1.3 microtype config. file: Adobe Minion (HH/KK)]
%<ppl> {mt-ppl.cfg}[2005/11/16 v1.6 microtype config. file: Palatino (RS)]
%<ptm> {mt-ptm.cfg}[2006/04/20 v1.7 microtype config. file: Times (RS)]
%<ugm> {mt-ugm.cfg}[2006/01/26 v1.0 microtype config. file: URW Garamond (RS)]
%<msa> {mt-msa.cfg}[2006/02/04 v1.1 microtype config. file: AMS symbols (a) (RS)]
%<msb> {mt-msb.cfg}[2005/06/01 v1.0 microtype config. file: AMS symbols (b) (RS)]
%<euf> {mt-euf.cfg}[2006/07/03 v1.1 microtype config. file: AMS Euler Fraktur (RS)]
%<eur> {mt-eur.cfg}[2006/07/31 v1.1 microtype config. file: AMS Euler Roman (RS)]
%<eus> {mt-eus.cfg}[2006/07/28 v1.2 microtype config. file: AMS Euler Script (RS)]
%<zpeu> {mt-zpeu.cfg}[2006/05/04 v1.0 microtype config. file: Adobe Euro (RS)]
%<mvs> {mt-mvs.cfg}[2006/07/05 v1.1 microtype config. file: Marvosym Euro (RS)]
%</config>
%
%<*driver|docsty>
%<*driver>
\makeatletter
\documentclass[10pt,a4paper,doc2]{ltxdoc}
%</driver>
% Compiling microtype.dtx with the command line option
% --jobname=microtype-code
% will produce the document microtype-code.pdf,
% containing only the Implementation.
\expandafter\newif\csname ifcodedoc\endcsname
\edef\@tempa{\jobname}
\edef\@tempb{\detokenize{microtype-code}}
\ifx\@tempa\@tempb
\codedoctrue
\fi
%<docsty>\codedoctrue
% Let's abolish CM! We use Charter and Letter Gothic
% (for the pre-built documentation on CTAN):
\usepackage[LGR,T1]{fontenc}
\usepackage[charter]{mathdesign}
\def\rmdefault{bch} % not scaled
\def\sfdefault{SourceSansPro-TLF}
\def\SourceSansPro@scale{1.02}
\IfFileExists{t1blg.fd}
{\def\ttdefault{blg}}
{\def\ttdefault{ulg}}
{\ttfamily\selectfont
\DeclareFontShape{T1}{\ttdefault}{eb}{n}{<-> ssub * \ttdefault/b/n}{}}
\usepackage{iftex}
%<*!docsty>
\ifxetex\else
\usepackage[latin1]{\ifluatex lua\fi inputenc}
\fi
%</!docsty>
\GetFileInfo{\jobname.dtx}
\usepackage{microtype}[\filedate]
\DeclareMicrotypeSet*[protrusion]
{ doc }
{ encoding = {*, TS1, OMS},
family = {rm*, sf*, tt*},
size = {footnotesize, small, normalsize} }
\SetProtrusion
{ encoding = OMS,
family = mdbch }
{ "68 = {400, }, % \langle
"69 = { ,400} } % \rangle
\DeclareMicrotypeSet*[kerning]
{ doc }
{ encoding = T1,
family = blg, % typewriter font and ...
font = * } % French sample in section \ref{sub:kerning}
\SetExtraKerning
{ encoding = T1,
family = blg }
{ _ = {100,100} } % underscores shouldn't touch
\ifxetex\else
% disable ?` and !` ligatures (sample in section \ref{sec:disable-ligatures})
\DisableLigatures[?,!]{encoding = *, family = rm* }
\fi
% Fraktur sample in section \ref{sec:lettersp}
\IfFileExists{t1mwr.fd}
{\def\textfrak##1{{\fontfamily{mwr}\selectfont ##1}}
\SetTracking[no ligatures={f,s,c}]{encoding=T1,family=mwr}{120}}
{\IfFileExists{yfonts.sty}
{\usepackage{yfonts}
\SetTracking[no ligatures={f,s,c}]{encoding=LY,family=yfrak}{120}}
{\def\textfrak{\rule{.5em}{1.5ex}\@gobble}}}
\ifpdftex
\microtypesetup{kerning=true}
\fi
\ifluatex % microtype.dtx finally compiles with 0.35!
\usepackage{luatex85}
\fi
\ifpdf
\microtypesetup{expansion=alltext} % with activated expansion ...
\tolerance=250 % ... we can make TeX almost as intolerant as it normally is (200)
\g@addto@macro\macrocode{\microtypesetup{expansion=false}}
% bonus material
\InputIfFileExists{microtype-logo.dtx}\relax\relax
\InputIfFileExists{microtype-lssample.dtx}\relax\relax
\else
\ifluatex\else
\let\lsstyle\relax
\fi
\fi
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{L}[1]{p{#1}<{\raggedright}}
\usepackage{color}
\definecolor{thered} {rgb} {0.65,0.04,0.07}
\definecolor{thegreen} {rgb} {0.06,0.44,0.08}
\definecolor{theblue} {rgb} {0.02,0.04,0.48}
\definecolor{sectioning}{gray}{0.44}
\definecolor{thegrey} {gray}{0.5}
\definecolor{theframe} {gray}{0.75}
\definecolor{theshade} {gray}{0.94}
\usepackage{graphicx}
\usepackage{etoolbox}
% general layout
\frenchspacing
\DeclareRobustCommand\textoractual[2]{\ifpdf
\pdfliteral direct{/Span<</ActualText(#2)>>BDC}#1\pdfliteral direct{EMC}%
\else #1\fi}
\expandafter\newif\csname ifcmr\endcsname
\long\def\@tempa{cmr}
\ifx\rmdefault\@tempa
\cmrtrue
\def\PackageFont{\sffamily}
\def\match{\textbullet}
\usepackage{amssymb} % \varnothing
\expandafter\let\expandafter\OrigTeX\csname TeX \endcsname
\DeclareRobustCommand\TeX{\textoractual{\OrigTeX}{TeX}}
\setlength\textheight{49\baselineskip}
\else
\let\bfdefault\bfdefault@previous % undo mathdesign's \def\bfdefault{b}
\def\Module#1{{\color{theblue}\textoractual{$\langle$}{<}\texttt{\itshape#1}\textoractual{$\rangle$}{>}}}
\DeclareRobustCommand\TeX{\textoractual{T\kern-.1em\lower.4ex\hbox{E}\kern-.075emX\@}{TeX}}
\DeclareRobustCommand\LaTeX{\textoractual{L\kern-.26em{\sbox\z@ T\vbox to\ht\z@{%
\hbox{\check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont A}%
\vss}}}{La}\kern-.075em\TeX}
\def\PackageFont{\ttfamily}
\def\match{{\large\raisebox{-.15em}{\textbullet}}}
{\catcode`\`=\active % indiscernible from ' in Bitstream Letter Gothic
\g@addto@macro\macro@code{\let`\textasciigrave}}
\DeclareEncodingSubset{TS1}{blg}{1} % for \textasciigrave
\linespread{1.07}\normalfont
\setlength\textheight{48\baselineskip}
\fi
\addtolength\textheight{\topskip}
\setlength\topmargin{5pt}
% sections
\def\@seccntformat#1{\llap{\csname the#1\endcsname\hskip\marginparsep}}
\def\MTsectionfont{\ifcmr\fontseries{bx}\else\fontseries{eb}\fi\sffamily\color{sectioning}}
\patchcmd\section {\bfseries}{\MTsectionfont}\relax\relax
\patchcmd\subsection {\bfseries}{\MTsectionfont}\relax\relax
\patchcmd\subsubsection{\bfseries}{\MTsectionfont}\relax\relax
\def\paragraph{\@startsection{paragraph}{4}%
{0pt}{8pt plus 2pt minus 1pt}{-1em}%
{\normalfont\normalsize\itshape}}
% title
\def\@maketitle{%
\newpage\null\vskip 2em
\begin{center}\sffamily
{\huge \@title\par\vskip 1.5em}%
{\large\hspace{4.5em}\parbox{.33\textwidth}{\@author}%
\parbox{.33\textwidth}{\@date}\par\vskip 1em
\textls*[-20]{\url{\githuburl}}}%
\vskip 2.5em\rule{\textwidth}{.4pt}%
\end{center}\par\vskip 1.5em}
\def\abstractname{}
% headers
\headheight=15pt
\def\ps@MTheadings{%
\def\@oddhead{%
\hbox to\textwidth{\vbox{\hbox to\textwidth{%
\footnotesize\sffamily{\leftmark\rightmark\strut}\hfill\thepage\strut}%
\hrule height 0.4pt width\textwidth \vskip-0.4pt
}}\hss}
\let\@oddfoot\@empty
\let\@mkboth\markboth
\def\sectionmark##1{\markboth{\textls*[70]{\MakeUppercase{##1}}}{}}
\def\subsectionmark##1{\markright{\,: ##1}}}
\pagestyle{MTheadings}
% toc
\let\l@section@\l@section
\def\l@section{\vskip -1.25ex\l@section@}
\def\l@subsection{\vskip.35ex \penalty\@secpenalty \@dottedtocline{2}{1.5em}{2.2em}}
\def\l@subsubsection#1#2{%
\leftskip 3.7em
\rightskip 2em plus 2em
\parindent 0pt
{\let\numberline\@gobble{\small #1~[#2]}}}
\def\l@table{\@dottedtocline{1}{0pt}{1.5em}}
\let\l@figure\l@table
\def\@pnumwidth{1.7em}
\def\defspecial@toc#1#2#3{\long\def#1{%
\ifpdf\phantomsection\bookmarksetupnext{italic}\pdfbookmark[1]{#2}{#3}\fi
\section*{#2}\@mkboth{\textls*[70]{\MakeUppercase{\contentsname}}}{}%
\@starttoc{#3}}}
\defspecial@toc\tableofcontents\contentsname{toc}
\defspecial@toc\listoftables\listtablename{lot}
\defspecial@toc\listoffigures\listfigurename{lof}
% bibliography
\def\@cite#1#2{#1\if@tempswa, #2\fi}
\def\thebibliography#1{%
\section{\refname}%
\list{}{\leftmargin 0pt}% \sloppy
\clubpenalty 4000
\@clubpenalty \clubpenalty
\widowpenalty 4000}
\def\@biblabel#1{}
% footnotes
\def\@makefnmark{\raisebox{0.3ex}{\sffamily\footnotesize\,\@thefnmark}}
\long\def\@makefntext#1{%
\leftskip 0pt
\parindent 0pt
\everypar{\parindent 0pt}%
\leavevmode\llap{\sffamily\@thefnmark\hskip\marginparsep}#1}
\def\footnoterule{%
\kern-3\p@
\hrule\@width \columnwidth
\kern2.6\p@}
\skip\@mpfootins=4pt
% lists
\setlength\leftmargini{15pt}
\setlength\leftmarginii{12.5pt}
\setlength\leftmarginiii{10pt}
\def\@listi{\leftmargin \leftmargini
\parsep 4.5pt plus 1pt minus 1pt
\topsep 4.5pt plus 1pt minus 1pt
\itemsep 0pt}
\let\@listI\@listi
\def\descriptionlabel#1{\hspace\labelsep\normalfont#1:}
\renewenvironment{itemize}
{\ifnum \@itemdepth >\thr@@\@toodeep\else
\advance\@itemdepth\@ne
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
\expandafter\list
\csname\@itemitem\endcsname
{\ifnum\@itemdepth=\@ne\leftmargin 0pt\fi
\def\makelabel##1{\hss\llap{\color{sectioning}##1}}}%
\fi}
{\endlist}
\newenvironment{enum}[1][0]
{\list\labelenumi
{\usecounter{enumi}\setcounter{enumi}{#1}\addtocounter{enumi}{-1}%
\renewcommand\labelenumi{\texttt{\theenumi}:}%
\leftmargin 30pt
\itemindent-15pt
\labelwidth 15pt
\labelsep 0pt
\def\makelabel##1{##1\hss}}}
{\endlist}
\newenvironment{options}
{\list{}
{\leftmargin 0pt
\labelwidth 0pt
\labelsep 1em
\itemindent \labelsep
\lstset{belowskip=0pt}}}
{\endlist}
% boxes (for some reason, mathdesign changes these values)
\setlength\fboxrule{0.4pt}
\setlength\fboxsep{3pt}
\setlength\arrayrulewidth{0.4pt}
% tables
\usepackage{tabularx}
\setlength\tabcolsep{2pt}
\newbox\mt@box
\newdimen\mt@unvdimen
\long\def\@makecaption#1#2{%
\setbox\mt@box\vbox{\llap{\vbox{% \fboxsep = 4pt
\vskip\dimexpr\floatsep-4pt+\fboxrule\relax
\hsize\dimexpr\marginparwidth-\marginparsep-4pt-\fboxrule\relax
\rightskip\dimexpr\marginparsep+4pt+\fboxrule\relax plus 2.5em
\footnotesize \sffamily #1:\\[-\dimexpr\aboverulesep+\cmidrulewidth+3.5\fboxrule]
\textcolor{theframe}{\rlap{\vrule width \hsize height\fboxrule}}\\[.3\baselineskip] #2}}}
\mt@unvdimen\dimexpr\ht\mt@box+\dp\mt@box\relax
\unvbox\mt@box
\vskip-\mt@unvdimen}
% index and change log
\IndexPrologue{\section{Index}%
\ifcodedoc
Numbers in upright shape refer to the \textit{page} where the corresponding entry
is described (bold face) resp. occurs.
Numbers in italic shape refer to the \textit{code line} where the corresponding entry
is defined (underlined) resp. used.
Numbers prefixed with `U' refer to the User manual.
\fi
}
\GlossaryPrologue{\section{Change history}\label{sec:changes}%
\ifcodedoc \PrintHistory \par\medskip\noindent
Numbers prefixed with `U' refer to the User manual.\fi
\vspace*{-\multicolsep}}
%\setcounter{finalcolumnbadness}{100}
%\raggedcolumns
\setcounter{IndexColumns}{2}
\def\IndexMin{12\baselineskip}
\g@addto@macro\IndexParms{%
\ifcodedoc\footnotesize\else\small\fi
\def\indexspace#1{%
\end{multicols}
\vspace{-20pt}%
\begin{multicols}{2}
\ifpdf{\let\bfseries\empty\let\hfil\empty\phantomsection\pdfbookmark[2]{#1}{#1}}\fi
\setbox0\hbox{\sffamily\hss#1}%
\ifdim\wd0<1em \setbox0\hbox to 1em{\sffamily\hss#1\hss}\fi
\llap{\color{thegrey}\box0\hskip\marginparsep}%
\vspace*{-\baselineskip}%
\IndexParms %\rightskip 15pt
\let\item\@idxitem
\raggedcolumns}}
\def\GlossaryParms{\IndexParms
\let\indexspace\relax
\def\@idxitem ##1##2\efill{%
\end{multicols}
\ifpdf \vspace{-3.25ex}%
\pdfbookmark[2]{\if##1v\relax ##2
(\csname MTversiondate##2\endcsname)\else ##2\fi}
{subsection\zap@space ##2 \@empty}\fi
\begin{multicols}{2}[%
\subsubsection*{\if##1v\relax
\llap{\mdseries\color{thegrey}\footnotesize
\csname MTversiondate##2\endcsname\hskip\marginparsep}%
Version ##2\else ##2\fi}][6\baselineskip]
\label{sub:changes:##2}%
\GlossaryParms \rightskip 15pt plus 5pt
\let\item\@idxitem
\ignorespaces \makeatletter \scan@allowedfalse}%
\def\subitem{\par\hangindent 15pt}%
\def\subsubitem{\subitem\hspace*{7.5pt}}}
% Change history
% based on an original idea by Tom Bombadil (https://tex.stackexchange.com/a/61251/7674),
% but don't look too closely at the messy rest, or you'll lose all your tikz skills
%<*!docsty>
\ifcodedoc
\usepackage{tikz,pgfcalendar}
\usetikzlibrary{calc}
\newcounter{MThistitem}
\def\MThistlastnode{n-0}
\pgfmathsetmacro{\MThistfirstyear}{2004} % v1.0 2004/09/11
\pgfmathsetmacro{\MThistlastyear}{\year}
\pgfmathsetmacro{\MThistyears}{\MThistlastyear-\MThistfirstyear}
\pgfmathsetmacro{\MThistvsep}{1.75}
\pgfmathsetmacro{\MThisthshift}{3}
\def\MThistprepare{%
\pgfmathsetmacro{\MThistnodesep}{(\textwidth+\MThisthshift cm+2pt)/(\theMThistitem/2+1)}% why the extra 2pt? I have no idea... probably because all this only pretends to be automatic...!
\pgfmathsetmacro{\MThistnodewidth}{\MThistnodesep*3/4}
\pgfmathsetmacro{\MThistxshift}{1.4pt}
\let\MThistcurrnodesep\MThistnodesep
\setcounter{MThistitem}{0}
\node[inner sep=0pt] (n-0) at (-\MThisthshift,\MThistvsep) {}; }
\let\MThistshow\@empty
\def\MThist@versiondate#1#2{% count items and reverse order
\ifnum\pdfmatch{([a-z])}{#1}=1
\gpreto\MThistshow{\MT@doversion{#1}{#2}{2}}%
\addtocounter{MThistitem}{1}%
\else
\gpreto\MThistshow{\MT@doversion{#1}{#2}{1}}%
\addtocounter{MThistitem}{2}%
\fi}
\def\MThist@ifmajor{1}
\def\MThistlastmajor{1}
\def\MT@doversion#1#2#3{%
\stepcounter{MThistitem}%
\def\MThist@xshift{0}%
\ifnum#3=2
\ifnum\pdfmatch{([a-z])}{#1}=1
\edef\MThist@current{\expandafter\strip@prefix\pdflastmatch1 }%
\fi
\ifnum\MThist@ifmajor>0 \def\MThist@xshift{-\MThistxshift}\fi
\def\MThist@ifmajor{0}%
\else
\def\MThist@current{#1}%
\ifnum\MThist@ifmajor<1 \def\MThist@xshift{\MThistxshift}\fi
\def\MThist@ifmajor{1}%
\fi
\node[right=\MThistcurrnodesep,xshift=\MThist@xshift,outer sep=0pt,align=center,nodemajor]
(n-\theMThistitem) at (\MThistlastnode.west) {\hyperref[sub:changes:#1]{\MThist@current\strut}};
\pgfmathsetmacro{\MThistcurrnodesep}{\MThistnodesep/#3}%
\ifnum\MThist@ifmajor>0
\ifnum\theMThistitem>1
\draw (n-\MThistlastmajor.north west) -- ($(n-\theMThistitem.north east)-(\MThistcurrnodesep pt,0)$);
\draw (n-\MThistlastmajor.south west) -- ($(n-\theMThistitem.south east)-(\MThistcurrnodesep pt,0)$);
\edef\MThistlastmajor{\theMThistitem}%
\fi
\else
\draw [very thin] ($(n-\theMThistitem.north west)+(.8pt,-.9pt)$) -- ($(n-\theMThistitem.north east)-( .8pt,.9pt)$);
\draw [very thin] ($(n-\theMThistitem.south west)+(.8pt, .9pt)$) -- ($(n-\theMThistitem.south east)+(-.8pt,.9pt)$);
\fi
\MThist@splitdate#2\relax
\pgfcalendardatetojulian{\MTYear-\MTMonth-\MTDay}{\@tempcnta}
\pgfcalendardatetojulian{\MTYear-1-1}{\@tempcntb}
\advance\@tempcnta-\@tempcntb
\pgfmathsetmacro{\MTDate}{\MTYear-\MThistfirstyear+\@tempcnta/365}
\expandafter\edef\csname MThistnodetime\theMThistitem\endcsname{\MTDate}
\expandafter\edef\csname MThist@ifmajor\theMThistitem\endcsname{\MThist@ifmajor}
\edef\MThistlastnode{n-\theMThistitem}}
\def\MThist@splitdate#1/#2/#3\relax{\def\MTYear{#1}\def\MTMonth{#2}\def\MTDay{#3}}
\def\MThisttimeline{%
\path (n-\theMThistitem.east); \pgfgetlastxy{\MT@tempdim}{\@tempdima};
\pgfmathsetmacro{\MThistxposition}{\MT@tempdim/28.452755}
\foreach \x in {1,...,\theMThistitem}{
\pgfmathsetmacro{\MThisttimeposition}{\MThistxposition/(\MThistlastyear-\MThistfirstyear)*\csname MThistnodetime\x \endcsname}
\draw[rounded corners=3pt,arrowmajor]
(\MThisttimeposition,0) -- (\MThisttimeposition,0.5) -- ($(n-\x.south)-(0,0.5)$) -- (n-\x.south); }
\draw[very thick,-latex] (0,0) -- ($(\MThistlastnode.east)-(0,\MThistvsep)+(1,0)$);
\foreach \x in {0,...,\MThistyears}{
\pgfmathsetmacro{\MThistlabelposition}{\MThistxposition/(\MThistlastyear-\MThistfirstyear)*\x}
\node[below] (label-\x) at (\MThistlabelposition,-0.2) {\number\numexpr\MThistfirstyear+\x};
\draw (label-\x.north) -- ++ (0,0.2); }}
\def\PrintHistory{%
\InputIfFileExists{microtype-hist.tmp}{\let\VersionDate\MThist@versiondate\@firstofone}\@gobble
{\hypersetup{linkcolor=thered}%
\hspace{-\MThisthshift cm}%
\rlap{%
\begin{tikzpicture}[color=thegrey,font=\fontsize{4.5}{6}\selectfont,
nodemajor/.code={%
\ifnum\MThist@ifmajor>0
\tikzset{fill=theshade,text width=\MThistnodewidth,inner sep=1pt}
\else
\tikzset{color=theshade,line width=1.6pt,draw,fill=white,text width=\MThistnodewidth/2,
font=\fontsize{4}{6}\selectfont,inner sep=0.4pt}
\fi
},
arrowmajor/.code={%
\expandafter\ifnum\csname MThist@ifmajor\x\endcsname=0
\tikzset{shorten >=-.8pt,very thin}
\fi
}]
\MThistprepare
\MThistshow
\MThisttimeline
% borders for the last major version
\ifnum\MThist@ifmajor>0 \def\@tempa{0,0}\def\@tempb{0,0}\else\def\@tempa{.8pt,.6pt}\def\@tempb{.8pt,-.6pt}\fi
\draw (n-\MThistlastmajor.north west) -- ($(n-\theMThistitem.north east)+(\@tempa)$);
\draw (n-\MThistlastmajor.south west) -- ($(n-\theMThistitem.south east)+(\@tempb)$);
\end{tikzpicture}}}}
\fi
%</!docsty>
% macro code
\MacroTopsep=0pt
\MacrocodeTopsep=3pt
\setlength\MacroIndent{0pt}
\def\theCodelineNo{\reset@font\sffamily\color{thegrey}\scriptsize
\textoractual{\arabic{CodelineNo}\ }{}}% don't copy line numbers
\def\MacroFont{\ttfamily\small}
\setcounter{StandardModuleDepth}{99}
\def\PrintMacroName#1{\strut\MacroFont\string #1\hskip15pt}
\def\ImplementationSettings{%
\linespread{1}%
\hfuzz=50pt
\def\MacroFont{\ttfamily\footnotesize}%
\let\macro@font\MacroFont}
% additional bells ...
\def\Describe#1#2#3{\noindent\csname Describe#1\endcsname{#2}%
\DescribeValues{#1}{#3}}
\def\DescribeOption{\leavevmode\@bsphack
\begingroup\MakePrivateLetters\Describe@Option}
\def\Describe@Option#1{\endgroup
\marginpar{\raggedleft\PrintDescribeOption{#1}}%
\SpecialOptionIndex{#1}\@esphack\ignorespaces}
\def\DescribePackage{\leavevmode\@bsphack
\begingroup\MakePrivateLetters\Describe@Package}
\def\Describe@Package#1{\endgroup
\marginpar{\raggedleft\PrintDescribeOption{#1.sty}}%
\CatMainIndex{#1}{package}\@esphack\ignorespaces}
\def\DescribeValues#1#2{%
\let\@tempa\@empty \let\Option@default\@empty
\@for\@tempb:=#2\do{%
\csname Special#1Value\expandafter\endcsname\@tempb\@nil
\expandafter\g@addto@macro\expandafter\@tempa
\expandafter{\csname #1Sep\endcsname}%
\expandafter\g@addto@macro\expandafter\@tempa
\expandafter{\@tempb}}%
\@ifnextchar[\PrintValues{\PrintValues[\Option@default]}}
\def\SpecialOptionValue#1#2\@nil{%
\if#1:\def\@tempb{\Variable{#2}}\else % : = variable
\if#1!\def\@tempb{#2}\def\Option@default{#2}\else % ! = default
\if#1*\def\@tempb{#2}\def\Option@default{\MaybeDefault{#2}}% * = default (maybe)
\fi\fi\fi}
\def\SpecialMacroValue#1#2\@nil{%
\if#1?\def\@tempb{\normalsize[\Variable{#2}]}% % ? = optional
\else\def\@tempb{\normalsize\{\Variable{#1#2}\}}\fi}
\let\SpecialEnvValue\SpecialMacroValue
\DeclareRobustCommand\langlechar{<} % for makeindex
\DeclareRobustCommand\ranglechar{>}
\def\Variable#1{%
\textoractual{$\langle$}{\langlechar}%
{\rmfamily\itshape\small#1}%
\textoractual{$\rangle$}{\ranglechar}}
\let\m@a\meta \def\meta#1{\textoractual{\m@a{#1}}{\langlechar#1\ranglechar}}
\def\MaybeDefault#1{\textrm{*}\,#1}
\def\OptionSep{{\rmfamily, }} \def\MacroSep{\,} \def\EnvironmentSep{\,}
\def\PrintValues[#1]{{\MacroFont\expandafter\@gobble\@tempa\hfill #1}\\*[.25\baselineskip]}
\def\CatIndex#1#2{\index{#1\actualchar{\protect\ttfamily #1} (#2)\encapchar \ifcodedoc\else doc\fi hyperpage}}
\def\CatIndeX#1#2#3{\index{#2\actualchar#1\ (#3)\encapchar \ifcodedoc\else doc\fi hyperpage}}
\def\CatMainIndex#1#2{\index{#1\actualchar{\protect\ttfamily #1} (#2)\encapchar docmain}}
\def\SpecialOptionIndex#1{\@bsphack
\index{\quotechar/#1% sort options as `Symbols'
\actualchar{\protect\ttfamily#1}\encapchar docmain}%
\CatMainIndex{#1}{option}\@esphack}
\def\SpecialUsageIndex#1{\@bsphack
\index{\quotechar1% sort commands as `Numbers'
\actualchar\string\verb
\quotechar*\verbatimchar\string#1\verbatimchar\encapchar docmain}%
{\let\special@index\index\SpecialIndex@{#1}{\encapchar docmain}}\@esphack}
\def\SpecialEnvIndex#1{\CatMainIndex{#1}{environment}}
\def\cmd#1{\orig@cs{\expandafter\cmd@to@cs\string#1}}
\DeclareRobustCommand\orig@cs[1]{\texttt{\char`\\#1}}
\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}%
{\let\special@index\index
\expandafter\SpecialIndex@\expandafter{\csname#1\endcsname}{\encapchar \ifcodedoc\else doc\fi hyperpage}}}
%</driver|docsty>
% microtype's index style (microtype-gind.ist):
%<docist>actual '='
%<docist>quote '!'
%<docist>level '>'
%<docist>preamble "\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n\\indexspace"
%<docist>postamble "\n\n \\end{theindex}\n"
%<docist>item_x1 "\\efill \n \\subitem "
%<docist>delim_0 "\\pfill "
%<docist>delim_1 "\\pfill "
%<docist>heading_prefix "{\\bfseries\\hfil "
%<docist>heading_suffix "\\hfil}\\nopagebreak\n"
%<docist>headings_flag 1
%<docist>symhead_positive "Options"
%<docist>numhead_positive "Commands"
%<*driver|docsty>
\def\PrintDescribeMacro#1{\strut\MacroFont\color{thegreen}\string #1}
\def\PrintDescribeEnv#1{\strut\MacroFont\bslash begin\{{\color{thegreen}#1}\}%
\\*[.25\baselineskip]\strut\bslash end\{{\color{thegreen}#1}\}}
\def\PrintDescribeOption#1{\strut\MacroFont\color{thered}#1}
\def\Indexing{\let\special@index\codeline@wrindex}
\def\NoIndexing{\let\special@index\@gobble}
\def\GeneralChanges#1{\edef\generalname{\if*#1 General\else#1\fi}}% mind the space!
\DeclareRobustCommand\key[1]{\textcolor{thered}{\ttfamily#1}}
\DeclareRobustCommand\pkg[1]{{\PackageFont#1}\@bsphack\CatIndex{#1}{package}\@esphack}
\DeclareRobustCommand\cls[1]{{\PackageFont#1}\@bsphack\CatIndex{#1}{class}\@esphack}
\DeclareRobustCommand\opt[1]{{\ttfamily#1}\@bsphack\CatIndex{#1}{option}\@esphack}
\DeclareRobustCommand\file[1]{{\ttfamily#1}}
\def\RequiresSep{ \textbar\ }
\def\requires#1{\let\@tempa\@empty
\@for\@tempb:=#1\do{%
\g@addto@macro\@tempa\RequiresSep
\expandafter\g@addto@macro\expandafter\@tempa\expandafter{\@tempb}}%
\hfill{\setlength\fboxsep{2pt}%
\fcolorbox{theframe}{white}{\mdseries\small\strut\color{sectioning}%
\,\expandafter\@gobble\@tempa\,}}}
% ... and whistles
\usepackage{listings}
\lstdefinestyle{microtype}{
gobble=1,columns=flexible,keepspaces,upquote,escapechar=",
basicstyle=\MacroFont,
keywords=[0]{\microtypesetup,\DeclareMicrotypeSet,\UseMicrotypeSet,
\DeclareMicrotypeSetDefault,\SetProtrusion,\SetExpansion,\SetTracking,
\SetExtraKerning,\SetExtraSpacing,\DisableLigatures,\DeclareCharacterInheritance,
\DeclareMicrotypeVariants,\DeclareMicrotypeAlias,\DeclareMicrotypeBabelHook,
\LoadMicrotypeFile,\DeclareMicrotypeFilePrefix,\microtypecontext,\textmicrotypecontext,
\textls,\lsstyle,\lslig,
\leftprotrusion,\rightprotrusion,\noprotrusion,\noprotrusionifhmode,
\Microtype@Hook},
keywordstyle=[0]\color{thegreen},
keywords=[1]{protrusion,expansion,activate,DVIoutput,disable,verbose,
config,factor,auto,stretch,shrink,step,selected,unit,tracking,kerning,
spacing,letterspace,babel,context,patch,nopatch,
%defersetup,copyfonts,deactivate,reactivate,% undocumented
no ligatures,outer spacing,outer kerning}, % there are three \nobreakspace in this line
keywordstyle=[1]\color{thered},
comment=[l]\%,
commentstyle=\color{thegrey}\itshape,
alsoother={0123456789_},
frame=single,backgroundcolor=\color{theshade},rulecolor=\color{theframe},
framerule=\fboxrule,xleftmargin=3.4pt,xrightmargin=3.4pt,belowskip=\smallskipamount
}
\lstset{style=microtype}
\lstdefinestyle{message}{deletekeywords={[1]{expansion,protrusion,auto}},
belowskip=-\smallskipamount,frame=none,xleftmargin=0pt,backgroundcolor=,
basicstyle=\MacroFont\footnotesize,delim=[is][\itshape\color{thegreen}]{<}{>}}
\let\verbatim\relax
\lstnewenvironment{verbatim}[1][]{\lstset{#1}}{}
\def\todo#1{\changes{zTo Do}{0000/00/00}{#1}%
\marginpar{\rightskip2\marginparsep plus1em \hangindent1.5em \hangafter-2
\smash{\llap{\raisebox{-1.4ex}{\colorbox{thered}{\Large\color{white}!} }}}%
\footnotesize\textcolor{thered}{#1}}}
\let\todo\@gobble
% fancy PDF document
\ifpdf
\usepackage{xr-hyper}
\usepackage[bookmarks,pdfdisplaydoctitle,
colorlinks,linkcolor=theblue,citecolor=theblue,urlcolor=thered,
hyperindex=false,hyperfootnotes=false]
{hyperref}
\usepackage[atend]{bookmark}
%<*!docsty>
\BookmarkAtEnd{%
\bookmark[startatroot,level=0,bold,gotor={microtype\ifcodedoc\else-code\fi.pdf}]
{\ifcodedoc User manual\else Implementation\fi}}
%</!docsty>
\externaldocument{microtype\ifcodedoc\else-code\fi}
\let\r@TotPages\relax % suppress multiply defined warning
\PassOptionsToPackage{nodvi}{totpages} % and annoying log output
\usepackage{hyperxmp} % (hyperxmp loads totpages)
\usepackage{attachfile}
\usepackage{pdfpages}
\hypersetup{
keeppdfinfo,
pdftitle={The microtype package\ifcodedoc\space-- Implementation\fi},
pdfauthor={R Schlicht <[email protected]>},
pdfsubject={Subliminal refinements towards typographical perfection},
pdfkeywords={TeX, LaTeX, pdfTeX, LuaTeX, XeTeX, typography, micro-typography,
character protrusion, margin kerning, optical alignment, font expansion,
font scaling, hz, kerning, spacing, glue, letterspacing, tracking, ligatures},
pdfcopyright={\textcopyright\ 2004--2025 R Schlicht\textLF
This work may be distributed and/or modified under the conditions
of the LaTeX Project Public License, either version 1.3c of this
license or (at your option) any later version.\textLF
This work has the LPPL maintenance status `maintained'.},
pdflicenseurl={https://www.latex-project.org/lppl/},
pdflang={en-GB}
}
% we no longer use {hypdestopt}, as it would break the external references
\def\changes@#1#2#3{% recording the changes ...
\protected@edef\@tempa{\noexpand\glossary{#1\levelchar
\ifx\saved@macroname\@empty \space\actualchar\generalname
\else\expandafter\@gobble\saved@macroname\actualchar
\string\verb\quotechar*\verbatimchar\saved@macroname\verbatimchar\fi
:\levelchar #3\encapchar \ifcodedoc\else doc\fi hyperpage}}%
\@tempa\endgroup\@esphack}
\def\MTrmn#1{\ifrmnum{#1}{\rmntonum{#1}}{#1}}
% remove double entries (\dochyperpage followed by \docmain)
\def\dochyperpage#1{\def\MT@curr@index{#1}\@ifnextchar,\dochyperpage@{\doc@hyperpage{#1}}}
\def\dochyperpage@,{\@ifnextchar\docmain\dochyperpage@@\dochyperpage@x}
\def\dochyperpage@@\docmain#1{\MT@ifstreq{#1}{\MT@curr@index}\relax\dochyperpage@x\docmain{#1}}
\def\dochyperpage@x{\expandafter\doc@hyperpage\expandafter{\MT@curr@index}, }
% indexing user doc ...
\ifcodedoc
\def\doc@hyperpage#1{\href[page={\MTrmn{#1}}]{microtype.pdf}{U\MTrmn{#1}}}
\def\docmain#1{\href[page={\MTrmn{#1}}]{microtype.pdf}{\textbf{U\MTrmn{#1}}}}
\def\main#1{\underline{\itshape\hyperlink{L:#1}{#1}}}
\def\SpecialIndex#1{\@bsphack\special@index{%
\expandafter\@gobble\string#1\actualchar
\string\verb\quotechar*\verbatimchar\string#1\verbatimchar
\encapchar codeline}\@esphack}
\else
% write references to the User manual intermediarily in roman numerals
% in order to separate them from those in the Implementation part
\def\@wrindex#1{\protected@write\@indexfile{\let\@roman\relax}{\string\indexentry{#1}{\@roman\thepage}}\endgroup\@esphack}
\def\HyInd@pagelink#1{\begingroup\toks@={}\edef\x{\MTrmn{#1} }\expandafter\HyInd@removespaces\x\@nil\endgroup}
\def\docmain#1{\textbf{\hyperpage{#1}}}
\let\doc@hyperpage\hyperpage
\fi
\def\theCodelineNo{% ... and implementation
\reset@font\sffamily\color{thegrey}\scriptsize
\@tempcnta\arabic{CodelineNo}\advance\@tempcnta by\@ne
\hypertarget{L:\number\@tempcnta}
{\textoractual{\arabic{CodelineNo}\ }{}}}% don't copy line numbers
\def\codeline#1{{\itshape\link@sanitize#1-\@nil{#1}}}
\def\link@sanitize#1-#2\@nil{\link@@sanitize#1,\@nil}
\def\link@@sanitize#1,#2\@nil{\hyperlink{L:#1}}
\def\ctanurl#1{Available from \acronym{CTAN} at \href{https://mirror.ctan.org/#1}{\nolinkurl{/#1}}}
\def\ctanpkgurl#1{Available from \acronym{CTAN} at \href{https://www.ctan.org/pkg/#1}{\nolinkurl{pkg/#1}}}
\DeclareRobustCommand\mailto[1]{\href{mailto:#1}{\nolinkurl{#1}}}
\def\mailtoRS{\href % some PDF viewers don't like spaces:
{mailto:Robert\%20Schlicht\%[email protected]\%3e?subject=[microtype\%20\fileversion]}
{\texttt{[email protected]}}}
% the samples in the introduction, utilising nested optional content groups (aka. layers)
% (nowadays, I would be using one of the ocg packages, but none of them existed back then (2005)):
\ifnum\pdftexversion<140 \else
\def\mt@layer#1#2{\pdfliteral page{/OC/#1 BDC}#2\pdfliteral page{EMC}}
\ifx\mt@objects\@undefined\let\mt@objects\@empty\fi
\ifx\mt@order \@undefined\let\mt@order \@empty\fi
\let\mt@resources\@empty
\def\mt@register#1#2{%
\immediate\pdfobj{<< /Type/OCG /Name(#1:#2) >>}
\expandafter\xdef\csname mt@#1@#2\endcsname{\the\pdflastobj\space 0 R }
\xdef\mt@objects {\mt@objects \csname mt@#1@#2\endcsname}
\xdef\mt@order {\mt@order \csname mt@#1@#2\endcsname}
\xdef\mt@resources{\mt@resources/#1#2 \csname mt@#1@#2\endcsname}}
\xdef\mt@order{\mt@order[(Sample)}
\mt@register{Protrusion}{true} \mt@register{Protrusion}{false}
\mt@register{Expansion} {true} \mt@register{Expansion} {false}
\mt@register{_compatibility}{}
\xdef\mt@order{\mt@order]}
\pdfcatalog{/OCProperties <<
/OCGs [\mt@objects]
/D << /Order [\mt@order]
/BaseState/OFF
/ON [\mt@Protrusion@false \mt@Expansion@false
\ifx\mtl@objects\@undefined\else\mtl@objects\fi] >> >> }
\def\mt@place#1{%
\vskip-\mt@unvdimen
\setbox\mt@box\vbox{#1}%
\mt@unvdimen\dimexpr\ht\mt@box+\dp\mt@box\relax
\unvbox\mt@box}
\def\mt@pseudo@marg#1{%
\mt@place{\llap{\vbox{%
\hsize\marginparwidth
\rightskip \marginparsep plus 1em
\leavevmode\itshape\footnotesize #1}}}}
\def\mt@show@sample#1#2{%
\mt@layer{Protrusion#1}{%
\mt@layer{Expansion#2}{%
\mt@place{\microtypesetup{protrusion=#1,expansion=#2}%
\mt@sample@text\strut}}}}
\def\mt@toggle@sample#1{%
\pdfstartlink user{/Subtype/Link
/BS << /Type/Border/W 1 /S/D /D[4 1] >>
/H/O /C[0.65 0.04 0.07] /Contents(Click to Toggle #1!)
%/OC << /Type/OCMD /VE[/Not \csname mt@_compatibility@\endcsname] >> % not honoured by older viewers anyway
/A << /S/SetOCGState /State[/Toggle \csname mt@#1@true\endcsname
\csname mt@#1@false\endcsname] >>}
#1 \hfill\pdfendlink & \mt@layer{#1true}{\rlap{on}}\mt@layer{#1false}{off}}
\long\def\microtypesample#1{%
\begingroup
\leftskip 15pt \rightskip 15pt
\parskip 4pt \parindent 0pt
\vskip 8pt % = \topsep without vertical stretchability
\long\def\mt@sample@text{#1}
\mt@pseudo@marg{\color{theblue}%
After you have read the text on the right, you can view the effect of
the features it describes by clicking on the links:\strut\\
\colorbox{theshade}{%
\begin{tabular}{@{}>{\upshape}l@{\quad}l}
\mt@toggle@sample{Protrusion}\\\addlinespace
\mt@toggle@sample{Expansion}
\end{tabular}}\\[0.3\baselineskip]
Both features are enabled throughout this document.}
\mt@show@sample{false}{false}
\mt@show@sample{false}{true}
\mt@show@sample{true} {false}
\mt@layer{_compatibility}{%
% for compatibility with older PDF viewers that don't support OCGs, we
% add a layer that contains a white box, which will hide the underlying
% layers for older viewers, and will be ignored by PDF 1.5 capable viewers.
\mt@place{\rlap{\hskip-\marginparwidth \color{white}%
\vrule width\dimexpr\hsize+\marginparwidth\relax height\mt@unvdimen}}
\mt@pseudo@marg{\color{thered}%
If you had a \acronym{PDF} viewer that understands
\acronym{PDF}\,{\smaller1.5}, you could view the effect of the
micro-typographic features by clicking on the links.\strut
\\\vphantom{\colorbox{white}{\tabular l\\\addlinespace\\\endtabular}}%
\\[0.3\baselineskip] Both features are enabled throughout this document.}}
\mt@show@sample{true}{true}
\vskip 4pt
\endgroup
\edef\x{\pdfpageresources{/Properties <<\mt@resources>>}}\x}
\def\emptypdfpageresources{\pdfpageresources{}}
\font\dummyspace=dummy-space
\pdfglyphtounicode{space}{0020}
\def\lst@outputspace{% copy spaces (from a font that really has a space at x20)
\setbox0\hbox{ }\@tempdima\wd0
\setbox0\hbox{\dummyspace\char"20}\advance\@tempdima-\wd0
\unhbox0 \kern\@tempdima}
\fi
\else
\usepackage{url,xr}
\externaldocument{microtype\ifcodedoc\else-code\fi}
\newcommand\hyperref[2][]{#2}
\let\hyperpage\@firstofone
\let\dochyperpage\@firstofone
\let\docmain\main
\let\texorpdfstring\@firstoftwo
\def\ctanurl{Available from \acronym{CTAN} at \url}
\let\ctanpkgurl\ctanurl
\let\nolinkurl\url
\let\mailto\texttt
\def\mailtoRS{\mailto{[email protected]}}
\let\href\@gobble
\newcommand\textattachfile[3][]{#3 \textit{[File \file{#2} not attached,
because \file{microtype.dtx} hasn't been compiled with \pdftex.]}}
\long\def\microtypesample#1{\begin{quote}#1\end{quote}}
\let\emptypdfpageresources\relax
\fi
\ifx\l@ukenglish\@undefined
\hyphenation{let-ter-spac-ing let-ter-spaced let-ter-space}
\else
\language=\l@ukenglish
\fi
\hyphenation{%An-dre-as Ber-nard Ha-rald Mi-cha-el Pe-ter Ste-phan Wolf-ram
%Har-ders Hop-pe Jac-kow-ski Ku-char-czyk Mei-er Mu-the-si-us Zed-ler
%Die-te-rich Sveinung Marcin RazorXsr
Dyballa Maverick
with-out
Pa-la-ti-no}
\def\fallbacktext#1{{\centering\itshape[#1]\par}}
% abbreviations
\DeclareRobustCommand\thanhthe{Th\^e%
\ifx\eTeXversion\undefined \llap{\raisebox{0.5ex}{\'{}}}%
\else \llap{\raisebox{0.45ex}{\'{}\kern\dimexpr.05em-2\fontdimen1\font\relax}}%
\fi}
\DeclareRobustCommand\thanh{H\`an \thanhthe{} Th\`anh}
\DeclareRobustCommand\pdftex{\texorpdfstring{pdf\kern.05em\TeX\CatIndeX{pdf\TeX}{pdftex}{engine}}{pdfTeX}}
\DeclareRobustCommand\luatex{\texorpdfstring{Lua\kern-.05em\TeX\CatIndeX{Lua\TeX}{luatex}{engine}}{LuaTeX}}
\DeclareRobustCommand\etex{\mbox{e-\kern-.075em\TeX}\CatIndeX{e-\TeX}{etex}{engine}}
\DeclareRobustCommand\nonetex{\rlap{\kern.05em/}\etex} % aka. \TeX
\def\@reflect#1{\ifdim\fontdimen1\font=0pt \reflectbox{#1}\else\rotatebox[origin=c]{180}{#1}\fi}
\DeclareRobustCommand\xe{\textoractual{\@reflect{X}\lower.4ex\hbox{\kern-.066em\@reflect{E}}}{Xe}}% also reflect the initial `X'?
\DeclareRobustCommand\xetex{\xe\kern-.1em\TeX\CatIndeX{\xe\TeX}{xetex}{engine}}
\DeclareRobustCommand\texlive{\TeX~Live\CatIndeX{\TeX~Live}{TeXLive}{distribution}}
\DeclareRobustCommand\miktex{MiK\TeX\CatIndeX{MiK\TeX}{MiKTeX}{distribution}}
\def\githuburl{https://github.com/schlcht/microtype}
\DeclareRobustCommand\githubissue[1]{\let\maybe@comma\@empty
[issue\maybe@plural#1,\@nil~\@for\@ISSUE:=#1\do{%
\maybe@comma\href{\githuburl/issues/\@ISSUE}{\#\@ISSUE}\let\maybe@comma,}]}
\def\maybe@plural#1,#2\@nil{\ifx\relax#2\else s\fi}
\def\microtype{{\PackageFont microtype}}
\def\letterspace{\pkg{letterspace}}
\def\fontdim{\cmd\fontdimen\,}
\def\eg{e.g.}
\def\ie{i.e.}
\def\EM#1{#1\kern.1emem}
\DeclareRobustCommand\smaller{\setbox\z@\hbox{\@tempcnta=\f@size
\edef\x{\@tempcnta=\the\@tempcnta}\expandafter}\x
\advance\@tempcnta-7 \ifcase\@tempcnta\tiny\or\scriptsize\or
\footnotesize\or\small\or\or\normalsize\or\or\large\or\or\or\Large\fi}
\DeclareRobustCommand\acronym[1]{\texorpdfstring{{\smaller\textls[60]{#1}}}{#1}}
\let\less=<
{\catcode`\<=\active
\AtBeginDocument{\catcode`\<=\active
\def<#1>{\acronym{#1}}
\def\contributor#1 <#2\at#3>{\@contributor{#1}{#2@#3}}}}
%\DeclareRobustCommand\@contributor[2]{\textit{#1}}
%\DeclareRobustCommand\@contributor[2]{\href{mailto:#2}{\textit{#1}}}
\ifcodedoc \else
\newwrite\@contributorsfile
\immediate\openout\@contributorsfile=microtype.cdx
\fi
\DeclareRobustCommand\@contributor[2]{\textit{#1}%
{\ifcodedoc\else\let\@indexfile\@contributorsfile\fi
\expandafter\index\expandafter{\@getlastname#1 \@nil\actualchar %\href{mailto:#2}{#1}
\textit{#1} (contributor)\encapchar \ifcodedoc\else doc\fi hyperpage}}}
\def\@getlastname#1 #2\@nil{\ifx\@nil#2\@nil#1\else\@getlastname#2\@nil\fi}
%<*driver>
\CodelineIndex
\EnableCrossrefs
\RecordChanges
\ifcodedoc
\let\printlogo\undefined
\InputIfFileExists{microtype-hist.tmp}
{\def\VersionDate##1##2{\global\expandafter\def\csname MTversiondate##1\endcsname{##2}}}
\relax
\else
\OnlyDescription
\fi
\begin{document}
\DocInput{microtype.dtx}
\end{document}
%</driver>
%</driver|docsty>
% \fi
%
% ^^A -------------------------------------------------------------------------
%\GeneralChanges*
%\ifcodedoc\else
%\changes{v1.0}{2004/09/11}{Initial version}
%\changes{v2.0}{2006/12/29}{new package \letterspace: a stripped-down version,
% containing the letterspacing commands only}
%\changes{v3.0}{2021/10/31}{move development to \href{\githuburl}{GitHub}}
%\changes{v3.1b}{2023/09/30}{add \file{DEPENDS.txt}
% (suggested by \contributor Bruno Victal <mirai\at makinata.eu>)}
% ^^A private mail, 2023/09/29
%
%\GeneralChanges{Documentation}
%\changes{v1.9b}{2006/01/13}{activate expansion in the distributed <PDF>}
%\changes{v2.2}{2007/04/01}{logo transparency and amusement}
%\changes{v3.0}{2021/06/01}{\relax split up in User manual (\file{microtype.pdf})
% and Implementation doc (\file{microtype-code.pdf})}
%\fi
%
% \GetFileInfo{\jobname.dtx}
% \title{\ifx\printlogo\undefined\else\printlogo\fi
% \textls[40]{The \microtype\ package}%
% \\[6pt]\large
% Subliminal refinements towards typographical perfection
% \ifcodedoc\\[9pt]{\Large--- \textls[60]{IMPLEMENTATION} ---}\fi}%
% \author{R Schlicht\\\mailtoRS}
% \date{\fileversion\\\filedate}
%
% \maketitle \thispagestyle{empty}
%
%\begin{abstract}
%\noindent
% The \microtype\ package provides a \LaTeX\ interface to the micro-typographic
% extensions that were introduced by \pdftex\ and some of which have since also
% propagated to \luatex\ and \xetex: most prominently, character protrusion and
% font expansion, furthermore the adjustment of interword spacing and additional
% kerning, as well as hyphenatable letterspacing (tracking) and the possibility
% to disable all or selected ligatures.
% These features may be applied to customisable sets of fonts, and all
% micro-typographic aspects of the fonts can be configured in a straight-forward
% and flexible way. Settings for various fonts are provided.
%
% Note that character protrusion requires \pdftex\ (version~0.14f or later),
% \luatex, or \xetex\ (at least version~0.9997).
% Font expansion works with \pdftex\ (version~1.20 for automatic expansion)
% or \luatex.
% The package will by default enable protrusion and expansion if they can safely
% be assumed to work.
% Disabling ligatures requires \pdftex\ ($\geq$\,1.30) or \luatex, while the
% adjustment of interword spacing and of kerning only works with \pdftex\ ($\geq$\,1.40).
% Letterspacing is available with \pdftex\ ($\geq$\,1.40), \luatex\ ($\geq$\,0.62) or \xetex.
%
% The alternative package \letterspace, which also works with plain \TeX,
% provides the user commands for letterspacing only, omitting support for all
% other extensions (see section~\ref{sec:lettersp}\ifcodedoc\space of the User manual\fi).
%
%\bigskip\noindent
% This package is copyright \textcopyright\ 2004\kern.09em--2025 R Schlicht.
% It may be distributed and/or modified under the conditions of the
% \IfFileExists{lppl.tex}{\hyperref[LPPL:LPPL]}{\href{https://www.latex-project.org/lppl/}}
% {\LaTeX\ Project Public License},
% either version~1.3c of this license or (at your option) any later version.
% This work has the <LPPL> maintenance status `maintained'.
%\end{abstract}
%
%
%\newpage
%\emptypdfpageresources ^^A layers of the logo
%
%{\sffamily\def\familydefault{\sfdefault}\ifcmr\else\DeclareFontSeriesDefault[sf]{bf}{sb}\fi
% \tableofcontents
% \listoftables
% \ifcodedoc\listoffigures\fi
% \vskip2\baselineskip
% \Large\MTsectionfont
% \noindent
% \ifpdf
% \ifcodedoc
% \href{file:microtype.pdf}{User manual}
% \else
% \href{file:microtype-code.pdf}{Implementation}
% \fi
% \normalfont\normalsize (external document)
% \fi
%}
%
%
%\ifcodedoc\else
%