I'm typesetting some material in two columns, the left one left-adjusted and the right one right-adjusted (it's a list of songs in a concert, with song names on the left and composer names on the right). My approach so far has been to use \begin{tabular}{L{4.2cm}R{3.2cm}}
where the column definitions are as follows:
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
However, with this approach my table becomes a little too wide. Some rows have more content on the left side (long song names) and some rows have more content on the right side (long composer names), but none of them have both - so if I could find a way to adjust the column widths automatically based on the content, that would solve my problem.
I don't know if this is even possible with a tabular approach - and I have no problem with switching to some other approach if it helps. The ultimate goal is to be able to have rows in a list with part of the row left-aligned, and the rest of the row right-aligned:
|<- left edge of text right edge of text->|
|The first song by Some Guy|
| who lived then|
| |
|Some other song by Someone Else|
|and another one by the same guy who also lived|
| |
|A fourth song by a guy with a Really Long Name|
| aw, he's dead, Jim|
Note how the "other song by the same guy" and "fourth song" rows overlap, i.e. the right column of the latter starts before the end of the left column of the former. So instead of rigidly defining the column widths, I'd like to define the width of the entire table (between the pipes above) and have the rest done for me automagically.
What's the best approach to achieve this in (Xe)LaTeX?
\multicolum
et al, but I would like an approach which lets me generate the content from somewhere else (just separating the columns with&
, or whatever is appropriate) and then have the widths decided for me based on content on each row.\hfill
between its two parameters.tabulary
columns are adjusted according to how much content is in each column.tabulary
, I still don't find any way to do this withoutmulticolum
s. Am I missing something?tabular
environment (of any kind) is by no means a requirement - it just happens to be the approach I thought would work... :P