Open main menu

Changes

2,642 bytes added ,  15:13, 28 November 2021
m
Remove TEXpage from code snippets
< [[Visuals]] | [[Graphics]] | [[Using Graphics]] >= Introduction =
Floats Floating Objects (floats) are placed (and numbered) automatically, with a configurable (and optional) caption. They are placed at an appropriate position determined by the TeX float placement algorithm. The algorithm has a number of options that can influence float placement.
Most options in the manual (such as {{cmd|placeexternalfigure}}) are described using the generic {{cmd|placefloat}}. Additionally, {{cmd|placelistoffigures}} creates a list of the figures used in the document.
Floats include "graphic", "figure", "table", and "intermezzo". Additional floats can be defined using {{cmd|definefloat}}.
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 {{cmd|placefigure}} but the same set of options are also valid for other floats.
This does not work correctly at a page boundary. The <tt>line</tt> option leaves the space above the figures empty, while the <tt>hang</tt> option also wraps texts above the figure.
==Floats and columns==
This special case is discussed [[Columns#Floats_and_other_limitations_of_columns|here]].
=Floats on empty pages= There’s a way to switch off page headings at full page floats: <texcode>\startplacefigure[title=Cow,location={page,high,header}] \externalfigure[cow.pdf]\stopplacefigure</texcode> =Protruding Floats in Double-Sided Documents==
If you have a double-sided document with wide outer margins then you might want your figures to protrude into the margin. In a double-sided document you need to tell ConTeXt to decide whether to make the figure protrude to the left or the right. This can be done as follows:
</texcode>
==Landscape Floats in a Portrait Document== 
Wide tables, for example, can be turned and most likely will need to be put on a separate page.
<texcode>
Both the table caption and the contents will be rotated, but not the page header and footer which remain "upright". Notice that one must set the TABLE textwidth to {{cmd|textheight}} in order for the table macros to fit properly.
== Floats and section headings == By default, section headings don't wrap "around" “around” floating objects. Instead, they will be moved down as far as needed to appear below the float. This behaviour can be controlled using the <tt>aligntitle</tt> option of the {{cmd|setupheads}} or {{cmd|setuphead}} commands. = Captions =
== Captions ==
To change the style of figure(table) captions, use {{cmd|setupcaptions}}.
To use a different (e.g. abbreviated) caption in the list of floats, you can do:
 
<texcode>
\startplacefigure[title={A rather long caption},list={A short caption}]
This is the content of the actual figure
\stopplacefigure
</texcode>
 
In MkII this was possible by:
<texcode>
</texcode>
Or = Float Combinations = If you want to place floats besides each other or in more recent a regular matrix,each with its own number and caption, you need a float combination: <context source=yes>\useMPlibrary [dum] %% sample images \startplacefigure [location=none] % disable numbering of outer float \startfloatcombination [nx=2, ny=1] % two columns, one row \startplacefigure [title=Left] \externalfigure [dummy] \stopplacefigure \startplacefigure [title=Right] \externalfigure [dummy] \stopplacefigure \stopfloatcombination\stopplacefigure</context> If you want only one number for the whole thing, you may use a regular combination within a float: <context source=yes>\useMPlibrary [dum] %% sample images \startplacefigure [title=My combination] \startcombination [nx=2, ny=1] \startcontent \externalfigure [dummy] \stopcontent \startcaption Left \stopcaption \startcontent \externalfigure [dummy] \stopcontent \startcaption Right \stopcaption \stopcombination\stopplacefigure</context>  See also {{cmd|startcombination}}, {{cmd|startfloatcombination}} and [[Combinations]]. = Subfloats =Subfloatnumbering creates subfigures sharing a mutual figure prefix and anindividual subfigure designator (circa November 2011 and latere.g. figure 1a), figure 1b, etc.) versions of ConTeXt. The command {{cmd|startsubfloatnumbering}} is used for this. <context source=yes>\useMPlibrary [dum] %% sample images \startsubfloatnumbering \startplacefigure [title=Alpha] \externalfigure \stopplacefigure  \startplacefigure [title=Beta] \externalfigure \stopplacefigure\stopsubfloatnumbering</context> Subfloats can also be used with floatcombinations:
<texcodecontext source=yes>\useMPlibrary [dum] %% sample images \startplacefigure [location=none] \startsubfloatnumbering \startfloatcombination [nx=2, ny=1] \startplacefigure [title=Left, reference=fig:left] \externalfigure \stopplacefigure \startplacefigure[title={A rather long caption}Right,listreference={A short caption}fig:right]\externalfigure \stopplacefigure \stopfloatcombinationThis is the content of the actual figure \stopsubfloatnumbering
\stopplacefigure
</texcode>
=See \in{figure}[fig:left] and \in{figure}[fig:right].</context>  See also {{cmd|startcombination}}, {{cmd|startfloatcombination}}, [[Combinations]] and {{cmd|startsubfloatcombination}}. = Flushing floats ==
The command {{cmd|placefloats}} outputs all pending floats.
 
[[Category:Basics]]
[[Category:Layout]]
69

edits