1

i have a question regarding equation number formatting: My document has chapters and sections. I have an equation within a section using the display mode. My equation number has a double dot which i want to change to a single dot. To make it more clear i will give an example how it currently looks like: 2. Chaptername
2.1 Sectionname
equation (2..1)

So i want to change it that it looks like (2.1). I suspect it has something to do with me changing my numbering format for my chapters and sections since i used specific commands to get dots into the chapter and section numbering:

\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}

How do i change it so that i only get the format {chapternumber}{.}{sectionnumber} or as in my example (2.1) ?

  • 1
    Please change your example into simething that shows your problem. And no never ever add . at the end of \the... macros, it always comes back to bite you. If needed it should be added where the \the... macro is used, not in the definition it self. – daleif Sep 4 '20 at 11:31
  • Add \renewcommand{\theequation}{\arabic{section}.\arabic{equation}}. – ferahfeza Sep 4 '20 at 11:36
  • @ferahfeza i tried your suggestions and it does yield the right format, however my chapter (where the equation is) is my second chapter and the equation number starts at 1 – James Sep 4 '20 at 11:40
  • 1
    ok i think i got it, i just changed the command to: \renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}} – James Sep 4 '20 at 11:43
  • I'm not sure that you want \ref{somelabel} to print “2.” if somelabel refers to the second chapter, do you? – egreg Sep 4 '20 at 12:08
2

with the help of ferahfeza i got the solution: using the command:

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

yields the result i wanted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.