# Re: how to add a caption to a Box inset?

I've been using this module and it's almost exactly what I need. I changed
the layout to NumberWithin = chapter to give me Box 1.1, 1.2, etc. But I
need to change a few other things... so here's a shopping list:

1. align the caption left, and set font parameters. Can I do that with
{caption} package somehow; if not, where in the LaTeX preamble is that
controlled? (Attempts to change, eg, kern8pt haven't worked.)

2. separate paragraphs with blank line the same as LyX does for normal text;
add blank line after Box caption too.

** 3. make use of cross references to the Box Float label. At the moment
this doesn't work with <reference> (/ref) or Formatted reference
(/prettyref) modes — both simply produce 'subsection ??'. Most importantly I
just want the reference to be 'Box 1.1', same as for figure floats; the
numbering is crucial.

I'm frustrated not to be able to figure this out for myself but so far LaTeX
is continuing to defeat me...

Thanks all!

On 3 September 2010 23:20, Jürgen Spitzmüller <sp...@lyx.org> wrote:

>  Justin Wood wrote:
> > Thanks for the help, Jürgen. I'm not that great with using LaTeX
> directly,
> > but is this on the right track for the boxedminipage style?
> > \usepackage{boxedminipage} in the preamble; then
> >
> >  \begin{boxedminipage}[c]{1\columnwidth}
> >
> > \label{Box: hydrological cycle}Some text, blah blah\end{boxedminipage}
> >
> >
> > I inserted that as Tex code within LyX. I get a box this way, but I, err,
> > can't quite see how to use this with a float and/or get a caption (in the
> > Box 1, or Box 1.1 format). Sorry...
>
> * Put the attached module in the layouts folder of your user directory
> (About>LyX tells you where the user directory is, if there is no layouts
> folder yet, create it)
>
> * Restart LyX
>
> * Go to Documents>Settings...>Modules, select the module "Boxed Float" and
> hit
>
> You should not be able to select a framed float from Insert>Floats. The
> float
> does not exactly look like you want (the caption is outside the box). If
> you
> want to have the caption inside the box, the following definition in your
> document preamble (while using the Boxed Float module) should help:
>
> \usepackage{framed}
> \newcommand\flo...@simplerule[2]{{\@f...@cfont #1 #2}\par}
> \renewcommand...@boxed{%
>  \d...@fs@cfont{\bfseries}\l...@fs@capt\flo...@simplerule
>   \d...@fs@pre{\begin{framed}}%
>   \d...@fs@post{\end{framed}}%
>   \d...@fs@mid{\kern8pt}%
>   \l...@fs@iftopcapt\iftrue}
>
> HTH,
> Jürgen
>