# How to right-align any line or word in a paragraph in any documentclass?

I have done some search for margin alignment in Latex but cannot find how can I right-align any single line?

For example, in a letter sometimes we put a Sincerely on the right. But without using specific documentclass, how can I align any single line in a paragraph to the right in any documentclass?

Many thanks for the help!

• Have you tested with \rightline{text}? – skpblack Aug 11 '14 at 4:06
• Have you looked into using \raggedleft? – Mico Aug 11 '14 at 4:35

Like this?

\documentclass{article}
\usepackage{kantlipsum}
\begin{document}
\kant[1]

\hspace*{\fill} Yours sincerely

This is some more text

\null\hfill Yours sincerely

Again some dummy text

\hspace*{0pt}\hfill Yours sincerely

And again Phew

\mbox{}\hfill Yours sincerely
\end{document}


• The way you write your answer might induce the idea that \par is necessary. I'd simply propose the <blank line> \hspace*{\fill} <text> solution. – egreg Aug 11 '14 at 9:13
• @egreg Oh! Sorry. I wanted it to be a new line and I preferred \par over \\ I changed it. Thanks. – user11232 Aug 11 '14 at 9:15

For a short line (With lenght less than \linewidth) you can use \rightline{word or phrase}.

If you want to align a paragraph at right put it in a flushright environment. This way allows line breaks with \\.

\begin{flushright}
Text\\
aligned to\\
the right.
\end{flushright}


This will work if the right-aligned content is considered a separate paragraph (i.e., it will have \parskip separation). Note that it will have less vertical separation than a flushright environment.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum[4]
{\raggedleft Sincerely,\par}
\lipsum[4]
\end{document}