Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Make an invisible vbox

I want to insert a \vbox between paragraphs, but I do not want it to affect interline spacing. I'm using Plain TeX. Here is my 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

The below shows bad spacing between the two paragraphs (where the asterisk appears):

Bad Spacing

Commenting out the line beginning with \nointerlineskip gives correct spacing between the two paragraphs:

Good spacing

How do I get my \vbox and correct interline spacing? Apologies for the huge images.

share|improve this question

marked as duplicate by lockstep, Werner, Marco Daniel, Yiannis Lazarides, Martin Scharrer Dec 7 '11 at 9:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Found my answer: tex.stackexchange.com/questions/22355/make-an-invisible-vbox. Thanks related sidebar! –  Justin Bailey Dec 6 '11 at 18:00
    
Please use a minimal page size in future images. –  Martin Schröder Dec 6 '11 at 22:15

2 Answers 2

up vote 1 down vote accepted

One has to work a bit harder to get everything in the correct place:

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

However, putting an asterisk in the margin is much easier than that:

\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
share|improve this answer
    
Why is all the necessary in the \vbox? Especially the \hrule and \vss? –  Justin Bailey Dec 6 '11 at 23:14
    
@JustinBailey The \hrule puts the reference point exactly at the uppermost level of the \vbox that will thus have zero height. The \vss is to avoid an underfull vbox. With \prevdepth=\tpd I ensure that the correct interline glue is inserted before the box with the asterisk and also between paragraphs. –  egreg Dec 6 '11 at 23:19

Alterative may be to use \vtop instead of \vbox and omit \nointerlineskip before:

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
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.