# Opposing alignment of multiple lines of long text without exceeding \linewidth

I'm trying to create some documents using the flashcards macros, and I'd like to have the text aligned like follows

    ____________________________________
|                                    |
| A string      An Xtra long string  |
| B string                 C string  |
| An Xtra long string 2    D string  |
|                                    |
------------------------------------


I tried using the tabular* environment, which seems quite suitable, used as follows:

\begin{tabular*}
A string               & An Xtra long string \\
B string               & C string \\
An Xtra long string 2  & D string
\end{tabular*}


Unfortunately the result overflows horizontally, something like this:

    ____________________________________
|                                    |
| A string               An Xtra long string
| B string                          C string
| An Xtra long string 2             D string
|                                    |
------------------------------------


So I've tried using makebox, like this:

\makebox[.48\linewidth][l]{A string}
\makebox[.48\linewidth][r]{An Xtra long string} \\
\makebox[.48\linewidth][l]{B string}
\makebox[.48\linewidth][r]{C string} \\
\makebox[.48\linewidth][l]{An Xtra long string 2}
\makebox[.48\linewidth][r]{D string}


But this results in too much vertical padding, something like this:

     ____________________________________
|                                    |
| A string      An Xtra long string  |
|                                    |
| B string                 C string  |
|                                    |
| An Xtra long string 2    D string  |
------------------------------------


Which is also not the desired result.

I think (hope) I've clearly demonstrated the outcome I desire. So far I've been mucking about, but I suspect there's a relatively easy way to accomplish this.

I would be grateful for any feedback or suggestions that you think may be of assistance.

-
Note that you don't have to (and shouldn't) sign with your name since it automatically appears in the lower right corner of your post. – Hendrik Vogt Jan 20 '11 at 7:17

## 2 Answers

Here's one option... use \hfill.

\documentclass{article}
\begin{document}
\noindent
\parbox{2in}{%
A string \hfill An Xtra long string \\
B string \hfill C string \\
An Xtra long string 2 \hfill  D string
}
\end{document}


(You don't really need the parbox; it's just that the point is easiest to see with a narrower width.)

I have another option which I'll post separately so it can be voted on separately or accepted/unaccepted separately.

-
This works, but I have to add \vspace*{-0.9ex} to the end of all the lines. Thanks! – Brian M. Hunt Jan 20 '11 at 0:20
Another great option in the memoir class is \leftspringright{⟨lfrac⟩}{⟨rfrac⟩}{⟨ltext⟩}{⟨rtext⟩}, though it requires some tinkering to make it work. :) – Brian M. Hunt Jan 21 '11 at 2:27

Another option is to use a tabbing environment:

\documentclass{article}
\begin{document}
\parbox{2in}{%
\begin{tabbing}
A string \ An Xtra long string \\
B string \ C string \\
An Xtra long string 2 \ D string
\end{tabbing}
}
\end{document}
`

I was going to post another screenshot, but I can't tell the difference between this output and the one I posted earlier, so...

-