从定理中删去单词

从定理中删去单词

我有一个这样的定理:

\documentclass[12pt]{book} 

\begin{document}

\newtheorem{definition}{Definition}[section]

\begin{definition}[Integers]
Integers are positive and negative whole numbers, including 0.\\
e.g. $..., -3, -2, -1, 0, 1, 2, 3, 4, ...$
\end{definition}

\end{document}

定义

我怎样才能使语句“整数有正数和负数……”归结为一行?

我已尝试过 \\ 但是这会产生一行无法结束的错误并且也不会降低“整数为正数和负数...”的准确性。

谢谢你!

答案1

您可以使用amsthm和定义自己的定理样式。

\documentclass[12pt]{book}
\usepackage{amsthm,amsmath}

\newtheoremstyle{breakthm}
  {\topsep}%   Space above
  {\topsep}%   Space below
  {\itshape}%  Body font
  {}%          Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%         Punctuation after thm head
  {\newline}%  Space after thm head: " " = normal interword space;
  {}%          Thm head spec (can be left empty, meaning `normal')
\newtheoremstyle{breakdef}
  {\topsep}%   Space above
  {\topsep}%   Space below
  {\upshape}%  Body font
  {}%          Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%         Punctuation after thm head
  {\newline}%  Space after thm head: " " = normal interword space;
  {}%          Thm head spec (can be left empty, meaning `normal')

\theoremstyle{breakthm}
\newtheorem{theorem}{Theorem}[section]

\theoremstyle{breakdef}
\newtheorem{definition}[theorem]{Definition}

\begin{document}

\begin{definition}[Integers]
Integers are positive and negative whole numbers, including $0$,
e.g.
\[
\dots, -3, -2, -1, 0, 1, 2, 3, 4,\dotsc
\]
\end{definition}

\begin{theorem}
The integers are useful.
\end{theorem}

\end{document}

在此处输入图片描述

但在我看来,这只是浪费空间。

请注意,这amsthm提供了更好的自定义可能性。使用theorem(或者,更好的是ntheorem),如果您希望定义中的正文字体直立,则必须定义一种新的定理样式,这是惯例。

另一种可能性是使用thmtools,这使得定义新的定理样式变得非常容易。与之前相同的是,可以使用

\documentclass[12pt]{book}
\usepackage{amsmath,amsthm,thmtools}

\declaretheoremstyle[
  postheadspace=\newline,
  bodyfont=\itshape,
]{breakthm}% main style

\declaretheoremstyle[
  style=breakthm,
  bodyfont=\normalfont,
]{breakdef}% override the bodyfont

\declaretheorem[
  name=Theorem,
  style=breakthm,
  numberwithin=section,
]{theorem}

\declaretheorem[
  name=Definition,
  style=breakdef,
  numberlike=theorem,
]{definition}

\begin{document}

\begin{definition}[Integers]
Integers are positive and negative whole numbers, including $0$,
e.g.
\[
\dots, -3, -2, -1, 0, 1, 2, 3, 4,\dotsc
\]
\end{definition}

\begin{theorem}
The integers are useful.
\end{theorem}

\end{document}

答案2

有许多用于定制定理的包,包括theorem核心乳胶分布:

\documentclass[12pt]{book}
\usepackage{theorem}
\theoremstyle{break}
\newtheorem{definition}{Definition}[section]
 \begin{document} 
 \begin{definition}[Integers]
 Integers are positive and negative whole numbers, including 0.\\
e.g. $..., -3, -2, -1, 0, 1, 2, 3, 4, ...$ 
\end{definition}
 \end{document} 

相关内容