这个答案很好地解释了如何让上下文网格上的文本和浮动文本很好地对齐。我对对齐有同样的要求,但我需要它作为图旁边的标题。
考虑以下示例(改编自同一答案)我怎样才能得到
- 标题是否位于网格的顶行?
- 图形的顶部是否与第一条网格线的 x 高度对齐?
```
\useMPlibrary [dum]
\setuplayout [grid=yes]
\setupinterlinespace [line=20pt]
\setupfloats [figure] [sidealign=line]
\setupcaptions [figure] [location={left, high},
% inbetween={\blank[-\strutdepth]}
]
\starttext
\showgrid
\startplacefigure
[title={There is not so much basic instruction, as of now, as there was in the old days, showing the differences between good and bad typographic design.},
]
\externalfigure [dummy] [width=.6\textwidth]
\stopplacefigure
\input zapf
\stoptext
```
答案1
通过反复试验,我找到了适合我的文档的以下方法。我觉得这有点不合时宜——我认为应该有办法将所有网格处理放在序言中——但它满足了我对结果的要求。
如果没有offset
,图片将与文本框顶部对齐,而不是实际上升高度。必须调整长度以适合字体和间距。
\useMPlibrary [dum]
\setuplayout [grid=yes]
\setupinterlinespace [line=20pt]
\setupcaption [figure] [
location={left,high},
number=no,
inbetween={\blank[-.01mm]}, %picture top-aligned, caption on grid
]
\starttext
\showgrid
\startplacefigure
[location=top,none,title={There is not so much basic instruction, as of now, as there was
in the old days, showing the differences between good and bad typographic design.},
]
\placeongrid[max]{\offset[y=2mm]{
\externalfigure [dummy] [width=.6\textwidth]%
}}
\stopplacefigure
\input zapf
\stoptext