TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wish to have a table with two rows - first one with a picture, and the second is some text (I know I can probably do it within the figure environment, but I want to do it on my own). I want the text to be split whenever necessary, so I use \begin{tabular}{p{width}}. However, I decided that I want to firstly set the height of the picture, and then let the width of the scaled picture determine the width of the text cell. How can I do it?

share|improve this question
“I want the text to be split whenever necessary…” Could you elaborate: Split to where? – morbusg Feb 3 '12 at 11:04

First set the picture into a box, then you can get the width of the box to use in your p argument using \settowidth (or just the \wd primitive) then use \usebox to put the picture into your table.




a picture here}

some text here some text here

share|improve this answer
Perhaps you should elaborate on how the OP can accomplish this, perhaps an example would make things clearer. – Roelof Spijker Feb 3 '12 at 11:23
yes well if the OP had provided a MWE I'd have probably edited it with an explicit fix, but OK I'll edit my answer in a bit. – David Carlisle Feb 3 '12 at 11:27
Supplementary question on personal preferences: I would have put the \savebox in the preamble (to keep it out of the way). Would you care to comment on that? – Brent.Longborough Feb 3 '12 at 12:10
The savebox contents are logically part of the document flow and so belong after begin{document}. If it's just a graphic it probably works here (but would mean you'd need one box per table, which is expensive) but if it contains text (as in my cut down example) it's only really reliable to do it after begin{document} as that is when all the font setup is finalised. – David Carlisle Feb 3 '12 at 12:32
Thank you. It's always rewarding to learn from a Master... – Brent.Longborough Feb 3 '12 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.