latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
239 stars 28 forks source link

XeLaTeX, set mono font after loading unicode-math and modify \parfillskip leads to big whitespace in \texttt #632

Open Jinwen-XU opened 4 months ago

Jinwen-XU commented 4 months ago

Description

With XeLaTeX, if one \setmonofont after loading unicode-math, and then modify the \parfillskip, there would be issue with the spacing in \texttt.

This problem does not happen with LuaLaTeX.

See https://tex.stackexchange.com/q/711456.

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmonofont{NewCMMono10-Regular.otf} % any other typewriter font would do

\begin{document}

\setlength{\parfillskip}{0pt plus 10pt}

\texttt{some text with whitespaces}

\texttt{some-text-with-whitespaces}

\end{document}
wspr commented 4 months ago

Thanks for the report. How bizarre. Confirming this problem does NOT arise when fontspec is loaded without unicode-math.

davidcarlisle commented 4 months ago

@wspr Ulrike commented at tex.sx that you can reproduce with just fontspec by declaring the font twice https://tex.stackexchange.com/questions/711456/xelatex-set-mono-font-after-loading-unicode-math-and-modify-parfillskip-leads#comment1767977_711456