答案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
你的担心毫无道理:编码非常简单。例如(另见Christian Hupfer 的评论:
% 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