答案1
與 GuM 的答案沒有根本不同,但進行了一些改進,以方便輸入偏導數esdiff
和交叉引用cleveref
(待加載後 hyperref
,如果你使用它):
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{esdiff}
\usepackage{cleveref}
\setcounter{chapter}{2}
\begin{document}
To find $g$, we know that
\begin{subequations}
\begin{align}
\diffp{g}{x} & = 3x^2y^2 + x^2, \label{eq:1} \\%
\diffp{g}{y} & = 2x^3y + y^2.\label{eq:2}
\end{align}
\end{subequations}
Integrating \Cref{eq:1} with respect to $x$ gives us
\begin{equation}\label{eq:3}
g = x^3y^2 + \frac{x^3}{3} + h(x)
\end{equation}
\end{document}
答案2
你的擔憂毫無道理:編碼絕對簡單。例如(另見克里斯蒂安·胡弗的評論:
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
\usepackage{amsmath}
\numberwithin{equation}{section}
\begin{document}
\setcounter{section}{2} % pretend we are in section two
By theorem~\ldots, \( \omega = dg \) for some~$g$. To find~$g$, we know that
\begin{subequations}
\label{eq:both}
\begin{align}
\frac{\partial g}{\partial x} &= 3x^{2}y^{2}+x^{2} \mbox{,}
\label{eq:first} \\
\frac{\partial g}{\partial y} &= 2x^{3}y+y^{2} \mbox{.}
\label{eq:second}
\end{align}
\end{subequations}
Integrating~\eqref{eq:first} with respect to~$x$ gives
\begin{equation}
g = x^{3}y^{2} + \frac{x^{3}}{3} + h(y) \mbox{,}
\end{equation}
etc. etc. Note that you can also reference equation~\eqref{eq:both} as a
whole.
\end{document}
對應的輸出是
答案3
幾天前我為類似的事情創建了一種方法。這裡這是。
只是不要忘記使用套件“amsmath”
您可以像這樣更改它(未經測試):
\makeatletter
\newcommand*\ifcounter[1]{%
\ifcsname c@#1\endcsname%
\expandafter\@firstoftwo%
\else%
\expandafter\@secondoftwo%
\fi%
}%
\makeatother
\makeatletter
\newcommand\EqFamTag[2][alph]{%
\ifcounter{#2}{%
\expandafter\addtocounter{#2}{1}%
\xdef\temp{\csname #2 Eq\endcsname\csname #1\endcsname{#2}}%
\global\expandafter\let\csname #2\arabic{#2}\endcsname\temp%
\tag{\temp}%
}{%
\global\expandafter\newcounter{#2}%
\expandafter\addtocounter{#2}{1}%
\xdef\temp{\theequation\csname #1\endcsname{#2}}%
\xdef\eqonfamily{\theequation}%
\global\expandafter\let\csname #2 Eq\endcsname\eqonfamily%
\global\expandafter\let\csname #2\arabic{#2}\endcsname\temp%
\tag{\temp}%
\expandafter\addtocounter{equation}{1}
}%
}%
\makeatother
然後你可以寫出你的等式:
\begin{equation}
x^2=3\EqFamTag{MyEquatioFamily}
\end{equation}
具有相同 '\EqFamTag{}' 的下一個方程式將為您提供同一系列中的下一個編號方程式...您可以根據需要添加標籤(檢查上面的帖子以了解如何在沒有標籤的情況下引用它們)
答案4
當您使用純TeX(從您的問題中不清楚)時,您可以使用OPmac,並且可以定義一個用一個參數\eqmark
呼叫的巨集變體\eqmarkx
:必須附加的字母。
\input opmac
\def\pdiff#1\over#2{{\partial#1\over\partial#2}}
\def\thednum{(\the\secnum.\the\dnum)}
\def\eqmarkx#1{\ifx a#1\global\advance\dnum by1 \fi
\def\thednum{(\the\secnum.\the\dnum#1)}%
\ifinner\else\eqno \fi
\wlabel\thednum \rm\thednum
}
\sec Test
To find $g$, we know that
$$
\eqalignno{
\pdiff g\over x &= 3x^2 y^2 + x^2, & \label[eq-a]\eqmarkx a \cr
\pdiff g\over y &= 2x^3 y + y^2. & \label[eq-b]\eqmarkx b \cr
}
$$
Integrating Equation \ref[eq-a] with respect to $x$ gives us
$$
g = x^3 y^2 + {x^3 \over 3} + h(x) \eqmark
$$
\bye