答案1
一种方法是使用nicematrix
。
\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
\[\begin{pNiceArray}[xdots/shorten=1.5ex]{CCCCCCC}
1 & \Cdots & c_{1r} & c_{1,r+1} &\Cdots & c_{1n} & d_1\\
\Vdots & & \Vdots & \Vdots & & \Vdots & \Vdots \\
0 & \Cdots & 1 & c_{r,r+1} &\Cdots & c_{rn} & d_r\\
0 & \Cdots & 1 & 0 &\Cdots & 0 & \textcolor{red}{d_{r+1}}\\
0 & \Cdots & 1 & 0 &\Cdots & 0 & 0\\
\Vdots & & \Vdots & \Vdots & & \Vdots & \Vdots \\
0 & \Cdots & 0 & 0 &\Cdots & 0 & 0
\CodeAfter
\begin{tikzpicture}
\draw[dashed] (col-7|-row-1) -- (col-7|-row-8);
\end{tikzpicture}
\end{pNiceArray}\]
\end{document}
这当然也适用于beamer
文档。
\documentclass{beamer}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{An augmented matrix}
\[\begin{pNiceArray}[xdots/shorten=1.5ex]{CCCCCCC}
1 & \Cdots & c_{1r} & c_{1,r+1} &\Cdots & c_{1n} & d_1\\
\Vdots & & \Vdots & \Vdots & & \Vdots & \Vdots \\
0 & \Cdots & 1 & c_{r,r+1} &\Cdots & c_{rn} & d_r\\
0 & \Cdots & 1 & 0 &\Cdots & 0 & \textcolor{red}{d_{r+1}}\\
0 & \Cdots & 1 & 0 &\Cdots & 0 & 0\\
\Vdots & & \Vdots & \Vdots & & \Vdots & \Vdots \\
0 & \Cdots & 0 & 0 &\Cdots & 0 & 0
\CodeAfter
\begin{tikzpicture}
\draw[dashed] (col-7|-row-1) -- (col-7|-row-8);
\end{tikzpicture}
\end{pNiceArray}\]
\end{frame}
\end{document}
您也可以使用arydshln
。
\documentclass{beamer}
\usepackage{arydshln}
\begin{document}
\begin{frame}[t]
\frametitle{An augmented matrix}
\[\left(\begin{array}{cccccc:c}
1 & \cdots & c_{1r} & c_{1,r+1} &\cdots & c_{1n} & d_1\\
\vdots & & \vdots & \vdots & & \vdots & \vdots \\
0 & \cdots & 1 & c_{r,r+1} &\cdots & c_{rn} & d_r\\
0 & \cdots & 1 & 0 &\cdots & 0 & \textcolor{red}{d_{r+1}}\\
0 & \cdots & 1 & 0 &\cdots & 0 & 0\\
\vdots & & \vdots & \vdots & & \vdots & \vdots \\
0 & \cdots & 0 & 0 &\cdots & 0 & 0
\end{array}\right)\]
\end{frame}
\end{document}