Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\DisableLigatures no longer working with microtype 3.2 and unicode-math #42

Open
njbart opened this issue Dec 17, 2024 · 1 comment
Open
Assignees
Labels
fixed in dev Fixed in the dev branch

Comments

@njbart
Copy link

njbart commented Dec 17, 2024

Description

Using \DisableLigatures[?,!]{} no longer seems to work with microtype 2024/12/12 v3.2 in the presence of \usepackage{unicode-math}.

Error message processing the MWE below (engine: This is LuaHBTeX, Version 1.18.0 (TeX Live 2024) (format=lualatex 2024.12.4) 17 DEC 2024 13:34:

! Undefined control sequence.
<argument> MT@feat 

Commenting out either \usepackage{unicode-math} or \DisableLigatures[?,!]{} results in a successful run of lualatex.

On a different machine which still has microtype 2024/03/29 3.1b, the unmodified MWE below continues to work well.

Background

This is to avoid unwanted ligatures: two when the following is intended: one
if a latex file contains character combinations such as !`.

pandoc (and quarto) unfortunately emit latex code containing !`` and ?``, even when unicode !“ or ?“ is used in the markdown source, and \usepackage{unicode-math} is included by pandoc (and quarto) by default and cannot easily be removed. In pandoc, latex ligatures can only be completely disabled, and in quarto, they cannot be disabled at all so far. In particular when using quarto, the only workaround I’ve found has been to use lualatex and the \DisableLigatures command.

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{microtype}
\usepackage{unicode-math}
\usepackage{fontspec}
\setmainfont[Renderer=Basic]{Arial}
\DisableLigatures[?,!]{}
\begin{document}
„Hi!``

„What?``
\end{document}
@schlcht
Copy link
Owner

schlcht commented Dec 18, 2024

thanks for the report, that's just one definition missing:

\def\MT@noligatures{%
  \MT@dotrue
  \let\@tempa\MT@nl@setname
  \def\MT@feat{nl}% <-- THIS LINE
  \MT@map@clist@n{font,encoding,family,series,shape,size}{%
    \MT@ifdefined@n@TF{MT@checklist@##1}%
      {\csname MT@checklist@##1\endcsname}%
      {\MT@checklist@{##1}}%
    {nl}%
  }%
  \ifMT@do
    \MT@noligatures@\MT@font\MT@nl@ligatures
  \fi
}

schlcht added a commit that referenced this issue Dec 18, 2024
@schlcht schlcht added the fixed in dev Fixed in the dev branch label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in dev Fixed in the dev branch
Projects
None yet
Development

No branches or pull requests

2 participants