我正在尝试破解以下命令
%\hsize=380 true pt
\line{%
1
\hfil\vtop{\hsize 365 truept{%
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}
}}
通过其当前页面。我编写了上述命令是为了获得一个练习环境,其中我将练习编号放在左侧(在本例中为编号 1),然后将其文本放在右侧。但是,当我在页面底部时,TeX 不会破坏环境并将所有文本插入到下一页。有没有办法获得我想要的结果,而不是使用\item
或类似的命令?
答案1
不要使用盒子。
\long\def\exercise#1 #2\endexercise{%
\begingroup\par\bigskip
\leftskip=15pt
\noindent\llap{\hbox to15pt{#1\hfil}}#2\par\bigskip
\endgroup}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
\exercise 1
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.
\endexercise
\bye
答案2
此方法已得到验证。只需确保\hbox
和使用相同的宽度即可\hangindent
。
(“辅助”宏用于提供虚拟文本。)
\def\fillertext{here is the text of the exercise. }
\long\def\myexercise#1#2{%
\noindent\hangindent3em
\hbox to3em{\hfil #1\quad}\unskip#2\ignorespaces
\par
}
\noindent
start with some unindented text.
\myexercise 1 {\fillertext\fillertext\fillertext
\fillertext\fillertext\fillertext\fillertext}
\vskip 8in
\myexercise 2 {\fillertext\fillertext\fillertext
\fillertext\fillertext\fillertext\fillertext}
\myexercise 3 {\fillertext\fillertext\fillertext
\fillertext\fillertext\fillertext\fillertext}
\noindent
and here is some more ordinary unindented text.
\bye