4

I just installed TeXLive-2016 and noticed that microtype, more precisely, the command \textls and exscale crashes, whereas they work fine in TeXLive-2015. Here is an example:

\documentclass{article}
\usepackage{microtype}
\usepackage{exscale}
\begin{document}
\textls[160]{$abc$}
\end{document}

What would be the reason behind this incompatibility?

  • The problem is clearly in what exscale adds to \every@math@size; not sure why it used to work and doesn't now. – egreg Jun 23 '16 at 9:05
  • @egreg: Imho it is a microtype problem. It seems to do some \global\let (\MT@glet) instead of \let now for \glb@currsize etc. But I'm not sure where exactly. – Ulrike Fischer Jun 23 '16 at 9:13
  • @UlrikeFischer I seem to remember that the local setting of \glb@currsize caused problems elsewhere: see tex.stackexchange.com/questions/291308/… – egreg Jun 23 '16 at 9:46
2

I'm not sure why math is used in a \textls context, but…

There is a difference between microtype version 2.6a (TL 2016)

\DeclareRobustCommand\lsstyle{%
  \not@math@alphabet\lsstyle\textls
  \MT@glet\glb@currsize\@empty
  \def\MT@feat{tr}%
  \let\MT@tracking\MT@set@tr@codes
  \selectfont
}

and version 2.5a (TL 2015)

\DeclareRobustCommand\lsstyle{%
  \not@math@alphabet\lsstyle\textls
  \let\glb@currsize\@empty
  \def\MT@feat{tr}%
  \let\MT@tracking\MT@set@tr@codes
  \selectfont
}

The code is in microtype-pdftex.def and in microtype-luatex.def (no \textls is defined with XeTeX).

There is no comment in the sources about the change from \let to \global\let, but it's what it should be done (see source2e). However, exscale does

\addto@hook\every@math@size{%
  \begingroup
     \setbox\z@\vbox{\hbox{$($}\kern\z@}%
     \global\big@size 1.2\ht\z@
  \endgroup}

and we can see the problem: the math formula inside the group triggers setting the math sizes and the value of \glb@currsize is empty, causing \every@math@size to be called… Infinite loop.

The following patch might solve the problem, because \textfont0 should already be set when the \hbox is built for measuring purposes.

\documentclass{article}
\usepackage{microtype}
\usepackage{exscale}
\usepackage{etoolbox}

\makeatletter
\edef\next{\the\every@math@size}
\patchcmd\next{\hbox{$($}}{\hbox{\the\textfont\z@(}}{}{}
\every@math@size=\expandafter{\next}
\makeatother

\begin{document}

$(\big(\Big(\bigg(\Bigg($

{\Large$(\big(\Big(\bigg(\Bigg($}

\textls[160]{$abc$}
\end{document}

enter image description here

  • I don't think the empty \glb@currsize alone is the problem. \mathversion sets it to empty too, and excale doesn't break. Resetting the older lsstyle definition doesn't help. And \lsstyle \gdef\glb@currsize{10} $abc$ fails too (but with a different error). – Ulrike Fischer Jun 23 '16 at 10:10
  • @UlrikeFischer The problem, I believe, is in typesetting the test formula in \every@math@size, which is not done by \mathversion. However, something else should be done, because \glb@currsize turns out to be empty. – egreg Jun 23 '16 at 10:13
  • The problem is in the definition of \MT@set@tr@codes. At the end a line has been added that resets \glb@currsize (\MT@glet\noexpand\glb@currsize\noexpand\@empty}. When I remove this the example compiles again. – Ulrike Fischer Jun 23 '16 at 10:52
  • @UlrikeFischer The code was added as a fix for tex.stackexchange.com/questions/187655/… – egreg Jun 23 '16 at 10:59
  • shouldn't microtype in \lsstyle use \aftergroup\glb@settings (like mathversion) to avoid this bug instead of the code in \MT@set@tr@codes? Seems to work fine. – Ulrike Fischer Jun 23 '16 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.