答案1
您amsthm
可以定义一种除了可选参数的处理之外与标准相同的样式。
\documentclass{article}
\usepackage{amsmath,amsthm}
\newtheoremstyle{arweddefinition}
{\topsep} % ABOVESPACE
{\topsep} % BELOWSPACE
{\upshape} % BODYFONT
{0pt} % INDENT (empty value is the same as 0pt)
{\bfseries} % HEADFONT
{.} % HEADPUNCT
{5pt plus 1pt minus 1pt} % HEADSPACE
% CUSTOM-HEAD-SPEC follows
{%
\if\relax\detokenize{#3}\relax
% no optional argument
\else
\makebox[0pt][l]{\hspace{\textwidth}\hspace{\marginparsep}\normalfont\itshape#3}%
\fi
\thmname{#1}\thmnumber{ #2}%
}
\theoremstyle{arweddefinition}
\newtheorem{definition}{Definition}[section]
\begin{document}
\section{Test}
\begin{definition}[Foo]
A \emph{foo} is something very useful. We will use foos all the
time in this paper. This should be enough to wrap.
\end{definition}
\begin{definition}
A \emph{baz} is not very useful so we don't set it in the margin.
We will not be using any baz in the paper. This should be enough to wrap.
\end{definition}
\end{document}
使用破碎\parbox
来适应更长的标题。
\documentclass{article}
\usepackage{amsmath,amsthm}
\newtheoremstyle{arweddefinition}
{\topsep} % ABOVESPACE
{\topsep} % BELOWSPACE
{\upshape} % BODYFONT
{0pt} % INDENT (empty value is the same as 0pt)
{\bfseries} % HEADFONT
{.} % HEADPUNCT
{5pt plus 1pt minus 1pt} % HEADSPACE
% CUSTOM-HEAD-SPEC follows
{%
\if\relax\detokenize{#3}\relax
% no optional argument
\else
\makebox[0pt][l]{%
\hspace{\textwidth}\hspace{\marginparsep}\normalfont\itshape
\smash{\parbox[t]{\marginparwidth}{\raggedright#3}}%
}%
\fi
\thmname{#1}\thmnumber{ #2}%
}
\theoremstyle{arweddefinition}
\newtheorem{definition}{Definition}[section]
\begin{document}
\section{Test}
\begin{definition}[Foo]
A \emph{foo} is something very useful. We will use foos all the
time in this paper. This should be enough to wrap.
\end{definition}
\begin{definition}
A \emph{baz} is not very useful so we don't set it in the margin.
We will not be using any baz in the paper. This should be enough to wrap.
\end{definition}
\begin{definition}[Strongly typed principal foo]
A \emph{strongly typed principal foo} is not very useful, but we set it in the
margin just by way of example. We will not be using themin the paper.
This should be enough to wrap.
\end{definition}
\end{document}