我想在页边空白处用大号(首字下沉)定理数字来标记定理。如果不使用 smash,我无法让 LaTeX 提高首字下沉,但如果定理足够短,这会导致数字重叠。
有没有办法要求在定理周围添加额外的填充?
梅威瑟:
\documentclass{article}
\usepackage{amsmath}
\usepackage[amsmath,thmmarks]{ntheorem}
\usepackage{lettrine}
\usepackage{libertine}
\newcommand{\numfont}[1]{\normalfont\oldstylenums{\lettrine[lhang=1,lines=3,lraise=.5]{\smash{#1}}{}}}}
%modified code from the margin theorem style
\makeatletter
\newtheoremstyle{dropmargin}%
{\item[\theorem@headerfont \numfont{##2} ##1\theorem@separator]}%
{\item[\theorem@headerfont \numfont{##2} ##1\ (##3)\theorem@separator]}
\makeatother
\theoremstyle{dropmargin}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\end{document}
答案1
一个选项是使用 a\raisebox
而不是\smash
;使用两个可选参数,您现在可以更好地控制希望 TeX 看到的放置数字的高度/深度。您可能需要调整设置以满足您的需求:
\documentclass{article}
\usepackage{amsmath}
\usepackage[amsmath,thmmarks]{ntheorem}
\usepackage{lettrine}
\usepackage{libertine}
\newcommand{\numfont}[1]{\normalfont\oldstylenums{\raisebox{10pt}[18pt][10pt]{\lettrine[lhang=1,lines=3]{#1}{}}}}
%modified code from the margin theorem style
\makeatletter
\newtheoremstyle{dropmargin}%
{\item[\theorem@headerfont \numfont{##2} ##1\theorem@separator]}%
{\item[\theorem@headerfont \numfont{##2} ##1\ (##3)\theorem@separator]}
\makeatother
\theoremstyle{dropmargin}
\newtheorem{theorem}{Theorem}
\newcommand\Text{Some test text for illustration and here there are some more words test text for illustration and here there are some more words test text for illustration and here there are some more words test text for illustration and here there are some more words}
\begin{document}
\Text
\begin{theorem} a \end{theorem}
\Text
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\begin{theorem} a \end{theorem}
\end{document}
答案2
Gonzalo 的解决方案包含一个问题:当定理有多条线时,我们看不到等距线。另一个解决方案是使用\prevgraph
以便知道定理中有多少条线。如果此值为 1 或 2,则我们添加一个额外的垂直空间。您可以通过将以下宏添加到您的代码(在您的\newtheorem
命令之后)来尝试此操作:
\def\endtheorem{\@endtheorem \ifcase\prevgraf \or \bigskip \or \medskip\fi}