summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/microtype
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-12-14 03:03:05 +0000
committerNorbert Preining <norbert@preining.info>2024-12-14 03:03:05 +0000
commitee322a93b7ab820250eb83dc0aa9057a1027498a (patch)
tree917a110e13dfde214c2145f2e91d45c1d0814fdb /macros/latex/contrib/microtype
parent51ff03f60cfca1dcc5845978233ed9d35f5ec9b0 (diff)
CTAN sync 202412140303
Diffstat (limited to 'macros/latex/contrib/microtype')
-rw-r--r--macros/latex/contrib/microtype/README.md15
-rw-r--r--macros/latex/contrib/microtype/microtype-code.pdfbin2137618 -> 2164501 bytes
-rw-r--r--macros/latex/contrib/microtype/microtype-utf.dtx2
-rw-r--r--macros/latex/contrib/microtype/microtype.dtx1079
-rw-r--r--macros/latex/contrib/microtype/microtype.pdfbin670969 -> 673182 bytes
5 files changed, 731 insertions, 365 deletions
diff --git a/macros/latex/contrib/microtype/README.md b/macros/latex/contrib/microtype/README.md
index 7dae3d2776..7ee121649c 100644
--- a/macros/latex/contrib/microtype/README.md
+++ b/macros/latex/contrib/microtype/README.md
@@ -4,18 +4,18 @@ The `microtype` package
**Subliminal refinements towards typographical perfection**
- (v3.1b -- 2024/03/29)
+ (v3.2 -- 2024/12/12)
Overview
--------
The `microtype` package provides a LaTeX interface to the micro-typographic
-extensions that were introduced by pdfTeX and 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.
+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
@@ -27,7 +27,8 @@ LuaTeX, or XeTeX (at least version 0.9997). Font expansion works with pdfTeX
enable protrusion and expansion if they can safely be assumed to work.
Disabling ligatures requires pdfTeX (at least version 1.30) or LuaTeX, while
the adjustment of interword spacing and of kerning only works with pdfTeX
-(at least 1.40). Letterspacing is available with pdfTeX (1.40) or LuaTeX (0.62).*
+(at least 1.40). Letterspacing is available with pdfTeX (1.40), LuaTeX (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
diff --git a/macros/latex/contrib/microtype/microtype-code.pdf b/macros/latex/contrib/microtype/microtype-code.pdf
index 186c876991..48d60076ae 100644
--- a/macros/latex/contrib/microtype/microtype-code.pdf
+++ b/macros/latex/contrib/microtype/microtype-code.pdf
Binary files differ
diff --git a/macros/latex/contrib/microtype/microtype-utf.dtx b/macros/latex/contrib/microtype/microtype-utf.dtx
index cfee09e68d..4789976f6b 100644
--- a/macros/latex/contrib/microtype/microtype-utf.dtx
+++ b/macros/latex/contrib/microtype/microtype-utf.dtx
@@ -27,7 +27,7 @@
\ProvidesFile
%</!EBGaramond>
%<*driver>
- {\jobname.dtx}[2024/03/29 v3.1b]
+ {\jobname.dtx}[2024/12/12 v3.2]
%</driver>
%<CharisSIL> {mt-CharisSIL.cfg}[2017/07/07 v1.1 microtype config. file: Charis SIL (RS)]
%<LatinModernRoman> {mt-LatinModernRoman.cfg}[2021/02/21 v1.1 microtype config. file: Latin Modern Roman (RS)]
diff --git a/macros/latex/contrib/microtype/microtype.dtx b/macros/latex/contrib/microtype/microtype.dtx
index c14309de32..5b5e535646 100644
--- a/macros/latex/contrib/microtype/microtype.dtx
+++ b/macros/latex/contrib/microtype/microtype.dtx
@@ -37,7 +37,7 @@
%<lua-> {microtype-luatex.def}
%<xe-> {microtype-xetex.def}
%<*package|letterspace|m-t|pdf-|lua-|xe-|show>
- [2024/03/29 v3.1b
+ [2024/12/12 v3.2
%<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.1b",
-%<luafile> date = "2024/03/29",
+%<luafile> version = "3.2",
+%<luafile> date = "2024/12/12",
%<luafile> description = "microtype module.",
%<luafile> author = "E. Roux, R. Schlicht and P. Gesang",
%<luafile> copyright = "E. Roux, R. Schlicht and P. Gesang",
@@ -942,11 +942,11 @@
%\begin{abstract}
%\noindent
% The \microtype\ package provides a \LaTeX\ interface to the micro-typographic
-% extensions that were introduced by \pdftex\ and 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.
+% 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.
@@ -959,7 +959,7 @@
% 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) or \luatex\ ($\geq$\,0.62).
+% 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
@@ -1196,11 +1196,10 @@
%\Describe{Option}{tracking}{true,!false,:font set name}
% This option will systematically change the tracking of the fonts specified in
% the active font set (by default, all small capitals).
-% It is not available with \xetex\ (you may use the `|LetterSpace|'
-% option of the \cite{fontspec} package instead).
% With \pdftex, it is only available in <PDF> mode.
%
-%\medskip
+%^^A\medskip
+%\pagebreak ^^A layout
%\Describe{Option}{kerning}{true,!false,:font set name}
%\DescribeOption{spacing}
% These features do not unconditionally improve the quality of the typeset text:
@@ -1257,7 +1256,7 @@
%\cmidrule(r){1-3}
% \let\textoractual\@firstoftwo ^^A why?
% \xetex
-% & $\geq$ 0.9997 & <PDF> & ! & _ & _ & _ & _ & _\\
+% & $\geq$ 0.9997 & <PDF> & ! & _ & _ & ? & _ & _\\
%\addlinespace[2pt]
%\bottomrule
%\end{tabular}^^A
@@ -1288,7 +1287,7 @@
% {Character protrusion \requires{\pdftex~0.14f,\luatex~0.30,\xetex~0.9997}}
% \label{sub:options-protrusion}
%
-%\Describe{Option}{factor}{:integer}[1000]
+%\Describe{Option}{factor}{:integer}[\MT@factor@default]
% Using this option, you can globally increase or decrease the amount by which
% the characters will be protruded. While a value of 1000 means that the full
% protrusion as specified in the configuration (see section~\ref{sub:protrusion})
@@ -1350,7 +1349,7 @@
% themselves, which may or may not be desired.
%
%\medskip
-%\Describe{Option}{stretch}{:integer}[20]
+%\Describe{Option}{stretch}{:integer}[\MT@stretch@default]
%\DescribeOption{shrink}
% You may specify the stretchability and shrinkability of a font, \ie, the
% maximum amount that a font may be stretched or shrunk. The numbers will be
@@ -1388,10 +1387,10 @@
%
%
%\subsection[Tracking]
-% {Tracking \requires{\pdftex~1.40,\luatex~0.62}}
+% {Tracking \requires{\pdftex~1.40,\luatex~0.62,\xetex~0.9997}}
% \label{sub:options-tracking}
%
-%\Describe{Option}{letterspace}{:integer}[100]
+%\Describe{Option}{letterspace}{:integer}[\MT@letterspace@default]
% This option changes the default amount for tracking (see section~\ref{sub:tracking})
% resp. letterspacing (see section~\ref{sec:lettersp}). The amount is specified
% in thousandths of \EM{1}; admissible values are in the range of \textminus1000
@@ -1962,7 +1961,7 @@
%
%
%\subsection[Tracking]
-% {Tracking \requires{\pdftex~1.40,\luatex~0.62}}
+% {Tracking \requires{\pdftex~1.40,\luatex~0.62,\xetex~0.9997}}
% \label{sub:tracking}
%
%\Describe{Macro}{\SetTracking}{?options,set of fonts,tracking amount}
@@ -2021,27 +2020,40 @@
% by default equal to the current letterspace amount. To remove kerning on
% both sides, you would write `|outer kerning={0,0}|'.
% \item[\key{no ligatures}]
-% By default, ligatures in letterspaced fonts will be
-% constructed as usual, which may be advisable when changing the
+% In the absence of this option, ligatures in letterspaced fonts would
+% be constructed as usual, which may be advisable when changing the
% tracking by only a small amount. For larger letterspacing amounts, on
% the other hand, the normal letter space within ligatures would have
% displeasing \textls[150]{e\lslig{ff}ects}.
% This key expects a comma-separated list of characters for which
% ligatures should be disabled; only the character that begins a ligature
% must be specified.
-% If the key is given without a value, \emph{all} ligatures of the font
-% will be disabled. With \pdftex, this is not recommended, however,
+% If the key is given without a value (or with the value `|all|'),
+% \emph{all} ligatures of the font will be disabled.
+% (With \pdftex, this is not recommended, however,
% since it entails that kerning will be switched off, too. With \luatex,
-% there is no such limitation.
-% The default settings disable ligatures for the character `|f|' only,
-% \ie, `ff', `fi', ffi', etc.\footnote{
-% With \pdftex\ versions older than 1.40.4, \emph{all} ligatures, and
-% hence all kerning, will be disabled. It is therefore recommended to
-% use at least version 1.40.4.}
+% there is no such limitation.)
+% Given the value `|none|', none of the ligatures will be disabled,
+% or, put positively, all of the font's ligatures will stay intact.
+% The default settings (in \file{microtype.cfg}) disable ligatures
+% for the character `|f|' only, \ie, `ff', `fi', ffi', etc.
+% ^^A\footnote{
+% ^^A With \pdftex\ versions older than 1.40.4, \emph{all} ligatures, and
+% ^^A hence all kerning, will be disabled. It is therefore recommended to
+% ^^A use at least version 1.40.4.}
% In exceptional situations, you can manually break up a ligature by
% inserting `|{\kern0pt}|' resp. \pkg{babel}'s \verb="|=
% shortcut, or protect it by enclosing it in \cs{lslig} (see
% section~\ref{sec:lettersp}).
+% \xetex\ does not allow disabling ligatures selectively, or generally,
+% for that matter.
+% \item[\key{features}] What it does allow, though, is enabling or disabling
+% OpenType font features pertaining to ligatures. With \xetex\ or \luatex,
+% the |features| key accepts any number of \pkg{fontspec} options for the
+% `Ligatures' font feature, \eg, |NoCommon|, |Rare|, |RequiredOff| or
+% |ResetAll| (see the \cite{fontspec} documentation for details).
+% With \luatex, the |features| and the |no ligatures| keys
+% may even be combined, where the latter will take precedence.
%\end{options}
%
%\ifx\lssample\undefined
@@ -2112,8 +2124,9 @@
%
%\medskip\noindent
% Letterspaced fonts for which settings don't exist will be spaced out by the
-% default of \EM{0.1} (adjustable with the package option \opt{letterspace}, see
-% section~\ref{sub:options-misc}). Suppose your editor wants you to shorten
+% default of \EM{\fpeval{\MT@letterspace@default/1000}}
+% (adjustable with the package option \opt{letterspace}, see
+% section~\ref{sub:options-tracking}). Suppose your editor wants you to shorten
% your 1000-pages chef-d'\oe uvre by a handful of pages, you could load
% \microtype\ with (fingers crossed):
%\begin{verbatim}
@@ -2167,6 +2180,7 @@
% \par
% For example, you can find the following settings, intended to be used
% for documents written in French, in the main configuration file:
+%\pagebreak ^^A layout
%\begin{verbatim}[deletekeywords={[1]{unit}}]
%\SetExtraKerning
% [ name = french-default,
@@ -2322,7 +2336,6 @@
% same time, whereas lists prefixed with `|(l)|' or `|(r)|' and those prefixed with
% `|(lr)|' are mutually exclusive.
% For all other features except protrusion, these prefixed lists will be ignored.
-%\looseness=-1 ^^A layout
%
%
%\subsection{Configuration files}\label{sub:config-file}
@@ -2512,14 +2525,17 @@
% section~\ref{sub:hook}.}
% This command will load the file `|mt-|\meta{font name}|.cfg|'.
%
+%\enlargethispage{\baselineskip} ^^A layout
%\medskip
%\Describe{Macro}{\DeclareMicrotypeFilePrefix}{prefix}
-% Or, in fact, it will load the file `\meta{prefix}|-|\meta{file name}|.cfg|'.
+% Or, in fact, it will load the file `\meta{prefix}|-|\meta{font name}|.cfg|'.
% The \meta{prefix} may be changed, which, however, you should only do
% if you have your own set of configuration files that you want to be
% loaded \emph{instead of} any of those provided with the package.
%
-%\section{Context-sensitive setup}\label{sec:context}
+%\section[Context-sensitive setup]
+% {Context-sensitive setup\requires{\pdftex~1.40,\luatex~0.30}}
+% \label{sec:context}
%
% The \microtype\ package also allows applying different micro-typographic
% settings to the fonts depending on the context in which they occur. This
@@ -2620,7 +2636,7 @@
%
%
%\section[Letterspacing revisited]
-% {Letterspacing revisited \requires{\pdftex~1.40,\luatex~0.62}}
+% {Letterspacing revisited \requires{\pdftex~1.40,\luatex~0.62,\xetex~0.9997}}
% \label{sec:lettersp} ^^A [also referenced in microtype.ins]
%
%\Describe{Macro}{\textls}{?amount,general text}
@@ -2643,7 +2659,8 @@
% The starred version of \cs{textls} does not add any
% extra kerning before or after the text, which may be useful, \eg, for section
% titles. By default, each character will be spaced out by
-% \EM{100/1000}\,=\,\EM{0.1}; this amount may be altered in the optional
+% \EM{\MT@letterspace@default/1000}\,=\,\EM{\fpeval{\MT@letterspace@default/1000}};
+% this amount may be altered in the optional
% argument to \cs{textls}, using the \cs{SetTracking} command, or globally with
% the \opt{letterspace} package option, with decreasing significance in this
% order.
@@ -2700,6 +2717,7 @@
% (which does not support package options) simply \cmd\input\ \file{letterspace.sty}.
%
%
+%\pagebreak ^^A layout
%\section[Disabling ligatures]
% {Disabling ligatures \requires{\pdftex~1.30,\luatex~0.30}}
% \label{sec:disable-ligatures}
@@ -2800,7 +2818,7 @@
%\begin{verbatim}[belowskip=-\smallskipamount]
%\newtagform{mytag}[\textbf]{\leftprotrusion{(}}{\rightprotrusion{)}}
%\end{verbatim}^^A
-% \MTsupp{\pkg{amsmath}, \cls{IEEEtran}}
+% \MTsupp{\pkg{amsmath}, \cls{IEEEtran}, \pkg{showkeys}}
%\endlist\endgroup
%
%\medskip\noindent
@@ -3076,7 +3094,7 @@
%
% \item
%\begin{verbatim}[deletekeywords={[1]{patch}}]
-%Package microtype Warning: Unable to apply patch `<eqnum>' on input line <29>.
+%Package microtype Warning: Unable to apply patch `<footnote>' on input line <29>.
%\end{verbatim}
%\changes{v3.1}{2022/09/15}{add hint about protrusion patch warnings}
% As described in chapter~\ref{sec:pedantic} above, \microtype\ tries to patch a number
@@ -3087,7 +3105,7 @@
% to update, the easiest solution to get rid of the warning is to disable the
% problematic patch with the \opt{nopatch} option, \eg:
%\begin{verbatim}[style=microtype]
-%\microtypesetup{nopatch={eqnum}}
+%\microtypesetup{nopatch=footnote}
%\end{verbatim}
%
% \item
@@ -3129,6 +3147,7 @@
% distributions, this can be changed in the file \file{updmap.cfg} by setting
% |pdftexDownloadBase14| to |true|.
%
+%\pagebreak ^^A layout
% \item
%\begin{verbatim}
%Warning: pdflatex (file <ecrm1000+20>): Font <ecrm1000+20 at 1200> not found
@@ -3194,7 +3213,7 @@
%
% This package would be pointless if
% \contributor H\`an \thanhthe{} Th\`anh <thanh\at pdftex.org>
-% hadn't created the \pdftex\ programme in the first place, which introduced
+% hadn't created the \pdftex\ program in the first place, which introduced
% the micro-typographic extensions and made them available to the \TeX\ world.
% Furthermore, I thank him for helping me to improve this package, and not
% least for promoting it in \cite{ThanhPracTeX}, \cite{ThanhEuroTeX07} and ^^A comma, to avoid the Three Ands Falls
@@ -3319,6 +3338,7 @@
% `\contributor Henning <@\at @>', ^^A https://tex.stackexchange.com/users/64603/henning
% \contributor Ronnie Marksch <Ronnie.Marksch\at yahoo.de>,
% \contributor David Carlisle <d.p.carlisle\at gmail.com>,
+% `\contributor web-stranger <@\at @>', ^^A https://tex.stackexchange.com/users/75134/web-stranger
% `\contributor Max <@\at @>', ^^A https://tex.stackexchange.com/users/16809/max
% `\contributor HcN <@\at @>', ^^A https://tex.stackexchange.com/users/87090/hcn
% \contributor Will Robertson <will\at wspr.io>,
@@ -3378,9 +3398,17 @@
% `\contributor simon-codes-something <@\at @>', ^^A https://github.com/simon-codes-something
% `\contributor scholnik <@\at @>', ^^A https://github.com/scholnik
% \contributor Ulrich Schwarz <@\at @>, ^^A https://tex.stackexchange.com/users/1860/ulrich-schwarz
-% \contributor Bruno Victal <mirai\at makinata.eu>
+% \contributor Bruno Victal <mirai\at makinata.eu>,
+% \contributor Linas Stonys <lstonys\at vtex.lt>,
+% `\contributor user202729 <@\at @>', ^^A https://tex.stackexchange.com/users/250119/user202729
+% \contributor Oliver Beery <@\at @>, ^^A https://github.com/beeryoliver
+% \contributor Bernhard Fisseni <@\at @>, ^^A https://github.com/teoric
+% \contributor Aleksandr Petrosyan <@\at @>, ^^A https://github.com/appetrosyan
+% \contributor Didier Verna <@\at @>, ^^A https://tex.stackexchange.com/users/24506/didier-verna
+% `\contributor nowox <@\at @>', ^^A https://tex.stackexchange.com/users/85416/nowox
+% `\contributor hpvd <@\at @>' ^^A https://github.com/hpvd
% and
-% \contributor Linas Stonys <lstonys\at vtex.lt>.
+% \contributor Mark Collins <@\at @>. ^^A https://github.com/Marcool04
%
%\iffalse
%\section{History of micro-typography} ^^A some time ...
@@ -3449,9 +3477,10 @@
% (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,
+%^^A \thanh, Sebastian Rahtz, Hans Hagen, Hartmut Henkel, Pawe\l\ Jackowski, Martin Schr\"oder, Karl Berry,
+% \thanh\ and others,
% \emph{The \pdftex\ user manual},
-% 28~February 2023.
+% 22~February 2024.
% (\ctanurl{systems/doc/pdftex/manual/pdftex-a.pdf})
%
% \bibitem[Fontname]{fontname}
@@ -3461,19 +3490,19 @@
%
% \bibitem[\LaTeXe\ font selection]{fntguide}
% \LaTeX\ Project Team, \emph{\LaTeXe\ font selection},
-% October 2023.
+% September 2024.
% (\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},
-% 15~January 2022.
+% 11~May 2024.
% (\ctanpkgurl{fontspec})
%
% \bibitem[\pkg{luaotfload}]{luaotfload}
% \LaTeX3 Project, \'Elie Roux, Khaled Hosny, Philipp Gesang, Ulrike Fischer, Marcel Kr\"uger,
% \emph{The \pkg{luaotfload} package},
-% 31~August 2023.
+% 14~February 2024.
% (\ctanpkgurl{luaotfload})
%
% \bibitem[\pkg{pdfcprot}]{pdfcprot}
@@ -3521,7 +3550,17 @@
%
%\begin{History}
%
-%\VersionDate{\expandafter\@gobble\fileversion}{\filedate}
+%\Version{\expandafter\@gobble\fileversion}{\filedate}
+% \item Support for tracking/letterspacing with \xetex\
+% \refsection{\ref{sub:options-microtype}, \ref{sub:tracking}, \ref{sec:lettersp}}
+% \item New default for letterspacing: \MT@letterspace@default\space \refsection{\ref{sub:options-tracking}}
+% \item New key `\texttt{features}' for \cs{SetTracking} to enable\slash disable
+% \pkg{fontspec} `Ligatures' features (\luatex/\xetex\ only)
+% \refsection{\ref{sub:tracking}}
+% \item New values `|none|' and `|all|' for the `|no ligatures|' key of
+% \cs{SetTracking} \refsection{\ref{sub:tracking}}
+%
+%\VersionDate{3.1b}{2024/03/29}
%
%\VersionDate{3.1a}{2023/03/13}
%
@@ -3957,7 +3996,7 @@
% \enquote,\foreignquote,\foreigntextquote,\foreigntextcquote,
% \hyphenquote,\hyphentextquote,\hyphentextcquote,\textquote,\textcquote} ^^A csquotes
%\DoNotIndex{\meta} ^^A doc
-%\DoNotIndex{\apptocmd,\gappto,\ifdefmacro,\ifdefparam,\patchcmd} ^^A etoolbox
+%\DoNotIndex{\apptocmd,\gappto,\ifdefdimen,\ifdefmacro,\ifdefparam,\patchcmd}^^A etoolbox
%\DoNotIndex{\txfigures,\lnfigures,\tbfigures,\prfigures,\fontfigurestyle,
% \fontfigurealignment,\fontbasefamily,\figureversion,\textfigures,
% \liningfigures,\tabularfigures,\proportionalfigures} ^^A fontaxes
@@ -3995,6 +4034,7 @@
%\DoNotIndex{\SOUL@,\SOUL@doword,\soulregister} ^^A soul
%\DoNotIndex{\tikz@expandcount} ^^A tikz
%\DoNotIndex{\conditionally@traceoff} ^^A trace
+%\DoNotIndex{\@vwid@sift,\sift@deathcycles,\@vwid@resetb,\@vwid@loff,\@vwid@measure}^^A varwidth
%\DoNotIndex{\@xspace,\@xspace@firsttrue} ^^A xspace
%\DoNotIndex{\frakfamily,\gothfamily,\swabfamily,\textfrak,\textgoth,\textswab}^^A yfonts
%\DoNotIndex{\booknumberline,\chapternumberline,\foottextfont,\partnumberline,
@@ -4007,7 +4047,7 @@
% \ifMT@inannot,\MT@inannottrue,\MT@inannotfalse,\MT@addto@annot,\MT@pdf@annot,
% \MT@show@pdfannot,\iftracingmicrotypeinpdfall,\tracingmicrotypeinpdfalltrue,
% \tracingmicrotypeinpdfallfalse,\DeclareMicroTypeAlias,\DeclareMicroTypeSet,
-% \LoadMicroTypeFile,\DeclareMicrotypeFilePrefix,\UseMicroTypeSet,\MicroType@Hook}^^A microtype
+% \LoadMicroTypeFile,\UseMicroTypeSet,\MicroType@Hook} ^^A microtype
%
% ^^A -------------------------------------------------------------------------
%
@@ -5053,7 +5093,6 @@
\MessageBreak I will quit now}
\MT@clear@options
\endinput\fi
-%</package|letterspace>
% \end{macrocode}
% Still there? Then we can begin:
% We need the \pkg{keyval} package, including the `new' \cmd\KV@@sp@def\
@@ -5062,7 +5101,6 @@
% For the \opt{patch} option, we use \pkg{etoolbox}, which requires \etex.
%\changes{v3.0}{2021/05/17}{require package \pkg{etoolbox} (for \opt{patch} option)}
% \begin{macrocode}
-%<*package|letterspace>
\RequirePackage{keyval}[1997/11/10]
%<*package>
^^X\RequirePackage{etoolbox}
@@ -5226,10 +5264,12 @@
%\begin{macro}{\MT@letterspace}
%\begin{macro}{\MT@letterspace@default}
% Default value for letterspacing (in thousandths of \EM{1}).
+%\changes{v3.2}{2024/10/11}{new default for letterspacing: \MT@letterspace@default\space
+% (following a report by \contributor Mark Collins <@\at @>) \githubissue{41}}
% \begin{macrocode}
%</package>
\let\MT@letterspace\m@ne
-\def\MT@letterspace@default{100}
+\def\MT@letterspace@default{50}
%<*package>
% \end{macrocode}
%\end{macro}
@@ -5484,9 +5524,9 @@ end
%\begin{macro}{\MT@if@expanding@F@}
% The following voodoo is based on a trick by \contributor Ulrich Schwarz <@\at @>.\footnote{Cf. \url{https://tex.stackexchange.com/a/29188/7674}}
% \begin{macrocode}
+%<*package>
\def\MT@if@expanding@F{\let\MT@if@expanding@F@\MT@if@expanding@F@\@firstofone}
\def\MT@if@expanding@F@#1#2#3{\relax\relax}
-%<*package>
% \end{macrocode}
%\end{macro}
%\end{macro}
@@ -5921,27 +5961,38 @@ microtype.if_str_eq = if_str_eq
% \end{macrocode}
%\end{macro}
%\changes{v2.6a}{2016/05/03}{fixes for \letterspace\ package with \luatex}
-%\begin{macro}{\MT@if@luaotf@font}
+%\begin{macro}{\MT@if@opentype@font}
%\changes{v2.8}{2019/11/27}{use \texttt{lua} function}
-% For fonts loaded by \pkg{luaotfload} we query the font's table.
+%\changes{v3.2}{2024/05/13}{version for \xetex}
+% For fonts loaded by \pkg{luaotfload} we query the font's table,
+% for \xetex, the font type. (`opentype' here stands for non-legacy.)
% \begin{macrocode}
-%<letterspace>\MT@pdf@or@lua{\let\MT@if@luaotf@font\@secondoftwo}{
+%<letterspace>\MT@pdf@or@lua{\let\MT@if@opentype@font\@secondoftwo}{
%<*lua-|letterspace>
-\def\MT@if@luaotf@font{\csname\MT@lua{%
- microtype.if_luaotf_font()
+\def\MT@if@opentype@font{\csname\MT@lua{%
+ microtype.if_opentype_font()
}\endcsname
}
%</lua-|letterspace>
+%<*xe->
+\def\MT@if@opentype@font{%
+ \ifnum\XeTeXfonttype\font@name=\z@
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi
+}
+%</xe->
%<letterspace>}
%<*luafile>
-local function if_luaotf_font()
+local function if_opentype_font()
local thefont = font.getfont(font.current())
if thefont and ( thefont.format == "opentype" or thefont.format == "truetype" )
then tex.write("@firstoftwo")
else tex.write("@secondoftwo")
end
end
-microtype.if_luaotf_font = if_luaotf_font
+microtype.if_opentype_font = if_opentype_font
%</luafile>
% \end{macrocode}
@@ -5961,7 +6012,7 @@ microtype.if_luaotf_font = if_luaotf_font
% \begin{macrocode}
%<*lua->
\def\MT@do@font#1{%
- \MT@if@luaotf@font{%
+ \MT@if@opentype@font{%
\def\MT@dofont@function{#1}%
\MT@lua{microtype.do_font()}%
}{\MT@while@num\z@\@cclvi{#1}}%
@@ -6003,7 +6054,6 @@ microtype.do_font = do_font
\ifnum\@tempcnta < \XeTeXlastfontchar\MT@font \MT@repeat
}
%</xe->
-%<*package>
% \end{macrocode}
%\end{macro}
%\changes{v1.4}{2004/11/12}{use one instead of five counters}
@@ -6013,6 +6063,7 @@ microtype.do_font = do_font
%\changes{v1.7}{2005/03/07}{use \etex's \cmd\numexpr\ if available}
% The \etex\ way is slightly faster.
% \begin{macrocode}
+%<*package>
\newcount\MT@count
\def\MT@increment#1{%
^^X \edef#1{\number\numexpr #1 + 1\relax}%
@@ -6177,6 +6228,7 @@ microtype.do_font = do_font
Expect lots of warnings and some malfunctions.\MessageBreak
You might want to use a proper class instead}%
}\relax
+%</package>
% \end{macrocode}
%\begin{macro}{\MT@setup@}
%\changes{v1.9a}{2005/11/21}{defer setup until the end of the preamble}
@@ -6189,7 +6241,6 @@ microtype.do_font = do_font
% advantages: \cs{microtypesetup} can be used to change options later on in the
% preamble, and fonts don't have to be set up before \microtype.
% \begin{macrocode}
-%</package>
%<*package|letterspace>
%<plain>\MT@requires@latex1{
\let\MT@setup@\@empty
@@ -6211,7 +6262,6 @@ microtype.do_font = do_font
% \begin{macrocode}
\def\MT@with@package@T#1{\@ifpackageloaded{#1}\@firstofone\@gobble}
%</package|letterspace>
-%<*package>
% \end{macrocode}
%\end{macro}
%\begin{macro}{\MT@with@babel@and@T}
@@ -6220,6 +6270,7 @@ microtype.do_font = do_font
%\changes{v3.1b}{2023/03/24}{don't use \cmd\@pkgextension\ (was \cmd\@onlypreamble d in older \LaTeX\ versions)}
% \LaTeX's \cmd\@ifpackagewith\ ignores the class options.
% \begin{macrocode}
+%<*package>
\def\MT@with@babel@and@T#1{%
\MT@ifdefined@n@T{opt@babel.sty}{%
\@expandtwoargs\MT@in@clist{#1}
@@ -6227,6 +6278,7 @@ microtype.do_font = do_font
\ifMT@inlist@\expandafter\@secondoftwo\else\expandafter\@firstofone\fi
}\@gobble
}
+%</package>
% \end{macrocode}
%\end{macro}
%\begin{macro}{\MT@ledmac@setup}
@@ -6258,9 +6310,8 @@ microtype.do_font = do_font
%\changes{v2.6}{2015/08/10}{support for \pkg{reledmac}}^^A
% The successor packages \pkg{eledmac} and \pkg{reledmac} are also supported.
% \begin{macrocode}
-%</package>
-%<pdf->\MT@requires@pdftex5{
%<*pdf-|lua-|xe->
+%<pdf->\MT@requires@pdftex5{
\def\MT@ledmac@setup{%
\ifMT@protrusion
\MT@ifdefined@c@TF\l@dunhbox@line{%
@@ -6289,7 +6340,6 @@ microtype.do_font = do_font
}%
\fi
}
-%</pdf-|lua-|xe->
%<*pdf->
}{
\def\MT@ledmac@setup{%
@@ -6302,7 +6352,48 @@ microtype.do_font = do_font
\fi
}
}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\MT@varwidth@setup}
+% Likewise, the \pkg{varwidth} package de- and reassembles \cmd\vbox es
+% line by line, in the course of which margin kerns will get lost.
+% We patch the relevant commands to record and reinsert the margin kerns.
+%\changes{v3.2}{2024/05/03}{patch \pkg{varwidth} to allow for margin kerning
+% (reported by `\contributor web-stranger <@\at @>')}
+% ^^A https://tex.stackexchange.com/questions/245798/microtype-raggedright-and-varwidth-doesnt-work-well-with-each-other
+% \begin{macrocode}
+\MT@requires@pdftex5{
%</pdf->
+ \def\MT@varwidth@setup{%
+ \ifMT@protrusion
+^^Q \MT@warning@nl{Cannot patch varwidth without etex extensions}%
+^^X \MT@info@nl{Patching varwidth to enable character protrusion}%
+^^X \newdimen\MT@vwid@leftmargin
+^^X \newdimen\MT@vwid@rightmargin
+^^X \patchcmd\@vwid@sift{\sift@deathcycles\z@}
+^^X {\MT@vwid@leftmargin\leftmarginkern\z@
+^^X \MT@vwid@rightmargin\rightmarginkern\z@ \sift@deathcycles\z@}{}{}%
+^^X \patchcmd\@vwid@resetb{\kern\@vwid@loff \unhbox\z@}
+^^X {\kern\@vwid@loff \ifdim\MT@vwid@leftmargin=\z@\else\kern\MT@vwid@leftmargin\fi
+^^X \unhbox\z@ \ifdim\MT@vwid@rightmargin=\z@\else\kern\MT@vwid@rightmargin\fi}{}{}%
+^^X \patchcmd\@vwid@measure{\kern\@vwid@loff \unhbox\z@}
+^^X {\kern\@vwid@loff \ifdim\MT@vwid@leftmargin=\z@\else\kern\MT@vwid@leftmargin\fi
+^^X \unhbox\z@ \ifdim\MT@vwid@rightmargin=\z@\else\kern\MT@vwid@rightmargin\fi}{}{}%
+ \fi
+ }
+%<*pdf->
+}{
+ \def\MT@varwidth@setup{%
+ \ifMT@protrusion
+ \MT@warning@nl{%
+ The pdftex version you are using does not allow\MessageBreak
+ character protrusion in varwidth environments.\MessageBreak
+ Upgrade pdftex to version 1.30 or later}%
+ \fi
+ }
+}
+%</pdf->
+%</pdf-|lua-|xe->
% \end{macrocode}
%\end{macro}
% The \pkg{shapepar} package (v2.2) fixes this in a similar manner by itself,
@@ -6456,6 +6547,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@with@package@T {ledmac}\MT@ledmac@setup
\MT@with@package@T {eledmac}\MT@ledmac@setup
\MT@with@package@T{reledmac}\MT@ledmac@setup
+ \MT@with@package@T{varwidth}\MT@varwidth@setup
\MT@with@package@T{xunicode}\MT@xunicodetrue
\MT@with@package@T{fontspec}\MT@fontspectrue
% \end{macrocode}
@@ -6643,7 +6735,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
}%
%</package>
}
-%<*package>
+%</package|letterspace>
% \end{macrocode}
%
%\subsubsection{Protrusion patches}
@@ -6655,6 +6747,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\begin{macro}{\MT@patch@info@undo}
% We have to patch some macros to get protrusion right.
% \begin{macrocode}
+%<*package>
\newif\ifMT@patch@ok
\def\MT@patch@info#1{\MT@info{Applying patch `#1'}}
\def\MT@patch@warn#1{\MT@warning{Unable to apply patch `#1'}}
@@ -6873,6 +6966,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\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}}
+%\changes{v3.2}{2024/12/12}{protrusion patch \texttt{eqnum}: fix for \pkg{showkeys}}
% \begin{itemize}
% \item \cls{IEEEtran}
% \begin{macrocode}
@@ -6885,11 +6979,16 @@ time will almost certainly lead to undesired results. Have your choice!}%
{}%
% \end{macrocode}
% \item \cmd\eqref\ (\pkg{amsmath}) relies on \cmd\tagform@, so we have to have it
-% use the original definition.
+% use the original definition. The \pkg{showkeys} package also modifies this
+% command, as well as \cmd\@eqnnum\space (below); we don't test for the package
+% itself but the relevant command, which is only redefined <ABD>.
% \begin{macrocode}
\@ifpackageloaded{amsmath}
- {\MT@patch@patch\tagform@{(}{\leftprotrusion{(}}%
- \MT@patch@patch\tagform@{)}{\rightprotrusion{)}}%
+ {\MT@ifdefined@c@TF\SK@tagform@
+ {\MT@patch@patch\SK@tagform@{(}{\leftprotrusion{(}}%
+ \MT@patch@patch\SK@tagform@{)}{\rightprotrusion{)}}}%
+ {\MT@patch@patch\tagform@{(}{\leftprotrusion{(}}%
+ \MT@patch@patch\tagform@{)}{\rightprotrusion{)}}}%
% \end{macrocode}
% The command has been made robust in 2022.
%\changes{v3.0e}{2022/05/21}{protrusion patch \texttt{eqnum}: adjust to robustness of \cmd\eqref\
@@ -6909,6 +7008,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\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/
+%\changes{v3.2}{2024/12/12}{protrusion patch \texttt{eqnum}: fix for \cls{IEEEtran}}
% \begin{macrocode}
\MT@with@package@T{mathtools}{%
\ifMT@patch@ok\else \MT@patch@oktrue
@@ -6918,8 +7018,12 @@ time will almost certainly lead to undesired results. Have your choice!}%
`\@backslashchar rightprotrusion' as\MessageBreak
appropriate in mathtools's `\@backslashchar newtagform' command}%
\fi}}
- {\MT@patch@patch\@eqnnum{(}{\leftprotrusion{(}}%
- \MT@patch@patch\@eqnnum{)}{\rightprotrusion{)}}}%
+ {\@ifclassloaded{IEEEtran}{}
+ {\MT@ifdefined@c@TF\SK@eqnnum
+ {\MT@patch@patch\SK@eqnnum{(}{\leftprotrusion{(}}%
+ \MT@patch@patch\SK@eqnnum{)}{\rightprotrusion{)}}}%
+ {\MT@patch@patch\@eqnnum{(}{\leftprotrusion{(}}%
+ \MT@patch@patch\@eqnnum{)}{\rightprotrusion{)}}}}}%
}{}%
% \end{macrocode}
% \end{itemize}
@@ -6927,6 +7031,25 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\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 The new footnote code (in \file{latex-lab-footnotes.ltx}), which is meant
+% to facilitate tagging, introduces many hooks, among them |fntext/begin|, which
+% would seem appropriate for us. Unfortunately, however, we cannot use it, as we'd
+% stumble over the hook management itself.
+%^^A see my feature request at https://github.com/latex3/tagging-project/issues/726
+% I think it's unnecessary to patch the |expl3| version too, but I suppose
+% it won't do any harm either.
+% There's no new code for footnotes in minipages at the moment.
+%\changes{v3.2}{2024/10/03}{fix protrusion patch \texttt{footnote} for tagging
+% (reported by \contributor hpvd <@\at @>) \githubissue{40}}
+% \begin{macrocode}
+ \MT@define@patch{footnote}{%
+ \MT@ifdefined@n@TF{fnote_footnotetext:n}
+ {\ExplSyntaxOn
+ \MT@patch@patch\@footnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}%
+ \MT@exp@cs\MT@patch@patch{fnote_footnotetext:n}{\ignorespaces}{\ignorespaces\leftprotrusion}%
+ \MT@patch@patch\@mpfootnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}%
+ \ExplSyntaxOff}
+% \end{macrocode}
% \item \pkg{hyperref} also patches this command (but only if |hyperfootnotes=true|,
% |implicit=true| and \cmd\hyper@nopatch@footnote\ is undefined)
%\changes{v3.0a}{2021/11/30}{fix protrusion patch \texttt{footnote} with \pkg{hyperref}
@@ -6936,8 +7059,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\changes{v3.0e}{2022/05/21}{fix protrusion patch \texttt{footnote} for \pkg{hyperref}
% if \cmd\hyper@nopatch@footnote\ is defined}
% \begin{macrocode}
- \MT@define@patch{footnote}{%
- \@ifpackageloaded{hyperref}
+ {\@ifpackageloaded{hyperref}
{\MT@if@false
\ifHy@implicit
\ifHy@hyperfootnotes
@@ -6983,12 +7105,12 @@ time will almost certainly lead to undesired results. Have your choice!}%
% \item the base classes
% \begin{macrocode}
{\MT@patch@patch\@footnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}}%
- \MT@patch@patch\@mpfootnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}}}}%
+ \MT@patch@patch\@mpfootnotetext{\ignorespaces}{\ignorespaces\leftprotrusion}}}}}%
}{}%
% \end{macrocode}
% \end{itemize}
% \item [|verbatim|] disable all microtypographic extensions in
-% verbatim blocks. (This could have been a nice opportunity
+% verbatim blocks. (This could have been another nice opportunity
% to use the new \LaTeX\ hook management, however, the hook
% here is executed too early -- namely, before the |\par| in
% \cmd\@verbatim, which may result in spilling the
@@ -7015,7 +7137,6 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@redefined@patches
}}
%</package>
-%</package|letterspace>
% \end{macrocode}
%
%\subsection{Font setup}\label{sub:font-setup}
@@ -7088,7 +7209,9 @@ time will almost certainly lead to undesired results. Have your choice!}%
% \begin{macrocode}
%<pdf->\MT@requires@pdftex6
%<lua->\MT@requires@luatex3
-%<pdf-|lua-> {\g@addto@macro\MT@setupfont\MT@tracking}\relax
+%<pdf-|lua->{
+%<pdf-|lua-|xe-> \g@addto@macro\MT@setupfont\MT@tracking
+%<pdf-|lua->}\relax
\g@addto@macro\MT@setupfont{%
\MT@check@font
\ifMT@inlist@
@@ -7218,7 +7341,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
%<pdf->}\relax
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\MT@lua@copy@font}
+%\begin{macro}{\MT@lua@copy@font} ^^A TODO: \fontname ?
% \meta{\#1} and \meta{\#2} are `|select|' and `|font|', respectively,
% \meta{\#3} is the font spec.
% \begin{macrocode}
@@ -8347,7 +8470,9 @@ time will almost certainly lead to undesired results. Have your choice!}%
% that's how the penalties bug was discovered~\dots).
%\changes{v3.0d}{2022/03/03}{no longer reset counters
% (reported by \contributor Brian Dunn <@\at @>) \githubissue{14}}
-% (We no longer reset counters etc., since we don't typeset groups anymore.)
+% (We no longer reset counters etc., since we don't typeset whole arguments anymore.)
+% Also, we begin a group to make it color-safe.
+%\changes{v3.2}{2024/04/24}{make color-safe}
%\begin{macro}{\MT@prot@hook}
% Furthermore, we have a hook for compatibility fixes (currently used for \pkg{csquotes} only),
%\begin{macro}{\MT@csq@eqgroup}
@@ -8386,7 +8511,9 @@ time will almost certainly lead to undesired results. Have your choice!}%
\interlinepenalty\z@
\@newlistfalse
\MT@prot@hook
- \MT@noindent #1\relax\MT@csq@eqgroup}%
+ \begingroup
+ \MT@noindent #1\relax\MT@csq@eqgroup
+ \endgroup}%
\vbadness=\@M
\splittopskip=\z@
\vfuzz=\maxdimen
@@ -8531,6 +8658,148 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\end{macro}
%\end{macro}
%\end{macro}
+%\begin{macro}{\MT@prot@get@first@group}
+%\begin{macro}{\MT@prot@get@first@group@}
+% If next char is |{|, start a group and try again, else continue until
+% we find a beginning char.
+% \begin{macrocode}
+\def\MT@prot@get@first@group@{%
+ \MT@prot@ifcat\bgroup{%
+ \def\MT@temp*{\MT@prot@addgroup}%
+ }{%
+ \def\MT@temp*{\MT@prot@get@first@token}%
+ }%
+ \MT@temp*%
+}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\MT@prot@get@first@group@tc}
+% The variant for text commands (in case they start with another group).
+% \begin{macrocode}
+\def\MT@prot@get@first@group@tc{%
+ \MT@prot@ifcat\bgroup{%
+ \def\MT@temp*##1##2\MT@nil{\MT@ifempty{##1}\relax
+ {{\MT@prot@get@firstgroup@tc##1\MT@nil}}}%
+ }{%
+ \def\MT@temp*{\MT@prot@get@first@token}%
+ }%
+ \MT@temp*%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\MT@prot@get@first@token}
+%\changes{v3.0e}{2022/06/15}{don't gobble previously captured content}
+%\changes{v3.1}{2023/03/06}{expand toks once}
+% This can be called repeatedly.
+% We add a letter or other character, \dots
+% \begin{macrocode}
+\def\MT@prot@get@first@token{%
+ \def\MT@temp*{\MT@exp@one@n\MT@ifempty{\the\MT@toks}
+ {\MT@exp@one@n\MT@ifempty{\the\MT@prot@toks}\relax{\the\MT@prot@toks\MT@gobble@to@nil}}
+ {\MT@exp@one@n\MT@prot@l{\the\MT@toks}}}%
+ \MT@prot@ifcat{a}{%
+ \def\MT@temp*{\MT@prot@addtoken@first}%
+ }{%
+ \MT@prot@ifcat{!}{%
+ \def\MT@temp*{\MT@prot@addtoken@first}%
+ }{%
+% \end{macrocode}
+% a space character, \dots
+% \begin{macrocode}
+ \MT@prot@ifx\@sptoken{%
+ \def\MT@temp* {\MT@prot@get@firstgroup}%
+ }{%
+% \end{macrocode}
+% commands, \dots
+% \begin{macrocode}
+ \let\MT@prot@ifmacro\MT@prot@ifmacro@
+ \MT@map@tlist@c\MT@prot@check@cmds\MT@prot@check
+% \end{macrocode}
+% \dots~or a command/active char whose first command is one of the following:
+% \begin{macrocode}
+ \MT@prot@ifmacro{%
+ \MT@prot@iffirstcmd\UTFviii@two@octets{%
+ \def\MT@temp*##1##2{\MT@exp@one@n\MT@prot@l{\the\MT@toks##1##2}}%
+ }{%
+ \MT@prot@iffirstcmd\UTFviii@three@octets{%
+ \def\MT@temp*##1##2##3{\MT@exp@one@n\MT@prot@l{\the\MT@toks##1##2##3}}%
+ }{%
+ \MT@prot@iffirstcmd\UTFviii@four@octets{%
+ \def\MT@temp*##1##2##3##4{\MT@exp@one@n\MT@prot@l{\the\MT@toks##1##2##3##4}}%
+ }{%
+% \end{macrocode}
+% (this is for chars made active by \pkg{csquotes}, via \cmd\MakeAutoQuote\ or
+% \cmd\MakeOuterQuote)
+% \begin{macrocode}
+ \MT@prot@iffirstcmd\csqQQ{\def\MT@temp*##1{\MT@exp@one@n\MT@prot@l{\the\MT@toks##1}}}{%
+% \end{macrocode}
+% or, finally, a <LICR> command.
+% \begin{macrocode}
+ \MT@prot@iflicrcmd
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ \MT@temp*%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\MT@prot@addtoken@first}
+% Begin filling toks.
+% \begin{macrocode}
+\def\MT@prot@addtoken@first#1{%
+ \MT@toks\expandafter{\the\MT@toks#1}%
+ \MT@prot@get@nexttoken
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\MT@prot@get@next@token}
+% Continue if letter or other.
+% \begin{macrocode}
+\def\MT@prot@get@next@token{%
+ \def\MT@temp*{\MT@prot@addtoken@next}%
+ \MT@prot@ifcat{a}\relax{%
+ \MT@prot@ifcat{!}\relax{%
+ \def\MT@temp*{\MT@exp@one@n\MT@prot@l{\the\MT@toks}}%
+ }%
+ }%
+ \MT@temp*%
+}
+%</package>
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\MT@prot@addtoken@next}
+% Add token to our toks and test whether we've seen enough (ligature completed).
+% For luatex, we have to jump through another hoop (\ie, box), because, contrary
+% to the manual, \cmd\lastnodetype\ isn't really compatible. ^^A cf. https://mailman.ntg.nl/pipermail/dev-luatex/2021-August/006536.html et seqq.
+%\changes{v3.2}{2024/04/24}{make color-safe}
+% \begin{macrocode}
+%<*pdf-|lua-|xe->
+\def\MT@prot@addtoken@next#1{%
+ \MT@toks\expandafter{\the\MT@toks#1}%
+ \setbox\MT@tempbox\hbox{%
+ \begingroup
+% \end{macrocode}
+% We disable italic correction, which would prevent us from
+% seeing the ligature (with text commands).
+% \begin{macrocode}
+ \let\maybe@ic\relax
+ \MT@exp@one@n\MT@maybe@textcmd{\the\MT@toks}%
+%<pdf-|xe-> \relax
+ \endgroup
+%<lua-> }\setbox\MT@tempbox\hbox{\unhbox\MT@tempbox
+ \ifnum\lastnodetype=7 \aftergroup\@firstoftwo\else\aftergroup\@secondoftwo\fi}%
+ \MT@prot@get@nexttoken
+ {\MT@exp@one@n\MT@prot@l{\the\MT@toks}}%
+}
+%</pdf-|lua-|xe->
+% \end{macrocode}
+%\end{macro}
%\begin{macro}{\MT@prot@check}
%\changes{v3.1}{2022/12/17}{allow replacement command}
%\begin{macro}{\MT@prot@check@}
@@ -8538,6 +8807,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
% \meta{\#3} will be \cmd\relax\ by default, but can also indicate
% a replacement command.
% \begin{macrocode}
+%<*package>
\def\MT@prot@check#1{\MT@prot@check@#1\relax\@nil}
\def\MT@prot@check@#1#2#3\@nil{%
\ifx\MT@prot@next#2%
@@ -8570,7 +8840,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
% \end{macrocode}
%\end{macro}
% \item
-%\begin{macro}{\MT@prot@check@X}
+%\begin{macro}{\MT@prot@check@O}
% Add a command with \textbf{O}ne argument.
% \begin{macrocode}
\def\MT@prot@check@O{%
@@ -8579,6 +8849,28 @@ time will almost certainly lead to undesired results. Have your choice!}%
% \end{macrocode}
%\end{macro}
% \item
+%\begin{macro}{\MT@prot@check@o}
+%\changes{v3.2}{2024/04/24}{new macro: for one-argument commands with optional argument}
+%\begin{macro}{\MT@prot@check@o@}
+% The same with an optional argument.
+% \begin{macrocode}
+\def\MT@prot@check@o{%
+ \def\MT@temp*##1{\@ifnextchar[{\MT@prot@check@o@##1}{\MT@prot@check@o@##1[]}}%
+}
+% \end{macrocode}
+% The \cmd\color\ command, for which this is used, would stumble over an empty
+% optional argument.
+% \begin{macrocode}
+\def\MT@prot@check@o@#1[#2]#3{%
+ \MT@ifempty{#2}
+ {\MT@toks\expandafter{\the\MT@toks#1{#3}}}
+ {\MT@toks\expandafter{\the\MT@toks#1[#2]{#3}}}%
+ \MT@prot@get@firstgroup
+}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+% \item
%\begin{macro}{\MT@prot@check@T}
% Add a command with \textbf{T}wo arguments.
% \begin{macrocode}
@@ -8670,6 +8962,9 @@ time will almost certainly lead to undesired results. Have your choice!}%
% ^^A private mail, 2023/03/13
%\changes{v3.1b}{2024/03/29}{fix: failed when group began with another command
% \githubissue{31}}
+%\changes{v3.2}{2024/09/03}{fix: add \cmd\@empty\ (reported by \contributor nowox <@\at @>)}
+% ^^A https://tex.stackexchange.com/questions/725639/insert-monospace-text-at-the-beginning-of-item-while-using-microtype
+%\begin{macro}{\MT@prot@check@F@@}
% Here we deal with \textbf{F}ont switching commands (\ie, text commands,
% which take an argument).
% We (a) remember the text command, (b) save the full text,
@@ -8684,15 +8979,47 @@ time will almost certainly lead to undesired results. Have your choice!}%
\else
\let\MT@prot@l\MT@prot@l@tc
\let\MT@prot@get@first@group\MT@prot@get@first@group@tc
- \def\MT@temp*##1##2{%
- \let\MT@maybe@textcmd##1%
+ \def\MT@temp*##1{%
\the\MT@toks
\MT@toks{}%
- \MT@prot@toks{##1{##2}}%
- \MT@prot@get@firstgroup@tc##2\MT@nil
+ \MT@prot@check@F@##1%
}%
\fi
}
+\def\MT@prot@check@F@@#1#2{%
+ \let\MT@maybe@textcmd#1%
+ \MT@prot@toks{#1{#2}}%
+ \MT@prot@get@firstgroup@tc#2\@empty\MT@nil
+}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\MT@prot@check@F@beamer}
+%\changes{v3.2}{2024/10/02}{compatibility with \cls{beamer}'s overlay specifications
+% (reported by \contributor Frank Mittelbach <frank.mittelbach\at latex-project.org>) \githubissue{38}}
+%\begin{macro}{\MT@prot@check@F@beamer@}
+% Compatibility with the \cls{beamer} class and its overlay specifications
+% (\eg, |\textbf<2>{...}|).
+% \begin{macrocode}
+\def\MT@prot@check@F@beamer#1{%
+ \@ifnextchar<%
+ {\MT@prot@check@F@beamer@#1}%
+ {\MT@prot@check@F@@#1}%
+}
+\def\MT@prot@check@F@beamer@#1<#2>#3{%
+ \def\MT@maybe@textcmd{#1<#2>}%
+ \MT@prot@toks{#1<#2>{#3}}%
+ \MT@prot@get@firstgroup@tc#3\@empty\MT@nil
+}
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
+%\begin{macro}{\MT@prot@check@F@}
+% Choose the right definition.
+% \begin{macrocode}
+\@ifclassloaded{beamer}
+ {\let\MT@prot@check@F@\MT@prot@check@F@beamer}
+ {\let\MT@prot@check@F@\MT@prot@check@F@@}
% \end{macrocode}
%\end{macro}
% \item
@@ -8700,6 +9027,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\changes{v3.1b}{2023/03/16}{new macro: for text commands with an optional argument
% (after \contributor scholnik <@\at @> reported
% that \cmd\MakeUppercase\ and friends support one) \githubissue{29}}
+%\begin{macro}{\MT@prot@check@C@}
% Same, but for commands that allow an optional argument (\eg, the \textbf{C}ase
% changing commands since \LaTeX\ 2022/11/01).
% \begin{macrocode}
@@ -8721,10 +9049,11 @@ time will almost certainly lead to undesired results. Have your choice!}%
\def\MT@prot@check@C@#1[#2]#3{%
\def\MT@maybe@textcmd{#1[#2]}%
\MT@prot@toks{#1[#2]{#3}}%
- \MT@prot@get@firstgroup@tc#3\MT@nil
+ \MT@prot@get@firstgroup@tc#3\@empty\MT@nil
}
% \end{macrocode}
%\end{macro}
+%\end{macro}
%\end{itemize}
%\begin{macro}{\MT@prot@check@cmds}
%\changes{v3.0e}{2022/06/09}{new macro: make list of commands extensible}
@@ -8734,6 +9063,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\changes{v3.1}{2023/01/07}{add \cmd\em}
%\changes{v3.1}{2023/03/06}{add \cmd\MakeUppercase\ and friends}
% And here's the list of commands that we can deal with.
+% (It's a bit of a shame that \cs{textls} is not among them.)
% \begin{macrocode}
\def\MT@prot@check@cmds{%
{I\ignorespaces}{I\relax}{I\@empty}%
@@ -8771,7 +9101,30 @@ time will almost certainly lead to undesired results. Have your choice!}%
% \begin{macrocode}
\@ifclassloaded{ltxdoc}
{\g@addto@macro\MT@prot@check@cmds{{E\enquote}{E\marg}{E\oarg}{E\parg}{E\cs}}}\relax
+% \end{macrocode}
+% Add \cmd\color\ (but not yet \cmd\textcolor).
+%\changes{v3.2}{2024/04/24}{add \pkg{color}'s \cmd\color\ command}
+% We also don't yet understand \cls{beamer}'s |<.-.>| notation added to \cmd\color.
+% \begin{macrocode}
\MT@addto@setup{%
+ \MT@with@package@T{color}
+ {\@ifclassloaded{beamer}\relax{\g@addto@macro\MT@prot@check@cmds{{o\color}}}}%
+% \end{macrocode}
+% \pkg{csquotes}'s \cmd\enquote\ command.
+% It would take precedence over the one provided by \cls{ltxdoc}.
+%\changes{v3.1}{2022/11/29}{add \pkg{csquotes}'s commands
+% (reported by \contributor Shen Zhou Hong <@\at @>)
+% \githubissue{25}}
+% \begin{macrocode}
+ \MT@with@package@T{csquotes}
+ {\@ifclassloaded{ltxdoc}
+ {\patchcmd\MT@prot@check@cmds{E\enquote}{e\enquote}\relax\relax}
+ {\g@addto@macro\MT@prot@check@cmds{{e\enquote}}}%
+ \g@addto@macro\MT@prot@check@cmds{{e\textquote}%
+ {l\foreignquote}{l\hyphenquote}{l\foreigntextquote}{l\hyphentextquote}%
+ {{eX}\textcquote\textquote}%
+ {{lX}\foreigntextcquote\foreigntextquote}%
+ {{lX}\hyphentextcquote\hyphentextquote}}}%
\MT@with@package@T{doc}
{\g@addto@macro\MT@prot@check@cmds{{E\meta}}}%
% \end{macrocode}
@@ -8782,12 +9135,20 @@ time will almost certainly lead to undesired results. Have your choice!}%
{S\txfigures}{S\lnfigures}{S\tbfigures}{S\prfigures}%
{O\fontfigurestyle}{O\fontfigurealignment}{O\fontbasefamily}%
{O\figureversion}%
- {F\textsw}{F\textssc}{F\textulc}%
{F\textfigures}{F\liningfigures}{F\tabularfigures}{F\proportionalfigures}}%
\IfFormatAtLeastTF{2020/02/02}\relax
{\g@addto@macro\MT@prot@check@cmds{%
{S\swshape}{S\ulcshape}{S\sscshape}%
- {F\textulc}{F\textsw}{F\textssc}}}}
+ {F\textulc}{F\textsw}{F\textssc}}}}%
+% \end{macrocode}
+% \pkg{fontspec}'s \cmd\fontspec's command allows an optional
+% argument \emph{after} the mandatory one, and we can't deal with
+% that (yet).
+%\changes{v3.2}{2024/05/22}{add some \pkg{fontspec} commands}
+% \begin{macrocode}
+ \MT@with@package@T{fontspec}
+ {\g@addto@macro\MT@prot@check@cmds{%
+ {O\addfontfeature}{O\addfontfeatures}{F\strong}}}%
% \end{macrocode}
% The \pkg{nfssext-cfr} package (an extension of the \pkg{nfssext} package,
% which is part of Philipp Lehman's \pkg{fontinstallationguide} but was never
@@ -8818,7 +9179,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
{F\textmb}{F\textdb}{F\textsb}{F\texteb}%
{F\textub}{F\textlg}{F\textel}{F\textul}}%
\IfFormatAtLeastTF{2020/02/02}\relax
- {\g@addto@macro\MT@prot@check@cmds{{S\swshape}{F\textsw}}}}
+ {\g@addto@macro\MT@prot@check@cmds{{S\swshape}{F\textsw}}}}%
% \end{macrocode}
% If \pkg{yfonts} is loaded, we add the relevant commands.
% \begin{macrocode}
@@ -8826,164 +9187,10 @@ time will almost certainly lead to undesired results. Have your choice!}%
{\g@addto@macro\MT@prot@check@cmds{%
{S\frakfamily}{S\swabfamily}{S\gothfamily}%
{F\textfrak}{F\textswab}{F\textgoth}}}%
-% \end{macrocode}
-% \pkg{csquotes}'s \cmd\enquote\ command.
-% It would take precedence over the one provided by \cls{ltxdoc}.
-%\changes{v3.1}{2022/11/29}{add \pkg{csquotes}'s commands
-% (reported by \contributor Shen Zhou Hong <@\at @>)
-% \githubissue{25}}
-% \begin{macrocode}
- \MT@with@package@T{csquotes}
- {\@ifclassloaded{ltxdoc}
- {\patchcmd\MT@prot@check@cmds{E\enquote}{e\enquote}\relax\relax}
- {\g@addto@macro\MT@prot@check@cmds{{e\enquote}}}%
- \g@addto@macro\MT@prot@check@cmds{{e\textquote}%
- {l\foreignquote}{l\hyphenquote}{l\foreigntextquote}{l\hyphentextquote}%
- {{eX}\textcquote\textquote}%
- {{lX}\foreigntextcquote\foreigntextquote}%
- {{lX}\hyphentextcquote\hyphentextquote}}}%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\MT@prot@get@first@group}
-%\begin{macro}{\MT@prot@get@first@group@}
-% If next char is |{|, start a group and try again, else continue until
-% we find a beginning char.
-% \begin{macrocode}
-\def\MT@prot@get@first@group@{%
- \MT@prot@ifcat\bgroup{%
- \def\MT@temp*{\MT@prot@addgroup}%
- }{%
- \def\MT@temp*{\MT@prot@get@first@token}%
- }%
- \MT@temp*%
-}
-% \end{macrocode}
-%\end{macro}
-%\end{macro}
-%\begin{macro}{\MT@prot@get@first@group@tc}
-% The variant for text commands (in case they start with another group).
-% \begin{macrocode}
-\def\MT@prot@get@first@group@tc{%
- \MT@prot@ifcat\bgroup{%
- \def\MT@temp*##1##2\MT@nil{\MT@ifempty{##1}\relax
- {{\MT@prot@get@firstgroup@tc##1\MT@nil}}}%
- }{%
- \def\MT@temp*{\MT@prot@get@first@token}%
- }%
- \MT@temp*%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\MT@prot@get@first@token}
-%\changes{v3.0e}{2022/06/15}{don't gobble previously captured content}
-%\changes{v3.1}{2023/03/06}{expand toks once}
-% This can be called repeatedly.
-% We add a letter or other character, \dots
-% \begin{macrocode}
-\def\MT@prot@get@first@token{%
- \def\MT@temp*{\MT@exp@one@n\MT@ifempty{\the\MT@toks}
- {\MT@exp@one@n\MT@ifempty{\the\MT@prot@toks}\relax{\the\MT@prot@toks\MT@gobble@to@nil}}
- {\MT@exp@one@n\MT@prot@l{\the\MT@toks}}}%
- \MT@prot@ifcat{a}{%
- \def\MT@temp*{\MT@prot@addtoken@first}%
- }{%
- \MT@prot@ifcat{!}{%
- \def\MT@temp*{\MT@prot@addtoken@first}%
- }{%
-% \end{macrocode}
-% a space character, \dots
-% \begin{macrocode}
- \MT@prot@ifx\@sptoken{%
- \def\MT@temp* {\MT@prot@get@firstgroup}%
- }{%
-% \end{macrocode}
-% commands, \dots
-% \begin{macrocode}
- \let\MT@prot@ifmacro\MT@prot@ifmacro@
- \MT@map@tlist@c\MT@prot@check@cmds\MT@prot@check
-% \end{macrocode}
-% \dots~or a command/active char whose first command is one of the following:
-% \begin{macrocode}
- \MT@prot@ifmacro{%
- \MT@prot@iffirstcmd\UTFviii@two@octets{%
- \def\MT@temp*##1##2{\MT@exp@one@n\MT@prot@l{\the\MT@toks##1##2}}%
- }{%
- \MT@prot@iffirstcmd\UTFviii@three@octets{%
- \def\MT@temp*##1##2##3{\MT@exp@one@n\MT@prot@l{\the\MT@toks##1##2##3}}%
- }{%
- \MT@prot@iffirstcmd\UTFviii@four@octets{%
- \def\MT@temp*##1##2##3##4{\MT@exp@one@n\MT@prot@l{\the\MT@toks##1##2##3##4}}%
- }{%
-% \end{macrocode}
-% (this is for chars made active by \pkg{csquotes}, via \cmd\MakeAutoQuote\ or
-% \cmd\MakeOuterQuote)
-% \begin{macrocode}
- \MT@prot@iffirstcmd\csqQQ{\def\MT@temp*##1{\MT@exp@one@n\MT@prot@l{\the\MT@toks##1}}}{%
-% \end{macrocode}
-% or, finally, a <LICR> command.
-% \begin{macrocode}
- \MT@prot@iflicrcmd
- }%
- }%
- }%
- }%
- }%
- }%
- }%
- }%
- \MT@temp*%
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\MT@prot@addtoken@first}
-% Begin filling toks.
-% \begin{macrocode}
-\def\MT@prot@addtoken@first#1{%
- \MT@toks\expandafter{\the\MT@toks#1}%
- \MT@prot@get@nexttoken
-}
-% \end{macrocode}
-%\end{macro}
-%\begin{macro}{\MT@prot@get@next@token}
-% Continue if letter or other.
-% \begin{macrocode}
-\def\MT@prot@get@next@token{%
- \def\MT@temp*{\MT@prot@addtoken@next}%
- \MT@prot@ifcat{a}\relax{%
- \MT@prot@ifcat{!}\relax{%
- \def\MT@temp*{\MT@exp@one@n\MT@prot@l{\the\MT@toks}}%
- }%
- }%
- \MT@temp*%
}
%</package>
% \end{macrocode}
%\end{macro}
-%\begin{macro}{\MT@prot@addtoken@next}
-% Add token to our toks and test whether we've seen enough (ligature completed).
-% For luatex, we have to jump through another hoop (\ie, box), because, contrary
-% to the manual, \cmd\lastnodetype\ isn't really compatible. ^^A cf. https://mailman.ntg.nl/pipermail/dev-luatex/2021-August/006536.html et seqq.
-% \begin{macrocode}
-%<*pdf-|lua-|xe->
-\def\MT@prot@addtoken@next#1{%
- \MT@toks\expandafter{\the\MT@toks#1}%
- \setbox\MT@tempbox\hbox{%
-% \end{macrocode}
-% We disable italic correction, which would prevent us from
-% seeing the ligature (with text commands).
-% \begin{macrocode}
- \let\maybe@ic\relax
- \MT@exp@one@n\MT@maybe@textcmd{\the\MT@toks}%
-%<pdf-|xe-> \relax
-%<lua-> }\setbox\MT@tempbox\hbox{\unhbox\MT@tempbox
- \ifnum\lastnodetype=7 \aftergroup\@firstoftwo\else\aftergroup\@secondoftwo\fi}%
- \MT@prot@get@nexttoken
- {\MT@exp@one@n\MT@prot@l{\the\MT@toks}}%
-}
-%</pdf-|lua-|xe->
-% \end{macrocode}
-%\end{macro}
%
%\subsubsection{Expansion}
%
@@ -9453,12 +9660,15 @@ time will almost certainly lead to undesired results. Have your choice!}%
%
% This only works with \pdftex\ 1.40
%\changes{v2.5}{2010/09/17}{letterspacing with \luatex\ 0.62} ^^A (beta:03)
+%\changes{v3.2}{2024/05/16}{letterspacing\slash tracking with \xetex\
+% (requested by \contributor Aleksandr Petrosyan <@\at @>)
+% \githubissue{22}}
% or \luatex\ 0.62.
% \begin{macrocode}
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
%<pdf->\MT@requires@pdftex6
%<lua->\MT@requires@luatex3
-{
+%<pdf-|lua->{
% \end{macrocode}
%\begin{macro}{\MT@tracking}
%\changes{v2.2}{2007/02/23}{remember fonts that shouldn't be letterspaced}
@@ -9478,9 +9688,9 @@ time will almost certainly lead to undesired results. Have your choice!}%
\fi
\fi
}
-%</pdf-|lua->
-%<pdf-|lua-|letterspace>\let\MT@tracking
-%<pdf-|lua-> \MT@tracking@
+%</pdf-|lua-|xe->
+%<pdf-|lua-|xe-|letterspace>\let\MT@tracking
+%<pdf-|lua-|xe-> \MT@tracking@
%<letterspace> \relax
% \end{macrocode}
%\end{macro}
@@ -9497,9 +9707,9 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\changes{v3.0}{2021/07/01}{with \pdftex\ 1.40.23, tracking also works for fonts with a zero \fontdim6}
% case we issue a warning (once for every font).
% \begin{macrocode}
-%<*pdf-|lua-|letterspace>
+%<*pdf-|lua-|xe-|letterspace>
\def\MT@set@tr@codes{%
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
\MT@vinfo{Tracking font `\MT@@font'\on@line}%
%<*pdf->
\MT@requires@pdftex8\@firstofone{%
@@ -9517,7 +9727,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@if@list@exists
\MT@get@tr@opt
\relax
-%</pdf-|lua->
+%</pdf-|lua-|xe->
\MT@ifdefined@c@TF\MT@letterspace@\relax{\let\MT@letterspace@\MT@letterspace}%
\ifnum\MT@letterspace@=\z@
% \end{macrocode}
@@ -9526,11 +9736,11 @@ time will almost certainly lead to undesired results. Have your choice!}%
% \begin{macrocode}
\MT@set@tr@zero
\else
-%<pdf-|lua-> \MT@vinfo{... Tracking by \number\MT@letterspace@}%
+%<pdf-|lua-|xe-> \MT@vinfo{... Tracking by \number\MT@letterspace@}%
% \end{macrocode}
% Letterspacing only works in <PDF> mode.
% \begin{macrocode}
- \MT@warn@tracking@DVI
+%<pdf-|lua-|letterspace> \MT@warn@tracking@DVI
% \end{macrocode}
%\begin{macro}{\MT@lsfont}
% The letterspaced font instances are saved in macros
@@ -9557,21 +9767,30 @@ time will almost certainly lead to undesired results. Have your choice!}%
% use when dealing with non-legacy fonts, as it is less problematic and faster
% than the \pdftex\ primitive \cmd\letterspacefont.
% \begin{macrocode}
-%<*lua-|letterspace>
- \MT@if@luaotf@font{%
-%<lua-&debug>\MT@dinfo@nl{1}{... luaotf font: \MessageBreak
-%<lua-&debug> \expandafter\fontname\font@name}%
+%<*lua-|xe-|letterspace>
+ \MT@if@opentype@font{%
+%<debug>\MT@dinfo@nl{1}{... opentype font: \MessageBreak
+%<debug> \expandafter\fontname\font@name}%
+%<lua-|xe-|letterspace> \let\MT@tr@features\@empty
+%<lua-|xe-> \MT@ifdefined@c@T\MT@tr@feat\MT@tr@set@features
\global\expandafter\font\MT@lsfont=\MT@ls@fontspec@font
+%<debug>\MT@dinfo@nl{2}{... -- new font: \expandafter\fontname\MT@lsfont}%
}{%
-%</lua-|letterspace>
+%</lua-|xe-|letterspace>
%<lua-&debug>\MT@dinfo@nl{1}{... legacy font}%
- \global\expandafter\letterspacefont\MT@lsfont\font@name\MT@letterspace@
-%<lua-|letterspace> }%
+%<lua-> \MT@ifdefined@c@T\MT@tr@feat
+%<lua-> {\MT@warning{\MT@@font\space is a legacy font.\MessageBreak
+%<lua-> Cannot disable Opentype `features' in \MT@curr@list@name}}%
+%<pdf-|lua-|letterspace> \global\expandafter\letterspacefont\MT@lsfont\font@name\MT@letterspace@
+%<xe-> \MT@warning{\MT@@font\space is a legacy font.\MessageBreak
+%<xe-> Cannot letterspace it}%
+%<xe-> \MT@glet\MT@lsfont\font@name
+%<lua-|xe-|letterspace> }%
% \end{macrocode}
%\changes{v2.2}{2007/06/16}{possibility to customise interword spacing}
% Scale interword spacing (not configurable in \letterspace).
% \begin{macrocode}
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
\MT@ifdefined@c@TF\MT@tr@ispace
{\let\@tempa\MT@tr@ispace}%
{\edef\@tempa{\MT@letterspace@*,,}}%
@@ -9579,7 +9798,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
{\edef\@tempa{\@tempa,\MT@tr@ospace}}%
{\edef\@tempa{\@tempa,,,}}%
\expandafter\MT@tr@set@space\@tempa,%
-%</pdf-|lua->
+%</pdf-|lua-|xe->
%<*letterspace>
% spacing = {<letterspace amount>*,,}
\fontdimen2\MT@lsfont=\dimexpr\numexpr 1000+\MT@letterspace@\relax sp
@@ -9591,19 +9810,22 @@ time will almost certainly lead to undesired results. Have your choice!}%
% ^^A MID: <46aa1cbb$0$31620$9b4e6d93@newsspool3.arcor-online.net>
% Adjust outer kerning (\microtype\ only).
% \begin{macrocode}
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
\MT@ifdefined@c@TF\MT@tr@okern{\let\@tempa\MT@tr@okern}{\def\@tempa{*,*}}%
\expandafter\MT@tr@set@okern\@tempa,%
% \end{macrocode}
%\changes{v2.2}{2007/02/23}{disable ligatures in letterspaced fonts manually
% (due to change in \pdftex\ 1.40.4)}
-% Disable ligatures (not configurable in \letterspace).
+% Disable ligatures (not configurable in \letterspace, not possible with \xetex).
+%\changes{v3.2}{2024/05/16}{fix noligatures for OpenType fonts with \letterspace}
% \begin{macrocode}
\MT@ifdefined@c@T\MT@tr@ligatures\MT@tr@noligatures
-%</pdf-|lua->
+%</pdf-|lua-|xe->
%<*letterspace>
% no ligatures = {f}
- \tagcode\MT@lsfont`f=\m@ne
+ \MT@if@opentype@font
+ {\MT@lua{microtype.noligatures([[\MT@lsfont]],[[\number\numexpr`f]])}}
+ {\tagcode\MT@lsfont`f=\m@ne}%
%</letterspace>
% \end{macrocode}
% Adjust protrusion values now, and maybe later (in \cs{MT@pr@split@val})
@@ -9616,11 +9838,11 @@ time will almost certainly lead to undesired results. Have your choice!}%
% (reported by \contributor Wolfram Schaalo <schaalo\at gmx.net>)}
% ^^A private mail, 2008/05/12
% \begin{macrocode}
-%<lua-|letterspace> \MT@if@luaotf@font\relax{%
-%<debug>\MT@dinfo@nl{2}{... compensating for tracking (\number\MT@letterspace@)}%
- \MT@do@font{\lpcode\MT@lsfont\@tempcnta=\numexpr\MT@letterspace@/2\relax
- \rpcode\MT@lsfont\@tempcnta=\numexpr\MT@letterspace@/2\relax}%
- \let\MT@the@pr@code\MT@the@pr@code@tr
+%<lua-|letterspace> \MT@if@opentype@font\relax{%
+%<(lua-|pdf-)&debug>\MT@dinfo@nl{2}{... compensating for tracking (\number\MT@letterspace@)}%
+%<!xe-> \MT@do@font{\lpcode\MT@lsfont\@tempcnta=\numexpr\MT@letterspace@/2\relax
+%<!xe-> \rpcode\MT@lsfont\@tempcnta=\numexpr\MT@letterspace@/2\relax}%
+%<!xe-> \let\MT@the@pr@code\MT@the@pr@code@tr
%<lua-|letterspace> }%
\fi
% \end{macrocode}
@@ -9629,8 +9851,8 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\changes{v2.5a}{2013/05/15}{fix: load font for \pkg{fontspec}} ^^A for MT@get@slot
% \begin{macrocode}
\aftergroup\MT@set@lsfont
-%<pdf-|lua-> \let\MT@font\MT@lsfont
-%<lua-> \MT@if@luaotf@font\MT@font\relax
+%<pdf-|lua-|xe-> \let\MT@font\MT@lsfont
+%<lua-|xe-> \MT@if@opentype@font\MT@font\relax
% \end{macrocode}
%\begin{macro}{\MT@set@curr@ls}
%\begin{macro}{\MT@curr@ls}
@@ -9647,11 +9869,11 @@ time will almost certainly lead to undesired results. Have your choice!}%
% We get the current outer spacing and adjust it, then, after the end of the
% current outer group, set the current outer spacing, again, and adjust.
% \begin{macrocode}
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
\MT@outer@space=\csname MT@outer@space\expandafter\string\font@name\endcsname\relax
\xdef\MT@set@curr@os{\MT@outer@space=\the\MT@outer@space\relax}%
\MT@tr@outer@l
-%</pdf-|lua->
+%</pdf-|lua-|xe->
% \end{macrocode}
%\end{macro}
% If \cs{MT@ls@adjust} is empty, it's the starred version of \cs{textls}.
@@ -9665,14 +9887,14 @@ time will almost certainly lead to undesired results. Have your choice!}%
% Otherwise, get the current outer kerning and adjust it, for left and right
% side (\microtype\ only).
% \begin{macrocode}
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
\else
\MT@outer@kern=\expandafter\expandafter\expandafter\@firstoftwo
\csname MT@outer@kern\expandafter\string\font@name\endcsname\relax
\ifdim\MT@outer@kern=\z@\else \MT@ls@outer@k \fi
\MT@outer@kern=\expandafter\expandafter\expandafter\@secondoftwo
\csname MT@outer@kern\expandafter\string\font@name\endcsname\relax
-%</pdf-|lua->
+%</pdf-|lua-|xe->
%<*letterspace>
\xdef\MT@set@curr@ok{\MT@outer@kern=\the\MT@outer@kern\relax}%
\MT@afteraftergroup{%
@@ -9681,7 +9903,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
}%
%</letterspace>
\fi
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
% \end{macrocode}
%\begin{macro}{\MT@set@curr@ok}
% Carry the outer kerning amount to outside the next group, then set outer
@@ -9698,7 +9920,7 @@ time will almost certainly lead to undesired results. Have your choice!}%
\MT@set@curr@ok
\noexpand\MT@tr@outer@r
}%
-%</pdf-|lua->
+%</pdf-|lua-|xe->
\fi
%<pdf-> }%
}
@@ -9720,10 +9942,11 @@ time will almost certainly lead to undesired results. Have your choice!}%
}%
%<!letterspace> }%
}
-%</pdf-|lua-|letterspace>
+%</pdf-|lua-|xe-|letterspace>
% \end{macrocode}
%\end{macro}
%\begin{macro}{\MT@ls@fontspec@font}
+% Add the |kernfactor| feature to a font loaded by \pkg{fontspec}.
%\changes{v2.6a}{2016/05/03}{fix for value of \textpm1000}
%\changes{v2.7}{2017/02/10}{fix for `\texttt{file:}\meta{font}' spec
% (reported by \contributor Reinhard Kotucha <reinhard.kotucha\at web.de>)}
@@ -9731,25 +9954,36 @@ time will almost certainly lead to undesired results. Have your choice!}%
%\changes{v3.0}{2021/03/19}{use \texttt{lua} to parse font spec\slash fix for font spec containing spaces
% (reported by \contributor Aman Mehra <reportaman\at gmail.com>)}
% ^^A https://tex.stackexchange.com/questions/567698/luatex-microtype-fontspec-luaotfload-buggy-interaction-canceling-each-others-s
-% Add the |kernfactor| feature to a font loaded by \pkg{fontspec}.
+%\changes{v3.2}{2024/05/03}{fix for spaces in font names, made necessary because \pkg{fontspec} v2.9b no longer strips them
+% (reported by \contributor Bernhard Fisseni <@\at @>)
+% \githubissue{35}} ^^A cf. https://github.com/latex3/fontspec/commit/b3f91feab5519d1a04db4b63adfc397e3e81a742
% \begin{macrocode}
%<*lua-|letterspace>
\def\MT@ls@fontspec@font{%
- \MT@lua{microtype.add_ls([[\MT@letterspace@]])}%
+ \MT@lua{microtype.add_ls([[\MT@letterspace@]],[[\MT@tr@features]])}%
}
%</lua-|letterspace>
+%<*xe->
+\def\MT@ls@fontspec@font{\MT@exp@two@c\MT@ls@fontspec@font@\fontname\font@name\MT@nil}
+\def\MT@ls@fontspec@font@"#1"#2\MT@nil{\MT@ls@fontspec@font@@#1::\MT@nil#2}
+\def\MT@ls@fontspec@font@@#1:#2:#3\MT@nil{%
+ "#1:#2letterspace=\strip@pt\dimexpr\MT@letterspace@ pt/10\relax
+ ;\MT@tr@features"%
+}
+%</xe->
%<*luafile>
-local function add_ls(k)
+local function add_ls(k,feat)
local f = tex.fontname(font.current())
local spec,size = match(f,'^(.+)( at .+)$')
if not spec then spec = f end
- local a,b,c = match(spec,'^([^:]+):?([^:]*):?(.*)$')
+ local q = match(spec,'^"') or ""
+ local a,b,c = match(spec,'^'..q..'([^:]+):?([^:]*):?(.*)'..q..'$')
local ls = "kernfactor=" .. k/1000 .. ';'
- microtype.sprint(a..':')
+ microtype.sprint(q..a..':')
if (a == "name" or a == "file") then
- microtype.sprint(b..':'..ls..c)
+ microtype.sprint(b..':'..ls..c..feat..q)
else
- microtype.sprint(ls..b)
+ microtype.sprint(ls..b..feat..q)
end
if size then
microtype.sprint(size)
@@ -9763,7 +9997,7 @@ microtype.add_ls = add_ls
%\begin{macro}{\MT@get@tr@opt}
% Various settings (only for the \microtype\ version).
% \begin{macrocode}
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
\def\MT@get@tr@opt{%
\MT@set@listname
\let\MT@tr@factor@\@m
@@ -9809,6 +10043,7 @@ microtype.add_ls = add_ls
% Which ligatures should we disable (empty means all, undefined none)?
% \begin{macrocode}
\MT@get@tr@opt@{noligatures} {ligatures}%
+%<lua-|xe-> \MT@get@tr@opt@{features} {feat}%
}
% \end{macrocode}
%\end{macro}
@@ -9819,14 +10054,92 @@ microtype.add_ls = add_ls
\MT@ifdefined@n@T{MT@tr@c@\MT@tr@c@name @#1}%
{\MT@let@nn{MT@tr@#2}{MT@tr@c@\MT@tr@c@name @#1}}%
}
-%</pdf-|lua->
+%</pdf-|lua-|xe->
% \end{macrocode}
%\end{macro}
+%\begin{macro}{\MT@tr@set@features}
+% With \luatex\ or \xetex, Ligatures features may be switched
+% on or off.
+% \begin{macrocode}
+%<*lua-|xe->
+\def\MT@tr@set@features{%
+ \MT@map@clist@c\MT@tr@feat{%
+ \MT@ifempty{##1}\relax{%
+ \MT@if@false
+ \lowercase{\edef\@tempa{##1}}%
+ \MT@map@tlist@n{{{required} {rlig}}
+ {{common} {liga}}
+ {{contextual} {clig}}
+ {{rare} {dlig}}
+ {{discretionary}{dlig}}
+ {{historic} {hlig}}
+%<lua-> {{tex} {tlig}}
+ }\MT@tr@set@feature@
+ \ifMT@if@\else
+%<*xe->
+ \MT@ifstreq{\@tempa}{tex}{%
+ \MT@xadd\MT@tr@features{mapping=tex-text;}%
+ }{%
+ \MT@ifstreq{\@tempa}{texoff}{%
+ \MT@xadd\MT@tr@features{mapping=;}%
+ }{%
+ \MT@ifstreq{\@tempa}{notex}{%
+ \MT@xadd\MT@tr@features{mapping=;}%
+ }{%
+%</xe->
+ \MT@ifstreq{\@tempa}{resetall}{%
+ \MT@xadd\MT@tr@features{+dlig;-dlig;+rlig;-rlig;+liga;-liga;+clig;-clig;+hlig;-hlig;%
+%<lua-> +tlig,-tlig;%
+%<xe-> mapping=tex-text;%
+ }%
+ }{%
+ \MT@warning@nl{Unknown Ligatures feature `##1' in \MT@curr@list@name.
+ Ignoring it}%
+ }%
+%<xe-> }}}%
+ \fi
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\MT@tr@set@feature@}
+%\begin{macro}{\MT@tr@set@feature@@}
+% \begin{macrocode}
+\def\MT@tr@set@feature@#1{%
+ \MT@tr@set@feature@@#1%
+}
+\def\MT@tr@set@feature@@#1#2{%
+ \MT@ifstreq\@tempa{#1}{%
+ \MT@tr@set@feature@@@{+#2}%
+ }{%
+ \MT@ifstreq\@tempa{#1off}{%
+ \MT@tr@set@feature@@@{-#2}%
+ }{%
+ \MT@ifstreq\@tempa{no#1}{%
+ \MT@tr@set@feature@@@{-#2}%
+ }{%
+ \MT@ifstreq\@tempa{#1reset}{%
+ \MT@tr@set@feature@@@{+#2;-#2}%
+ }\relax
+ }%
+ }%
+ }%
+}
+\def\MT@tr@set@feature@@@#1{%
+ \MT@xadd\MT@tr@features{#1;}%
+ \MT@if@true
+ \MT@tlist@break
+}
+%</lua-|xe->
+% \end{macrocode}
+%\end{macro}
+%\end{macro}
%\begin{macro}{\MT@set@lsfont}
% Redefine \cmd\font@name, which will be called a second later (in
% \cmd\selectfont).
% \begin{macrocode}
-%<*pdf-|lua-|letterspace>
+%<*pdf-|lua-|xe-|letterspace>
%<plain>\MT@requires@latex2{
\def\MT@set@lsfont{\MT@exp@two@c\let\font@name\MT@lsfont}
% \end{macrocode}
@@ -9862,8 +10175,8 @@ microtype.add_ls = add_ls
\DeclareRobustCommand\lsstyle{%
\not@math@alphabet\lsstyle\textls
\let\glb@currsize\@empty
-%<pdf-|lua-> \MT@maybe@gobble@with@tikz{\aftergroup\glb@settings}%
-%<pdf-|lua-> \def\MT@feat{tr}%
+%<pdf-|lua-|xe-> \MT@maybe@gobble@with@tikz{\aftergroup\glb@settings}%
+%<pdf-|lua-|xe-> \def\MT@feat{tr}%
\let\MT@tracking\MT@set@tr@codes
\selectfont
}
@@ -9954,32 +10267,52 @@ microtype.add_ls = add_ls
\aftergroup\MT@set@lsbasefont
\fi
}
-%</pdf-|lua-|letterspace>
+%</pdf-|lua-|xe-|letterspace>
% \end{macrocode}
%\end{macro}
%\end{macro}
%\begin{macro}{\MT@tr@noligatures}
+% Since an empty value is somewhat ambiguous, we also allow the values
+% `|all|' and `|none|'.
+%\changes{v3.2}{2024/04/03}{new values `\texttt{none}' and `\texttt{all}'
+% for the `\texttt{no ligatures}' key in
+% \cs{SetTracking} (after a report by \contributor user202729 <@\at @>)}
+% ^^A https://tex.stackexchange.com/questions/709456/ligatures-are-not-preserved-by-textls-letter-spacing/
% \pdftex\ 1.40.0--1.40.3 disabled all ligatures in letterspaced fonts.
% \begin{macrocode}
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
%<pdf->\MT@requires@pdftex7{
+%<*pdf-|lua->
\def\MT@tr@noligatures{%
\ifx\MT@tr@ligatures\@empty
\MT@noligatures@\MT@lsfont\@undefined
\else
- \MT@noligatures@\MT@lsfont\MT@tr@ligatures
+ \MT@ifstreq\MT@tr@ligatures{all}{%
+ \MT@noligatures@\MT@lsfont\@undefined
+ }{%
+ \MT@ifstreq\MT@tr@ligatures{none}\relax{%
+ \MT@noligatures@\MT@lsfont\MT@tr@ligatures
+ }%
+ }%
\fi
}
-%<*pdf->
-}{
+%</pdf-|lua->
+%<*pdf-|xe->
+%<pdf->}{
\def\MT@tr@noligatures{%
- \MT@warning@nl{%
- Disabling selected ligatures is only possible since\MessageBreak
- pdftex 1.40.4. Disabling all ligatures instead}%
- \MT@glet\MT@tr@noligatures\relax
+ \MT@ifstreq\MT@tr@ligatures{all}\relax{%
+ \MT@warning@nl{%
+ Disabling (selected) ligatures is
+%<pdf-> possible since\MessageBreak pdftex 1.40.4.
+%<pdf-> Disabling all ligatures instead%
+%<xe-> not possible with\MessageBreak xetex.
+%<xe-> Ignoring `no ligatures' key in \MT@curr@list@name
+ }%
+ \MT@glet\MT@tr@noligatures\relax
+ }%
}
-}
-%</pdf->
+%<pdf->}
+%</pdf-|xe->
% \end{macrocode}
%\end{macro}
%\begin{macro}{\MT@outer@space}
@@ -10047,10 +10380,16 @@ microtype.add_ls = add_ls
% \end{macrocode}
% For \fontdim2, we also have to subtract the kerning that letterspacing adds
% to each side of the characters (only half if it's for outer spacing).
+%\changes{v3.2}{2024/05/15}{fix for \luatex\ and \xetex}
+% This is necessary only for legacy fonts.
% \begin{macrocode}
+%<*pdf-|lua->
\ifnum#2=\tw@
+%<lua-> \MT@if@opentype@font\relax{%
\advance\@tempdima -\dimexpr\MT@letterspace@ sp*\MT@dimen@six/#3\relax
+%<lua-> }%
\fi
+%</pdf-|lua->
}{%
\MT@ifempty\@tempa{\let\@tempa\MT@letterspace@}\relax
\@tempdima=\dimexpr \numexpr1000+\@tempa sp *\fontdimen#2\MT@lsfont/1000\relax
@@ -10259,6 +10598,7 @@ microtype.add_ls = add_ls
%\end{macro}
% For older \pdftex\ versions and \luatex, throw an error.
% \begin{macrocode}
+%<*pdf-|lua->
}{
\DeclareRobustCommand\lsstyle{%
\MT@error{Letterspacing only works with \MT@engine tex version
@@ -10269,17 +10609,8 @@ microtype.add_ls = add_ls
\MT@glet\lsstyle\relax
}
}
-% \end{macrocode}
-% And for \xetex, too.
-% \begin{macrocode}
%</pdf-|lua->
-%<*xe->
-\DeclareRobustCommand\lsstyle{%
- \MT@error{Letterspacing currently doesn't work with xetex}
- {Run pdftex or luatex, or use the `soul' package instead.}%
- \MT@glet\lsstyle\relax
-}
-%</xe->
+%</pdf-|lua-|xe->
% \end{macrocode}
%\begin{macro}{\textls}
%\changes{v2.0}{2005/09/21}{new command: letterspacing} ^^A (beta:1)
@@ -10364,12 +10695,13 @@ microtype.add_ls = add_ls
%\begin{macro}{\MT@outer@kern}
%\begin{macro}{\MT@tr@set@okern}
%\changes{v2.3d}{2008/12/19}{allow empty value for \texttt{outer kerning}}
+%\changes{v3.2}{2024/05/14}{fix for \luatex\ and \xetex}
% This dimen is used for the starred version of \cs{textls}, for \cs{lslig}
% and for adjusted outer kerning.
% \begin{macrocode}
\newdimen\MT@outer@kern
%</package|letterspace>
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
\def\MT@tr@set@okern#1,#2,{%
\let\MT@temp\@empty
\MT@ifempty{#1}{\MT@tr@set@okern@{*}}{\MT@tr@set@okern@{#1}}%
@@ -10394,11 +10726,13 @@ microtype.add_ls = add_ls
\@tempdima=\dimexpr \numexpr\@tempa*\MT@letterspace@/1000\relax sp
* \fontdimen6\MT@lsfont/2000\relax
}%
- \advance\@tempdima -\dimexpr \MT@letterspace@ sp
- * \fontdimen6\MT@lsfont/2000\relax
+%<lua-> \MT@if@opentype@font\relax{%
+%<pdf-|lua-> \advance\@tempdima -\dimexpr \MT@letterspace@ sp
+%<pdf-|lua-> * \fontdimen6\MT@lsfont/2000\relax
+%<lua-> }%
\edef\MT@temp{\MT@temp{\the\@tempdima}}%
}
-%</pdf-|lua->
+%</pdf-|lua-|xe->
% \end{macrocode}
%\end{macro}
%\begin{macro}{\MT@ls@outer@k}
@@ -10406,7 +10740,7 @@ microtype.add_ls = add_ls
% for cases of nested letterspacing without anything actually printed. ^^A eg. \LaTeX!
%\changes{v2.5a}{2013/05/15}{add marker for tightly nested letterspacing}
% \begin{macrocode}
-%<*pdf-|lua-|letterspace>
+%<*pdf-|lua-|xe-|letterspace>
\def\MT@ls@outer@k{%
\ifhmode
\ifdim\lastkern=-3sp \unkern
@@ -10421,7 +10755,7 @@ microtype.add_ls = add_ls
{\kern\MT@outer@kern\kern3sp\kern-3sp\relax}%
\fi
}
-%</pdf-|lua-|letterspace>
+%</pdf-|lua-|xe-|letterspace>
% \end{macrocode}
%\end{macro}
%
@@ -10463,19 +10797,22 @@ microtype.add_ls = add_ls
%\changes{v2.3b}{2008/03/27}{fix: warning messages for unknown slots}
% \begin{macrocode}
\let\MT@warn@maybe@inputenc\@empty
- \def\MT@curr@list@name{\@backslashchar DisableLigatures}%
+ \MT@ifstreq\MT@feat{tr}\relax
+ {\def\MT@curr@list@name{\@backslashchar DisableLigatures}}%
\MT@map@clist@c#2{%
- \KV@@sp@def\@tempa{##1}\MT@get@slot
- \ifnum\MT@char>\m@ne
- \tagcode#1\MT@char=\m@ne
+ \MT@ifempty{##1}\relax{%
+ \KV@@sp@def\@tempa{##1}\MT@get@slot
+ \ifnum\MT@char>\m@ne
+ \tagcode#1\MT@char=\m@ne
% \end{macrocode}
% With \luatex, we additionally register the ligatures that should be inhibited
% in a table (used by the \pkg{luaotfload} function |keepligature|).
%\changes{v2.6}{2016/04/20}{use \pkg{luaotfload} function to keep\slash inhibit ligatures}
% \begin{macrocode}
-%<lua-> \MT@if@luaotf@font
-%<lua-> {\MT@lua{microtype.noligatures([[#1]],[[\MT@char]])}}\relax
- \fi
+%<lua-> \MT@if@opentype@font
+%<lua-> {\MT@lua{microtype.noligatures([[#1]],[[\MT@char]])}}\relax
+ \fi
+ }%
}%
\MT@vinfo{... Disabling ligatures for characters: #2}%
}{%
@@ -10486,7 +10823,7 @@ microtype.add_ls = add_ls
}%
}{%
\pdfnoligatures#1%
-%<lua-> \MT@if@luaotf@font
+%<lua-> \MT@if@opentype@font
%<lua-> {\MT@lua{microtype.noligatures([[#1]],"_all_")}}\relax
\MT@vinfo{... Disabling all ligatures}%
}%
@@ -12086,9 +12423,9 @@ end
%<*pdf-|lua-|xe->
%<pdf->\MT@requires@pdftex6
%<lua->\MT@requires@luatex3
-%<pdf-|lua-> {\def\MT@active@features{,tr}}{%
- \let\MT@active@features\@empty
-%<pdf-|lua-> }
+%<pdf-|lua-> {%
+ \def\MT@active@features{,tr}%
+%<pdf-|lua-> }{\let\MT@active@features\@empty}
%</pdf-|lua-|xe->
% \end{macrocode}
%\end{macro}
@@ -12182,7 +12519,7 @@ end
% Inside the preamble, this command shouldn't actually do anything but remember itself for
% later.
% \begin{macrocode}
-\def\microtypecontext{\MT@begin@catcodes\MT@microtypecontext}
+\DeclareRobustCommand\microtypecontext{\MT@begin@catcodes\MT@microtypecontext}
\def\MT@microtypecontext#1{\MT@end@catcodes\MT@addto@setup{\microtypecontext{#1}}}
\MT@addto@setup{%
\DeclareRobustCommand\microtypecontext{%
@@ -12598,6 +12935,13 @@ end
\MT@get@size@
\fi
% \end{macrocode}
+% Font specifications also accept dimens. (\cmd\ifdefdimen\ is provided
+% by \pkg{etoolbox}.)
+%\changes{v3.2}{2024/05/03}{check for dimen (reported by \contributor Oliver Beery <@\at @>)
+% \githubissue{36}}
+% \begin{macrocode}
+^^X \MT@exp@one@n\ifdefdimen\MT@val{\edef\MT@val{\the\MT@val}}\relax
+% \end{macrocode}
% Test whether we finally got a number or dimension so that we can strip the
% `|pt|' (\cmd\@defaultunits\ and \cmd\strip@pt\ are kernel macros).
%\changes{v1.2}{2004/09/27}{additional magic to catch some errors}
@@ -13027,20 +13371,28 @@ end
%\subsubsection{Interaction with \pkg{babel}}
%
%\begin{macro}{\DeclareMicrotypeBabelHook}
+%\changes{v2.0}{2005/10/04}{new command: interaction with \pkg{babel}} ^^A (beta:1)
+%\changes{v3.2}{2024/05/25}{make catcode-safe}
+%\begin{macro}{\MT@DeclareMicrotypeBabelHook}
% Declare the context that should be loaded when a \pkg{babel} language
% is selected. The command will not check whether a previous declaration will
% be overwritten.
-%\changes{v2.0}{2005/10/04}{new command: interaction with \pkg{babel}} ^^A (beta:1)
% \begin{macrocode}
%<*package>
-\def\DeclareMicrotypeBabelHook#1#2{%
+\def\DeclareMicrotypeBabelHook{%
+ \MT@begin@catcodes
+ \MT@DeclareMicrotypeBabelHook
+}
+\def\MT@DeclareMicrotypeBabelHook#1#2{%
\MT@map@clist@n{#1}{%
\KV@@sp@def\@tempa{##1}%
\MT@gdef@n{MT@babel@\@tempa}{#2}%
}%
+ \MT@end@catcodes
}
% \end{macrocode}
%\end{macro}
+%\end{macro}
%
%
%\subsubsection{Fine tuning}
@@ -13138,6 +13490,7 @@ end
\MT@gdef@n{MT@ex@c@\MT@ex@c@name}{#3}%
\MT@end@catcodes
}
+%</pdf-|lua->
% \end{macrocode}
%\end{macro}
%\end{macro}
@@ -13152,7 +13505,10 @@ end
% to adjust interword spacing
% (suggested by \contributor Steven~E. Harris <seh\at panix.com>)}
% ^^A private mail, 2007/06/15
+%\changes{v3.2}{2024/05/15}{new key `\texttt{features}' to en-\slash disable \pkg{fontspec}
+% features (\luatex\ or \xetex)}
% \begin{macrocode}
+%<*pdf-|lua-|xe->
\def\SetTracking{%
\MT@begin@catcodes
\MT@SetTracking
@@ -13178,7 +13534,7 @@ end
tracking set `\MT@curr@set@name'}}}%
\MT@end@catcodes
}
-%</pdf-|lua->
+%</pdf-|lua-|xe->
% \end{macrocode}
%\end{macro}
%\begin{macro}{\SetExtraSpacing}
@@ -13526,11 +13882,9 @@ end
{\MT@warn@nodim{character widths}}%
}%
}
-%</package>
% \end{macrocode}
% Tracking may only be relative to a dimension.
% \begin{macrocode}
-%<*pdf-|lua->
\define@key{MT@tr@c}{unit}[1em]{%
\MT@glet@nc{MT@tr@c@\MT@curr@set@name @unit}\@empty
\def\@tempa{#1}%
@@ -13539,7 +13893,7 @@ end
{\MT@warn@nodim{1em}%
\MT@gdef@n{MT@tr@c@\MT@curr@set@name @unit}{1em}}%
}
-%</pdf-|lua->
+%</package>
% \end{macrocode}
% Spacing and kerning codes may additionally be relative to space dimensions.
% \begin{macrocode}
@@ -13603,14 +13957,17 @@ end
%<pdf-> \relax
\fi
}
+%</pdf-|lua->
% \end{macrocode}
% Tracking: Interword spacing and outer kerning.
% The variant with space just in case \cs{SetTracking} is called inside an
% argument (\eg, to \cmd\IfFileExists).
% \begin{macrocode}
+%<*pdf-|lua-|xe->
\MT@define@opt@key{tr}{spacing}
\MT@define@opt@key{tr}{outerspacing}
\MT@define@opt@key{tr}{outerkerning}
+\MT@define@opt@key{tr}{features}
% \end{macrocode}
% Which ligatures should be disabled?
% \begin{macrocode}
@@ -13619,7 +13976,7 @@ end
\define@key{MT@tr@c}{outer spacing}[]{\setkeys{MT@tr@c}{outerspacing={#1}}}
\define@key{MT@tr@c}{outer kerning}[]{\setkeys{MT@tr@c}{outerkerning={#1}}}
\define@key{MT@tr@c}{no ligatures}[]{\setkeys{MT@tr@c}{noligatures={#1}}}
-%</pdf-|lua->
+%</pdf-|lua-|xe->
% \end{macrocode}
%
%\subsubsection{Character inheritance}
@@ -14652,6 +15009,7 @@ end
%\changes{v1.7}{2005/02/17}{fix: warning also when setting to \texttt{(no)compatibility}}
%\changes{v1.9a}{2005/11/21}{inside the preamble, accepts all package options}
%\changes{v2.3d}{2009/03/05}{select font after setup}
+%\changes{v3.2}{2024/04/24}{make robust}
%\begin{macro}{\MT@define@optionX}
% Inside the preamble, \cs{microtypesetup} accepts the same options as the
% package (unless \opt{defersetup}|=false|).
@@ -14659,8 +15017,8 @@ end
% |protrusion|, |expansion|, |activate|, |tracking|, |spacing| and |kerning|
% (but specifying font sets is not allowed), and |patch| and |nopatch|.
% \begin{macrocode}
-\def\microtypesetup{\setkeys{MT}}
-\MT@addto@setup{\def\microtypesetup#1{\setkeys{MTX}{#1}\selectfont}}
+\DeclareRobustCommand\microtypesetup{\setkeys{MT}}
+\MT@addto@setup{\DeclareRobustCommand\microtypesetup[1]{\setkeys{MTX}{#1}\selectfont}}
%</package>
%<*pdf-|lua-|xe->
\def\MT@define@optionX#1#2{%
@@ -14732,7 +15090,6 @@ end
%\end{macro}
% \begin{macrocode}
\MT@define@optionX{protrusion}\MT@protrudechars
-%</pdf-|lua-|xe->
%<*pdf-|lua->
\MT@define@optionX{expansion}\MT@adjustspacing
% \end{macrocode}
@@ -14759,7 +15116,6 @@ end
% The same for |tracking|, |spacing| and |kerning|, which do not have a
% |compatibility| level.
% \begin{macrocode}
-%<*pdf-|lua->
%<pdf->\MT@requires@pdftex6{
%<lua->\MT@requires@luatex3{
\def\MT@define@optionX@#1#2{%
@@ -14798,13 +15154,11 @@ end
%<pdf-> \MT@define@optionX@{spacing}{\pdfadjustinterwordglue\@tempcnta}
%<pdf-> \MT@define@optionX@{kerning}{\pdfprependkern\@tempcnta
%<pdf-> \pdfappendkern\@tempcnta}
-}{
-%</pdf-|lua->
-%<*pdf-|lua-|xe->
+%<pdf-|lua->}{
% \end{macrocode}
% Disable for older \pdftex\ versions and for \xetex\ and \luatex.
% \begin{macrocode}
-\define@key{MTX}{tracking}[true]{\MT@warning{Ignoring tracking setup}}
+%<pdf-|lua->\define@key{MTX}{tracking}[true]{\MT@warning{Ignoring tracking setup}}
%<lua->}
\define@key{MTX}{kerning}[true]{\MT@warning{Ignoring kerning setup}}
\define@key{MTX}{spacing}[true]{\MT@warning{Ignoring spacing setup}}
@@ -15265,7 +15619,7 @@ end
%\begin{macro}{\MT@setup@tracking}
% Tracking, spacing and kerning.
% \begin{macrocode}
-%<*pdf-|lua->
+%<*pdf-|lua-|xe->
%<pdf->\MT@requires@pdftex6{%
%<lua->\MT@requires@luatex3{%
\def\MT@setup@tracking{%
@@ -15282,7 +15636,7 @@ end
\MT@info@nl{No adjustment of tracking}%
\fi
}
-%</pdf-|lua->
+%</pdf-|lua-|xe->
% \end{macrocode}
%\end{macro}
%\begin{macro}{\MT@setup@spacing}
@@ -15393,7 +15747,7 @@ end
}%
\fi
}
-%<pdf-|xe-> \def\MT@setup@tracking{\MT@error@doesnt@work{tracking}}
+%<pdf-> \def\MT@setup@tracking{\MT@error@doesnt@work{tracking}}
\def\MT@setup@kerning {\MT@error@doesnt@work{kerning}}
\def\MT@setup@spacing {\MT@error@doesnt@work{spacing}}
%<pdf->}
@@ -15402,8 +15756,8 @@ end
%\end{macro}
%\begin{macro}{\MT@setup@warntracking}
% \begin{macrocode}
+%<pdf-|lua-|xe->\def\MT@setup@warntracking
%<letterspace>\MT@addto@setup
-%<pdf-|lua->\def\MT@setup@warntracking
% \end{macrocode}
%\begin{macro}{\MT@warn@tracking@DVI}
%\changes{v2.2}{2007/02/11}{warning when letterspacing in <DVI> mode}
@@ -15412,7 +15766,7 @@ end
% not work. We also switch on protrusion if it isn't already, to compensate for
% the letterspacing kerns.
% \begin{macrocode}
-%<*pdf-|lua-|letterspace>
+%<*pdf-|lua-|xe-|letterspace>
{%
%<*pdf-|letterspace>
\ifnum\pdfoutput<\@ne
@@ -15428,10 +15782,12 @@ end
}%
\else
%</pdf-|letterspace>
+%<*pdf-|lua-|letterspace>
\def\MT@warn@tracking@DVI{%
\ifnum\pdfprotrudechars<\@ne \global\pdfprotrudechars\@ne \fi
\MT@glet\MT@warn@tracking@DVI\relax
}%
+%</pdf-|lua-|letterspace>
%<pdf-|letterspace> \fi
% \end{macrocode}
%\end{macro}
@@ -15442,8 +15798,7 @@ end
\MT@ls@too@large\MT@letterspace
\fi
}
-%</pdf-|lua-|letterspace>
-%<xe->\let\MT@setup@warntracking\relax
+%</pdf-|lua-|xe-|letterspace>
% \end{macrocode}
%\end{macro}
%\begin{macro}{\MT@setup@noligatures}
@@ -16424,16 +16779,26 @@ end
% By default, we only disable the `f*' ligatures, for those fonts that have
% any. Thus, ligatures and especially kerning for all other characters will be
% retained.
+%\changes{v3.2}{2024/05/13}{\texttt{features} instead of \texttt{no ligatures} with \xetex}
+% With \xetex, we reset all ligatures (keeping only the \TeX\ pseudo-ligatures).
% \begin{macrocode}
%<*m-t>
%%% -----------------------------------------------------------------------
%%% TRACKING/LETTERSPACING
-\SetTracking
+\ifx\XeTeXrevision\@undefined
+\SetTracking % pdftex/luatex
[ name = default,
no ligatures = {f} ]
{ encoding = {OT1,T1,T2A,LY1,OT4,QX,EU2,TU} }
{ }
+\else
+\SetTracking % xetex
+ [ name = default,
+ features = {ResetAll} ]
+ { encoding = {EU1,TU} }
+ { }
+\fi
% \end{macrocode}
%
@@ -20451,7 +20816,7 @@ This is the current font stretched by 5\%, normal, and shrunk by 5\%:
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-% \CheckSum{13078}
+% \CheckSum{13403}
%
% \Finale
%
diff --git a/macros/latex/contrib/microtype/microtype.pdf b/macros/latex/contrib/microtype/microtype.pdf
index d2447135fe..68b6b3b5d8 100644
--- a/macros/latex/contrib/microtype/microtype.pdf
+++ b/macros/latex/contrib/microtype/microtype.pdf
Binary files differ