如何在方程式編號中包含章節編號

如何在方程式編號中包含章節編號

classicthesis我正在嘗試更改包中的方程式編號樣式。我按照中給的答案進行操作這裡但不影響方程式樣式。我想在方程式編號中包含章節編號。有人可以幫我嗎?

答案1

您可以載入該amsmath套件並使用其\numberwithin命令來實現您的目標:

在此輸入影像描述

\documentclass{report}
\usepackage{classicthesis}
\usepackage{amsmath}
\numberwithin{equation}{chapter}
\begin{document}
\chapter{First chapter}
\begin{equation}  \label{eq:pyth}
a^2+b^2=c^2
\end{equation}
Here's a cross-reference to equation \eqref{eq:pyth}.
\end{document}

附錄:如果您想讓方程式編號看起來像(1--1)而不是像(1.1),則\theequation巨集也需要修改:

在此輸入影像描述

\documentclass{report}
\usepackage{classicthesis}
\usepackage{amsmath}
\numberwithin{equation}{chapter}
\renewcommand{\theequation}{\thechapter--\arabic{equation}}    

\begin{document}
\setcounter{chapter}{2}
\chapter{Third chapter}
\begin{equation}  \label{eq:albert}
E=mc^2
\end{equation}
Here's a cross-reference to equation \eqref{eq:albert}.
\end{document}

答案2

在 \documentclass[]{} 選項中新增“floatperchapter”

相關內容