6

In the minimal example below, I want to create an empty space to the right of the paragraph using \parshape. However, the first line is indented and spills over into the empty space. I don't want that. How do I get all the lines to end at the same place to create a neat, empty square?

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\parshape=5
0pt 0.5\textwidth
0pt 0.5\textwidth
0pt 0.5\textwidth
0pt 0.5\textwidth
0pt \textwidth
\lipsum[1]
\end{document}

enter image description here

10

The \parshape primitive sets the space a paragraph fits into: the fact your first line as a parindent is neither here nor there, and the fact the line doesn't break nicely is down to the filler text being in the wrong language to hyphenate correctly. You can see this if you use the Latin hyphenation patterns (lipsum is 'cod Latin'):

\documentclass{article}
\usepackage{lipsum}
\usepackage[latin]{babel}

\begin{document}
\parshape=5
0pt 0.5\textwidth
0pt 0.5\textwidth
0pt 0.5\textwidth
0pt 0.5\textwidth
0pt \textwidth
\noindent\lipsum[1]
\end{document}

enter image description here

  • Hm, I suspected something like that. Is there some way of knowing whether the current paragraph will be/is indented? If so, I could modify the first line in \parshape accordingly. – gablin Aug 31 '13 at 16:58
  • @gablin The two things are separate: the \parshape is the 'box' you pour text into, the indent is part of the 'filling'. You can set up some code to remove the indent if you want: perhaps we might have a bit more context? (I don't see why \noindent is no good in the example as written.) – Joseph Wright Aug 31 '13 at 17:01
  • Aaaargh! I get it now! You're telling me the reason the first line overflows into the empty space no the right is not due to the initial indentation, but due to the filler not being able to break the last word properly. If so then there's no problem at all - \parshape works as expected! Thank you! =D – gablin Aug 31 '13 at 17:07
  • I also had to verify that this was the case by adding the babel package as you recommended, and now the empty square looks nice and... square. =) – gablin Aug 31 '13 at 17:08

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.