可能重复:
创建一个不可见的 vbox
我想\vbox
在段落之间插入一个,但我不想它影响行间间距。我使用的是 Plain TeX。这是我的 MWE:
\input plain
asdljflasd dasjfdlf lasdfdflaslfjlsadf sajf lsdfas Lorem ipsum dolor
sit amet, consectetur adipiscing elit. Quisque sollicitudin pretium\par
\nointerlineskip\vbox to 0pt{\hbox to 0pt{\hskip -10pt *}\kern0pt}\nointerlineskip
In hac habitasse platea dictumst. Etiam rutrum blandit velit sed
rutrum. Curabitur rhoncus erat a turpis suscipit vitae rutrum turpis
\bye
下面显示了两个段落之间的间距不正确(出现星号的地方):
注释掉以 开头的行\nointerlineskip
可以使两个段落之间的间距正确:
我如何获得\vbox
正确的行间距?抱歉图片太大。
答案1
要想让所有东西都放在正确的位置,就必须付出更多的努力:
asdljflasd dasjfdlf lasdfdflaslfjlsadf sajf lsdfas Lorem ipsum dolor
sit amet, consectetur adipiscing elit. Quisque sollicitudin pretium
\edef\tpd{\the\prevdepth}\nointerlineskip
\vbox to 0pt{\hrule height 0pt\prevdepth=\tpd\llap{\strut*\kern10pt}\vss}%
\prevdepth=\tpd
In hac habitasse platea dictumst. Etiam rutrum blandit velit sed
rutrum. Curabitur rhoncus erat a turpis suscipit vitae rutrum turpis
然而,在边缘处放置星号要比这容易得多:
\def\marginasterisk{\leavevmode\llap{*\kern\parindent\kern10pt}}
asdljflasd dasjfdlf lasdfdflaslfjlsadf sajf lsdfas Lorem ipsum dolor
sit amet, consectetur adipiscing elit. Quisque sollicitudin pretium
\marginasterisk In hac habitasse platea dictumst. Etiam rutrum blandit velit sed
rutrum. Curabitur rhoncus erat a turpis suscipit vitae rutrum turpis
答案2
替代方案可以是使用\vtop
代替\vbox
并省略\nointerlineskip
之前的内容:
asdljflasd dasjfdlf lasdfdflaslfjlsadf sajf lsdfas Lorem ipsum dolor
sit amet, consectetur adipiscing elit. Quisque sollicitudin pretium\par
\vtop to 0pt{\hbox to 0pt{\hskip -10pt *}\kern 0pt}%
\nointerlineskip
In hac habitasse platea dictumst. Etiam rutrum blandit velit sed
rutrum. Curabitur rhoncus erat a turpis suscipit vitae rutrum turpis
\bye