General ⇒ "Aligning" the last line in a paragraph
"Aligning" the last line in a paragraph
By default, text in a paragraph is justified and the last line is "ragged right". Is there a way to make the last line "ragged left"? There is a need for this in some environments when I use right-to-left languages (often mixed with latin text), but for some reason it doesn't align the last line correctly.
NEW: TikZ book now 40% off at Amazon.com for a short time.

"Aligning" the last line in a paragraph
The following example may be helpful:
Code: Select all
\documentclass{article}
\usepackage{lipsum}
% This is the relevant environment
\newenvironment{LastLineToRight}%
{\setlength{\parindent}{0pt}\setlength{\leftskip}{0pt plus 1fil}\setlength{\rightskip}{0pt plus -1fil}}{\par}
% \parskip increased to better see the end of each paragraph
\addtolength{\parskip}{3ex}
\begin{document}
% Two paragraphs with normal text
\lipsum[1-2]
% Paragraphs with the last line right justified.
\begin{LastLineToRight}
\lipsum[1-20]
\end{LastLineToRight}
% Normal text again
\lipsum[1-2]
\end{document}
Re: "Aligning" the last line in a paragraph
Thanks a lot
What should be changed to make the last line centered? Or maybe it requires other technique?

"Aligning" the last line in a paragraph
You need only this other enironment:
Code: Select all
\newenvironment{LastLineCentered}%
{\setlength{\parindent}{0pt}\setlength{\leftskip}{0pt plus 0.5fil}\setlength{\rightskip}{0pt plus -0.5fil}}{\par}
Re: "Aligning" the last line in a paragraph
Of course
Thank you very, very much, Juanjo
