通过编写网格排版的输出例程,我发现了一个不一致之处。查看文档中\specialoutput
和文档末尾的空格序列。输出例程中相同的空格序列遵循网格,但其他地方却不遵循。
梅威瑟:
\catcode`@=11
\output{\ifnum\outputpenalty>-30000\relax \plainoutput \else \specialoutput \fi}
% Simulate a float box:
\setbox\tw@\vbox{%
\strut This is a float box that should obey grid typesetting.
This is a float box that should obey grid typesetting.
This is a float box that should obey grid typesetting.
This is a float box that should obey grid typesetting.
\vrule height 14pt depth 4pt width 5cm% to simulate an object of random height
\par\vskip\z@}% this makes \dp\tw@=\z@
% Fit the float box to the grid
\ht\tw@\dimexpr \ht\tw@/\baselineskip*\baselineskip\relax
\def\@setstrut{\setbox\strutbox=\hbox{\vrule height.7\baselineskip
depth .3\baselineskip width\z@}}
\@setstrut
% First case: \unvbox in output routine
\def\specialoutput{% Simulate a "here" float
\setbox\z@\vbox{\unvbox\@cclv}
\dimen@\dp\z@
\unvbox\z@
\vskip-\dimen@
\vskip1.3\baselineskip
\copy\tw@
\vskip\dimen@
\vskip.7\baselineskip}% total \vskip is whole number times \baselineskip
% A primitive control if the grid is obeyed
\vtop to\z@{\noindent X \break X \break X \break X \break X \break X%
\break X \break X \break X \break X \break X \break X \break X \break X%
\break X \break X \break X \break X \break X \break X \break X \break X%
\break X \break X \break X \break X \break X \break X\vss}
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
\vadjust{\penalty-40000}% insert float
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\strut
\setbox4\vbox{\strut Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.}
\dimen@\dp4
% Use the same spacing as in \specialoutput, but here with no success
\unvbox4
\vskip-\dimen@
\vskip1.3\baselineskip
\copy\tw@
\vskip\dimen@
\vskip.7\baselineskip
{\bf Now the grid is not obeyed any more.} Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
\bye
答案1
没有区别。您的示例中还有其他因素在起作用:
- 在您的“内联”浮动中,您对具有一定深度的框进行操作,但您取消跳过该框,添加了更多框和一些粘连。现在基线位于最后一个的底部边缘
\vskip
。但它应该\dimen@
更高,以\vskip
模仿深度。粘贴了行间粘连,通常会减少前一行的深度,但事实并非如此;结果所有后续文本将向下移动\dimen@
。
您可以通过添加来弥补这一点
\prevdepth=\dimen@
在\vskip
s 之后(或在 之后\copy\tw@
,没有区别)。通过此修正,您将获得
- 您可以看到仍然有一个微小的偏移 - 这是添加的
\lineskip
(=1pt
),因为您粘贴的框高于这个高度\baselineskip
,而 TeX 会谨慎地避免将段落的行压在一起而它们之间没有任何空格。设置\lineskip=0pt
(虽然您可能通常不想要)可以为您提供良好的对齐效果:
这些都不会在输出程序中发生,因为您只是在那里堆叠框(而不是文本行),并且重要的是高度+深度而不是基线。