答案1
这是一个带有 的解决方案ntheorem
。我定义了一个wrap
定理样式,它只是使用\hangindent
和\hangafter
:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[thmmarks, amsmath, thref]{ntheorem}
\makeatletter
\newlength{\wrapboxlg}
\newtheoremstyle{wrap}%%
{\item[\hskip\labelsep\Large\theorem@headerfont ##1~##2\theorem@separator]
\mbox{}\endgraf\settowidth{\wrapboxlg}{\Large\theorem@headerfont ##1~##2\theorem@separator\normalsize\enspace}
\vskip-1.5\baselineskip
\hangindent = \wrapboxlg\hangafter =-2\noindent
}%
{\item[\hskip\labelsep\Large\theorem@headerfont ##1~##2]
\mbox{}\endgraf\settowidth{\wrapboxlg}{\Large\theorem@headerfont ##1~##2\theorem@separator\normalsize\enspace}
\vskip-1.5\baselineskip
\hangindent = \wrapboxlg\hangafter =-2\noindent
{\theorem@headerfont (##3)\theorem@separator}\ }%
\makeatother
\theoremstyle{wrap}
\theoremheaderfont{\upshape\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{.}
\newtheorem{Ex}{Example}[section]
\usepackage{lipsum}
\begin{document}
\setcounter{section}{1}
\setcounter{Ex}{22}
\begin{Ex}
\lipsum[11]
\end{Ex}
\bigskip
\begin{Ex}[This is the example title]
Sed feugiat. Cum sociis natoque penatibus et magnis dis par-
turient montes, nascetur ridiculus mus. Ut pellentesque augue
sed urna. Vestibulum diam eros, fringilla et, consectetuer eu, nonummy id,
sapien. Nullam at lectus. In sagittis ultrices mauris. Curabitur malesuada
erat sit amet massa. Fusce blandit. Aliquam erat volutpat. Aliquam euismod.
Aenean vel lectus. Nunc imperdiet justo nec dolor.
\end{Ex}
\end{document}