[Tex/LaTex] Flush a left-flushed box right

boxeshorizontal alignmentletterhead

I would like to put an address in my document as follows:

|                             |
|                     Name    |
|                     Street #|
|                     City    |
|                     ZIP     |
|                             |

where the | mark the left and right page borders. I would like the items of the address (Name, Street etc.) to be left-flushed, but the box right-flushed so that the longest item touches the right page border.

Is there a simple way to accomplish this?

Best Answer

Use a tabular for the left alignment and use \hfill to flush it to the right.

\documentclass{article} 
\begin{document}

Before

\null\hfill\begin{tabular}{l@{}}
     Name \\
     Street \# \\
     City \\
     ZIP \\
 \end{tabular}

\noindent\hrule% Show width of line
After

\end{document}