
是否可以為矩陣方程式的每一行給出方程式編號?
我怎麼能在子方程式編號的脈絡中擁有方程式標籤,矩陣方程式的每一行都有一個?在這裡,我想要等式編號,例如 (3.1a)、(3.1b)、(3.1c)(我不是指有邊框矩陣中的行/列標籤)。
謝謝!
答案1
唔!並不真正支援 LaTeX 語法,但是
\documentclass{article}
\usepackage{amsmath}
\newsavebox\labelbox
\begin{document}
\savebox\labelbox{$\begin{matrix}
\refstepcounter{equation}(\theequation)\label{aa}\\
\refstepcounter{equation}(\theequation)\label{bb}\\
\refstepcounter{equation}(\theequation)\label{cc}
\end{matrix}$}
\[
\begin{bmatrix}
H & J^T & -Z^{\frac12} \\
J & -\delta I & \\
-Z^{\frac12} & & -X
\end{bmatrix}
\begin{bmatrix}
r \\ s \\ t
\end{bmatrix}
=
\lambda
\begin{bmatrix}
H & & \\
& U & \\
& & W
\end{bmatrix}
\begin{bmatrix}
r \\ s \\ t
\end{bmatrix}
\eqno
\usebox{\labelbox}
\]
[\ref{aa}]
[\ref{bb}]
[\ref{cc}]
\end{document}
答案2
一次偶然的機會,我發現了一個簡單直接的方法。如果實際矩陣中有一些大列,則應該在計數矩陣中設定相應的幻像。\displaystyle
如果確實需要的話,還可以在方程式編號矩陣中加入一個。
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\ltxlabel}{\ltx@label}
\makeatother
\begin{document}
\begin{align}\refstepcounter{equation}
\begin{bmatrix}
H & J^T & -Z^{\frac12} \\
J & -\delta I & \\
-Z^{\frac12} & & -X
\end{bmatrix}
\begin{bmatrix}
r \\ s \\ t
\end{bmatrix}
=
\lambda
\begin{bmatrix}
H & & \\
& U & \\
& & W
\end{bmatrix}
\begin{bmatrix}
r \\ s \\ t
\end{bmatrix}
\tag*{$\begin{matrix}
\text{(\theequation a)}\\
\text{(\theequation b)}\\
\text{(\theequation c)}
\end{matrix}$}
\ltxlabel{eq:matrix}
\end{align}
The first row (\ref{eq:matrix}a) is the most important row of the matrix.
\end{document}
答案3
這是一種手動避免操作計數器的方法。我創建了兩個\vbox
es。第一個是空白子方程式數組,第二個是簡單\[...\]
構造中的所需矩陣。然後我將兩個\vbox
es 堆疊在一起。瞧!
我甚至進行了設置,以便調整矩陣的垂直基線跳躍(因為我使用了 TABstacks)會自動反映在方程式編號的垂直分隔中(通過使用宏\aligngap
)。
如果需要的話,可以用{bmatrix}
es 替換我的 TABstacks,它仍然可以工作,儘管在這種情況下, 的定義\aligngap
需要一些調整。
\documentclass{article}
\usepackage{amsmath,tabstackengine,lipsum}
\newsavebox\boxA
\def\aligngap{\dimexpr\Lstackgap-15pt\relax}
\begin{document}
\lipsum[1]
{\setstackgap{L}{14pt}% SELECTABLE MATRIX ROW BASELINESKIP
\setbox0=\vbox{\begin{subequations}%
\begin{align}\label{eq:A}\\[\aligngap]\label{eq:B} \\[\aligngap]\label{eq:C}\end{align}%
\end{subequations}}
\savebox\boxA{\vbox{\[
\setstacktabbedgap{5pt}
\bracketMatrixstack{
H & J^T & -Z^{\frac12} \\
J & -\delta I & \\
-Z^{\frac12} & & -X}
\bracketVectorstack{r \\ s \\ t}
=
\lambda
\bracketMatrixstack{
H & & \\
& U & \\
& & W}
\bracketVectorstack{r \\ s \\ t}
\]}}
\noindent\stackengine{3.5pt}{\box0}{\usebox{\boxA}}{O}{c}{F}{F}{L}}
In equations \ref{eq:A}, \ref{eq:B}, and \ref{eq:C},
\lipsum[2]
\end{document}
答案4
如果需要 AMS-s,下面有一個可能的快速但骯髒的替代方案\tag
。缺點是首先需要進行一些手動高度調整matrix
。如果沒有大衛的解決方案,這個解決方案就不會存在。謝謝,大衛!我也需要這個。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\par\noindent\begin{minipage}[c][][c]{0.9\textwidth}
\begin{align*}
\begin{matrix}
1\cdot x_1&+&2\cdot x_2&+&3\cdot x_3&=&4\\[3pt]
5\cdot x_1&+&6\cdot x_2&+&7\cdot x_3&=&8\\[3pt]
9\cdot x_1&+&10\cdot x_2&+&11\cdot x_4&=&12
\end{matrix}
\end{align*}
\end{minipage}\begin{minipage}[c][][c]{0.1\textwidth}
\begin{align}\refstepcounter{equation}
\tag{\theequation a}\label{eq:1a}\\[0pt]
\tag{\theequation b}\label{eq:1b}\\[0pt]
\tag{\theequation c}\label{eq:1c}
\end{align}
\end{minipage}
\end{document}