我希望缩进一个长定理的文本,以便第二行的文本正好位于第一行文本的下方(而不是“定理”一词的下方),如下所示:
定理 1:这是一个长定理,我希望第二
行的文本能够缩进。
这是一个小例子,遗憾的是其中的文本没有缩进。
\documentclass{article}
\newtheorem{Theorem}{Theorem}
\begin{document}
\begin{Theorem}
This is a long thoerem where I would like the text in the second line to be indented.
\end{Theorem}
\end{document}
有人知道如何解决这个问题吗?
更新:根据 Werner 的回答和下面相应的评论,我想扩展这个例子如下,其中我还创建了一个定理表以及页脚中对定理的引用,目前它不适用于 Werner 提供的解决方案:
\documentclass[8pt]{extbook}
\usepackage{amsthm}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage{titletoc}
\usepackage{tocloft}
\newtheoremstyle{TheoremStyle}{3pt}{3pt}{\bfseries}{}{\bfseries}{}{.5em}{\thmname{#1}\thmnumber{ #2} \addcontentsline{ToT}{section}{#1~\protect\numberline{#2}{#3}}}
\theoremstyle{TheoremStyle}
\newtheorem{Theorem}{Theorem}
\makeatletter
\newcommand\TableofTheorems{\chapter*{Table of Theorems}\@starttoc{ToT}}
\begin{document}
\TableofTheorems
\newpage
\pagestyle{fancy}
\fancyhead[RO]{Theorem \theTheorem}
\fancyhead[LE]{Theorem \theTheorem}
\section*{Chapter 1}
\addcontentsline{ToT}{chapter}{Chapter 1}
\begin{Theorem}[This is a long thoerem where I would like the text in the second line to be indented.]
This is a long thoerem where I would like the text in the second line to be indented.
\end{Theorem}
\newpage
\begin{Theorem}[This is another theorem.]
This is another theorem.
\end{Theorem}
\newpage
\begin{Theorem}[This is the third Theorem]
This is another theorem.
\end{Theorem}
\end{document}
答案1
定理实际上是列表。你可以使用enumitem
以您想要的方式格式化列表,同时tocloft
帮助设置定理列表的内容:
\documentclass{article}
\newtheorem{Theorem}{Theorem}% Original Theorem definition
\usepackage{enumitem,tocloft}
\newenvironment{MyTheorem}[1][]{%
\def\theoremtocarg{#1}% Capture optional argument
\begin{enumerate}[
series=theoremlist, % Maintain unique counter
resume=theoremlist, % Continue from previous counter
align=left,
leftmargin=*,
label={\bfseries Theorem \arabic*},
ref=\arabic*
]
\item \itshape%
\addcontentsline{tot}{theorem}{\protect\numberline{\theenumi}\ \theoremtocarg}% Add theorem to List of Theorems
}{%
\end{enumerate}
}
\newlistof[section]{theorem}{tot}{List of Theorems}% Define List of Theorems
\renewcommand{\cfttottitlefont}{\Large\bfseries}% Default for \section
\begin{document}
\listoftheorem
\section{First section}
\begin{Theorem}
This is a long theorem where I would like the text in the second line to be indented.
\end{Theorem}
\begin{MyTheorem}[First theorem]
This is a long theorem where I would like the text in the second line to be indented.
\end{MyTheorem}
\begin{Theorem}
This is a long theorem where I would like the text in the second line to be indented.
\end{Theorem}
\begin{MyTheorem}[Second theorem]
This is a long theorem where I would like the text in the second line to be indented.
\end{MyTheorem}
\end{document}