Difference between revisions of "Floating Objects"

From Wiki
Jump to navigation Jump to search
(Added some examples)
(→‎Examples: fix usage)
Line 56: Line 56:
  
 
<texcode>
 
<texcode>
\placefigure [nonumber] {caption} {\externalfigure{figurename}}
+
\placefigure [nonumber] {caption} {\externalfigure[figurename]}
 
</texcode>
 
</texcode>
  
Line 62: Line 62:
  
 
<texcode>
 
<texcode>
\placefigure [right,2*line] {caption} {\externalfigure{figurename}}
+
\placefigure [right,2*line] {caption} {\externalfigure[figurename]}
 
</texcode>
 
</texcode>
  
Line 68: Line 68:
  
 
<texcode>
 
<texcode>
\placefigure [right,2*hang] {caption} {\externalfigure{figurename}}
+
\placefigure [right,2*hang] {caption} {\externalfigure[figurename]}
 
</texcode>
 
</texcode>
  
 
This does not want correctly at a page boundary. The <tt>line</tt> options leaves the space above the figures empty, while the <tt>hang</tt> option also wraps texts above the figure.
 
This does not want correctly at a page boundary. The <tt>line</tt> options leaves the space above the figures empty, while the <tt>hang</tt> option also wraps texts above the figure.

Revision as of 09:31, 15 August 2006

< Visuals | Graphics | Using Graphics >

Floats are elements like tables or figures that are placed (and numbered) automatically by TeX. They are so called as they can float around the output pages to a place where TeX thinks they are appropriate (You can influence what TeX thinks as appropriate).

Floats are ConTeXt's "base class" for everything that uses a \place... command (table, figure, own floats).

If you search options of e.g. \placeexternalfigure you must look after \placefloat in the manual! (same for \setup... etc.)

The float types "graphic", "figure", "table" and "intermezzo" are readily defined. If you need more (i.e. if you need another numbering or table of something), you can easily define your own floats with \definefloat.

\placefloat[place][reference]{caption}{some float}

place is one or several (comma separated) of:

preferenceresult
leftleft of text
rightright of text
herepreferably here
topat top of page
bottomat bottom of page
inleftin left margin
inrightin right margin
inmarginin the margin (left or right)
marginin the margin (margin float)
pageon a new (empty) page
oppositeon the left page
alwaysprecedence over stored floats
forceper se here

(table copied from the manual)

\placefigure and \placetable also accept the same set of options, and allow to create floating figures and captions respectively.

reference

If you don't need to refer to your float, you can leave this parameter out.

Examples

I will explain the examples in terms of \placefigure but the same set of options are also valid for other floats.

  • If you do not want a caption
\placefigure {none} {\externalfigure{figurename}}

or

\placefigure[none] {} {\externalfigure{figurename}}


  • If you do not want the figure to be numbered (but still want the caption)
\placefigure [nonumber] {caption} {\externalfigure[figurename]}
  • Suppose you want the figure to be placed on the right side of the page, a few lines into the paragraph, and want the rest of the paragraph to warp around the figure
\placefigure [right,2*line] {caption} {\externalfigure[figurename]}

or

\placefigure [right,2*hang] {caption} {\externalfigure[figurename]}

This does not want correctly at a page boundary. The line options leaves the space above the figures empty, while the hang option also wraps texts above the figure.