How can I force the last line in a paragraph to justify to the right margin?
I am doing some micro-optimisations on my text/figure layout, and I want to insert figures and tables in the middle of paragraphs and have the text flow around them - Just the top and bottom, the figures are the full width of the text.
I would prefer to work with vanilla-LaTeX, and not have to use any external packages.
Text Formatting ⇒ Force last line in paragraph to justify
NEW: TikZ book now 40% off at Amazon.com for a short time.
Force last line in paragraph to justify
Hi,
this can be achieved by adjusting the \leftskip, \rightskip and \parfillskip lengths:
You can find an explanation on those parameters in the book TeX by Topic, by Victor Eijkhout, or in The TeXbook.
Edit: if you are planning to use these settings throughout your document, I would also suggest to use
to avoid the situation illustrated at the end of the second paragraph in my example
this can be achieved by adjusting the \leftskip, \rightskip and \parfillskip lengths:
Code: Select all
\documentclass{book}
\usepackage{lipsum}% just to generate some text
\setlength\leftskip{0pt plus 1fil}
\setlength\rightskip{-\leftskip}
\setlength\parfillskip{\leftskip}
\begin{document}
\lipsum[1-4]
\end{document}
Edit: if you are planning to use these settings throughout your document, I would also suggest to use
Code: Select all
\setlength\parindent{0pt}
1,1,2,3,5,8,13,21,34,55,89,144,233,...