自訂逐項清單中的子方程式編號

自訂逐項清單中的子方程式編號

這是問題的後續逐項清單中的子方程式編號

\documentclass[10pt]{article}

% for fancy math
\usepackage{amsmath}

% rank operator
\DeclareMathOperator*{\rank}{rank}

% Matrix transpose
\newcommand{\trans}[1]{\ensuremath{{#1}^\top}}

% for extra space at the end of abbreviation
\usepackage{xspace}

% positive semi-definite
\newcommand{\psd}{\textsc{psd}\xspace}

% boldface uppercase letters for matrices
\newcommand{\Abf}{\ensuremath{\mathbf A}}
\newcommand{\Bbf}{\ensuremath{\mathbf B}}

% boldface lowercase letters for vectors
\newcommand{\xbf}{\ensuremath{\mathbf x}}

% for math blackboard font
\usepackage{amssymb}
% set of real numbers
\newcommand{\Rbb}{\ensuremath{\mathbb R}}

\usepackage{palatino}
\usepackage[sc]{mathpazo}

\begin{document}
\noindent
For any real symmetric matrcies $\Abf$ such that $\rank(\Abf_{n\times n})=r$,
the following statements are equivalent
and any one of them can serve as the definition of
\emph{positive semi-definite} (\psd) matrices.
\begin{subequations}
\begin{itemize}
  \item $\trans\xbf \Abf\xbf \geq 0$ for any non-zero vector
    $\xbf\in\Rbb^{n\times 1}$.
    \hfill\refstepcounter{equation}\textup{(\theequation)}%
  \item All the $n$ eigenvalues of $\Abf$ are non-negative.
    \hfill\refstepcounter{equation}\textup{(\theequation)}%
  \item $\Abf=\trans\Bbf \Bbf$ for some $\Bbf$ with $\rank(\Bbf)=r$.
    \hfill\refstepcounter{equation}\textup{(\theequation)}%
\end{itemize}
\end{subequations} 
\end{document}

在此輸入影像描述

現在,我想自訂標籤(1a)(1b)並將(1c)定義與其他典型的方程式編號區分開來。

  • 我想將它們標記為(def1)(def2)、 和(def3)
  • 但我仍然想使用subequations環境,因為我想透過eqref命令將它們作為方程式引用。

我怎樣才能做到這一點?

答案1

您可以引入一個新的計數器mysub

\newcounter{mysub}
\setcounter{mysub}{0}
\renewcommand{\themysub}{def\arabic{mysub}}

並使用這個而不是\theequationsubequations.

如果您也希望在 結束後重設此計數器subequations,也請新增以下行

\usepackage{etoolbox}
\AtEndEnvironment{subequations}{\setcounter{mysub}{0}}

微量元素:

\documentclass[10pt]{article}

% for fancy math
\usepackage{amsmath}

% rank operator
\DeclareMathOperator*{\rank}{rank}

% Matrix transpose
\newcommand{\trans}[1]{\ensuremath{{#1}^\top}}

% for extra space at the end of abbreviation
\usepackage{xspace}

% positive semi-definite
\newcommand{\psd}{\textsc{psd}\xspace}

% boldface uppercase letters for matrices
\newcommand{\Abf}{\ensuremath{\mathbf A}}
\newcommand{\Bbf}{\ensuremath{\mathbf B}}

% boldface lowercase letters for vectors
\newcommand{\xbf}{\ensuremath{\mathbf x}}

% for math blackboard font
\usepackage{amssymb}
% set of real numbers
\newcommand{\Rbb}{\ensuremath{\mathbb R}}

\usepackage{palatino}
\usepackage[sc]{mathpazo}

\usepackage{etoolbox}
\AtEndEnvironment{subequations}{\setcounter{mysub}{0}}

\newcounter{mysub}
\setcounter{mysub}{0}
\renewcommand{\themysub}{def\arabic{mysub}}

\begin{document}
\noindent
For any real symmetric matrcies $\Abf$ such that $\rank(\Abf_{n\times n})=r$,
the following statements are equivalent
and any one of them can serve as the definition of
\emph{positive semi-definite} (\psd) matrices.
\begin{subequations}\label{eq:1}
\begin{itemize}
  \item $\trans\xbf \Abf\xbf \geq 0$ for any non-zero vector
    $\xbf\in\Rbb^{n\times 1}$.
    \hfill\refstepcounter{mysub}\textup{(\themysub)}\label{eq:1a}%
  \item All the $n$ eigenvalues of $\Abf$ are non-negative.
    \hfill\refstepcounter{mysub}\textup{(\themysub)}%
  \item $\Abf=\trans\Bbf \Bbf$ for some $\Bbf$ with $\rank(\Bbf)=r$.
    \hfill\refstepcounter{mysub}\textup{(\themysub)}%
\end{itemize}
\end{subequations}

\noindent
We refer to the global equation \eqref{eq:1} and to subequation \eqref{eq:1a}

\end{document} 

輸出:

在此輸入影像描述

答案2

也許這就是您想要的但不確定。

\begin{align}
& \hspace*{-3cm} \bullet \;\; \trans\xbf \Abf\xbf \geq 0 \text{  for any non-zero vector } \xbf\in\Rbb^{n\times 1}.\tag{def1} \label{ok} \\
& \hspace*{-3cm} \bullet \;\;  \text{ All the } n\text{ eigenvalues of } \Abf  \text{are non-negative}.\tag{def2} \label{ok2} \\
& \hspace*{-3cm} \bullet \;\;  \Abf=\trans\Bbf \Bbf  \text{ for some } \Bbf \text{ with } \rank(\Bbf)=r. \tag{def3} \label{ok3} 
\end{align}
This is Eq.\eqref{ok} and not quite Eq.\eqref{ok2}

在此輸入影像描述

相關內容