3

Why don't the nicematrix and fontspec package play well together?

Here is a MWE:

\documentclass{article}

\usepackage{nicematrix}
\usepackage{fontspec}
\usepackage{lipsum}

\begin{document}
\lipsum*[1-3]
$\begin{pNiceMatrix}a&b\\0&0\end{pNiceMatrix}$
\end{document} 

When you comment out either the fontspec package or the nicematrix package (and the corresponding environment) the compilation runs fine. As is, if you put in a NiceMatrix environment, it still compiles, but throws the error LaTeX Error: Missing \begin{document}.

  • 1
    I have no such problem, compiling with xelatex as well as with lualatex. Is your installation up-to-date? – Bernard Sep 20 at 21:04
  • Interesting; I did update my installation before posting the question. My system is a Mac running TeX Live 2019. I can provide the log file if that would help. – tim Sep 20 at 21:16
  • Quite strange… And you have the error message with this very code? – Bernard Sep 20 at 21:19
  • Yep! Here's the link to the log file. Apparently the error occurs immediately when loading the nicematrix package. – tim Sep 20 at 21:28
  • I see you have the very latest version of nicematrix (3.2), whereas MiKTeX (my distribution) still has version 3.1. That's the only difference I notice. Maybe a problem with latest version. Just in case: try changing the loading order. – Bernard Sep 20 at 21:43
3

In the latest update of the nicematrix package there is a zero width space

U+feff ZERO WIDTH NO-BREAK SPACE

at the start of line 21 before the % this is clearly an error, you should report to the package author.

You can save a local copy of the file, deleting the line

% \iffalse meta-comment

and it will run without error

  • I just mailed the author with a link to this post. – David Carlisle Sep 20 at 22:22
  • Awesome; I was just about to do that too. Thank you! – tim Sep 20 at 22:24
  • 1
    Thanks. I will post a corrected version of the package nicematrix on CTAN today. – F. Pantigny Sep 21 at 4:36
  • 1
    I have posted on CTAN a corrected version (3.2a). – F. Pantigny Sep 21 at 15:59
  • @F.Pantigny thanks! – David Carlisle Sep 21 at 16:07

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.