如何在页面标题中添加换行符?

如何在页面标题中添加换行符?

我正在使用 编写文档,amsart标题很长。现在我想知道,如何才能得到一个换行符,这样它就不会填满每页的标题。我试过了,\protect\\\但没有成功。这是一个最简单的例子:

\documentclass[11pt]{amsart}
\usepackage{lipsum}

\begin{document}

\title[An annoyingly long title that almost makes me \protect\\ cry and I do not see how to fit it into the head so the question is what I can do?]{An annoyingly long title that almost makes me cry and I do not see how to fit it into the head so the question is what I can do?}
{\maketitle}
\lipsum
\lipsum[3-56]
\end{document}

答案1

赫伯特的回答有一些改进:

\documentclass[11pt]{amsart}
\usepackage{lipsum}
\newcommand{\mylongtitle}[1]{%
  \ifodd\value{page}%
    \protect\parbox{0.97\linewidth}{#1}\hfill%
  \else%
    \hfill\protect\parbox{0.97\linewidth}{#1}%
  \fi%
}

\headsep=1cm
\calclayout

\begin{document}

\title[\mylongtitle{An annoyingly long title that almost makes me cry and I
do not see how to fit it into the head so the question is what I can do?}]
{An annoyingly long title that almost makes me cry and I do not see how to
fit it into the head so the question is what I can do?}
\maketitle
\lipsum
\lipsum[3-56]
\end{document} 

在此处输入图片描述

我已经定义了一个新命令\mylongtitle,用于可选参数中,\title确保奇数页和偶数页的正确间距。

我还添加了

\headsep=1cm

平衡页眉和文本之间的距离(最好不要使用,geometry因为它会弄乱amsart设置)。\calclayout重新计算页面布局后。

答案2

用一个\parbox

\title[\hfill\protect\parbox{0.975\linewidth}{An annoyingly 
         long title that almost makes me\\ cry and I do not see how to fit it 
         into the head so the question is what I can do?}]{An annoyingly 
         long title that almost makes me cry and I do not see how to fit it 
         into the head so the question is what I can do?}

相关内容