3

Following this question the nicematrix v3.3 (2019/10/01) package from @f-pantigny has no problems with the tikz tikzexternalize library.

But this code

\documentclass{standalone}

\usepackage{amstext}
\usepackage{nicematrix}

\usetikzlibrary{external}
\tikzexternalize

\begin{document}
    $
        \begin{pNiceArray}{CCCC|C}
        \star   & \circ     & \Cdots    & \circ     & \circ \\
        0       & *     & \Ddots    & \Vdots    & \Vdots    \\
        \Vdots  & \Ddots    & \Ddots    & \circ     &       \\
        0       & \Cdots    & 0         & 0         & \circ 
        \end{pNiceArray}
    $
    \tikz\draw (0,0) circle [radius=1cm];
\end{document}

don't compile (TeX 3.14159265 (TeX Live 2019/W32TeX)) with the error

Package tikz Error: Sorry, the system call 'pdflatex -shell-escape -halt-on-e

The externalize logfile has the lines

A tikzpicture has been optimized away. Use '/tikz/external/optimize=false' to d
isable this.

! Package nicematrix Error: A dotted line can't be drawn because you have not
(nicematrix)                put all the ampersands required on the row 3.
(nicematrix)                If you go on, this dotted line will be ignored.

If we use

\tikzexternalize[optimize=false]

then everything compile.

Is this a bug and if yes, why?

@f-pantigny: Maybe a fix is to add at line 586 from nicematrix.sty

external / optimize = false
7
  • 3
    I wouldn't add it to the .sty, for sure. Somebody might prefer not to externalise nicematrix environments and keep optimisation. Hard-coding it in the .sty would confuse things. Maybe something in the documentation would be better or an option.
    – cfr
    Oct 3, 2019 at 18:15
  • @cfr I agree with your objection but one could add something like \ifcsname tikzexternal@TEXDIALECT@collectpicture\endcsname \endcsname% <do something>\fi to make sure that this will only be executed if externalize is loaded. It might also be better to turn off optimization only locally, i.e. within the nicearray environments.
    – user194703
    Oct 3, 2019 at 18:23
  • @cfr nicematrix enviroments are not externalize per default (line 586 from nicematrix.sty). I mean to disable optimization only locally for the nicearray environments.
    – maphy-psd
    Oct 3, 2019 at 18:45
  • @Schrödinger'scat I think that my suggestion turn off optimization for the nicearray environments, didn't it?
    – maphy-psd
    Oct 3, 2019 at 18:45
  • 1
    I will try to find the best solution... (I'm the author of nicematrix). Oct 4, 2019 at 17:53

1 Answer 1

2

I have written a new version of nicematrix (v. 3.4 of 2019/10/05). In this version, the optimisation of the externalisation of Tikz is disabled in the environments of nicematrix when the package or the class standalone is used.

1
  • 1
    @f-pantigny thanks for the fast update. I tested it and it works (for me).
    – maphy-psd
    Oct 7, 2019 at 18:22

You must log in to answer this question.

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