答案1
您可以将\interlinepenalty
和其他一些惩罚设置为较高的负值,并让输出例程绘制基线。以下示例并不完美,并且存在一些错误,但它可以作为一个起点。
基本思想来自于此: http://www.tug.org/TUGboat/tb29-1/tb91pearls.pdf
\def\showbaseline{\hbox to\wd0{\setbox0=\hbox to\wd0{\unhbox0}%
\unhbox0 \llap{\vrule height.5pt depth0pt width\hsize}}}
\let\PAR\par
\def\par{\penalty-50000\PAR}% Horrible! Will not work with LaTeX.
% Force the output routine between lines
\predisplaypenalty=-50000
\postdisplaypenalty=-50000
\interdisplaylinepenalty=-50000
\interlinepenalty=-50000
\maxdeadcycles=500% Alsmost every line adds a dead cycle.
\newtoks\orioutput \orioutput=\output % wrap the original \output routine
\output{%
\ifnum\outputpenalty>-20001 \the\orioutput
\else\ifnum\outputpenalty<-\maxdimen \the\orioutput
\else
\unvbox255 % flush the entire list back
\setbox0=\lastbox % strip the very last box
\nointerlineskip % avoid doubled interline glue
\showbaseline % make the test and return the box back.
\advance\outputpenalty by 50000%
\penalty\outputpenalty % weak lie that nothing happened...
\fi\fi}
\noindent Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero $\displaystyle\int$ eos et accusam et justo duo dolores et ea
rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
sit amet.
$$ \displaylines{\int \cr \oint} $$
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
$\displaystyle\int$ sed diam voluptua.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua.
\bye