标题与用 \newtheorem 编号的编号在同一行吗?

标题与用 \newtheorem 编号的编号在同一行吗?

是否可以将\newtheorem“标题”与编号保持在同一行?并为标题和正文赋予不同的样式?

我想做这样的事情:

\begin{theorem}[Bayes' Theorem]
Poopy Stoopy
\end{theorem}

并使其显示为:

Theorem 1.1 - Bayes' Theorem
Poopy Stoopy

“定理 1.1”用粗体表示,“贝叶斯定理”用斜体表示,“Poopy Stoopy”用正常字体表示

答案1

您可以使用\theoremseparator

在此处输入图片描述

代码 :

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[ thmmarks, thref]{ntheorem}

\theoremstyle{plain}
\theoremseparator{.~---}

\newtheorem{thm}{Theorem}[chapter]


\begin{document}
\chapter{}
\section{Introduction}
\begin{thm}\label{testthm}
Bayes' Theorem
\end{thm}
Poopy Stoopy.


\begin{thm}\label{testthm}
Some theorem
\end{thm}
Some text.

\end{document}

答案2

使用适当定义的定理样式。

\documentclass{article}
\usepackage{amsthm}

\newtheoremstyle{guymatz}
  {\topsep}     % ABOVESPACE
  {\topsep}     % BELOWSPACE
  {\normalfont} % BODYFONT
  {0pt}         % INDENT (empty value is the same as 0pt)
  {\bfseries}   % HEADFONT
  {}            % HEADPUNCT
  {\newline} % HEADSPACE
  {\thmname{#1}\thmnumber{ #2}\thmnote{\textnormal{ -- \textit{#3}}}} % CUSTOM-HEAD-SPEC

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

\begin{document}

\section{Basics}

\begin{theorem}[Bayes' Theorem]
Poopy stoopy.
\end{theorem}

\begin{theorem}
Poopy stoopy.
\end{theorem}

\end{document}

在此处输入图片描述

相关内容