無限大小的nicematrix

無限大小的nicematrix

我正在嘗試編寫這個三對角(無限大小)矩陣的 Nicematrix 版本,因為 pmatrix 環境呈現一個非常醜陋的版本

\begin{equation}
\begin{pmatrix}
    -\lambda & \lambda             & 0                    & 0       & \dots  \\
    \mu      & -(\lambda+\mu)      & \lambda              & 0       &        \\
    0        & 2\mu                & -(\lambda+2\mu)      & \lambda &        \\
    \vdots   &                     & \ddots               & \ddots  & \ddots
\end{pmatrix}
\end{equation}

於是我就天真地寫下了

\begin{equation}
\begin{pNiceMatrix}
    -\lambda & \lambda             & 0                    & 0       & \Cdots  \\
    \mu      & -(\lambda+\mu)      & \lambda              & 0       &        \\
    0        & 2\mu                & -(\lambda+2\mu)      & \lambda &        \\
    \Vdots   &                     & \Ddots               & \Ddots  & \Ddots
\end{pNiceMatrix}
\end{equation}

但結果根本不起作用

我猜問題來自於缺乏結束我的 \Ddots 的指示。但是那我該如何管理無限大小的矩陣呢?

編輯

我提供了一個完整的最小範例,以及我正在使用的文檔類別。

\documentclass{article}

\usepackage{nicematrix}

\begin{document}
\begin{equation}
\begin{pNiceMatrix}
    -\lambda & \lambda             & 0                    & 0       & \Cdots  \\
    \mu      & -(\lambda+\mu)      & \lambda              & 0       &        \\
    0        & 2\mu                & -(\lambda+2\mu)      & \lambda &        \\
    \Vdots   &                     & \Ddots               & \Ddots  & \Ddots
\end{pNiceMatrix}
\end{equation}
\end{document}

編譯的結果看起來和我提供的圖片有點不同,因為我有一個字體包。但問題仍然存在。

答案1

命令\Ldots\Cdots\Vdots\Ddots\Iddots旨在用於非空白單元格之間。這樣你就可以製造細胞了\NotEmpty

在此輸入影像描述

\documentclass{article}

\usepackage{nicematrix}

\begin{document}

\[
\begin{pNiceMatrix}
    -\lambda  & \lambda        & 0               & 0         & \Cdots  \\
    \mu       & -(\lambda+\mu) & \lambda         & 0         &         \\
    0         & 2\mu           & -(\lambda+2\mu) & \lambda   &         \\
    \Vdots    &                & \Ddots          & \Ddots    & \Ddots  \\
    \NotEmpty &                &                 & \NotEmpty & \NotEmpty
\end{pNiceMatrix}
\]

\end{document}

答案2

也許\phantom對您來說就足夠了?

\documentclass[border=5mm]{standalone}
\usepackage{nicematrix}
\begin{document}
$\begin{pNiceMatrix}
    -\lambda & \lambda             & 0                    & 0       & \Cdots  \\
    \mu      & -(\lambda+\mu)      & \lambda              & 0       &        \\
    0        & 2\mu                & -(\lambda+2\mu)      & \lambda &        \\
    \Vdots   &                     & \Ddots               & \Ddots  & \Ddots\\
\phantom{}&\phantom{}&\phantom{}&\phantom{.}&\phantom{.}
\end{pNiceMatrix}$
\end{document}

在此輸入影像描述

相關內容