I am trying to define a dialog environment while using the lettrine package. My problem are the spaces between the dialogs. There is no problem when a dialog consists of more than two lines. But paragraphs with one line are problematic since the number of lines given in lettrine is two.

Is it possible to count the lines in a paragraph and determine the space between the paragraphs with respect to the number of lines?





  Just one line.



1 Answer 1


Try to insert e.g. this

{\par\ifnum\prevgraf<2 \leavevmode\null\par\fi}

instead of just {\par} in the definition of the "ending" of the dialog environment.

Edit: I corrected your ME to make it a MWE;).

Edit 2: note that this simple solution will break if the dialog environment contains more than one paragraph and the last one has less than two lines. To work in such a case, one would probably need to redefine \par, which is definitely not something for the faint-of-heart.

  • 1
    Probably \ifnum\prevgraf<2 would be better.
    – egreg
    Feb 26, 2012 at 20:04
  • Change to \usepackage[demo]{graphicx}, then you can compile without the image. Feb 26, 2012 at 20:04
  • @PeterGrill: the fake image might be too big then.
    – mbork
    Feb 26, 2012 at 20:04
  • @egreg: theoretically yes, practically it won't matter too much;). But I corrected this anyway.
    – mbork
    Feb 26, 2012 at 20:05
  • It worked! mbork, thank you very much for quick response. Feb 26, 2012 at 20:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .