
セクション番号をnumberchapter.numbersection.
次のようにしたいので、次のように入力します。
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}.}
しかし、定理を作成したい場合、定理の番号は と表示されます。とTheorem numberchapter.numbersection..numbertheorem
の間には二重のドットがあります。 単一のドットのみを表示するにはどうすればよいでしょうか?numbersection
numbertheorem
\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}
編集:
Egreg の回答によると、セクションとサブセクションをフォーマットすると、ドットが表示されません。なぜこのようなことが起こるのでしょうか、また解決策は何でしょうか?
\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}
答え1
\thesection
おそらく、セクションとサブセクションへの相互参照に末尾のピリオドを付けたくないでしょう。したがって、と にピリオドをハードワイヤードすることは望ましくありません\thesubsection
。
次のコードでは、末尾のピリオドが によって追加されます\@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}
これを使用するとtitlesec
、適切な場所にピリオドを明示的に追加できるため、さらに簡単になります。
\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}
答え2
試す:
\renewcommand{\thetheorem}{\thesection\arabic{theorem}}