Caption beside Figure/Table

advertisement
Caption beside Figure/Table
Herbert Voß
4th June 2001
Contents
1 General
1
2 Vertically Centered
1
3 Bottom Baseline
2
4 Top Baseline
3
5 Examples
4
1 General
There are different methodes to write a caption above, down or beside a figure or
table. There is a problem, if you want to write the caption right or left on top
of the figure/float. For all this you need minipages. LYX creates a new length
LyXMinipageIndent and set it to parindent:
\newlength{\LyXMinipageIndent}
\setlength{\LyXMinipageIndent}{\parindent}
If you don’t like this one set it with another command to cero:
\setlength{\LyXMinipageIndent}{0pt}
2 Vertically Centered
Fig. 1 shows the caption vertically centered right beside the image. Same is possible with left sided.
20010604/v1.0/voss@lyx.org
CapBesideFig.lyx
1
Figure 1: a not so long caption for my
not so big image
Insert your float as usual. Than put the cursor before the image and enter the
paragraph-layout: layout paragraph extra. You’ll get something like fig. 2.
Important is the button for the vertical alignment.
Choose only 98% of the whole textwidth. For a symmetrical alignment 49%
for each minipagewidth.
Choose a width of 100% (!) of columnwidth for the image, or leave it as it
is if it’s a smaller one.
Activate the button „hfill between minipage paragraphs“, if you prefer some
space between figure/table and caption.
Activate the button „Start new minipage“.
Figure 2: The LYX menu for minipages
in layout paragraph extra for the
vertical alignment
3 Bottom Baseline
To put the Caption on the baseline of the image is possible with activating the button layout paragraph extra vertical alignment bottom (fig. 3). This
figure also shows the behaviour of the bottom baseline.
2
The LYX menu for minipages in
layout paragraph extra for a bottom baseline
4 Top Baseline
The image is for LATEX only a character in a line. So there are some problems when
we want to put the caption with it’s top beside the top of the image. The image
or the text has to be raised down the line. Write in the LATEX preamble the following texcode for the new command \myFigFloat{<float placement>}{<image
file>}{<caption text>}:
\newsavebox{\myFig}
\newlength{\myCapWidth}% depends to figurewidth
\newlength{\myFigsep}% sep between figure and caption
\setlength{\myFigsep}{2em}
\newcommand\myFigFloat[3]{%
\sbox{\myFig}{#2\hspace{\myFigsep}}
\setlength{\myCapWidth}{\textwidth}
\begin{figure*}[#1]
\raisebox{-\height}{\usebox{\myFig}}%
\addtolength{\myCapWidth}{-\the\wd\myFig}%
\raisebox{1.5ex}{\parbox[t]{\myCapWidth}{\caption{#3}}}
\hfill
\end{figure*}%
}
and in the LYX-text
\myFigFloat{<placement>}{<insert the figure via lyx-menue>}{<caption>}
for example
\myFigFloat{!htb}{<any figure>}{a very nice caption}
Figure 3 how this looks in the LYX-Text. You can insert the figure via LYXmenu, with the button on the main menu or via insert figure/table.
As fig. 3 shows, you are able to insert a label in the caption-text. So we can
also reference to the example fig. 4.
3
Figure 3: A snapshot from the LYX
text for the use of the \myFigFloatcommand
Figure 4: another caption for a top
aligned figure-caption combination
with the \myFigFloat-command
The float placement is for individual placement, so leave layout document
extra float placement blank.
5 Examples
A test with the wonderful Charlotte Bronté for the „Caption beside a figure“. Charlotte is one the famous three Bronté Sisters ....
A test with the wonderful Charlotte Bronté for the „Caption beside a figure“.
Charlotte is one the famous three Bronté Sisters ....
A test with the wonderful Charlotte Bronté for the „Caption beside a figure“.
Charlotte is one the famous three Bronté Sisters ....
4
Figure 5:
This is my beautiful
caption for Charlotte Bronté, one
of the three famous Bronté sisters
(http://www.educat.hu-berlin.
de/~voss/bronte.html)
Figure 6:
This is my beautiful
caption for Charlotte Bronté, one
of the three famous Bronté sisters
(http://www.educat.hu-berlin.
de/~voss/bronte.html)
5
Figure 7: This is my beautiful caption for Charlotte
Bronté, one of the three famous Bronté sisters
(http://www.educat.hu-berlin.de/~voss/
bronte.html)
6
Download