
섹션 번호를 다음과 같이 지정하고 싶습니다. 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}}