我目前在 LaTeX 中有以下等式:
我试图在 LaTeX 中实现以下目标:
问题是我似乎无法让编号从 1a 开始。当我使用以下代码时,它从 0a 开始:
\renewcommand{\theequation}{\thesection\alph{equation}}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
我试过使用
\setcounter{equation}{1}
但是该行代码改变了字母的起始位置(在本例中为 0b)。
编辑:我的文章(文档类 apa)中已经有 4 个部分;这段代码位于第 4 部分,因此从技术上讲它必须从 4a 开始。
答案1
您应该使用为此subequations
提供的环境amsmath
。
平均能量损失
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\section{1st subequation}
\begin{subequations}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{subequations}
\begin{subequations}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{subequations}
\section{2nd subequation}
\begin{subequations}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{subequations}
\section{No subequation}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\section{3rd subequation}
Here we want to start again from 4.
\setcounter{equation}{3}
\begin{subequations}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{subequations}
\end{document}
输出:
答案2
\setcounter{equation}{0}
在每个部分设置:
\documentclass{article}
\usepackage{amsmath}
\setcounter{equation}{0}
\renewcommand{\theequation}{\thesection\alph{equation}}
\begin{document}
\section{a}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\section{b}
\setcounter{equation}{0}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\section{c}
\setcounter{equation}{0}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\section{d}
\setcounter{equation}{0}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{document}
输出:
根据您的上次评论:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\section{a}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\begin{equation}
a=b
\end{equation}
\section{b}
\begin{equation}
a=b
\end{equation}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\section{c}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\section{d}
\setcounter{equation}{0}
\renewcommand{\theequation}{\thesection.\alph{equation}}
\begin{align}
\text{Level 1}&: y_{mdi} = \mu_{di} + e_{mdi}\\
\text{Level 2}&: \mu_{di} = \mu_i + r_{0di}\\
\text{Level 3}&: \mu_i = \gamma_{000} + u_{00i}
\end{align}
\end{document}