Skip to content

Expansion context fails in LuaTeX #68

Description

@rhelder

Description

With LuaTeX, changing stretch or string parameters with \microtypecontext causes error: (font expansion): font has been expanded with different stretch limit. I cannot reproduce the issue with pdfTeX.

Note: If expansion contexts just aren't supported for LuaTeX, I apologize -- the manual both says that expansion contexts are only supported by pdfTeX and implies that they are suppored by LuaTeX. On page 14, before the sloppy example, the manual says 'expansion contexts are only possible with pdfTeX version 1.40.4 or newer'. After the same example, the manual says 'This method of employing contexts to temporarily apply different expansion parameters only works with pdfTeX version 1.40.4 or later, or with LuaTeX.' I'm writing this report on the assumption that the latter is true, and apologies again if I've got it wrong.

Minimal example

\documentclass{article}
\usepackage[verbose]{microtype}

\SetExpansion[context=ragged, stretch=0, shrink=20]{encoding = {OT1,T1,TS1,TU}}{}

\begin{document}
{\microtypecontext{expansion=ragged}Hello world}
\end{document}

This example leads to error: (font expansion): font has been expanded with different stretch limit when using LuaTeX, but everything goes fine with pdfTeX. (It works with LuaTeX if you remove TU from the list of encodings, since the other encodings are note used.)

If my very remedial understanding is correct, this is happening because LuaTeX only allows one stretch or shrink limit per font. However, microtype usually works around this by copying (in pdfTeX) or redefining (in LuaTeX) the font. It seems from the log output that maybe microtype is not redefining the font as it should. The log is attached here:

min.log

For what it's worth, disabling expansion altogether (with \microtypesetup{expansion=false}) causes no problems with LuaTeX.

Let me know if there's any other information I can provide that would be helpful. Thanks for your work on this excellent package!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions