I have a problem with the vertical alignment of two subfigures. One is
less high than the other, so what I wanted was to align the smaller
one vertically centered wrt the bigger one (so not aligned at the
bottom). (see my really bad figure below to get the idea) I know this
is possible, I have done this some years ago - but cannot remember
how..
------------
| |
--------- | |
| | | |
| | | |
--------- | |
| |
-------------
I read the documentation and they have a big-box/small-box example
that should do the trick. However, when I put it into the code, I
always get a line break in between the figures (no matter how small
they are) such that they are now next to each other anymore. This is
independent from the size I give to them, so somehow I seem to be
missing a crucial point here..
Minimal example:
\sbox{\tempbox}{\includegraphics[width=40mm]{figs/figure1}}
\begin{figure}
\centering
\subfloat[]{\vbox to \ht\tempbox{\vfil\includegraphics[width=40mm]
{figs/figure2}\vfil}}\qquad
\subfloat[]{\usebox{\tempbox}}%
\end{figure}
Any ideas why the line break occurs? Is this the right way to center
vertically?
Thanks a lot for your help!
Please don't try to make ASCII art when using a variable-width font :-)
The spacing will be different for everyone, and just results in a mess
of characters.
\usepackage{array}
...
\begin{tabular}{m{40mm}m{40mm}}
\includegraphics[width=40mm]{foo}
&
\includegraphics[width=40mm]{bar}
\end{tabular}
But depending on where the (0,0) reference-point in your images is, and
on what surplus white-space they have, and where the creating
application has put the bounding-box, this may require adjustment.
///Peter
Thank you very much for the hint (ASCII art and tabular). However,
what I actually wanted was two _subfigures_ that are vertically
centered to each other... I don't see how this could be done in a
tabular.
Any other suggestions are highly welcome.
Thanks
Tim
> Minimal example:
>
> \sbox{\tempbox}{\includegraphics[width=40mm]{figs/figure1}}
That's not a minimal example. It doesn't compile as it doesn't start
with \documentclass and doesn't contain all necessary packages. Also
it use a local graphic. Make a small but complete example, replace
the \includegraphics by \rule{<width>}{<height>}.
--
Ulrike Fischer
Sorry, my misunderstanding. I think you'd need to rewrite subfig.
///Peter
\includegraphics starts a paragraph when used
in vertical mode (e.g., in a bare \vbox). A
paragraph is automatically as wide as \textwidth,
so your two boxes together are too wide to fit on
one line.
You can undo this wide-as-a-paragraph phenomenon by
wrapping \hbox{} around your \includegraphics command.
Instead of your fourth and fifth line, use this:
\subfloat[]{%
\vbox to \ht\tempbox
{
\vfil
\hbox{\includegraphics[width=40mm]{figs/figure2}}
\vfil
}%
}\qquad
(Excessive use of indentation is to help me keep braces
matched.)
Alternatively, put _both_ figures in \savebox-es and
use them.
The floatrow package might also help, but I confess I
don't really know. It is _supposed_ to help with
placing side-by-side figures and it might help in
this case. The doc subfig.pdf says it is compatible.
Dan
To reply by email, change LookInSig to luecking
Dan, you are my personal hero - work suggestion works like a charm.
Thanks for sharing this insight into subfig :)
Cheers and thanks a lot!