ConTeXt: \setupalign 和垂直对齐的问题

ConTeXt: \setupalign 和垂直对齐的问题

当我的 MWE 有 时\setupalign[height],我的底部浮动正确地位于页面的底部,但是标题和以下文本之间的垂直间隙可能太大。

当我删除时\setupalign[height],我的底部浮动位于页面底部的正上方,但标题和以下文本之间的垂直间隙是正确的。

我似乎可以通过包括\setupalign[height]并将我的更改\setupwhitespace为以下内容来解决问题:

\setupwhitespace [4pt plus 1pt minus 1pt]

这是最好的做法吗?

对齐

\setupalign[height] % delete this line or not

\showframe 
\setupwhitespace [quarterline]

\defineexternalfigure [myfigure][width=\textwidth]
\definefloat[myfloat][figure][location={bottom,none}]

\starttext

\dorecurse{1}{\input tufte\par}
We thrive in information--thick worlds because of our marvelous and everyday ca­ pacity to select, edit, single out, structure, highlight, group, pair, merge, harmo­ nize, synthesize, focus, organize, condense, reduce, boil down, choose, categorize, catalog, classify, list, abstract, scan, look into, idealize, isolate, discriminate, dis­ tinguish, screen, pigeonhole, pick over.
\startplacefloat [myfloat][location={bottom,none}]
    \externalfigure[greybox][myfigure]
\stopplacefloat
\dorecurse{2}{\input tufte\par}

\page

\startsection [title=First section]
\dorecurse{6}{\input tufte\par}

\page

\startsection [title=Second section]
\dorecurse{2}{\input tufte\par}

\stopsection

\stoptext

答案1

当您使用 时\setupalign[height],您会强制最后一行的底部与文本块的底部对齐。如果页面上的文本高度小于文本块的高度,则某物必须拉伸才能对齐底部。在第 3 页上,页眉后的粘连是“最有弹性的”,因此它会扩展以正确对齐底部。添加\setupwhitespace[quarterline]会在每个段落后添加四分之一行的拉伸(?),这意味着节标题后的粘连不需要拉伸太多。这是否是最好的做法纯粹是个人喜好问题。

如果您的唯一目标是让底部浮动位于页面的最底部,那么您可以删除\setupalign[height]\setupwhitespace[quarterline]并添加\setupfloat[bottombefore=\vfill]

\showframe
\setupfloat[bottombefore=\vfill]

\defineexternalfigure [myfigure][width=\textwidth]
\definefloat[myfloat][figure][location={bottom,none}]

\starttext

\dorecurse{1}{\input tufte\par}
We thrive in information--thick worlds because of our marvelous and everyday ca­ pacity to select, edit, single out, structure, highlight, group, pair, merge, harmo­ nize, synthesize, focus, organize, condense, reduce, boil down, choose, categorize, catalog, classify, list, abstract, scan, look into, idealize, isolate, discriminate, dis­ tinguish, screen, pigeonhole, pick over.
\startplacefloat [myfloat][location={bottom,none}]
    \externalfigure[greybox][myfigure]
\stopplacefloat
\dorecurse{2}{\input tufte\par}

\page

\startsection [title=First section]
\dorecurse{6}{\input tufte\par}

\page

\startsection [title=Second section]
\dorecurse{2}{\input tufte\par}

\stopsection

\stoptext

在此处输入图片描述

如果您想要保留\setupalign[height]并且不想让标题后的粘合部分拉伸,那么您需要调整标题的总高度(跳过之前 + 文本高度 + 跳过之后)为的整数倍\baselineskip,或者您需要在页面的其他位置添加一些拉伸(就像您对 所做的那样\setupwhitespace[quarterline]

相关内容