我在定理环境中遇到了行太长的问题。以下示例显示了这个问题,我需要在标题中换行,但没有。有什么建议吗?
\documentclass[a4paper,10pt,twocolumn]{article}
\usepackage{theorem}
{\theoremheaderfont{\upshape\bfseries}
\theorembodyfont{\normalfont\slshape}
\newtheorem{definition}{Definition}}
\begin{document}
\begin{definition}[Long heading that should have a line break]
A definition is a statement of the meaning of a term (a word, phrase, or other set of symbols).
Definitions can be classified into two large categories, intensional definitions (which try to give the essence of a term) and extensional definitions (which list every single object that a term describes).
A term may have many different senses and multiple meanings, and thus require multiple definitions.
\end{definition}
\end{document}
感谢您的帮助!
答案1
在另一个主题的帮助下,我自己找到了一个解决方案,如果有人感兴趣,解决方案如下。我将包“theorem”替换为“ntheorem”,并添加了一些形成命令,这些命令是我从另一个主题改编而来的:
\documentclass[a4paper,10pt,twocolumn]{article}
\usepackage{ntheorem}
\makeatletter
\renewtheoremstyle{plain}% Adds automatic line break, if heading is too long
{\item{\theorem@headerfont ##1\ ##2\theorem@separator}~}
{\item{\theorem@headerfont ##1\ ##2\ (##3)\theorem@separator}~}
\makeatother
{\theoremheaderfont{\upshape\bfseries}
\theorembodyfont{\normalfont\slshape}
\newtheorem{definition}{Definition}}
\begin{document}
\begin{definition}[Long heading that should have a line break]
A definition is a statement of the meaning of a term (a word, phrase, or other set of symbols).
Definitions can be classified into two large categories, intensional definitions (which try to give the essence of a term) and extensional definitions (which list every single object that a term describes).
A term may have many different senses and multiple meanings, and thus require multiple definitions.
\end{definition}
\end{document}
注 1:某个版主能把这个问题标记为已解决吗?(或者如果这个问题不有趣,就删除它。)我不知怎么的一开始无法登录,所以我以访客身份问了这个问题,现在自己找到了解决方案。
注 2:此解决方案与论坛中已有的解决方案不同!此解决方案不适用于定理包和此解决方案需要另外八行代码,而且结果也不同(我不希望在标题之后或在标题内部有换行符)。