# Right Aligned Text With Normal Hyphenation Rules

I am using a right aligned minipage with right aligned content. What I want is its content to look like the normal aligned one in the first minipage. The only difference being the last word I have underlined to be right aligned like it is in the second minipage. What I ask is depicted in the image.

MWE

\documentclass{book}

\usepackage{lipsum}

\begin{document}

\begin{flushright}

\begin{minipage}{0.65\textwidth}

\lipsum[1]

\end{minipage}

\end{flushright}

\vspace{1cm}

\begin{flushright}

\begin{minipage}{0.65\textwidth}

\begin{flushright}

\lipsum[1]

\end{flushright}

\end{minipage}

\end{flushright}

\end{document}

• see, if the RaggedLeft from package ragged2e is what you looking for: {\RaggedLeft <your text>}. Oct 11 '16 at 14:23
• @Zarko I tried it, and although it is better the hyphenation is not perfect.
Oct 11 '16 at 14:23
• what is the perfect hyphenation? Oct 11 '16 at 14:26
• @Zarko When you right normal text like in the first minipage I show in the image. Basically what I want is to be like that but the sentence of the last line to start from the right.
Oct 11 '16 at 14:28
• then you actually ask: how to make last line in text rigged left :-) similar question you can find here (on TeX.SE). Oct 11 '16 at 14:32

Typeset the text in a box, remove the last line and reinsert it after having removed the glue at its end, preceded by \hfill. The following lastflushright environment behaves like a minipage with bottom alignment. It's not difficult to get also top or center alignment.

\documentclass{book}

\usepackage{lipsum}

\makeatletter
\newenvironment{lastflushright}[1]
{\leavevmode\vbox\bgroup\@tempdima=#1\relax
\setbox\@tempboxa\vbox\bgroup\color@begingroup
\hsize\@tempdima\textwidth\hsize\columnwidth\hsize
\@parboxrestore
\@minipagerestore\@setminipage}
{\@minipagefalse\color@endgroup\egroup
\setbox\@tempboxa=\vbox{\unvbox\@tempboxa\global\setbox1=\lastbox}
\box\@tempboxa
\setbox\@tempboxa=\hbox{\unhbox1\unskip\unskip}
\nointerlineskip
\hbox to\@tempdima{\hfill\box\@tempboxa}%
\egroup
}
\makeatother

\begin{document}

\begin{lastflushright}{0.45\textwidth}
\lipsum[3]
\end{lastflushright}
\begin{minipage}[b]{0.45\textwidth}
\lipsum[3]
\end{minipage}
\end{document}


• Wow I thought that it would be something simple. Thank you very much though.