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

Here is a MWE:




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
    Commented Sep 20, 2019 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
    Commented Sep 20, 2019 at 21:16
  • Quite strange… And you have the error message with this very code?
    – Bernard
    Commented Sep 20, 2019 at 21:19
  • Yep! Here's the link to the log file. Apparently the error occurs immediately when loading the nicematrix package.
    – tim
    Commented Sep 20, 2019 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
    Commented Sep 20, 2019 at 21:43

1 Answer 1


In the latest update of the nicematrix package there is a zero width 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. Commented Sep 20, 2019 at 22:22
  • Awesome; I was just about to do that too. Thank you!
    – tim
    Commented Sep 20, 2019 at 22:24
  • 2
    Thanks. I will post a corrected version of the package nicematrix on CTAN today. Commented Sep 21, 2019 at 4:36
  • 1
    I have posted on CTAN a corrected version (3.2a). Commented Sep 21, 2019 at 15:59
  • @F.Pantigny thanks! Commented Sep 21, 2019 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .