EDIT: I knew I was forgetting something! I have edited the question to show how to properly do it.
I have a koma-script book (my PhD thesis) that number its equations (and tables, figures, etc.) within chapters.
How do I deal with an unnumbered chapter (for instance, the introduction) and avoid the dumb eq. (0.1) that appears (but of course keep the nice eq. (1.1) of the following chapter)?
I have not found an easy way to do it, and the trick that I tried
\renewcommand*{\theequation}{%
\ifnum\value{chapter}=0 %
\else
\thechapter.
\fi
\arabic{equation}%
}
provides an ugly space (1. 1) that I don't see how to purge.
EDIT: It is sufficient to add a % symbol like this: \thechapter.%
MWE:
\documentclass{srcbook}
\usepackage{amsmath}
\begin{document}
\chapter*{Unnumbered introduction}
\begin{equation}
a = 1
\end{equation}
\chapter{Numbered chapter}
\begin{equation}
b = 2
\end{equation}
\end{document}
\renewcommand*{\theequation}{\arabic{equation}and then\renewcommand*{\theequation}{\thechapter.\arabic{equation}}at the first numbered chapter. – Teepeemm Nov 30 '21 at 16:40