1

I'm having the following problem with lettrines and paragraph with a single line :

\lettrine[lines=2, loversize=0.15, findent=1em, nindent=0em ]{1}{}%
First step.
\lettrine[lines=2, loversize=0.15, findent=1em, nindent=0em ]{2}{}%
Secod step. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin quis lectus sodales velit tempor interdum adipiscing eu tellus. Maecenas ornare enim eget euismod suscipit. Nam luctus aliquam consequat. Donec placerat molestie ullamcorper. Quisque aliquet vehicula feugiat. Phasellus mollis bibendum justo a pulvinar. Fusce at vehicula nulla.
\lettrine[lines=2, loversize=0.15, findent=1em, nindent=0em ]{3}{}%
Third step.

this code gives me

test

I would like to have the same space between the numbers 1 and 2 than between the last line of paragraph 2 and the number 3.

I think a way to do it is to count the number of lines af the paragraph and add a linebreak if there is only one line. But I don't know how to do it....*

I've seen a other topic which had a solution for a similar problem using a environnement, but I would prefere not to have to use an environnement if possible.

  • Try "First step.\\" since your illuminated cap seems to be exactly two lines high. (Sorry \\ doesn't work well in quoted code) – Steven B. Segletes Jan 29 '14 at 16:56
  • You can add \par\mbox{} right after "First step." – Gonzalo Medina Jan 30 '14 at 2:22
  • Steven B. Segletes: it works. But is there a way not to have to do it manually ? I have a several pages long file, and I'd like to have an automatic double skip after short paragraph. – Tonial Jan 30 '14 at 7:41
  • I don't know for sure, and maybe a clever person has an answer but it looks to me that the way lettrine knows where to put the 2nd line of a paragraph is by forgetting (pretending not to know) about the presence of the illuminated cap. Thus, when a paragraph ends on line 1, it no longer remembers that it needs to do a double skip, to account for the cap. – Steven B. Segletes Jan 30 '14 at 11:10
2

A starting point: \prefgraf stores the number of lines in the last typeset paragraph.

\documentclass{article}
\usepackage{lettrine}
\usepackage{lmodern} % for scalable fonts
\usepackage{xpatch}

\pretocmd{\lettrine}{\checklettrine}{}{}
\newcommand{\checklettrine}{%
  \ifnum\prevgraf<2 \vspace{\baselineskip}\fi
}

\begin{document}

\lettrine[lines=2, loversize=0.15, findent=1em, nindent=0em ]{1}{}%
First step.

\lettrine[lines=2, loversize=0.15, findent=1em, nindent=0em ]{2}{}%
Second step. Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Proin quis lectus sodales velit tempor interdum adipiscing eu tellus. 
Maecenas ornare enim eget euismod suscipit. Nam luctus aliquam consequat. 
Donec placerat molestie ullamcorper. Quisque aliquet vehicula feugiat. 
Phasellus mollis bibendum justo a pulvinar. Fusce at vehicula nulla.

\lettrine[lines=2, loversize=0.15, findent=1em, nindent=0em ]{3}{}%
Third step.

\end{document}

enter image description here

Without knowing more about your document it's difficult to guess what situations you're using \lettrine in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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