
Quero que a numeração das seções seja numberchapter.numbersection.
Então eu digito
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}.}
Mas se eu quiser fazer um teorema, a numeração do teorema será exibida Theorem numberchapter.numbersection..numbertheorem
. Há um ponto duplo entre numbersection
e numbertheorem
. Como posso mostrar apenas um único ponto?
\documentclass[twoside,11pt]{book}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm,papersize={15.5cm,23.5cm}]{geometry}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}.}
\renewcommand{\thesubsection}{\arabic{chapter}.\arabic{section}.\arabic{subsection}.}
\usepackage{amsthm}
\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}{Theorem}[section]
\begin{document}
\chapter{ABC}
blablabla
\section{ONE}
\begin{theorem}
dddd
\end{theorem}
\end{document}
EDITAR:
Com base na resposta do Egreg, se eu formatar a seção e a subseção, o ponto não aparecerá. Por que isso pode acontecer e qual a solução?
\documentclass{book}
\usepackage{amsthm,titlesec}
\titleformat{\section}
[hang]
{\bfseries}
{\bfseries\thesection}{1ex}{\bfseries}
\titlespacing{\section}{1.5pt}{0.2cm}{0.2cm}
\titleformat{\subsection}
[hang]
{\bfseries}
{\bfseries\thesubsection}{1ex}{\bfseries}
\titlespacing{\subsection}{1.5pt}{0.2cm}{0.2cm}
\renewcommand{\thechapter}{\Roman{chapter}}
\makeatletter
\renewcommand{\@seccntformat}[1]{%
\ifcsname format#1\endcsname
\csname format#1\endcsname
\else
\csname the#1\endcsname
\fi
\quad
}
\makeatother
\newcommand{\formatsection}{\thesection.}
\newcommand{\formatsubsection}{\thesubsection.}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}{Theorem}[section]
\begin{document}
\chapter{ABC}
blablabla with \ref{sec:one} and no period.
\section{ONE}\label{sec:one}
\begin{theorem}
dddd
\end{theorem}
\subsection{TWO}
Just to see what happens.
\end{document}
Responder1
Muito provavelmente você não deseja que as referências cruzadas a seções e subseções tenham o ponto final. Então você não quer conectar o período in \thesection
e in \thesubsection
.
Com o código a seguir, o ponto final é adicionado por \@seccntformat
.
\documentclass{book}
\usepackage{amsthm}
\renewcommand{\thechapter}{\Roman{chapter}}
\makeatletter
\renewcommand{\@seccntformat}[1]{%
\ifcsname format#1\endcsname
\csname format#1\endcsname
\else
\csname the#1\endcsname
\fi
\quad
}
\makeatother
\newcommand{\formatsection}{\thesection.}
\newcommand{\formatsubsection}{\thesubsection.}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}{Theorem}[section]
\begin{document}
\chapter{ABC}
blablabla with \ref{sec:one} and no period.
\section{ONE}\label{sec:one}
\begin{theorem}
dddd
\end{theorem}
\subsection{TWO}
Just to see what happens.
\end{document}
Se você usar titlesec
é ainda mais fácil, pois você pode adicionar explicitamente o ponto final no lugar certo.
\documentclass{book}
\usepackage{amsthm,titlesec}
\titleformat{\section}[hang]
{\bfseries}
{\thesection.}
{1ex}
{}
\titlespacing{\section}{1.5pt}{0.2cm}{0.2cm}
\titleformat{\subsection}[hang]
{\bfseries}
{\thesubsection.}
{1ex}
{}
\titlespacing{\subsection}{1.5pt}{0.2cm}{0.2cm}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}{Theorem}[section]
\begin{document}
\chapter{ABC}
blablabla with \ref{sec:one} and no period.
\section{ONE}\label{sec:one}
\begin{theorem}
dddd
\end{theorem}
\subsection{TWO}
Just to see what happens.
\end{document}
Responder2
Tentar:
\renewcommand{\thetheorem}{\thesection\arabic{theorem}}