[Tex/LaTex] How to right-align whole longtables

horizontal alignmentlongtabletables

Say I have the following document:

\documentclass{article}
\usepackage{longtable}

\begin{document}

\begin{longtable}{|lr|}
  \hline
  A & 1\\
  B & 2\\
  C & 3\\
  \hline
\end{longtable}

\end{document}

I want this whole table to be aligned with the right page margin. I know that if it were a simple table I could use \raggedleft to achieve this, but it does not work with longtable objects (for which I have true need in my real case). How can I align a longtable to the right page margin?

Best Answer

\begin{longtable}[r]{|lr|}

Use the optional argument.

Related Question