[Tex/LaTex] How to float right but align left

horizontal alignment

I'm typesetting a formal letter within a much larger document (hundreds of pages). I'd like to produce something along the lines of what you get with the letter document class, but without actually that class. (I'm heavily invested in memoir already.)

The main thing I'm struggling with is the address. The requirement is that the address box float all the way right, but be left-aligned within the box.

The best I've achieved is this hack:

\hspace*{0.6\linewidth}
\begin{minipage}{0.4\linewidth}
Joe Bloggs\\
123 ABC Street\\
Townville, Regionia\\
Countrystan\\
Friday, May 29, 2015
\end{minipage}

but the results are unsatisfactory.

How do I float this address right but have it aligned flush left?

Best Answer

Put the address inside a tabular and use \hfill to shove it over to the right:

enter image description here

\documentclass{memoir}
\usepackage{showframe}% Just for this example
\begin{document}

\hfill
\begin{tabular}{l@{}}
  Joe Bloggs \\
  123 ABC Street \\
  Townville, Regionia \\
  Countrystan \\
  Friday, May 29, 2015
\end{tabular}

\end{document}

The column gap was removed on the right of the left-aligned column using @{}. There's no need to remove it on the left as the content is filled from the left margin anyway.