定理格式

定理格式
\theoremstyle{remark} \newtheorem{example}{Example}

然后:

\begin{example}
Some text
\end{example}

输出为:

Example 1. Some text

有什么办法可以自动获取而不缩进:

Example 1.
Some text

我尝试写:

\begin{example}
\\Some text
\end{example}

但是有两个缺点,首先每次都必须这样做,第二个缺点是它无法编译,并且 Latex 错误是:

./doc.tex:60:There's no line here to end.\\S

答案1

以下是使用所需新样式定义的示例amsthm

\documentclass{article}
\usepackage{amsthm}

\newtheoremstyle{mystyle}% name
  {3pt}%Space above
  {3pt}%Space below
  {\normalfont}%Body font
  {0pt}%Indent amount
  {\itshape}% Theorem head font
  {.}%Punctuation after theorem head
  {\newline}%Space after theorem head 2
  {}%Theorem head spec (can be left empty, meaning ‘normal’)

\theoremstyle{mystyle}
\newtheorem{exam}{Example}

\begin{document}

\begin{exam}
Test exam
\end{exam}

\end{document}

break下面是使用包中预定义样式的示例ntheorem

\documentclass{article}
\usepackage{ntheorem}

\theoremstyle{break}
\theoremheaderfont{\normalfont\itshape}
\theorembodyfont{\normalfont}
\theoremseparator{.}
\newtheorem{exam}{Example}

\begin{document}

\begin{exam}
Test exam
\end{exam}

\end{document}

thmtools最后,这里有一个使用和amsthm作为后端的示例:

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}

\declaretheoremstyle[
spaceabove=3pt, spacebelow=3pt,
headfont=\normalfont\itshape,
notefont=\normalfont, notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=\newline,
qed=\qedsymbol
]{mystyle}
\declaretheorem[style=mystyle]{example}

\begin{document}

\begin{example}
Test exam
\end{example}

\end{document}

相关内容