[Tex/LaTex] Theorem and chapter with Dot at the end

chapterspunctuationsectioningtheorems

I'd like to have dot at end of the number of chapter and at the end of the number of theorem.

I tried to use something like that:

\documentclass{report}
\usepackage{amsthm}

\newtheorem{definition}{Definicja}[chapter]

\renewcommand{\thechapter}{\arabic{chapter}.}
\renewcommand{\thesection}{\thechapter\arabic{section}.}

\begin{document}

    %EDIT
    \tableofcontents
    %END EDIT

    \chapter{Chapter}
    \section{Section}
    \begin{definition}
        Some content
    \end{definition}    
\end{document}

but theorem looks like this (two dots):
enter image description here

How to remove this dot in theorem after number of chapter and add dot at end of the theorem. It should be: Definicja 2.1.

Best Answer

To add a dot after the chapter number in the title of the chapter only, you need to patch \@makechapterhead:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makechapterhead}% <cmd>
  {\thechapter}% <search>
  {\thechapter.}% <replace>
  {}{}% <success><failure>
\makeatother

To add a dot after the (any) sectional number in its title only, you can update \@seccntformat:

\makeatletter
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname.\quad}
\makeatother

The default display for a theorem defined under amsthm is to end its number with a dot.

Here is a complete minimal example highlighting the above:

enter image description here

\documentclass{report}

\usepackage{amsthm}

\newtheorem{definition}{Definicja}[chapter]

%\renewcommand{\thechapter}{\arabic{chapter}}% Default
%\renewcommand{\thesection}{\thechapter.\arabic{section}}% Default

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makechapterhead}% <cmd>
  {\thechapter}% <search>
  {\thechapter.}% <replace>
  {}{}% <success><failure>
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname.\quad}
\makeatother

\begin{document}

\setcounter{chapter}{6}% Just for this example
\chapter{Chapter}

\setcounter{section}{7}% Just for this example
\section{Section}

\setcounter{definition}{8}% Just for this example
\begin{definition}
Some content
\end{definition}

\end{document}