# How can I put a small box of text in a bigger box of text?

How can I put a small box of text inside another larger text box (which is a figure)? (Perhaps similar to adding a boxed legend manually.)

I'm looking for something like this:

_________
|aaa bbb|
|ccc ---|
|ddd |ee|
---------


I have tried "\begin{subfigure}...\end{subfigure}" but I don't know how to position it (really, I have no clue, aside from placement specifiers). Starter code below; ideally the "a b" box should overlap the bottom right corner of the "lots of text" box.

\begin{figure}[t]
\begin{center}
\scalebox{0.8}{
\begin{boxedminipage}[t]{5in}
\begin{tabbing}
lots of text lots of text  \\
lots of text lots of text \\
lots of text lots of text \\
lots of text lots of text  \\
lots of text lots of text  \\
lots of text \\
lots of text \\
lots of text \\
lots of text \\
\end{tabbing}
\end{boxedminipage}}
\end{center}
\vspace{-0.2in}
\begin{boxedminipage}[b]{0.5in}
\begin{subfigure}
a \\
b \\
\end{subfigure}
\end{boxedminipage}
\caption{a caption}
\vspace{-0.2in}
\end{figure}

-
Welcome to TeX.sx! More information on this site can be seen in the faq and the Unofficial TeX-SX FAQ meta.tex.stackexchange.com/q/1144/19384 as well as the markdown help tex.stackexchange.com/editing-help. Welcome to the community! – Peter Jansson Jan 2 '13 at 21:29
Can you please add a minimal working example of what you have tried so far? This would help us pick up, where you left. – Max Jan 2 '13 at 21:31
@Max I've added as far as I've gotten. I'm not sure I'm on the right track, but I can't seem to find tutorials for positioning the objects I'm attempting to use (which themselves may be poorly chosen). – Jan Gorzny Jan 2 '13 at 21:49
@JanGorzny What alignment do you want of the two objects? – egreg Jan 2 '13 at 21:51
Should the box borders align, or be visibly separate from one another? – Werner Jan 2 '13 at 21:59

One option is to use the not-well documented picinpar package, to create a window for the image inside a normal float. Some considerations:

(1) There are not a bottom option as far I know, but vertical position can be controlled by the number of lines to skip (first option).

(2) If you want a numbered captions for the image and not for the whole float, use figwindow insteaf of window environment. Note that custom captions made with captiondef, capt-of or caption packages do not work here.

(3) The package picins is recommended instead of picinpar. Unfortunately is not available in the TeXLive distribution, but you can download it from CTAN if you have problems with picinpar.

On the other hand, if the main float must be framed you can use a minipage inside a \fbox for example (see MWE). Or more simple, use a framed or mdframed environment (both needs the package with the same name).

\documentclass{article}
\usepackage[demo]{graphicx} % option demo to use fake images
\usepackage{lipsum}         % dummy text
\usepackage{picinpar}       % win­dows in para­graphs

\begin{document}

\begin{figure}[t]
\fbox{
\begin{minipage}{1\textwidth}
\begin{window}[%
6,% lines above
r,% position
\includegraphics[width=.5\textwidth]{some.jpg},%
A simple caption% the subcaption
]
\lipsum[1]
\end{window}
\end{minipage}
}
\caption{A figure float with a pseudo-subfloat inside.}
\end{figure}
\end{document}


-