更改方程式編號以獲得一個而不是兩個點

更改方程式編號以獲得一個而不是兩個點

我有一個關於方程式編號格式的問題:我的文件有章節。我在使用顯示模式的部分中有一個方程式。我的方程式編號有一個雙點,我想將其更改為單點。為了讓它更清楚,我將給出一個範例,它目前的樣子: 2. Chaptername
2.1 Sectionnameequation
(2..1)

所以我想改變它看起來像(2.1)。我懷疑這與我更改章節和章節的編號格式有關,因為我使用特定命令將點添加到章節和章節編號中:

\documentclass[11pt,a4paper,ngerman]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\ofoot[\pagemark]{\pagemark}
\cfoot[]{}
\author{James Oliver Reppin}
\usepackage[onehalfspacing]{setspace}
%\usepackage{biblatex}
%\bibliography{masterarbeit_bibtex_1}
\usepackage{tocloft}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\usepackage{amsmath}

\begin{document}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} 
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\thechapter}{\arabic{chapter}.}
\renewcommand{\thesection}{\thechapter\arabic{section}.} 
\chapter{chapter2}
\section{section2}
\begin{equation}
    \|x-x_{k}\| =  \min_{j=1,...,n} \|x-x_{j}\| 
\end{equation}
\end{document}

我如何更改它以便我只獲得格式 {chapternumber}{.}{sectionnumber} 或如我的範例 (2.1) 所示?

答案1

在ferahfeza的幫助下我得到了解決方案:使用指令:

\begin{document}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\end{document}

產生我想要的結果。

相關內容