0

Today I was using \nicematrix package first time.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
 \usepackage{amsmath,mathtools}
 \usepackage{amsfonts}
 \usepackage{amssymb}
 \usepackage{array,xparse,l3keys2e,expl3} 
 \usepackage[fit]{tikz}
 \usepackage[transparent]{nicematrix}


\begin{document}    


\NiceMatrixOptions{transparent}
 $\begin{pmatrix}
    1 & \cdots & \cdots & 1 \\
    0 & \ddots & & \vdots \\
    \vdots & \ddots & \ddots & \vdots \\
    0 & \cdots & 0 & 1
\end{pmatrix}$
\end{document}

I was wan not at all getting anything. Anybody, please tell me how to use \nicematrix package, if at all I am wrong.

enter image description here

10
  • \documentclass[10pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath,mathtools} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{array,xparse,l3keys2e,expl3} \usepackage{tikz} \usepackage{nicematrix} \begin{document} \NiceMatrixOptions{transparent} $ \begin{pmatrix} 1 & \cdots & \cdots & 1 \\ 0 & \ddots & & \vdots \\ \vdots & \ddots & \ddots & \vdots \\ 0 & \cdots & 0 & 1 \end{pmatrix}$ \end{document} Commented Sep 9, 2019 at 9:31
  • Nothing happened. Even I have updated my code. See the updates one. Commented Sep 9, 2019 at 9:38
  • Are you able to compile your code? I couldn't compile yours and the code I posted is what compiled and gave an output. Commented Sep 9, 2019 at 9:39
  • Your code and mine are the same. I am unable to compile my code. I have included nicematrix.sty in the folder. Do I have to do anything else? Commented Sep 9, 2019 at 9:42
  • Well, if you have the full TeX distribution installed on your machine, the nicematrix package should already be there. Also, you can't write \usepackage[fit]{tikz}, you have to change it to \usepackage{tikz} \usetikzlibrary{fit} Commented Sep 9, 2019 at 9:45

1 Answer 1

4

Your code is not compilable. You need to remove options from tikz as well from nicematrix packages:

\documentclass[10pt,a4paper]{article}
%   \usepackage[utf8]{inputenc} % default wih recent article
\usepackage{mathtools}% also load amsmath
\usepackage{amssymb}  % also load amsfonts
\usepackage{array,xparse} 
% Why you load l3keys2e and expl3 packages? 
% Packages, which use them load those package themselves.
\usepackage{tikz}       % <---
\usetikzlibrary{fit}
\usepackage{nicematrix} % <---

\begin{document}

\NiceMatrixOptions{transparent}
 \[
\begin{pmatrix}
     1 & \cdots & \cdots & 1      \\
     0 & \ddots &        & \vdots \\
\vdots & \ddots & \ddots & \vdots \\
     0 & \cdots & 0      & 1
\end{pmatrix}
\]
\end{document}

enter image description here

Note, you need to compile above MWE at least twice. Is this what you looking for?

Edit: Your matrix you can write also on the following (more sensible) way:

\documentclass[10pt,a4paper]{article}
\usepackage{mathtools}
\usepackage{amssymb}  
\usepackage{nicematrix} 

\begin{document}

 \[
\begin{pNiceMatrix}
     1 & \Cdots & \Cdots & 1      \\
     0 & \Ddots &        & \Vdots \\
\Vdots & \Ddots & \Ddots & \Vdots \\
     0 & \Cdots & 0      & 1
\end{pNiceMatrix}
\]

\[
\begin{pmatrix}
     1 & \cdots & \cdots & 1      \\
     0 & \ddots &        & \vdots \\
\vdots & \ddots & \ddots & \vdots \\
     0 & \cdots & 0      & 1
\end{pmatrix}
\]
\end{document}

where for dotted lines inside matrix are used commands Cdots, Ddots and Vdots defined byh nicematrix. The advantage of using them instead of (global) setting \NiceMatrixOptions{transparent} is that they only works in {pNiceMatrix} environments.

For comparison is added code for standard matrix. Result is:

enter image description here

9
  • Yes, but I am getting an error message. Commented Sep 9, 2019 at 20:00
  • @SachchidanandPrasad, (i) you should tell us, what error you receive; (ii) probably you have out-dated nicematrix or even complete LaTeX installation.
    – Zarko
    Commented Sep 9, 2019 at 22:34
  • @SachchidanandPrasad, I add another option to use nicematrix math environment. Both example works with recent package version (version 3.0 from 2019/08/15) as it is advertised .
    – Zarko
    Commented Sep 9, 2019 at 23:14
  • keyvalue error: "option-unknown" Unknown option 'transparent' for package . For immediate help type H <return>. \NiceMatrixOptions{transparent} This is the message I am getting. Commented Sep 10, 2019 at 4:04
  • 1
    @SachchidanandPrasad, You have to old version of nicematrix package. Try example which I show in the edit part of answer, where are used Cdor, Ddot and Vdot.
    – Zarko
    Commented Sep 10, 2019 at 6:00

You must log in to answer this question.

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