“松散”的章节/段落编号

“松散”的章节/段落编号

编辑 尝试了amsthm下面 egreg 提供的出色解决方案后,我意识到我更喜欢等效ntheorem构造。有人能帮忙吗?


有些数学书使用“松散”的章节/段落编号样式,如下所示:

第一章 基础

(1.1)定义

[...]

(1.2)备注

[...]

(1.3)

[更多内容没有明确标题,可能跨越数个段落。]

(1.4)定理

[...]

证明[...]

(1.5)

[其他一些没有明确标题的背景故事,可能跨越数个段落。]

(1.6)一些免费标题,如“进一步了解”

[...]

我希望你能明白我的意思。在 Latex 中实现这种编号样式的推荐方法是什么?在amsthmorntheorem包中可以实现吗?

添加

我在一些书中观察到的风格是,编号总是放在括号中(可能是为了与正常的章节/部分编号区分开来)。编号和(如果给出)标题采用粗体字体,但字体大小与正常文本相同。

答案1

不太难amsthm:只需要定义一些合适的定理样式。参见https://tex.stackexchange.com/a/17555/4427https://tex.stackexchange.com/a/353540/4427

\documentclass{book}
\usepackage{amsthm}

\makeatletter
\newtheoremstyle{azimutplain}
  {\topsep}   % ABOVESPACE
  {\topsep}   % BELOWSPACE
  {\itshape}  % BODYFONT
  {0pt}       % INDENT (empty value is the same as 0pt)
  {\bfseries} % HEADFONT
  {}          % HEADPUNCT
  {5pt plus 1pt minus 1pt} % HEADSPACE
  {(\thmnumber{#2}) \thmname{#1}\@ifnotempty{#3}{ (\thmnote{#3})}.} % CUSTOM-HEAD-SPEC
\newtheoremstyle{azimutdefinition}
  {\topsep}   % ABOVESPACE
  {\topsep}   % BELOWSPACE
  {\normalfont}  % BODYFONT
  {0pt}       % INDENT (empty value is the same as 0pt)
  {\bfseries} % HEADFONT
  {}          % HEADPUNCT
  {5pt plus 1pt minus 1pt} % HEADSPACE
  {(\thmnumber{#2}) \thmname{#1}\@ifnotempty{#3}{ (\thmnote{#3})}.} % CUSTOM-HEAD-SPEC
\newtheoremstyle{azimutloose}
  {\topsep}   % ABOVESPACE
  {\topsep}   % BELOWSPACE
  {\normalfont}  % BODYFONT
  {0pt}       % INDENT (empty value is the same as 0pt)
  {\bfseries} % HEADFONT
  {}          % HEADPUNCT
  {5pt plus 1pt minus 1pt} % HEADSPACE
  {(\thmnumber{#2})\@ifnotempty{#3}{ \thmnote{#3}.}} % CUSTOM-HEAD-SPEC
\makeatother

\theoremstyle{azimutplain}
\newtheorem{theorem}{Theorem}[chapter]

\theoremstyle{azimutdefinition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{remark}[theorem]{Remark}

\theoremstyle{azimutloose}
\newtheorem{looseinner}[theorem]{}
\makeatletter
\newenvironment{loose}[1][]
 {\@ifempty{#1}{\looseinner}{\looseinner[#1]}}
 {\endlooseinner}
\makeatother

\begin{document}

\chapter{Foundations}

\begin{definition}
Some text
\end{definition}

\begin{remark}
Some text
\end{remark}

\begin{loose}
Some more content without an explicit title, possibly spanning several paragraphs.

Some more content without an explicit title, possibly spanning several paragraphs.
\end{loose}

\begin{theorem}
Some text
\end{theorem}
\begin{proof}
Some text
\begin{loose}
Some other background story without explicit title, possibly spanning several paragraphs.

Some other background story without explicit title, possibly spanning several paragraphs.\qedhere
\end{loose}
\end{proof}

\begin{loose}[Further insight]
Some text
\end{loose}

\end{document}

在此处输入图片描述

答案2

egreg 的解决方案可以轻松修改以ntheorem代替amsthm

\documentclass{book}

\usepackage{ntheorem}

\makeatletter
  \newtheoremstyle{azimut}%
    {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
            (##2)\ ##1\theorem@separator}\hbox{\strut}}}]}%
    {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
            (##2)\ ##1:\ ##3\theorem@separator}\hbox{\strut}}}]}
  \newtheoremstyle{azimutnoname}%
    {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
            (##2)\theorem@separator}\hbox{\strut}}}]}%
    {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
            (##2)\ ##3\theorem@separator}\hbox{\strut}}}]}
  \newtheoremstyle{azimutnonumber}%
    {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
            ##1\theorem@separator}\hbox{\strut}}}]}%
    {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
            ##1:\ ##3\theorem@separator}\hbox{\strut}}}]}
\makeatother

\theoremstyle{azimut}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{definition}[theorem]{Definition}
\newtheorem{remark}[theorem]{Remark}

\theoremstyle{azimutnoname}
\newtheorem{looseinner}[theorem]{}
\makeatletter
  \newenvironment{loose}[1][]
    {\ifx\relax#1\relax\looseinner\else\looseinner[#1]\fi}
    {\endlooseinner}
\makeatother

\theoremstyle{azimutnonumber}
\newtheorem{proof}{Proof}


\begin{document}

\chapter{Foundations}

\begin{definition}
Some text
\end{definition}

\begin{remark}
Some text
\end{remark}

\begin{loose}
Some more content without an explicit title, possibly spanning several paragraphs.

Some more content without an explicit title, possibly spanning several paragraphs.
\end{loose}

\begin{theorem}
Some text
\end{theorem}
\begin{proof}
Some text
\begin{loose}
Some other background story without explicit title, possibly spanning several paragraphs.

Some other background story without explicit title, possibly spanning several paragraphs.
\end{loose}
\end{proof}

\begin{loose}[Further insight]
Some text
\end{loose}

\end{document}

MWE 输出


上述样式定义只是ntheorem默认样式的改编版本break。如果您想省略标题后的换行符,请使用改编版本的样式plain

\makeatletter
  \newtheoremstyle{azimut}%
    {\item[\hskip\labelsep \theorem@headerfont (##2)\ ##1\theorem@separator]}%
    {\item[\hskip\labelsep \theorem@headerfont (##2)\ ##1:\ ##3\theorem@separator]}
  \newtheoremstyle{azimutnoname}%
    {\item[\hskip\labelsep \theorem@headerfont (##2)\theorem@separator]}%
    {\item[\hskip\labelsep \theorem@headerfont (##2)\ ##3\theorem@separator]}
  \newtheoremstyle{azimutnonumber}%
    {\item[\hskip\labelsep \theorem@headerfont ##1\theorem@separator]}%
    {\item[\hskip\labelsep \theorem@headerfont ##1:\ ##3\theorem@separator]}
\makeatother

相关内容