Graphics, Figures & TablesGraphic and text in a colored box

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
roadtripryan
Posts: 1
Joined: Fri Jan 21, 2011 5:09 pm

Graphic and text in a colored box

Post by roadtripryan »

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:

\noindent{\fboxsep=.3pt\framebox{\colorbox{newyell}{
\parbox{\textwidth}{
\begin{wrapfigure}{l}{0.4\textwidth}
\vspace{-35pt}
\begin{center}
\includegraphics[width=0.35\textwidth]{img_0236.jpg}
\end{center}
\end{wrapfigure}

\phantom{0}\textcolor{blue}{
{\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
}
}
%\vskip80pt
}}}
}

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?!?!?

Thanks,
Ryan

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply