Changes

Jump to navigation Jump to search
5,390 bytes added ,  18:18, 8 June 2020
m
no edit summary
Floats are elements like tables or figures that are placed (and numbered) automatically by TeX.= Introduction =
Floats Floating Objects (floats) are ConTeXt's "base class" for everything that uses placed (and numbered) automatically, with a <tt>\placeconfigurable (and optional) caption.They are placed at an appropriate position determined by the TeX float placement algorithm..</tt> command (table, figure, own floats)The algorithm has a number of options that can influence float placement.
If you search Most options of e.g. <tt>\placeexternalfigure</tt> you must look after <tt>\placefloat</tt> in the manual! (same for <tt>\setupsuch as {{cmd|placeexternalfigure}}) are described using the generic {{cmd|placefloat}}.Additionally, {{cmd|placelistoffigures}} creates a list of the figures used in the document..</tt> etc.)
<pre>\placefloat[place]Floats include "graphic", "figure", "table", and "intermezzo". Additional floats can be defined using {caption{cmd|definefloat}{some float}</pre>.
'''<texcode>\placefloat[place''' is one of: (PLEASE SOMEONE ADD DESCRIPTIONS!)* left* right* here* top* bottom* inleft* inright* inmargin* margin* page* opposite* always* force][reference]{caption}{some float}* tall</texcode>
'''place''' is one or several (comma separated) of:<table><tr bgcolor="#AAAAAA"><th>preference</th><th align="left">result</th></tr><tr bgcolor="#DDDDDD"><td>left</td><td>left of text</td></tr><tr><td>right</td><td>right of text</td></tr><tr bgcolor="#DDDDDD"><td>here</td><td>preferably here</td></tr><tr><td>top</td><td>at top of page</td></tr><tr bgcolor="#DDDDDD"><td>bottom</td><td>at bottom of page</td></tr><tr><td>inleft</td><td>in left margin</td></tr><tr bgcolor="#DDDDDD"><td>inright</td><td>in right margin</td></tr><tr><td>inmargin</td><td>in the margin (left or right)</td></tr><tr bgcolor="#DDDDDD"><td>margin</td><td>in the margin (margin float)</td></tr><tr><td>page</td><td>on a new (empty) page</td></tr><tr bgcolor="#DDDDDD"><td>opposite</td><td>on the left page</td></tr><tr><td>90</td><td>orientation (rotation angle), both captionand contents</td></tr><tr bgcolor="#DDDDDD"><td>always</td><td>precedence over stored floats</td></tr><tr><td>force</td><td>per se here</td></tr><tr bgcolor="#DDDDDD"><td>split</td><td>(For TABLES only) split tables</td></tr></table>(table copied from the manual) {{cmd|placefigure}} and {{cmd|placetable}} also accept the same set of options, and allow to create floating figures and captions respectively. '''You get reference''noIf 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. * If you do not want a caption <texcode>\placefigure[none] {} {\externalfigure[figurename]}</texcode>  * If you do not want the figure to be numbered (but still want the caption) <texcode>\placefigure [nonumber] {caption} {\externalfigure[figurename]}</texcode> * 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 wrap around the figure <texcode>\placefigure [right,2*line] {caption} {\externalfigure[figurename]}</texcode> or  <texcode>\placefigure [right,2*hang] {caption } {\externalfigure[figurename]}</texcode> 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>\definefloat[textmarginfigure][textmarginfigures]\setupfloat[textmarginfigure][location=inner]\placetextmarginfigure{\externalfigure[figurename]}</texcode> The following code gives a full example that can be pasted into live ConTeXt: <texcode>\setuppagenumbering [alternative=doublesided]\setuplayout[location=middle,backspace=2pc, width=20pc]\definefloat[textmarginfigure][textmarginfigures]\setupfloat[textmarginfigure][location=inner]\starttext\input knuth\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}\input knuth\placetextmarginfigure[here]{}{\externalfigure[figurename][width=30pc]}\input knuth\stoptext</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>\startplacetable [location={page,90},title=Table caption] \bTABLE [textwidth=\textheight] put a wide table here... \eTABLE\stopplacetable</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" 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>nonealigntitle</tt>option of the {{cmd|setupheads}} or {{cmd|setuphead}} commands. = 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>\defineselector[caption][max=2,n=2]\starttext\setupselector[caption][n=1]\completelistoffigures\setupselector[caption][n=2]\placefigure[][]{\select{caption} {Short caption for list} {A rather longer caption which will appear below the figure itself}} {This is the content of the actual figure}\stoptext</texcode> Or in more recent (circa November 2011 and later) versions of ConTeXt: <texcode>\startplacefigure[title={A rather long caption},list={A short caption}]This is the content of the actual figure\stopplacefigure</texcode> = Flushing floats = The command {{cmd|placefloats}} outputs all pending floats. [[Category:Basics]][[Category:Layout]]

Navigation menu