我想做这样的事:
\begin{theorem}[Actual name of theorem]
This theorem states that...
\end{theorem}
并且它应该呈现:
Actual name of theorem. This theorem states that...
我通过创建类似定理的环境改变了定理的名称,但我想在线执行此操作,而不创建新的环境。
答案1
从问题中无法明确不一方面需要创造新的环境,另一方面多种的将为每个单独命名的定理创建一个新的环境。
假设是后者,也许是这样的?
\documentclass{book}
\usepackage{amsthm}
\usepackage{thmtools}
\declaretheorem[name=Theorem,numberwithin=chapter]{theorem}
\makeatletter
\declaretheoremstyle[
headfont=\bfseries,
headindent=-0.25em,
postheadspace=0.5em,
notefont=\bfseries,
notebraces={}{},
headformat=\NOTE\thmt@space\NUMBER,
bodyfont=\mdseries\itshape,
spaceabove=12pt,spacebelow=12pt,
]{namedthmstyle}
\makeatother
\declaretheorem[
style=namedthmstyle,
name=Theorem,
title = {},
numberlike=theorem
]{namedtheorem}
\begin{document}
\chapter{The whole thing}
\begin{namedtheorem}[Theorem of Pythagoras]
The square on the hypotenuse of a right triangle equals the sum of the squares other two sides.
\end{namedtheorem}
\begin{namedtheorem}[Fermat's Last Theorem]
For $n > 2$, there are no positive integers $a, b, c$ for which $a^{n} + b^{n} = c^{n}$.
\end{namedtheorem}
\end{document}
请注意,我必须namedtheorem
使用 来“假装”使名称排版与左边距基本齐平headindent=-0.25em
。当然,还有更好、更精确的方法来实现这一点。