大家正在制作页面标题,我需要将一些文本与网格对齐\definemakeup
梅威瑟:
\showframe
\showgrid
\definemakeup[custom][headerstate=none,footerstate=none]
\setuplayout[custom][grid=yes,backspace=30mm]
\setuplayout[grid=yes,backspace=30mm]
\setupwhitespace[big]
\starttext
\startmakeup[custom]
\setupwhitespace[big]
\input ward\par
\input ward
\stopmakeup
\input ward\par
\input ward
\stoptext
如您所见,使用backspace=
时,像 这样的命令可以正常工作,但是。\setuplayout
grid=yes
编辑:感谢 DG 和 Aditya 的回答,该选项grid=high
与我想要的非常接近,但当我使用其他字体(例如无衬线字体)时,它会失败。请参阅以下 MWE:
\showgrid
\definefontfamily [mainface][rm][TeX Gyre Pagella]
\definefontfamily [mainface][ss][TeX Gyre Heros]
\setupbodyfont[mainface,
sans,%<---
]
\setuplayout[grid=normal]
\definemakeup[titlepage][
headerstate=none,
footerstate=none,
]
\setuplayout[titlepage][
grid=high,
backspace=30mm,
]
\starttext
\startmakeup[titlepage]
\input ward\blank
\input ward
\stopmakeup
\input ward\blank
\input ward
\stoptext
答案1
Makeup 与 grid 配合得不好,因为基本上它就是一个\vbox
。在这种情况下,内部有一个\dontleavhmode
添加垂直空间的,其效果可以使用 top 选项并通过反复尝试猜测值来补偿:
\showgrid
%
\definefontfamily [mainface][rm][TeX Gyre Pagella]
\definefontfamily [mainface][ss][TeX Gyre Heros]
\setupbodyfont[mainface,
sans,%<---
]
%
%
\setuplayout[grid=normal]
%
\definemakeup[titlepage][
headerstate=none,
footerstate=none,
]
\setupmakeup[titlepage][
top=\vskip-0.75em,
bottom=,]
\setuplayout[titlepage][
backspace=30mm,
]
\starttext
\startmakeup[titlepage]
\input ward\blank[line]
\input ward
\stopmakeup
\input ward\blank[line]
\input ward
\stoptext
top=\vskip-0.75em\vskip10\lineheight
如果您想将框的位置设置在文本区域顶部 10 行处,也可以使用。
答案2
不要\par
在以下情况下使用\input ward
更新:如果您想在段落之间添加空行,请使用\blank
:
\showframe
\showgrid
\setuplayout
[grid=normal]
\definemakeup
[titlepage]
[headerstate=none,
footerstate=none]
\setuplayout
[titlepage]
[grid=high,
backspace=30mm]
\starttext
\startmakeup[titlepage]
\input ward\blank
\input ward
\stopmakeup
\input ward\blank
\input ward
\stoptext