In preparing a solutions manual for a textbook, I quite often wanted to place some text and an associated figure side-by-side as part of the solution. What I ended up doing was either using multicolumn mode or else (more often) a two-column table. The problem with the latter solution is that it required tuning to get the widths of the columns correct so that the entire thing looked right. What I'd like is a more automatic way to accomplish this. Specifically, I want two columns, with text in one and a figure in the other; I'd like the column containing the figure to be sized so that the figure just fits in the column, and the column containing the text to be left- and right-justified.

There was a somewhat related conversation in comp.text.tex recently ("spring margin", Jun 8) in which someone suggested the memoir class with \leftspringright, but at a quick read that didn't seem to actually do what I'd like.

Any suggestions?

Here is an example. The following tex:

The point on the unit circle associated with $-13\pi/3$ is  
$(1/2,-\sqrt{3}/2)$, so  
  \cot (-13\pi/3) = -1/\sqrt{3}=-\sqrt{3}/3.  

generates the following pdf snippet: alt text The document has several hundred such images, and different spacing is required in general depending on the size of the image so as not to exceed the right margin.

My preamble looks like this:


so I'm not using anything particularly unusual.

  • You should comment on why some of the answers provided do not do what you want so that they might be improved.
    – TH.
    Sep 12, 2010 at 12:00
  • Don't ask me how I ended up on this one :), but since you did not accept any of the answers, may I suggest you to use TikZ for this purpose? See the introduction parts of Sec.2,3,4. By the way, you can still use your external figures too.
    – percusse
    Dec 3, 2011 at 1:59

6 Answers 6


I suspect that tabularx (also available within memoir) might be able to handle this.

Something like this might be the basis for a solution:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Maecenas in felis sapien. 
& \fbox{\parbox[t]{2cm}{Simulated Figure}}

Phasellus consectetur, sapien nec mollis euismod, 
sapien sapien posuere justo, nec elementum sapien nisl vitae metus. 
Ut nisl lacus, tincidunt eget fringilla eget, eleifend sit amet ipsum. 
& \fbox{\parbox[t]{4cm}{Simulated Figure}}

The segment \fbox{\parbox[t]{4cm}{Simulated Figure}} stands in place of your figures.

There may be problems with this, depending on the exact nature of your figure. If you'd like to post an example, we may be able to help you better.

  • I posted some example text and output as an edit to the original question.
    – rogerl
    Sep 9, 2010 at 13:50

Here's a new/fresh answer after @rogerl's clarification.

It is possible to measure the figure, and adapt the table dimensions accordingly.

Here's a (slightly elephantine} proof of concept:

\addtolength{\myotherside}{-5mm} % column separator
The point on the unit circle associated with $-13\pi/3$ is  
$(1/2,-\sqrt{3}/2)$, so  
  \cot (-13\pi/3) = -1/\sqrt{3}=-\sqrt{3}/3.  

Just edited the solution to give slightly better centering (I think...)


It is semantically better to flow the text and figures as normal writing (as suggested by TH) rather than placing it in a tabular environment; you can use the wrapfig environment. This makes it also possible to flow the figures both left or right, which will improve the overall look of the page.

Here is a solution:


\quad  % dummy to let wrapfig start before 
           % actual paragraph

\index{Area of parallelogram, to find}%
\index{Parallelogram, to find area of}%
---To find the area of a parallelogram,
multiply its
length, or \textit{base} as it is
called, by its height, or
\textit{altitude} as it is called, or
expressed in the simple
form of an algebraic
A = b \times  h


\index{Area of triangle, to find}%
\index{Triangle, to find area of}%
---To find the area of a triangle when
the base and altitude are given,
multiply its base by its altitude
and divide by $2$, or

You might need to experiment a little at first, but if your text and figures are more or less the same width and amount of text, the work involved is not that much.

The above code gives me this: alt text

  • I fully agree that this is semantically cleaner, but OP said "hundreds of figures"; I don't know whether he's prepared to do the individual number-of-lines tuning for each one... Sep 11, 2010 at 7:44
  • @Brent there are no real short-cuts here, one could wrap some of the commands in macros to lessen the amount of work. At the end one should also produce the figures with TikZ which would take quite a bit of time also.
    – yannisl
    Sep 11, 2010 at 8:18
  • I admit I'm more than a little surprised that there is no short-cut available. I can't believe I'm the first person (or even the hundredth) to have this problem.
    – rogerl
    Sep 11, 2010 at 12:42
  • yes, I agree there are no (or at least very few) shortcuts. But I think that it would be possible to do a semantically clean wrapper based on "my" method (ie sizing the box first). I don't have spare time to do that now, but I'll think about it a bit more and hope to repost something in a few days. Clearly there will be cases where the text and the figure have unfavourable relative sizes, but I think my approach works in a generic way and avoids hand-tuning except in the most recalcitrant cases. Sep 11, 2010 at 18:49

And, finally, here's another possible answer, though I accept this may not be exactly what you want: scale all the figures to the same width, using, for example,


If the figure sizes are within reasonable limits, I think this may be aesthetically more appealing, but I accept that your mileage may vary considerably from mine...

  • That would be wonderful, but sadly I cannot do that because I don't have control over the figure sizes and the publisher does have requirements on the final apparent size of the figures.
    – rogerl
    Sep 11, 2010 at 12:43

How about using wrapfig to place your graphics on the right and then have your text flow around it? Something like


Then you use it like this.

\wfig[scale=2]{image-name}{Caption here}

The optional argument is the same as the optional argument to \includegraphics.


OK, as vaguely promised, here's my final (!?) suggestion.

The ncctools bundle includes, within the nccfloats package, the \sidefig command. Here's a complete example based on \sidefig:

    \sbox{\sbsfigbox}{#1}                              % Get figure into a box
    \settowidth{\sbsfigwid}{\usebox{\sbsfigbox}}       % Measure the box
    \sidefig[c](\sbsfigwid){\usebox{\sbsfigbox}}{#2}   % Build everything
The point on the unit circle associated with $-13\pi/3$ is  
$(1/2,-\sqrt{3}/2)$, so  
  \cot (-13\pi/3) = -1/\sqrt{3}=-\sqrt{3}/3.\]
  • Rather than answering 4 times, you can edit an old answer.
    – TH.
    Sep 12, 2010 at 12:02
  • I've just spotted that \sidefloat places the figure on the outside, or `\sidefloat* places it on the inside, rather than left or right. Is this OK? Sep 12, 2010 at 12:15
  • @TH: Yes. I decided consciously to make separate answers, to reduce the clutter in any single answer. This is in part a consequence of progressive discovery of the OP's requirements and my understanding of them. Sep 12, 2010 at 12:27

You must log in to answer this question.

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