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'm new to LaTeX, and have been struggling with what I think should be simple.

I want to create a box with a blue border and yellow interior. Inside of the box should be a graphic on the left, and text on the right. Seems simple, and I have gotten it to work, but this will be generated from a database, so text length is variable. It currently works if after the text I add vspace to fill out the box to the height of the graphic. Otherwise, the box is only the height of the text, and the image spill out the bottom.

The code I am using is:


{\bf Test:}\ My test line\newline
\phantom{0}\ this is a tesrt\newline
\phantom{0}\ this is a tesrt\newline
\phantom{0}\ this is a tesrt\newline
\phantom{0}\ this is a tesrt\newline
\phantom{0}\ this is a tesrt\newline

If I enable the \vskip, the box is the right size, otherwise it is too short. Since it comes from a database with variable length text, I can't hard code a value.

What am I doing wrong?!?!?

share|improve this question
Welcome to tex.sx! 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 23 '11 at 7:51
@all high rep users: This question has already been edited by TH, lockstep and myself. If other users edit it, too, it would become CW, as described on meta.SO. (I'm not sure if it needs one or two additional editors; at the link it says that "at least five" different editors make a question CW, but it doesn't say if this is including or excluding the OP.) – Hendrik Vogt Jan 23 '11 at 9:15
@Hendrik: I just wanted to edit the question title (to be something better than "XXX question") ... if you think the question should not become community wiki, please do this instead of me. (My proposal: How can I avoid my graphics overflowing the box?). – Paŭlo Ebermann Aug 14 '11 at 11:58
@Paŭlo: Don't worry, title edits don't count towards CW. Just make sure you don't touch the body. – Hendrik Vogt Aug 14 '11 at 13:00


{\bf Test:}~My test line\newline
\phantom{0}~this is a tesrt\newline
\phantom{0}~this is a tesrt\newline
\phantom{0}~this is a tesrt\newline
\phantom{0}~this is a tesrt\newline
\phantom{0}~this is a tesrt\newline

alt text

share|improve this answer
Works perfectly! Thanks, I've been fighting that one for awhile. – Ryan Jan 23 '11 at 19:52
So why not approve the answer (Press the green hook) – xeroc Jan 26 '11 at 11:06

Your Answer


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