1

I'm making a .cwl file for the package nicematrix, and am unsure how TeXstudio checks keyvals for completion. Here is a sample .cwl file and an image of the editor in TeXstudio that display the issue:

# nicematrix package

#include:amsmath
#include:array
#include:l3keys2e
#include:pgfcore
#include:xparse

\begin{NiceTabular}[position]{cols}[keyvals]#\tabular
\end{NiceTabular}
\begin{NiceArray}[position]{cols}[keyvals]#m\array
\end{NiceArray}
\begin{NiceMatrix}[keyvals]#m\array
\end{NiceMatrix}

#keyvals:\begin{NiceTabular},\begin{NiceArray},\begin{NiceMatrix}
hlines
#endkeyvals

editor

It works fine for the NiceMatrix environment since it recognizes the key hlines listed in the .cwl and does not recognize the unlisted key hvlines. However, for the NiceTabular environment, neither the listed nor unlisted key is recognized, and for the NiceArray environment, it does not mark the unlisted key as invalid.

Clearly this has something to do with the fact that NiceTabular and NiceArray have the optional [position] and mandatory {cols} while NiceMatrix has neither, but I've not been able to find a fix from the user manual or examples. How does one account for the [position] and {cols} arguments while still having TeXstudio properly check for completion in the [keyvals]?

1
  • 1
    For information, in {NiceArray} and {NiceTabular}, you can put all the available keys both before and after the preamble. That means that you should write rather \begin{NiceTabular}[keyvals]{cols}[keyvals]#\tabular (I say that but I have no competence in TeXStudio and its cwl files). Commented Jun 10, 2021 at 20:24

1 Answer 1

1

TeXstudio's parsing of cwls is somewhat limited, so the current nicematrix cwl just checks for keyval completion using the syntax where the keys come before the preamble.

You must log in to answer this question.

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