在两个对页上制作给定文本的 Latex 排版

发布于 2024-08-20 05:04:14 字数 252 浏览 8 评论 0原文

我如何鼓励/让 Latex 排版文本的某些部分,以便它全部出现在连续的偶数页、奇数页对页面上?

经过反复试验,可以诱使 \nopagebreak 这样做,但是有没有一种有效的策略呢?像 samepage 这样的环境是理想的,但是这样的环境:

  1. 如果需要获取对页上的所有文本,将在奇数页上强制分页;
  2. 允许在环境主体中的任何位置最多分页,如果不能确保这一点,则会失败。

How do I encourage/make Latex typeset some portion of text so that it will all appear on a consecutive even-page, odd-page pair of pages?

With trial and error, \nopagebreak can be coaxed into doing this, but is there a strategy that Just Works? Something like a samepage environment would be ideal, but one that:

  1. Will force a pagebreak on odd pages if that is needed to get all the text on facing pages;
  2. Allows up to one page break anywhere in the environment body, and fails noisily if that can't be ensured.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苹果你个爱泡泡 2024-08-27 05:04:14

您可以组合一个环境,例如

\newenvironment{twopage}{%
  \begingroup\setbox0\vbox\bgroup
}{%
  \egroup
  \ifdim\ht0>\textheight
    \setbox1\vsplit0 to \textheight
    \cleardoublepage\unvbox1\clearpage
    \ifdim\ht0>\textheight
      \PackageWarning{twopage}{Overflow in twopage environment}%
    \fi
    \unvbox0\clearpage
  \else
    \clearpage\unvbox0\clearpage
  \fi\endgroup
}

如果您想要更吵闹的故障,请将 \PackageWarning 更改为 \PackageError\unvboxes 应允许注释/浮动才能正常工作 - 如果您不需要它,您可以考虑将它们全部更改为 \boxes (尽管我对 \vsplit 的行为有点生疏 关于框深度和跳过,因此这可能会产生有趣的行为,但它可以保证您只需要两页,即从第二页底部流出任何额外的内容)。

You could put together an environment such as

\newenvironment{twopage}{%
  \begingroup\setbox0\vbox\bgroup
}{%
  \egroup
  \ifdim\ht0>\textheight
    \setbox1\vsplit0 to \textheight
    \cleardoublepage\unvbox1\clearpage
    \ifdim\ht0>\textheight
      \PackageWarning{twopage}{Overflow in twopage environment}%
    \fi
    \unvbox0\clearpage
  \else
    \clearpage\unvbox0\clearpage
  \fi\endgroup
}

If you want a noisier failure, change \PackageWarning into \PackageError, The \unvboxes should allow for notes/floats to work properly - if you don't need that, you might consider changing them all to \boxes instead (although I'm a bit rusty on the behavior of \vsplit with respect to box depths and skips, so that might produce funny behavior, but it would guarantee that you only took two pages by flowing anything extra off the bottom of the second page).

森林迷了鹿 2024-08-27 05:04:14

\clearpage之间存在区别\cleardoublepage。通过在左侧您想要的内容之前使用 \cleardoublepage ,在右侧您想要的内容之前使用 \clearpage ,您可以强制使用您想要的布局寻找。

当然,twoside 选项是必须的。

There is a distinction between \clearpage and \cleardoublepage. By using \cleardoublepage just before the stuff you want on the left hand side and \clearpage before the stuff you want on the right hand side you can force the layout you're looking for.

Of course, the twoside option is must.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文