5

I need to combine lettrines, explicit linebreaks and hanging indents for whatever chunk of text ends up being longer than one typeset line.

For the sake of semiautomatic text-production I'd very much prefer just to have to deal with one (custom) linebreaking command (\lb in the example).

When using \newline the lettrines are displayed correctly (not overwritten by the following line), but everything apart from the first line of the whole text will be set hanging.

With \par the hanging indent is correct but not for the lines affected by the lettrine:

\documentclass[11pt,a5paper]{article}

\usepackage[showframe]{geometry}


\usepackage{lettrine}

%\newcommand{\lb}{\newline}
\newcommand{\lb}{\par}

\setlength{\leftskip}{5cm}
\setlength{\parindent}{-5cm}



\begin{document}

A pretty short line of regular text\lb
A pretty short line of regular text\lb
A pretty short line of regular text\lb
\lettrine{A}{} short line with lettrine\lb
A pretty short line with lettrine\lb
A pretty short line with lettrine\lb
A pretty short line of regular text\lb
A pretty short line of regular text but way too long to be on one line, so we need to break it\lb
A pretty short line of regular text\lb

\end{document}

I am searching for a way to have lettrines and normal text all to align to the left and long lines to be indented negatively as shown here:

Desired result

5
+75

mwe

Not sure of what are you trying to do exactly, but for lines without drop capitals is enough \everypar{\hangindent5cm} and of course each line must be a paragraph.

In case that you do not want the hang indent after some lines, add also \handafter.

Nothing of this will not work for lettrines paragraphs, as they have already fixed parameters, but via \lettrine options you can simulate a \hangindent and adjust the lettrine position and size in several ways. I played with some of these options in the MWE to show some of the possibilities.

It seems that you want also several lines attached to the same lettrine . Then hen they must be in the same paragraph and use \newline.This will not allow a a hang indentation of each possible long line, only simulate it for the whole paragraph.

For simplicity the MWE bellow show \par instead of blank lines and macros only for the dummy text:

\documentclass[11pt,a5paper]{article}
\usepackage{geometry}
\usepackage{lettrine,lipsum,xcolor}
\setlength{\parindent}{0pt}
% dummy text definitions
\def\kantreason{our knowledge  begins with the senses, 
proceeds then to the understanding, and ends with reason. 
There is nothing higher than reason.}
\def\shortext{A pretty short line of regular text.}
\def\droptext{Another short line with lettrine.}
\begin{document}
{\par\setlength{\parskip}{1ex}
\everypar{\hangindent5cm}
\shortext
\lettrine[lines=5,findent=-20pt,slope=.5em]{A}{ll} 
\kantreason 
\newline  \droptext \newline \droptext
\par\shortext
\par All \kantreason
\par\shortext
\par All \kantreason
\lettrine[loversize=-.1,lraise=.5,lines=3,lhang=0, 
findent=-5pt,nindent=2cm]{A}{ll} \kantreason
\par\shortext
\par\hangafter3\shortext\shortext\shortext\shortext
\shortext\shortext\shortext\shortext\shortext 
\par} % group must end with \par!!!
\end{document}
  • Thanks a lot! It is a bit difficult to explain the exact purpose as my problem is part of a way more complicated setup, but if the MWE works I'll probably be able to get my project working. ;) The crux with your solution is that I could go through all (pretty frequent) lettrines im my text and manually replace the \pars with \newlines to make them display correctly but I'd much rather just use one kind of linebreak-command (\lb in my example) mainly because I will be generating the main text semiautomatically. – Florian Dec 6 '18 at 12:48
  • I've edited the question to hopefully make things clearer. – Florian Dec 6 '18 at 13:09
  • 2
    @Florian Clearer, but this is what a Spaniard would call "swim and keep an eye on the clothes" an unreliable task: Break lines (but not the paragraph) and end a paragraphs look like sometimes like the same thing, but are very different actions. You cannot have both at the same time, at least with a simple macro. And add lettrines mean use specials paragraphs, making much more complex the problem. You cluld use conditionals, but how many conditions you should consider in the macro to cover all possible use cases automatically? Sometimes is just simpler set the format yourself. – Fran Dec 6 '18 at 15:58
4

Instead of using lettrine, you can adjust the \parshape to wrap around the letter. This way a \newline would work without problem.

enter image description here

\documentclass{article}

\usepackage{lettrine,graphicx}

\newcommand{\lb}{\newline}

% https://tex.stackexchange.com/q/127504/5764
\makeatletter
\def\newparshape{\parshape\@npshape0{}}
\def\@npshape#1#2#3{\ifx\\#3\expandafter\@@@npshape\else\expandafter\@@npshape\fi
  {#1}{#2}{#3}}
\def\@@npshape#1#2#3#4#5{%
  \ifnum#3>\z@\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
  {\expandafter\@@npshape\expandafter{\the\numexpr#1+1\relax}{#2 #4 #5}{\numexpr#3-1\relax}{#4}{#5}}%
  {\@npshape{#1}{#2}}}
\def\@@@npshape#1#2#3{#1 #2 }
\makeatother

\begin{document}

\raggedright
A pretty short line of regular text\lb
A pretty short line of regular text\lb
A pretty short line of regular text\lb
\newparshape{4}{0pt}{\linewidth}{1}{2.5em}{\dimexpr\linewidth-2.5em}{1}{0pt}{\linewidth}\\
\raisebox{\dimexpr-\height+.6\baselineskip}[0pt][0pt]{%
  \resizebox{!}{1.6\baselineskip}{A}}pretty short line with lettrine\lb
A pretty short line with lettrine\lb
A pretty short line with lettrine\lb
A pretty short line of regular text\lb
A pretty short line of regular text but way too long to be on one line, so we need to break it\lb
A pretty short line of regular text\lb

\end{document}

In a bigger document, you could define a "\lettrine" for each letter, say:

\newcommand{\LettrineA}{%
  \newparshape{4}{0pt}{\linewidth}{1}{2.5em}{\dimexpr\linewidth-2.5em}{1}{0pt}{\linewidth}\\
  \raisebox{\dimexpr-\height+.6\baselineskip}[0pt][0pt]{%
    \resizebox{!}{1.6\baselineskip}{A}}%
}

\newcommand{\LettrineB}{%
  % ...
}
  • Unfortunately this doesn't seem to produce hanging paragraph indents (second line from the bottom), does it? (Please don't bother to answer if you don't have the time -- I can work with my crude hack below) – Florian Feb 6 at 17:08
  • @Florian: \parshape changes the shape of the current paragraph, so if you want hanging indents on lines not specified as part of the \parshape command, then you'll have to manually insert them (or specify them as part of the \parshape). If you provide an example I can see what can be done to assist. – Werner Feb 6 at 18:06
0

Turns out lettrine.sty can be easily modified to allow hanging paragraphs:

Commenting out the line with \noindent (the only occurence in the file), saving it under some other name and supply \indent at the line breaks will produce precisely the result from the screenshot in the question.

\documentclass[11pt,a5paper]{article}

\usepackage[showframe]{geometry}

\usepackage{lettrineHANGING}

\newcommand{\lb}{\newline\indent}
%\newcommand{\lb}{\par}

\setlength{\leftskip}{5cm}
\setlength{\parindent}{-5cm}

\begin{document}

A pretty short line of regular text\lb
A pretty short line of regular text\lb
A pretty short line of regular text%\lb
\lettrine{A}{} short line with lettrine\lb
A pretty short line with lettrine\lb
A pretty short line with lettrine\lb
A pretty short line of regular text\lb
A pretty short line of regular text but way too long to be on one line, so we need to break it\lb
A pretty short line of regular text\lb

\end{document}

There are probably more elegant solutions, but this one seems robust and works without manual intervention.

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.