方程式编号中可以包含“Eq.”吗?

方程式编号中可以包含“Eq.”吗?

就我个人而言,我希望在方程编号前面加上“Eq.”此外,我希望在方程前面加上章节编号,这样方程的编号就变成了 (Eq. 3.1),而不是 (1)。

谁知道这是否可能?

答案1

您应该研究加载mathtools包(顺便说一下,它会自动加载amsmath包)并使用它\newtagform\usetagform宏。

\documentclass{article}
\usepackage{mathtools}
\numberwithin{equation}{section} % how the equation numbers are formed
\newtagform{show_eq}{(Eq.\ }{)}  % how the equation numbers are displayed
\usetagform{show_eq}

\begin{document}
\section{Introduction}
\begin{equation}
1+1=3?
\end{equation}
\begin{equation}
1+1\neq3
\end{equation}
\section{Some section or chapter without content...}
\section{Content!}
\begin{equation}
1+1=2
\end{equation}
\begin{equation}
1+2=3
\end{equation}
\end{document}

它应该是什么样子的例子

答案2

有可能的!

我从如何更改公式编号样式,但这个 MWE 应该足以帮助您。

\documentclass{article}
\usepackage{amsmath} % \numberwithin{equation} doesn't exist without this package.
\numberwithin{equation}{section} % This line resets equation numbering when starting a new section.
\renewcommand{\theequation}{Eq. \thesection.\arabic{equation}} % This line ads "Eq." in front of your equation numbering.
\begin{document}
\section{Introduction}
\begin{equation}
1+1=3?
\end{equation}
\begin{equation}
1+1\neq3
\end{equation}
\section{Some section or chapter without content...}
\section{Content!}
\begin{equation}
1+1=2
\end{equation}
\begin{equation}
1+2=3
\end{equation}
\end{document}

它应该是什么样子的例子

不幸的是,行的顺序至关重要,因为可以用 覆盖\renewcommand{\theequation}{Eq. \thesection.\arabic{equation}}\numberwithin{equation}{section}而您只能得到(1.1)

注意,如果\numberwithin{equation}{section}省略,则在开启新节后公式编号仍会继续,因此编号会变成(Eq. 1.1)(Eq. 1.2)(Eq. 3.3)(Eq. 3.4),这很不方便。

相关内容