纯文本。beginsection 不换行

纯文本。beginsection 不换行

我正在为某人输入一篇数学文章。他让我用纯 TeX(而不是 LaTeX)输入,因为他习惯使用纯 TeX,我想他想让我编辑一下我输入的内容。

无论如何,我对纯 TeX 还不熟悉。在每个部分的开头我都使用\beginsection。但是当文本超出行长时,行不会中断。有没有办法改变命令\beginsection,让它在行末中断行?

谢谢,niv

答案1

\beginsection这是from的定义plain.tex

\outer\def\beginsection#1\par{\vskip\z@ plus.3\vsize\penalty-250
  \vskip\z@ plus-.3\vsize\bigskip\vskip\parskip
  \message{#1}\leftline{\bf#1}\nobreak\smallskip\noindent}

这意味着标题确实设置在 内\leftline,不允许换行。如何修改它?删除\leftline但添加 的本地设置,\interlinepenalty以便由节标题形成的段落不会跨页分割。

\catcode`@=11

\outer\def\beginsection#1\par{%
  \vskip\z@ plus.3\vsize % a generous stretchability
  \penalty-250 % a good point to break a page
  \vskip\z@ plus-.3\vsize % but cancel it if no page break is taken at the penalty
  \bigskip\vskip\parskip % separation from the above text if no page break
  \message{#1}% log the section title
  \begingroup
  \interlinepenalty=10000 % no page break allowed in the title if split across lines
  \hangindent=\parindent \hangafter=1 % indent all lines like the first one
  \bf#1\par
  \endgroup
  \nobreak % no page break between the title and the following text
  \smallskip
  \noindent
}

\catcode`@=12

\vsize=6\baselineskip % just to show that no break is taken

\beginsection This is a long title that should be split across lines; just
  make it sufficiently long; maybe this long is sufficient

Text of the section

\beginsection 
  This is a long title that should be split across lines; just
  make it sufficiently long; maybe this long is sufficient
  This is a long title that should be split across lines; just
  make it sufficiently long; maybe this long is sufficient
  This is a long title that should be split across lines; just
  make it sufficiently long; maybe this long is sufficient

Text of the section

\bye

在此处输入图片描述

相关内容