供参考:
\usepackage{amsmath}
% 绑定公式编号到 section,确保每次新章节或新段落编号重置
\numberwithin{equation}{section}
% 自定义编号格式
\renewcommand{\theequation}{%
\ifnum\value{section}=0
\arabic{chapter}.\arabic{equation}%
\else
\arabic{chapter}.\arabic{section}.\arabic{equation}%
\fi
}
【 在 portage 的大作中提到: 】
: 这么个需求,公式编号格式为 arabic{chapter}.arabic{section}.number
: 若 arabic{section}=0,那么编号里就不出现 section 段
: 请问该怎么写 if 语句
: ...................
--
FROM 101.6.70.*