TeX:在垂直盒子中嵌套水平盒子没有按预期显示

发布于 2024-09-28 17:08:53 字数 614 浏览 7 评论 0原文

使用以下简单的 TeX:

\hbox to \hsize {

\vbox to 2 true in {
aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa.  aaa aaaaa aaaaa aaa aaaaa aaaa aaa 
aaaa aaa aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa.  aaa aaaaa aaaaa aaa aaaaa 
aaaa aaa aaaa aaa.  }

\vbox to 2 true in {
bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb.  bbb bbbbb bbbbb bbb bbbbb bbbb bbb 
bbbb bbb bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb.  bbb bbbbb bbbbb bbb bbbbb 
bbbb bbb bbbb bbb.  }
}

目标是看到两个盒子侧面包含一段左右的文本。除了 TeXed 时,第一个 vbox 拉伸到 \hsize 的完整大小,将第二个 vbox 挤出页面。

为什么这不能按预期工作?可能有更好的方法来实现并排段落,但我仍然对这里的问题感兴趣。

With the following plain TeX:

\hbox to \hsize {

\vbox to 2 true in {
aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa.  aaa aaaaa aaaaa aaa aaaaa aaaa aaa 
aaaa aaa aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa.  aaa aaaaa aaaaa aaa aaaaa 
aaaa aaa aaaa aaa.  }

\vbox to 2 true in {
bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb.  bbb bbbbb bbbbb bbb bbbbb bbbb bbb 
bbbb bbb bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb.  bbb bbbbb bbbbb bbb bbbbb 
bbbb bbb bbbb bbb.  }
}

the goal is to see two boxes side containing a paragraph or so of text. Except that when TeXed, the first vbox stretches to the full size of \hsize, squeezing the second vbox off the page.

Why doesn't this work as expected? There might be a better way to implement side-by-side paragraphs, but I'm still interested in what's wrong here.

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

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

发布评论

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

评论(1

无畏 2024-10-05 17:08:53

段落中的一行文本将始终延伸到 \hsize (该段落末尾的 \hsize 的值)。因此,例如使用:

\hbox to \hsize {
   \vbox to 3 true in {
     \hsize=3 true in
     \strut aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa. aaa aaaaa aaaaa aaa
     aaaaa aaaa aaa aaaa aaa aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa.
     aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa.\vfil
   }
   \hfil
   \vbox to 3 true in {
     \hsize=3 true in
     \strut bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb. bbb bbbbb bbbbb bbb
     bbbbb bbbb bbb bbbb bbb bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb.
     bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb.\vfil
   }
}

A line of text in a paragraph will always stretch to \hsize (the value of \hsize at the end of that paragraph). Thus, use for example:

\hbox to \hsize {
   \vbox to 3 true in {
     \hsize=3 true in
     \strut aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa. aaa aaaaa aaaaa aaa
     aaaaa aaaa aaa aaaa aaa aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa.
     aaa aaaaa aaaaa aaa aaaaa aaaa aaa aaaa aaa.\vfil
   }
   \hfil
   \vbox to 3 true in {
     \hsize=3 true in
     \strut bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb. bbb bbbbb bbbbb bbb
     bbbbb bbbb bbb bbbb bbb bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb.
     bbb bbbbb bbbbb bbb bbbbb bbbb bbb bbbb bbb.\vfil
   }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文