3

So, this is a case of "It's LaTeX, surely there's a better way of doing this."

I've tried using tabular*, tabularx, and a few other things, but I don't quite get what I'm doing wrong with any of them. My current (working) code looks like

\usepackage{array}
...
\newcolumntype{R}{>{\flushright\arraybackslash}m{.75\columnwidth}}
\newcolumntype{L}{>{\flushleft\arraybackslash}m{.25\columnwidth}}
\begin{tabular*}{\columnwidth}{R|L}
    lots of cool text that is long and needs wrapping
  &
    a very small fixed-width object,
    in my case a graphic made with the igo package
\end{tabular*}

My trouble is with my column definitions. I had to choose the columnwidths by hand. I just want the whole tabular to span the current columnwidth, with one column as shrunk as possible (the second) and the other as wide as possible. This made me think of using tabular*, but the examples I found with \fill did not work with line wrapping.

Is there a better way of doing this?

1 Answer 1

6

I think you want tabularx package and

\begin{tabularx}{\textwidth}{>{\raggedleft}X|l}
  lots of text & \includegraphics{...}
\end{tabularx}

Or as pointed out in the comments, you were using vertical centred column so

\renewcommand{\tabularxcolumn}[1]{>{\raggedleft}m{#1}}

\begin{tabularx}{\textwidth}{X|l}
  lots of text & \includegraphics{...}
\end{tabularx}
3
  • 2
    Or if you want the X column to be like an m column, add \renewcommand{\tabularxcolumn}[1]{>{\raggedleft}m{#1}}
    – Alan Munn
    Apr 8, 2012 at 20:57
  • This is definitely fixing bits of what I was doing wrong with tabularx! Thanks! I'm still working out some silly behaviors, but I think it's stuff I can figure out with how graphics work. Apr 8, 2012 at 21:27
  • Awesome! I managed to find another thread solving the graphics issues with \vcenter, and now it all works very prettily! Apr 8, 2012 at 21:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .