summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/microtype/microtype.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-02-24 03:00:45 +0000
committerNorbert Preining <norbert@preining.info>2022-02-24 03:00:45 +0000
commitdc88afec77f198ebb8774f9c87146f2985e8f156 (patch)
treec2ffe8156173930a3f167b2cdeeb4fc1cd66a6b3 /macros/latex/contrib/microtype/microtype.dtx
parentd529109bf475e3f1e220ce0e980e104b1a7e3c6b (diff)
CTAN sync 202202240300
Diffstat (limited to 'macros/latex/contrib/microtype/microtype.dtx')
-rw-r--r--macros/latex/contrib/microtype/microtype.dtx514
1 files changed, 342 insertions, 172 deletions
diff --git a/macros/latex/contrib/microtype/microtype.dtx b/macros/latex/contrib/microtype/microtype.dtx
index 03f19a1d69..1649f7fed4 100644
--- a/macros/latex/contrib/microtype/microtype.dtx
+++ b/macros/latex/contrib/microtype/microtype.dtx
@@ -3,12 +3,12 @@
% ------------------------------------------------------------------------
% The `microtype' package
% Subliminal refinements towards typographical perfection
-% Copyright (c) 2004--2021 R Schlicht <w.m.l@gmx.net>
+% Copyright (c) 2004--2022 R Schlicht <w.m.l@gmx.net>
%
% 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:
-% http://www.latex-project.org/lppl.txt, and version 1.3c or later is part
+% 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'.
@@ -37,7 +37,7 @@
%<lua-> {microtype-luatex.def}
%<xe-> {microtype-xetex.def}
%<*package|letterspace|m-t|pdf-|lua-|xe-|show>
- [2021/12/10 v3.0b
+ [2022/02/22 v3.0c
%<package> Micro-typographical refinements
%<letterspace> Robust letterspacing
%<show> Visual debugging for the microtype package
@@ -52,8 +52,8 @@
%<luafile>local microtype = microtype
%<luafile>microtype.module = {
%<luafile> name = "microtype",
-%<luafile> version = "3.0b",
-%<luafile> date = "2021/12/10",
+%<luafile> version = "3.0c",
+%<luafile> date = "2022/02/22",
%<luafile> description = "microtype module.",
%<luafile> author = "E. Roux, R. Schlicht and P. Gesang",
%<luafile> copyright = "E. Roux, R. Schlicht and P. Gesang",
@@ -80,8 +80,9 @@
%
%<*driver|docsty>
%<*driver>
-\documentclass[10pt,a4paper]{ltxdoc}
\makeatletter
+\AddToHook{package/doc/before}{\pkgcls@targetdate=1 \def\pkgcls@targetlabel{v2}}
+\documentclass[10pt,a4paper]{ltxdoc}
%</driver>
% Compiling microtype.dtx with the command line option
% --jobname=microtype-code
@@ -389,9 +390,9 @@
\ignorespaces \makeatletter \scan@allowedfalse}%
\def\subitem{\par\hangindent 15pt}%
\def\subsubitem{\subitem\hspace*{7.5pt}}}
-% change history
-% (lots of the following stolen from Tom Bombadil's answer:
-% https://tex.stackexchange.com/a/61251/7674)
+% 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}
@@ -403,48 +404,98 @@
\pgfmathsetmacro{\MThistyears}{\MThistlastyear-\MThistfirstyear}
\pgfmathsetmacro{\MThistvsep}{1.75}
\pgfmathsetmacro{\MThisthshift}{3}
-\pgfmathsetmacro{\MThistnodewidth}{3mm}
\def\MThistprepare{%
- \pgfmathsetmacro{\MThistnodesep}{(\textwidth+\MThisthshift cm-\MThistnodewidth-1pt)/\theMThistitem}
+ \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
- \gpreto\MThistshow{\MT@doversion{#1}{#2}}
- \stepcounter{MThistitem}}
-\def\MT@doversion#1#2{%
- \stepcounter{MThistitem}
- \node[right=\MThistnodesep,text width=\MThistnodewidth,inner sep=1pt,outer sep=0pt,fill=theshade,align=center]
- (n-\theMThistitem) at (\MThistlastnode.west) {\hyperref[sub:changes:#1]{#1\strut}};
- \draw (n-\theMThistitem.north west) -- (n-\theMThistitem.north east);
- \draw (n-\theMThistitem.south west) -- (n-\theMThistitem.south east);
+ \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{%
- \draw[very thick,-latex] (0,0) -- ($(\MThistlastnode.east)-(0,\MThistvsep)+(1,0)$) ;
\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=2pt] (\MThisttimeposition,0) -- (\MThisttimeposition,0.5) -- ($(n-\x.south)-(0,0.5)$) -- (n-\x.south); }
+ \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}%
+ {\hypersetup{linkcolor=thered}%
\hspace{-\MThisthshift cm}%
- \rlap{\begin{tikzpicture}[color=thegrey,font=\fontsize{4.5}{6}\selectfont]
- \MThistprepare
- \MThistshow
- \MThisttimeline
+ \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>
@@ -566,8 +617,9 @@
\DeclareMicrotypeSetDefault,\SetProtrusion,\SetExpansion,\SetTracking,
\SetExtraKerning,\SetExtraSpacing,\DisableLigatures,\DeclareCharacterInheritance,
\DeclareMicrotypeVariants,\DeclareMicrotypeAlias,\DeclareMicrotypeBabelHook,
- \LoadMicrotypeFile,\microtypecontext,\textmicrotypecontext,
- \textls,\lsstyle,\lslig,\leftprotrusion,\rightprotrusion,\Microtype@Hook},
+ \LoadMicrotypeFile,\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,
@@ -606,7 +658,8 @@
{\ifcodedoc User manual\else Implementation\fi}}
%</!docsty>
\externaldocument{microtype\ifcodedoc\else-code\fi}
- \PassOptionsToPackage{nodvi}{totpages} % remove annoying log output
+ \let\r@TotPages\relax % suppress multiply defined warning
+ \PassOptionsToPackage{nodvi}{totpages} % and annoying log output
\usepackage{hyperxmp} % (hyperxmp loads totpages)
\usepackage{attachfile}
\usepackage{pdfpages}
@@ -618,12 +671,12 @@
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--2021 R Schlicht\textLF
+ pdfcopyright={\textcopyright\ 2004--2022 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={http://www.latex-project.org/lppl/},
+ pdflicenseurl={https://www.latex-project.org/lppl/},
pdflang={en-GB}
}
% we no longer use {hypdestopt}, as it would break the external references
@@ -665,7 +718,7 @@
\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{http://mirror.ctan.org/#1}{\nolinkurl{/#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:
@@ -908,9 +961,9 @@
% other extensions (see section~\ref{sec:lettersp}\ifcodedoc\space of the User manual\fi).
%
%\bigskip\noindent
-% This package is copyright \textcopyright\ 2004\kern.09em--2021 R Schlicht.
+% This package is copyright \textcopyright\ 2004\kern.09em--2022 R Schlicht.
% It may be distributed and/or modified under the conditions of the
-% \IfFileExists{lppl.tex}{\hyperref[LPPL:LPPL]}{\href{http://www.latex-project.org/lppl/}}
+% \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'.
@@ -1372,7 +1425,8 @@
%\medskip
%\Describe{Option}{babel}{true,!false}
% Loading the package with the \opt{babel} option will adjust the typesetting
-% according to the respective selected language. Read section~\ref{sec:context}
+% according to the respective selected language. This also works with the
+% \pkg{polyglossia} package. Read section~\ref{sec:context}
% for further information.
%
%\medskip
@@ -2536,7 +2590,7 @@
%
%\medskip
%\Describe{Macro}{\DeclareMicrotypeBabelHook}
-% {list of \pkg{babel} languages,context list}
+% {list of \pkg{babel}/\pkg{polyglossia} languages,context list}
% Naturally, \microtype\ does not know about the typographic specialties of
% every language. This command is a means of teaching it how to adjust the
% context when a particular language is selected. The main configuration file
@@ -2586,7 +2640,8 @@
%\medskip
%\Describe{Macro}{\lslig}{ligature}
% Since the commands \cs{textls} and \cs{lsstyle} will also evaluate the
-% `\texttt{no ligatures}' key for the respective font, you usually need not worry
+% `\texttt{no ligatures}' key for the respective font (cf.
+% section~\ref{sub:tracking}), you usually need not worry
% about protecting or breaking ligatures with most fonts. However, in certain
% situations, there may be a conflict of ligatures beginning with the same
% letter, where some of them should be inhibited, while others should not. For
@@ -2604,7 +2659,7 @@
% (namely, `\textls{\def\!#1{\textcolor{thegreen}{\lslig{#1}}}^^A
% \def\?#1{\textcolor{thered}{#1}}^^A
% \textfrak{Au\!{s:}\?{si}\!{ch}t\!{s:}lo\?{si}gkeit}}',
-% with ligatures here shown in green, inhibited ligatures in red).
+% with ligatures here highlighted in green, inhibited ligatures in red).
%
%\begin{verbatim}[morekeywords={[0]{\kern}}]
%\SetTracking[no ligatures={f}]{encoding = LY, family = yfrak}{120}
@@ -2663,7 +2718,8 @@
% ^^A Otherwise, it won't work at all
%
%
-%\section{Being pedantic about protrusion}\label{sec:pedantic}
+%\section[Being pedantic about protrusion]
+% {Being pedantic about protrusion \requires{\etex}}\label{sec:pedantic}
%
% Protrusion works well in running paragraphs, but may also be desirable
% in situations where \TeX, in contrast to human eyes, would not see a margin,^^A
@@ -2696,7 +2752,11 @@
%\DescribeMacro{\noprotrusion}
% is a command from \LaTeX\ proper, so it's just mentioned apropos.
% When added to the beginning or end of a line, protrusion at the respective
-% margin will be prevented.
+% margin will be prevented.\linebreak
+%\DescribeMacro{\noprotrusionifhmode}
+% While the latter command will always leave vertical mode first
+% (which in some situations may result in unwanted vertical space),
+% this variant prevents protrusion only if already in horizontal mode.
%
%\medskip\noindent
% The \microtype\ package defines a number of patches in order to get protrusion
@@ -2713,20 +2773,24 @@
% line above -- are neatly aligned; without the patch, the first A would be
% slightly shifted to the right.
% This patch also affects environments such as |quote| or |flushleft|, which are
-% implemented in \LaTeX\ as lists with an implicit empty item.
+% implemented in \LaTeX\ as lists starting with an implicit empty item.
% \MTsupp{standard classes, \cls{beamer}, \cls{simplecv}}
-% \item[toc] Adds protrusion at the left margin of sectioning titles in the Table of Contents
+% \item[toc] Adds protrusion at the left margins of sectioning titles in the Table of Contents
% and similar Lists of \meta{Things}.
% \MTsupp{standard classes, \cls{memoir}}
-% \item[footnote] Protrusion for the first line of footnote text (only visible when
-% the footnote text is set in block paragraphs, like in this document).
+% \item[footnote] Protrusion for the first line of footnote text (visible in particular
+% when the footnote text is set in block paragraphs, like in this document).
% \MTsupp{standard classes, \cls{memoir}, <\cls{KOMA}> classes, \pkg{hyperref}}
-% \item[eqnum] Protrusion for equation numbers on either side.
+% \item[eqnum] Protrusion for equation numbers on either side. If you are using the
+% interface provided by \pkg{mathtools}, insert the relevant commands
+% yourself, \eg:
+%\begin{verbatim}[belowskip=-\smallskipamount]
+%\newtagform{mytag}[\textbf]{\leftprotrusion{(}}{\rightprotrusion{)}}
+%\end{verbatim}^^A
% \MTsupp{standard classes, \pkg{amsmath}, \cls{IEEEtran}}
%\endlist\endgroup
%
-%\enlargethispage{\baselineskip} ^^A layout
-%\noindent
+%\medskip\noindent
% By default, all of the above patches will be applied. Should this not be desired,
% or in case you are running into problems, you may prevent or undo the patches through
% the \textcolor{thered}{\opt{patch}} and \textcolor{thered}{\opt{nopatch}} options,
@@ -2741,8 +2805,9 @@
%
%\medskip\noindent
%\leavevmode\llap{\itshape\color{thegrey}Help wanted!\hskip\marginparsep}^^A
-%\leftprotrusion These pedantic protrusion patches are work-in-progress. I suspect many use cases
-% where they either do not work as advertised, or worse, where they may even lead to errors.
+%\leftprotrusion These pedantic protrusion patches are still work-in-progress.
+% I suspect many use cases where they either do not work as advertised,
+% or worse, where they may even lead to errors.
% Also, I am aware that there are myriads of classes and packages out there that
% modify internal commands in their own ways, possibly rendering the patches useless.
% Finally, there will certainly be many more situations where protrusion would be appropriate.
@@ -2750,7 +2815,7 @@
% so I welcome any suggestions and problem reports you may have.
%
%
-%\section{Creating configurations and contributing}\label{sec:contrib} ^^A [also referencd in microtype.ins]
+%\section{Creating configurations and contributing}\label{sec:contrib} ^^A [also referenced in microtype.ins]
%
% I would also be glad to include configuration files for more fonts. Preparing such
% configurations is quite a time-consuming task and requires a lot of patience.
@@ -2934,7 +2999,7 @@
% the settings will only work reliably if you specify the |inputenc| key.
%\changes{v2.3a}{2008/02/25}{add hint about \pkg{babel} having to be loaded first}
% \item When loading the package with the \opt{babel} option, you must load
-% the \pkg{babel} package before \microtype.
+% the \pkg{babel} or \pkg{polyglossia} package before \microtype.
%\changes{v2.5}{2012/09/11}{add hint about \luatex\ compatibility}
% \item Before this package was fully compatible with \luatex, the following
% method of enabling expansion and protrusion with the \cite{fontspec}
@@ -2981,7 +3046,6 @@
% possible in <DVI> mode with \pdftex, it requires that all instances of the expanded fonts
% exist on your \TeX\ system.
%
-%\pagebreak ^^A layout
% \item
%\begin{verbatim}
%! pdfTeX error (font expansion): auto expansion is only possible with scalable fonts.
@@ -2999,7 +3063,7 @@
%Package microtype Warning: Unknown slot number of character
%(microtype) `<\k A>'
%(microtype) in font encoding `TU' in inheritance list
-%(microtype) `microtype.cfg/406(protrusion)'.
+%(microtype) `"\csname MT@pr@inh@TU////\endcsname"'.
%\end{verbatim}
%\changes{v3.0}{2021/06/26}{add hint about unknown slot numbers}
% If you receive lots of warnings like the above, and you are running \luatex\
@@ -3071,7 +3135,6 @@
% \file{pdflatex.ini} (2.5 or newer).
%
% \item
-%\pagebreak ^^A layout
%\begin{verbatim}
%pdfTeX warning (font expansion): font should be expanded before its first use
%\end{verbatim}
@@ -3086,7 +3149,7 @@
% If you wonder how this document was created, just have a look at the source
% code in \file{microtype.dtx}, which is either already included in your \TeX\
% distribution, or else can be downloaded from
-% \href{http://mirror.ctan.org/macros/latex/contrib/microtype/}
+% \href{https://mirror.ctan.org/macros/latex/contrib/microtype/}
% {\acronym{CTAN}}.
% For the source code of the logo on the title page and of the letterspacing
% sample from section~\ref{sub:tracking}, see the Implementation part,
@@ -3149,8 +3212,9 @@
% original meanings of all activated characters, thus allowing for these
% characters to be used in the configuration files.
% \contributor Peter Wilson <herries.press\at earthlink.net>
-% kindly provided a hook in his \pkg{ledmac}/\pkg{ledpar} packages, so that
-% critical editions can finally also benefit from character protrusion.
+% kindly provided a hook in his \pkg{ledmac}/\pkg{ledpar} packages
+% (inherited by their successors \pkg{reledmac}\slash\pkg{reledpar}),
+% so that critical editions can also benefit from character protrusion.
% Likewise,
% \contributor Donald Arseneau <asnd\at triumf.ca>
% patched his \pkg{shapepar} package to accommodate protrusion.
@@ -3257,14 +3321,19 @@
% `\contributor tnull <@\at @>', ^^A https://tex.stackexchange.com/users/91987/tnull
% `\contributor azur <@\at @>', ^^A https://tex.stackexchange.com/users/216369/azur
% `\contributor Safron <@\at @>', ^^A https://tex.stackexchange.com/users/149123/safron
+% \contributor Joseph Wright <@\at @>, ^^A https://tex.stackexchange.com/users/73/joseph-wright
% \contributor Gustavo Barros <@\at @>, ^^A https://tex.stackexchange.com/users/105447/gusbrs
% \contributor Torsten Schuetze <torsten.schuetze\at gmx.net>,
% `\contributor florian <@\at @>', ^^A https://tex.stackexchange.com/users/172863/florian
% \contributor Liang-Bo Wang <@\at @>, ^^A https://github.com/ccwang002
% `\contributor MisterFiLou <@\at @>', ^^A https://github.com/MisterFiLou
-% \contributor Akira Yokosawa <@\at @> ^^A https://github.com/akiyks
+% \contributor Akira Yokosawa <@\at @>, ^^A https://github.com/akiyks
+% `\contributor theufman <@\at @>', ^^A https://github.com/theufman
+% `\contributor frafl <@\at @>', ^^A https://github.com/frafl
+% \contributor Joel Coffman <@\at @>, ^^A https://github.com/joel-coffman
+% `\contributor user182849 <@\at @>' ^^A https://tex.stackexchange.com/users/182849/user182849
% and
-% `\contributor theufman <@\at @>'. ^^A https://github.com/theufman
+% `\contributor NightShade <@\at @>'. ^^A https://tex.stackexchange.com/users/260836/nightshade
%
%\iffalse
%\section{History of micro-typography} ^^A some time ...
@@ -3298,85 +3367,81 @@
%\begin{thebibliography}{}
% \bibitem[Th\`anh 2000]{ThanhThesis}
% \thanh, `Micro-typographic extensions to the \TeX\ typesetting system',
-% \newblock Diss. Masaryk University Brno 2000,
-% \newblock in: \textit{TUGBoat}, vol.~21 (2000), no.~4, pp.~317--434.
-% \newblock (Online at \url{http://www.tug.org/TUGboat/Articles/tb21-4/tb69thanh.pdf})
+% Diss. Masaryk University Brno 2000,
+% in: \textit{TUGBoat}, vol.~21 (2000), no.~4, pp.~317--434.
+% (Online at \url{https://www.tug.org/TUGboat/Articles/tb21-4/tb69thanh.pdf})
%
%\iffalse ^^A obsolete
% \bibitem[Th\`anh 2001]{ThanhTUG}
% \thanh, `Margin Kerning and Font Expansion with \pdftex',
-% \newblock in: \textit{TUGBoat}, vol.~22 (2001), no.~3:
-% `Proceedings of the 2001 Annual Meeting', pp.~146--148.
-% \newblock (Online at \url{http://www.tug.org/TUGboat/Articles/tb22-3/tb72thanh.pdf})
+% in: \textit{TUGBoat}, vol.~22 (2001), no.~3:
+% `Proceedings of the 2001 Annual Meeting', pp.~146--148.
+% (Online at \url{https://www.tug.org/TUGboat/Articles/tb22-3/tb72thanh.pdf})
%\fi
%
% \bibitem[Th\`anh 2004]{ThanhPracTeX}
% \thanh, `Micro-typographic extensions of \pdftex\ in practice',
-% \newblock in: \textit{TUGBoat}, vol.~25 (2004), no.~1:
-% `Proceedings of the Practical \TeX\ 2004 Conference', pp.~35--38.
-% \newblock (Online at \url{http://www.tug.org/TUGboat/Articles/tb25-1/thanh.pdf})
+% in: \textit{TUGBoat}, vol.~25 (2004), no.~1:
+% `Proceedings of the Practical \TeX\ 2004 Conference', pp.~35--38.
+% (Online at \url{https://www.tug.org/TUGboat/Articles/tb25-1/thanh.pdf})
%
%\iffalse
% \bibitem[Th\`anh 2005]{ThanhEuroTeX05}
% \thanh, `Experiences with micro-typographic extensions of \pdftex\ in practice',
-% \newblock in: Euro\TeX\ 2005 Proceedings
-% ^^A 15th~Annual Meeting of the European \TeX\ Users,
-% ^^A March~7 -- March~11, 2005, Abbaye des Pr\'emontr\'es, Pont-\`a-Mousson,
-% [=~\textit{TUGBoat}, vol.~27 (2006), no.~0],
-% pp.~159--164.
-% \newblock (Online at \url{http://www.tug.org/TUGboat/Articles/tb27-0/thanh.pdf})
-% ^^A = \url{http://www.dante.de/dante/events/eurotex/papers/TUT07.pdf}
+% in: Euro\TeX\ 2005 Proceedings
+% ^^A 15th~Annual Meeting of the European \TeX\ Users,
+% ^^A March~7 -- March~11, 2005, Abbaye des Pr\'emontr\'es, Pont-\`a-Mousson,
+% [=~\textit{TUGBoat}, vol.~27 (2006), no.~0], pp.~159--164.
+% (Online at \url{https://www.tug.org/TUGboat/Articles/tb27-0/thanh.pdf})
%\fi
%
% \bibitem[Th\`anh 2008]{ThanhEuroTeX07}
% \thanh, `Font-specific issues in \pdftex',
-% \newblock in: \textit{TUGBoat}, vol.~29 (2008), no.~1:
-% `EuroBacho\TeX\ 2007 Proceedings', pp.~36--41.
-% \newblock (Online at \url{http://www.tug.org/TUGboat/Articles/tb29-1/tb91thanh-fonts.pdf})
+% in: \textit{TUGBoat}, vol.~29 (2008), no.~1:
+% `EuroBacho\TeX\ 2007 Proceedings', pp.~36--41.
+% (Online at \url{https://www.tug.org/TUGboat/Articles/tb29-1/tb91thanh-fonts.pdf})
%
% \bibitem[\pdftex\ manual]{pdftexman}
% \thanh, Sebastian Rahtz, Hans Hagen, Hartmut Henkel, Pawe\l\ Jackowski, Martin Schr\"oder, Karl Berry,
% \emph{The \pdftex\ user manual},
-% \newblock 18~February 2021.
-% \newblock (\ctanurl{systems/doc/pdftex/manual/pdftex-a.pdf})
-% ^^A latest version at \url{http://sarovar.org/projects/pdftex/}
-% ^^A or even \url{http://foundry.supelec.fr/scm/?group_id=23}
+% 18~February 2021.
+% (\ctanurl{systems/doc/pdftex/manual/pdftex-a.pdf})
%
% \bibitem[Fontname]{fontname}
% Karl Berry, \emph{Fontname: Filenames for \TeX\ fonts},
-% \newblock July 2009.
-% \newblock (\ctanurl{info/fontname/fontname.pdf})
+% July 2009.
+% (\ctanurl{info/fontname/fontname.pdf})
%
% \bibitem[\LaTeXe\ font selection]{fntguide}
% \LaTeX\ Project Team, \emph{\LaTeXe\ font selection},
-% \newblock March 2021.
-% \newblock (\ctanurl{macros/latex/base/fntguide.pdf})
+% March 2021.
+% (\ctanurl{macros/latex/base/fntguide.pdf})
%
% \bibitem[\pkg{fontspec}]{fontspec}
% Will Robertson,
-% \emph{The \pkg{fontspec} package: Font selection for \xe\LaTeX\ and Lua\LaTeX},
-% \newblock 21~February 2020.
-% \newblock (\ctanpkgurl{fontspec})
+% \emph{The \pkg{fontspec} package: Font selection for \xe\LaTeX\ and Lua\LaTeX},
+% 15~January 2022.
+% (\ctanpkgurl{fontspec})
%
% \bibitem[\pkg{luaotfload}]{luaotfload}
% \LaTeX3 Project, \'Elie Roux, Khaled Hosny, Philipp Gesang, Ulrike Fischer, Marcel Kr\"uger,
-% \emph{The \pkg{luaotfload} package},
-% \newblock 21~May 2021.
-% \newblock (\ctanpkgurl{luaotfload})
+% \emph{The \pkg{luaotfload} package},
+% 21~May 2021.
+% (\ctanpkgurl{luaotfload})
%
% \bibitem[\pkg{pdfcprot}]{pdfcprot}
% Carsten Schurig, Tobias Schlemmer, \emph{The \pkg{pdfcprot}|.sty| package},
-% \newblock 10 June 2005.
-% \newblock (\ctanpkgurl{pdfcprot})
+% 10 June 2005.
+% (\ctanpkgurl{pdfcprot})
%
% \bibitem[\pkg{soul}]{soul}
% Melchior Franz, \emph{The \pkg{soul} package},
-% \newblock 17 November 2003.
-% \newblock (\ctanpkgurl{soul}).
+% 17 November 2003.
+% (\ctanpkgurl{soul}).
%\changes{v2.3a}{2008/01/06}{mention \pkg{soulutf8}}
-% \newblock See also Heiko Oberdiek's extension of this package,
-% \pkg{soulutf8}, which adds Unicode support.
-% \newblock (\ctanpkgurl{soulutf8})
+% See also Heiko Oberdiek's extension of this package,
+% \pkg{soulutf8}, which adds Unicode support.
+% (\ctanpkgurl{soulutf8})
%
%\end{thebibliography}
%
@@ -3415,6 +3480,8 @@
%
%\VersionDate{\expandafter\@gobble\fileversion}{\filedate}
%
+%\VersionDate{3.0b}{2021/12/10}
+%
%\VersionDate{3.0a}{2021/12/02}
%
%\Version{3.0}{2021/10/31}
@@ -3772,8 +3839,8 @@
%^^A\DoNotIndex{\font,\fontdimen,\fontname,\nullfont,\sfcode,\spacefactor,
%^^A \spaceskip,\xspaceskip} ^^A tex
%\DoNotIndex{\currentgrouplevel,\currentgrouptype,\currentiflevel,\detokenize,
-% \dimexpr,\eTeXversion,\ifcsname,\ifdefined,\lastnodetype,\numexpr,
-% \scantokens,\unexpanded}
+% \dimexpr,\eTeXversion,\ifcsname,\ifdefined,\lastnodetype,\numexpr,\protected,
+% \unexpanded}
%^^A\DoNotIndex{\fontcharwd,\iffontchar} ^^A e-tex
%\DoNotIndex{\pdfannot,\pdfmatch,\pdfoutput,\pdfstrcmp,
% \pdftexrevision,\pdftexversion}
@@ -3784,7 +3851,7 @@
%\DoNotIndex{\XeTeXversion,\XeTeXrevision,\strcmp}
%^^A\DoNotIndex{\XeTeXcharglyph,\XeTeXfonttype,\XeTeXglyph,\XeTeXglyphindex,
%^^A \XeTeXglyphname,\XeTeXlastfontchar,\XeTeXprotrudechars} ^^A xetex
-%\DoNotIndex{\directlua,\glet,\luatexversion}
+%\DoNotIndex{\directlua,\glet,\luatexversion,\pdfextension,\pdffeedback}
%^^A\DoNotIndex{\adjustspacing,\copyfont,\expandglyphsinfont,
%^^A \ignoreligaturesinfont,\outputmode,\protrudechars,\tracingfonts} ^^A luatex
%\DoNotIndex{\eplain,\usepkg@pkg} ^^A eplain
@@ -3792,13 +3859,13 @@
% \@currname,\@defaultunits,\@elt,\@empty,\@eqnnum,\@expandtwoargs,\@fileswfalse,
% \@firstofone,\@firstoftwo,\@footnotetext,\@gobble,\@gobbletwo,\@ifclassloaded,
% \@ifl@t@r,\@ifl@aded,\@ifpackagelater,\@ifpackageloaded,\@ifstar,\@ifundefined,\@item,
-% \@let@token,\@m,\@M,\@makeother,\@minus,\@nameuse,\@ne,\@newlistfalse,\@nil,\@nnil,
-% \@onelevel@sanitize,\@onlypreamble,\@pkgextension,\@plus,\@ptionlist,\@removeelement,
-% \@secondoftwo,\@spaces,\@sptoken,\@tempa,\@tempb,\@tempc,\@tempcnta,\@tempcntb,\@tempdima,
-% \@typeset@protect,\@undefined,\@unprocessedoptions,\@unusedoptionlist,\@xobeysp,
-% \check@icr,\cl@@ckpt,\color@begingroup,\color@endgroup,\g@addto@macro,\hmode@bgroup,\m@ne,
-% \maybe@ic,\maybe@ic@,\nfss@text,\not@math@alphabet,\on@line,\p@,\set@display@protect,
-% \strip@prefix,\strip@pt,\@text@composite,\tw@,\z@,\z@skip,\zap@space,
+% \@let@token,\@m,\@M,\@makeother,\@minus,\@mpfootnotetext,\@nameuse,\@ne,\@newlistfalse,
+% \@nil,\@nnil,\@onelevel@sanitize,\@onlypreamble,\@pkgextension,\@plus,\@ptionlist,
+% \@removeelement,\@secondoftwo,\@spaces,\@sptoken,\@tempa,\@tempb,\@tempc,\@tempcnta,
+% \@tempcntb,\@tempdima,\@typeset@protect,\@undefined,\@unprocessedoptions,\@unusedoptionlist,
+% \@xobeysp,\check@icr,\cl@@ckpt,\color@begingroup,\color@endgroup,\g@addto@macro,
+% \hmode@bgroup,\m@ne,\maybe@ic,\maybe@ic@,\nfss@text,\not@math@alphabet,\on@line,
+% \p@,\set@display@protect,\strip@prefix,\strip@pt,\@text@composite,\tw@,\z@,\z@skip,\zap@space,
% \active,\documentclass,\dotfill,\fbox,\fboxrule,\fboxsep,\fmtversion,\footnotesize,
% \leavevmode,\llap,\makeatletter,\makebox,\mathrm,\mbox,\medskip,\newbox,\newcommand,
% \newcount,\newdimen,\newif,\newline,\newskip,\newtoks,\nobreak,\nonfrenchspacing,
@@ -3807,7 +3874,7 @@
% \value,\AddToHook,\AtBeginDocument,\AtEndOfPackage,\CheckCommand,\CurrentOption,
% \DeclareOption,\DeclareRobustCommand,\IfFileExists,\IfFormatAtLeastTF,\InputIfFileExists,
% \MessageBreak,\PackageError,\PackageInfo,\PackageWarning,\PassOptionsToPackage,
-% \ProcessOptions,\RequirePackage,\@@enc@update,\UnicodeEncodingName}
+% \ProcessOptions,\RawNoindent,\RequirePackage,\@@enc@update,\UnicodeEncodingName}
%^^A\DoNotIndex{\add@accent,\cf@encoding,\curr@fontshape,\define@newfont,
%^^A \do@subst@correction,\f@encoding,\f@family,\f@size,\font@name,\fontencoding,
%^^A \fontseries,\fontshape,\glb@currsize,\glb@settings,\normalfont,\pickup@font,
@@ -3815,9 +3882,10 @@
%\DoNotIndex{\normalpdfoutput,\normalpdftexversion,\normalpdftexrevision} ^^A tex live 2004
%\DoNotIndex{\foreign@language,\languagename,\select@language,\shorthandoff} ^^A babel
%\DoNotIndex{\percentsign} ^^A babel/spanish,galician,mexican
+%\DoNotIndex{\polyglossia@language@switched} ^^A polyglossia
%\DoNotIndex{\CJK@ifundefined,\CJK@plane,\CJK@temp,\CJK@addcmap} ^^A CJK,CJKutf8
%\DoNotIndex{\color} ^^A color
-%\DoNotIndex{\@disablequotes} ^^A csquotes
+%\DoNotIndex{\csqQQ,\csq@bqgroup,\csq@eqgroup,\@disablequotes} ^^A csquotes
%\DoNotIndex{\ifHy@hyperfootnotes,\pdfstringdefDisableCommands,\pdfstringdefWarn} ^^A hyperref
%\DoNotIndex{\ifpdf,\ifetex,\ifluatex,\ifxetex} ^^A ifpdf/iftex
%\DoNotIndex{\@inpenc@undefined@,\IeC,\inputencoding,\inputencodingname} ^^A inputenc
@@ -3987,6 +4055,8 @@
\newcommand*\textmicrotypecontext[2]{#2}
\newcommand\leftprotrusion[1]{#1}
\newcommand\rightprotrusion[1]{#1}
+\providecommand*\noprotrusion{}
+\newcommand*\noprotrusionifhmode{}
\@ifpackageloaded{letterspace}{\let\MT@textls\relax}{%
%</package>
\newcommand*\lsstyle{}
@@ -4157,6 +4227,8 @@
% requires a viewer for <PDF> version 1.5 (you could use |/Text| if you're
% using an older <PDF> viewer).
% \begin{macrocode}
+\ifx\directlua\@undefined \else
+ \protected\def\pdfannot{\pdfextension annot }\fi
\def\MT@show@pdfannot#1{%
\ifnum\tracingmicrotypeinpdf<#1 \else
\iftracingmicrotypeinpdfall\leavevmode\fi
@@ -4904,14 +4976,20 @@
^^X\RequirePackage{etoolbox}
% \end{macrocode}
%\begin{macro}{\MT@toks}
-% We need a token register.
+% We need a token register,
%\changes{v1.9}{2005/09/28}{use instead of \cmd\toks@}
% \begin{macrocode}
\newtoks\MT@toks
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\MT@tempbox}
+% our own box,
+% \begin{macrocode}
+\newbox\MT@tempbox
+% \end{macrocode}
+%\end{macro}
%\begin{macro}{\ifMT@if@}
-% A scratch if.
+% and a scratch if.
% \begin{macrocode}
\newif\ifMT@if@
% \end{macrocode}
@@ -6292,7 +6370,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@with@package@T{csquotes}{%
\@ifpackagelater{csquotes}{2005/05/11}{%
\g@addto@macro\MT@setupfont@hook\@disablequotes
- \g@addto@macro\MT@prot@hook\@disablequotes
+ ^^X\apptocmd\csq@bqgroup{\let\MT@csq@eqgroup\csq@eqgroup}\relax\relax
}{%
\MT@warning@nl{%
Should you receive warnings about unknown slot\MessageBreak
@@ -6653,11 +6731,12 @@ time will almost certainly lead to undesired results. Have your choice!}%
% \item (a patch for \pkg{titletoc} would also be worthwhile~\dots)
%\todo{patch for \pkg{titletoc}}
% \end{itemize}
-% \item [|eqnum|] equation numbers (with or without \pkg{amsmath}). \cmd\eqref\ relies
-% on \cmd\tagform@, so we have to make it use the original definition.
+% \item [|eqnum|] equation numbers
%\changes{v3.0}{2021/05/21}{protrusion patch for equation numbers
% (provided by \contributor Holger Gerhardt <holger.gerhardt\at uni-bonn.de>)}
%\changes{v3.0a}{2021/11/22}{protrusion patch \texttt{eqnum} for \cls{IEEEtran}}
+% \begin{itemize}
+% \item \cls{IEEEtran}
% \begin{macrocode}
\MT@define@patch{eqnum}{%
\@ifclassloaded{IEEEtran}
@@ -6666,17 +6745,43 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@patch@patch\theIEEEsubequationdis{(}{\leftprotrusion{(}}%
\MT@patch@patch\theIEEEsubequationdis{)}{\rightprotrusion{)}}}%
{}%
+% \end{macrocode}
+% \item \cmd\eqref\ relies on \cmd\tagform@, so we have to have it
+% use the original definition.
+% \begin{macrocode}
\@ifpackageloaded{amsmath}
{\MT@patch@patch\tagform@{(}{\leftprotrusion{(}}%
\MT@patch@patch\tagform@{)}{\rightprotrusion{)}}%
- \MT@patch@patch\eqref{\tagform@}{\@nameuse{MT@patch@saved@\string\tagform@}}}
+ \MT@patch@patch\eqref{\tagform@}{\@nameuse{MT@patch@saved@\string\tagform@}}%
+% \end{macrocode}
+% \item If the user has altered the tags' appearance via \pkg{mathtools}'s \cmd\newtagform\
+% interface, our patch won't have any effect. We don't issue a warning
+% because \verb/\(left|right)protrusion/ might have been specified appropriately
+% in \cmd\newtagform. We could also patch the latter command (or, to be more
+% precise, |\MT_define_tagform:nwnn|), but the timing is a bit tricky, so
+% for now info it is.
+%\todo{patch for \pkg{mathtools}'s \cmd\newtagform}
+%\changes{v3.0c}{2021/12/30}{info that protrusion patch \texttt{eqnum} may not be effective with \pkg{mathtools}
+% (reported by \contributor user182849 <@\at @>)}
+% ^^A https://tex.stackexchange.com/questions/628090/usetagform-incompatible-with-microtype/
+% \begin{macrocode}
+ \MT@with@package@T{mathtools}{%
+ \ifMT@patch@ok\else \MT@patch@oktrue
+ \MT@info@nl{The `eqnum' patch may not be effective because you are\MessageBreak
+ using the mathtools package. Make sure to insert\MessageBreak
+ `\@backslashchar leftprotrusion' and
+ `\@backslashchar rightprotrusion' as\MessageBreak
+ appropriate in mathtools's `\@backslashchar newtagform' command}%
+ \fi}}
{\MT@patch@patch\@eqnnum{(}{\leftprotrusion{(}}%
\MT@patch@patch\@eqnnum{)}{\rightprotrusion{)}}}%
}{}%
% \end{macrocode}
+% \end{itemize}
% \item [|footnote|] footnote text (only visible with block paragraphs)
-%\changes{v3.0}{2021/05/25}{protrusion patch for footnote text}
-%\begin{itemize}
+%\changes{v3.0}{2021/05/25}{protrusion patch for footnote text}^^A
+%\changes{v3.0c}{2022/01/21}{protrusion patch \texttt{footnote}: also for minipages}^^A
+% \begin{itemize}
% \item \pkg{hyperref} also patches this command (but only if |hyperfootnotes=true|)
%\changes{v3.0a}{2021/11/30}{fix protrusion patch \texttt{footnote} with \pkg{hyperref}
% (reported by \contributor Liang-Bo Wang <@\at @>) \githubissue{2}}
@@ -6686,27 +6791,34 @@ time will almost certainly lead to undesired results. Have your choice!}%
{\ifHy@hyperfootnotes\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\@secondoftwo
{\MT@patch@patch\@footnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}%
- \MT@patch@patch\@footnotetext{\@empty\ignorespaces}{\@empty\ignorespaces\leftprotrusion}}
+ \MT@patch@patch\@footnotetext{\@empty\ignorespaces}{\@empty\ignorespaces\leftprotrusion}%
+ \MT@patch@patch\@mpfootnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}%
+ \MT@patch@patch\@mpfootnotetext
+ {{\expandafter\hyper@@anchor\expandafter
+ {\Hy@footnote@currentHref}{\relax}}\ignorespaces}
+ {{\expandafter\hyper@@anchor\expandafter
+ {\Hy@footnote@currentHref}{\relax}}\ignorespaces\leftprotrusion}}
% \end{macrocode}
-% \item so do the <\cls{KOMA}> classes (which load \pkg{scrkbase})
-%\changes{v3.0a}{2021/12/02}{fix protrusion patch \texttt{footnote} with <\cls{KOMA}> classes
-% (reported by \contributor MisterFiLou <@\at @>) \githubissue{2}}
+% \item \cls{memoir} additionally allows footnotes in the margins
% \begin{macrocode}
- {\@ifpackageloaded{scrkbase}
- {\MT@patch@patch\scr@saved@footnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}}
+ {\@ifclassloaded{memoir}
+ {\MT@patch@patch\@footnotetext{\foottextfont #1}{\foottextfont\leftprotrusion #1}%
+ \MT@patch@patch\@mpfootnotetext{\foottextfont #1}{\foottextfont\leftprotrusion #1}}
+ {\MT@patch@patch\@mpfootnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}%
% \end{macrocode}
-% \item base classes
+% \item the <\cls{KOMA}> classes (which load \pkg{scrkbase})
+%\changes{v3.0a}{2021/12/02}{fix protrusion patch \texttt{footnote} with <\cls{KOMA}> classes
+% (reported by \contributor MisterFiLou <@\at @>) \githubissue{2}}
% \begin{macrocode}
- {\MT@patch@patch\@footnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}%
+ \@ifpackageloaded{scrkbase}
+ {\MT@patch@patch\scr@saved@footnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}}%
% \end{macrocode}
-% \item \cls{memoir} additionally allows footnotes in the margins
+% \item the base classes
% \begin{macrocode}
- \@ifclassloaded{memoir}
- {\MT@patch@patch\@footnotetext{\foottextfont #1}{\foottextfont\leftprotrusion #1}}
- {}}}%
+ {\MT@patch@patch\@footnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}}}}%
}{}%
% \end{macrocode}
-%\end{itemize}
+% \end{itemize}
% Finally, execute any redefinitions.
% \begin{macrocode}
\MT@redefined@patches
@@ -6978,7 +7090,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
%<pdf-> \pdffontsize\MT@font
%<lua-> \MT@requires@luatex4{\pdffeedback fontsize}{\pdffontsize}\MT@font
%<xe-> \MT@size pt
- \MT@info{Fixing zero \string\fontdimen 6 for font `\MT@@font'\MessageBreak
+ \MT@info{Fixing zero \@backslashchar fontdimen 6 for font `\MT@@font'\MessageBreak
(new value: \the\fontdimen6\MT@font)}%
%<pdf-> \MT@requires@pdftex8\relax{\MT@glet@nc{\MT@@font-fake6}\@empty}%
\fi
@@ -7942,9 +8054,11 @@ time will almost certainly lead to undesired results. Have your choice!}%
}
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\MT@tempbox}
+%\begin{macro}{\noprotrusionifhmode}
+%\changes{v3.0c}{2021/12/22}{new command}
+% Same, but only if we're already in hmode.
% \begin{macrocode}
-\newbox\MT@tempbox
+\DeclareRobustCommand\noprotrusionifhmode{\relax\ifhmode\kern-\p@\kern\p@\fi}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\leftprotrusion}
@@ -7953,8 +8067,11 @@ time will almost certainly lead to undesired results. Have your choice!}%
% We try to reconstruct the next glyph (possibly a ligature).\footnote{
% \luatex\ offers the command \cmd\protrusionboundary, which could
% potentially be very helpful here, but it doesn't seem to do what it
-% promises (not even the example from the manual works as advertised).}
+% promises (not even the example from the manual works as advertised).
% ^^A cf. https://mailman.ntg.nl/pipermail/dev-luatex/2021-May/006486.html
+% Maybe \contributor Marcel Kr\"uger <@\at @>'s attempt at a
+% |betterprotrusionboundary| (\url{https://tex.stackexchange.com/a/629080})
+% could be an option.}
% \begin{macrocode}
\DeclareRobustCommand\leftprotrusion{%
\MT@toks{}%
@@ -7965,52 +8082,72 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\begin{macro}{\MT@prot@l}
%\changes{v3.0b}{2021/12/05}{make \cmd\long\ again
% (reported by \contributor Akira Yokosawa <@\at @>) \githubissue{3}}
+%\changes{v3.0c}{2022/01/14}{next try at removing \cmd\long}
% This probably doesn't need to be \cmd\long\ any longer.
% \begin{macrocode}
-\long\def\MT@prot@l#1{%
+\def\MT@prot@l#1{%
\MT@get@prot{#1}{left}%
#1%
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\rightprotrusion}
+%\changes{v3.0}{2021/05/15}{new command}
+%\begin{macro}{\MT@prot@r}
+%\changes{v3.0c}{2022/01/14}{no longer \cmd\long}
% Unfortunately, there's no way to retrieve anything that's already been typeset,
% so the counterpart cannot be defined symmetrically.
-%\changes{v3.0}{2021/05/15}{new command}
% \begin{macrocode}
\DeclareRobustCommand\rightprotrusion{\MT@prot@r}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\MT@prot@r}
-% \begin{macrocode}
-\long\def\MT@prot@r#1{%
+\def\MT@prot@r#1{%
{#1}%
\MT@get@prot{#1}{right}%
}
% \end{macrocode}
%\end{macro}
+%\end{macro}
%\begin{macro}{\MT@get@prot}
% Typeset the text inside a box and get the left and right margin kerns.
% We add an extra \cmd\vbox\ in case we're inside a |tabular|.
% \cmd\@newlistfalse\ is meant to make \cmd\\ work in |centering| etc.
-%\changes{v3.0a}{2021/11/22}{reset counters}
+%\changes{v3.0a}{2021/11/22}{reset counters}^^A
%\changes{v3.0a}{2021/11/05}{compatibility fix for \pkg{csquotes}
-% (reported by \contributor Gustavo Barros <@\at @>) \githubissue{1}}
+% (reported by \contributor Gustavo Barros <@\at @>) \githubissue{1}}^^A
% ^^A https://tex.stackexchange.com/questions/621440/microtype-csquotes-autoquote-and-itemize-interaction
%\changes{v3.0a}{2021/11/27}{set penalties to zero and vfuzz to max
-% (reported by \contributor florian <@\at @>)}
+% (reported by \contributor florian <@\at @>)}^^A
% ^^A https://tex.stackexchange.com/questions/624171/overfull-vbox-in-list-of-figures-since-miktex-update
-%\changes{v3.0b}{2021/12/05}{unconditionally \cmd\leavevmode}
+%\changes{v3.0b}{2021/12/05}{unconditionally \cmd\leavevmode}^^A
% We set various penalties to zero to allow linebreaking, and don't
% bother if the split box is overfull (but shouldn't we? -- after all,
% that's how the penalties bug was discovered~\dots).
%\begin{macro}{\MT@ckpt}
% We also reset the counters and disable writing to auxiliary files.
%\begin{macro}{\MT@prot@hook}
-% Furthermore, we have a hook for compatibility fixes.
+% Furthermore, we have a hook for compatibility fixes (not used at the moment),
+%\begin{macro}{\MT@csq@eqgroup}
+%\changes{v3.0c}{2022/01/06}{compatibility for \pkg{csquotes}, again
+% (reported by \contributor NightShade <@\at @>)}
+% ^^A https://tex.stackexchange.com/questions/629068/microtype-quotation-marks-in-itemize-not-aligned-properly-at-begin-of-an-item
+% and a command for \pkg{csquotes}'s grouping (because we actually typeset
+% the quote character, instead of disabling quotes altogether (as we suggested
+% for \githubissue{1}, which was wrong)).
+%\begin{macro}{\MT@noindent}
+%\changes{v3.0c}{2022/01/14}{use \cmd\RawNoindent, if available \githubissue{8}}
+% Finally, \LaTeX's new paragraph hooks require special attention, as they're
+% (currently?) unable to distinguish between real typesetting and trial runs.
+% In our case, fortunately, we really don't want to trigger the hooks.
+% Also, we don't need a \cmd\RawParEnd\ at the end (as suggested in \file{ltpara}),
+% I think, as none of our commands are \cmd\long\ anymore.
% \begin{macrocode}
\let\MT@prot@hook\@empty
-\long\def\MT@get@prot#1#2{%
+\let\MT@csq@eqgroup\relax
+\ifx\RawNoindent\@undefined
+ \let\MT@noindent\noindent
+\else
+ \let\MT@noindent\RawNoindent
+\fi
+\def\MT@get@prot#1#2{%
\begingroup
\def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
\edef\MT@ckpt{\cl@@ckpt}%
@@ -8025,7 +8162,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\interlinepenalty\z@
\@newlistfalse
\MT@prot@hook
- \noindent #1}%
+ \MT@noindent #1\MT@csq@eqgroup}%
\vbadness=\@M
\splittopskip=\z@
\vfuzz=\maxdimen
@@ -8052,6 +8189,8 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\end{macro}
%\end{macro}
%\end{macro}
+%\end{macro}
+%\end{macro}
%\begin{macro}{\MT@prot@ifx}
% Test next token.
% \begin{macrocode}
@@ -8073,7 +8212,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\begin{macro}{\MT@prot@ifmacro@@}
% Test whether \meta{\#1} is a macro or an active character
% that does not take an argument.
-% (inspired by Joseph Wright). ^^A https://tex.stackexchange.com/a/331696/
+% (inspired by \contributor Joseph Wright <@\at @>). ^^A https://tex.stackexchange.com/a/331696/
% Only works with \etex.
% \begin{macrocode}
^^X\def\MT@prot@ifmacro{%
@@ -8095,11 +8234,15 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\end{macro}
%\end{macro}
%\begin{macro}{\MT@prot@iffirstcmd}
-% Test for the first command.
+% Test whether the first token in \cs{MT@prot@next} (once expanded) is the
+% command \meta{\#1}. Since \cs{MT@prot@next} may also be user-defined (or
+% whatever), we have to use our own, \cmd\long\ version of \cmd\@car.
+%\changes{v3.0c}{2021/12/17}{use \cmd\long\ variant of \cmd\@car\
+% (reported by \contributor frafl <@\at @>) \githubissue{6}}
% \begin{macrocode}
\def\MT@prot@iffirstcmd#1{%
- \ifx\relax#1\relax\expandafter\@secondoftwo\else
- \MT@exp@two@c\ifx\@car\MT@prot@next\relax\@empty\@nil#1%
+ \ifx\relax#1\expandafter\@secondoftwo\else
+ \MT@exp@two@c\ifx\MT@car\MT@prot@next\relax\@nil#1%
\expandafter\expandafter\expandafter\@firstoftwo
\else
\expandafter\expandafter\expandafter\@secondoftwo
@@ -8108,6 +8251,12 @@ time will almost certainly lead to undesired results. Have your choice!}%
}
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\MT@car}
+% A long car.
+% \begin{macrocode}
+\long\def\MT@car#1#2\@nil{#1}
+% \end{macrocode}
+%\end{macro}
%\begin{macro}{\MT@prot@iflicrcmd}
% Fun with <LICR>:
% Test if the first command of the third command of the first command
@@ -8138,6 +8287,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
% If we have a group, we inject \cs{MT@prot@get@firstchar} at the
% beginning again and don't bother about the rest. This still allows,
% \eg, |\verb|, |verbatim| or |lstlistings| material.
+% The downside of being this cautious is that we'll miss lots of cases.
%\changes{v3.0b}{2021/12/05}{don't rescan anymore
% (reported by \contributor Akira Yokosawa <@\at @>
% and \contributor theufman <@\at @>) \githubissue{3,4}}
@@ -8194,11 +8344,16 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@prot@iffirstcmd\UTFviii@four@octets{%
\def\MT@temp*##1##2##3##4{\MT@prot@l{##1##2##3##4}}%
}{%
- \MT@prot@iflicrcmd{T1}{%
- \MT@prot@iflicrcmd{TU}{%
- \MT@prot@iflicrcmd{LY1}{%
- \MT@prot@iflicrcmd{OT1}{%
- \MT@prot@iflicrcmd{T2A}\relax % should we add more encodings?
+% \end{macrocode}
+% (this is for \pkg{csquotes})
+% \begin{macrocode}
+ \MT@prot@iffirstcmd\csqQQ{\def\MT@temp*##1{\MT@prot@l{##1}}}{%
+ \MT@prot@iflicrcmd{T1}{%
+ \MT@prot@iflicrcmd{TU}{%
+ \MT@prot@iflicrcmd{LY1}{%
+ \MT@prot@iflicrcmd{OT1}{%
+ \MT@prot@iflicrcmd{T2A}\relax % should we add more encodings?
+ }%
}%
}%
}%
@@ -12191,7 +12346,7 @@ end
\renewcommand*\DisableLigatures[2][]{%
\MT@error{Disabling ligatures of a font is only possible\MessageBreak
with pdftex version 1.30 or newer.\MessageBreak
- Ignoring \string\DisableLigatures}{%
+ Ignoring \@backslashchar DisableLigatures}{%
%<pdf-> Upgrade
%<xe-> Use
pdftex.}%
@@ -13796,8 +13951,8 @@ end
% is now officially deprecated.
% \begin{macrocode}
\MT@ifdefined@c@T\MicroType@Hook{\MT@error{%
- Command \string\MicroType@Hook\space is deprecated.\MessageBreak
- Use \string\Microtype@Hook\space instead}
+ Command \@backslashchar MicroType@Hook is deprecated.\MessageBreak
+ Use \@backslashchar Microtype@Hook instead}
{You might want to inform the font package authors.}\MicroType@Hook}
\MT@ifdefined@c@T\Microtype@Hook\Microtype@Hook
% \end{macrocode}
@@ -14490,9 +14645,9 @@ end
\ifnum\sfcode`\. > 1500
\MT@ifstreq\MT@sp@context{nonfrench}\relax{%
\MT@warning@nl{%
- \string\nonfrenchspacing\space is active. Adjustment of\MessageBreak
+ \@backslashchar nonfrenchspacing is active. Adjustment of\MessageBreak
interword spacing will disable it. You might want\MessageBreak
- to add `\@backslashchar\MT@MT context{spacing=nonfrench}'\MessageBreak
+ to add `\@backslashchar microtypecontext{spacing=nonfrench}'\MessageBreak
to your preamble}%
}%
\fi
@@ -14664,7 +14819,7 @@ end
}
% \end{macrocode}
%\end{macro}
-% We patch the language switching commands to enable language-dependent setup.
+% We patch \pkg{babel}'s language switching commands to enable language-dependent setup.
% \begin{macrocode}
\MT@addto@setup{%
\ifMT@babel
@@ -14710,9 +14865,26 @@ end
% In case \pkg{babel} was loaded before \microtype:
% \begin{macrocode}
\MT@set@babel@context\languagename
+% \end{macrocode}
+% The \pkg{polyglossia} package has a useful hook.
+%\changes{v3.0c}{2022/01/21}{make \opt{babel} option work with \pkg{polyglossia}}
+% Unfortunately, compatibility with \pkg{polyglossia} is less useful in itself,
+% as only \luatex\ allows working on font copies, and currently doesn't provide
+% the kerning or spacing feature. But who knows, maybe somebody would want more
+% protrusion in French\dots
+% \begin{macrocode}
}{%
- \MT@warning@nl{You did not load the babel package.\MessageBreak
- The `babel' option won't have any effect}%
+ \@ifpackageloaded{polyglossia}{%
+ \MT@info@nl{Registering with polyglossia's language switching hook}%
+ \gappto\polyglossia@language@switched{%
+ \MT@set@babel@context{\languagename}%
+ }%
+ \MT@set@babel@context\languagename
+ }{%
+ \MT@warning@nl{%
+ You did not load the babel or the polyglossia package.\MessageBreak
+ The `babel' option won't have any effect}%
+ }%
}%
\fi
}
@@ -15378,7 +15550,7 @@ end
% ^^A http://tug.org/pipermail/tex-live/2008-September/017385.html
% The Romanian \cmd\textcommabelow\ accents are actually replacements for the
% \cmd\c\ variants, which had previously (and erroneously\footnote{
-% Cf. \url{http://tug.org/pipermail/tex-live/2008-August/017204.html}})
+% Cf. \url{https://tug.org/pipermail/tex-live/2008-August/017204.html}})
% been included in <QX> encoding. They are still kept for backwards
% compatibility.
%\iffalse
@@ -19402,7 +19574,7 @@ end
% (|space| or |1em|). For Times, for example, a thin space would be 665. I
% don't know whether French typography really wants a thin space, or rather (as
% it happens to turn out with <CMR>) half a space.
-% (Wikipedia\footnote{\url{http://fr.wikipedia.org/wiki/Espace_typographique}, 5 July 2007.}
+% (Wikipedia\footnote{\url{https://fr.wikipedia.org/wiki/Espace_typographique}, 5 July 2007.}
% claims it should be a quarter of an em, which seems too much to me; then
% again, it also says that this \emph{was} a thin space in French typography.)
% \begin{macrocode}
@@ -19565,11 +19737,9 @@ This is the current font stretched by 5\%, normal, and shrunk by 5\%:
% \appendix
% \AppendixSettings
% \GeneralChanges{Documentation}
-%
%\changes{v2.5}{2013/02/23}{include \file{microtype-logo.dtx} and \file{microtype-lssample.dtx}}
% \InputIfFileExists{microtype-logo.dtx}\relax\relax
% \InputIfFileExists{microtype-lssample.dtx}\relax\relax
-%
% \PrintChanges
%
% ^^A -------------------------------------------------------------------------
@@ -19591,7 +19761,7 @@ This is the current font stretched by 5\%, normal, and shrunk by 5\%:
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-% \CheckSum{12313}
+% \CheckSum{12399}
%
% \Finale
%