Difference between revisions of "Combinations"
m (changed pre to texcode and tt to cmd) |
m (→Floatcombinations: fixed bug in example for \floatcombinations) |
||
(14 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
− | + | Combinations are ConTeXt's way to align several pictures (preferrably at same size): | |
− | Combinations | + | == Combinations == |
<texcode> | <texcode> | ||
− | \startcombination[x*y] | + | \startcombination[x*y] %% x=columns, y=rows |
{something}{caption} ... | {something}{caption} ... | ||
... | ... | ||
\stopcombination | \stopcombination | ||
</texcode> | </texcode> | ||
+ | |||
+ | or using the newer interface: | ||
+ | |||
+ | <texcode> | ||
+ | \startcombination [nx=3, ny=2] %% 3 columns, 2 rows | ||
+ | \startcontent something \stopcontent | ||
+ | \startcaption caption \stopcaption | ||
+ | \startcontent something \stopcontent | ||
+ | \startcaption caption \stopcaption | ||
+ | \startcontent something \stopcontent | ||
+ | \startcaption caption \stopcaption | ||
+ | \startcontent something \stopcontent | ||
+ | \startcaption caption \stopcaption | ||
+ | \startcontent something \stopcontent | ||
+ | \startcaption caption \stopcaption | ||
+ | \startcontent something \stopcontent | ||
+ | \startcaption caption \stopcaption | ||
+ | \stopcombination | ||
+ | |||
+ | </texcode> | ||
+ | |||
means: | means: | ||
You define, how much figures in columns * rows you'd like to align. | You define, how much figures in columns * rows you'd like to align. | ||
− | You must provide one "figure something" (e.g. an | + | You must provide one "figure something" (e.g. an {{cmd|externalfigure}}) and a caption for every "cell". |
+ | |||
+ | The sample, from the manual, shows how to define a caption for the whole group and use it as float (see [[Floating Objects]]): | ||
+ | |||
+ | <context source=yes> | ||
+ | \useMPlibrary [dum] %% sample images | ||
+ | |||
+ | \startplacefigure [title=An example of a combination] | ||
+ | \startcombination [nx=3, ny=2] | ||
+ | \startcontent \externalfigure [dummy] \stopcontent | ||
+ | \startcaption a \stopcaption | ||
+ | \startcontent \externalfigure [dummy] \stopcontent | ||
+ | \startcaption b \stopcaption | ||
+ | \startcontent \externalfigure [dummy] \stopcontent | ||
+ | \startcaption c \stopcaption | ||
+ | \startcontent \externalfigure [dummy] \stopcontent | ||
+ | \startcaption d \stopcaption | ||
+ | \startcontent \externalfigure [dummy] \stopcontent | ||
+ | \startcaption e \stopcaption | ||
+ | \startcontent \externalfigure [dummy] \stopcontent | ||
+ | \startcaption f \stopcaption | ||
+ | \stopcombination | ||
+ | \stopplacefigure | ||
+ | </context> | ||
+ | |||
+ | == Floatcombinations == | ||
+ | |||
+ | When combination contain floats, the command {{cmd|startfloatcombination}} is used. Here an example using float combinations as well as subfloatnumbering that creates subfigures sharing a mutual figure prefix and an individual subfigure designator (e.g. figure 1a), figure 1b, etc.). | ||
+ | |||
+ | <context source=yes> | ||
+ | \useMPlibrary [dum] %% sample images | ||
+ | |||
+ | \startplacefigure [location=none] | ||
+ | %\startsubfloatnumbering % This does not work! | ||
+ | \startfloatcombination [nx=2, ny=1] | ||
+ | \startplacefigure [title=Left, reference=fig:left] \externalfigure \stopplacefigure | ||
+ | \startplacefigure [title=Right, reference=fig:right] \externalfigure \stopplacefigure | ||
+ | \stopfloatcombination | ||
+ | %\stopsubfloatnumbering % This does not work! | ||
+ | \stopplacefigure | ||
+ | |||
+ | See \in{figure}[fig:left] and \in{figure}[fig:right]. | ||
+ | </context> | ||
+ | |||
+ | == Setup == | ||
+ | |||
+ | There is {{cmd|setupcombinations}} command. | ||
+ | |||
+ | == Referencing == | ||
+ | |||
+ | To reference a subfigure you can provide the subfigure's caption as a second parameter to the {{cmd|in}} command. | ||
+ | |||
+ | To reference the subfigure with the caption d you would write: | ||
− | |||
<texcode> | <texcode> | ||
− | \ | + | \in{figure}{d}[fig:combinations] |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | { | ||
− | |||
− | |||
− | |||
</texcode> | </texcode> | ||
− | + | ||
+ | This would produce something like 'figure 2.4d'. The content of the second parameter simply gets appended to the end of the figure's reference-number, thus the example above would still work even if the caption would be 'd) An awesome subfigure'. | ||
+ | |||
+ | == See also == | ||
+ | [[Floating_Objects#Subfloats]], {{cmd|startfloatcombination}}, {{cmd|startsubfloatnumbering}} | ||
+ | |||
+ | [[Category:Graphics]] |
Revision as of 16:49, 3 December 2021
Combinations are ConTeXt's way to align several pictures (preferrably at same size):
Combinations
\startcombination[x*y] %% x=columns, y=rows {something}{caption} ... ... \stopcombination
or using the newer interface:
\startcombination [nx=3, ny=2] %% 3 columns, 2 rows \startcontent something \stopcontent \startcaption caption \stopcaption \startcontent something \stopcontent \startcaption caption \stopcaption \startcontent something \stopcontent \startcaption caption \stopcaption \startcontent something \stopcontent \startcaption caption \stopcaption \startcontent something \stopcontent \startcaption caption \stopcaption \startcontent something \stopcontent \startcaption caption \stopcaption \stopcombination
means:
You define, how much figures in columns * rows you'd like to align.
You must provide one "figure something" (e.g. an \externalfigure) and a caption for every "cell".
The sample, from the manual, shows how to define a caption for the whole group and use it as float (see Floating Objects):
\useMPlibrary [dum] %% sample images \startplacefigure [title=An example of a combination] \startcombination [nx=3, ny=2] \startcontent \externalfigure [dummy] \stopcontent \startcaption a \stopcaption \startcontent \externalfigure [dummy] \stopcontent \startcaption b \stopcaption \startcontent \externalfigure [dummy] \stopcontent \startcaption c \stopcaption \startcontent \externalfigure [dummy] \stopcontent \startcaption d \stopcaption \startcontent \externalfigure [dummy] \stopcontent \startcaption e \stopcaption \startcontent \externalfigure [dummy] \stopcontent \startcaption f \stopcaption \stopcombination \stopplacefigure
Floatcombinations
When combination contain floats, the command \startfloatcombination is used. Here an example using float combinations as well as subfloatnumbering that creates subfigures sharing a mutual figure prefix and an individual subfigure designator (e.g. figure 1a), figure 1b, etc.).
\useMPlibrary [dum] %% sample images \startplacefigure [location=none] %\startsubfloatnumbering % This does not work! \startfloatcombination [nx=2, ny=1] \startplacefigure [title=Left, reference=fig:left] \externalfigure \stopplacefigure \startplacefigure [title=Right, reference=fig:right] \externalfigure \stopplacefigure \stopfloatcombination %\stopsubfloatnumbering % This does not work! \stopplacefigure See \in{figure}[fig:left] and \in{figure}[fig:right].
Setup
There is \setupcombinations command.
Referencing
To reference a subfigure you can provide the subfigure's caption as a second parameter to the \in command.
To reference the subfigure with the caption d you would write:
\in{figure}{d}[fig:combinations]
This would produce something like 'figure 2.4d'. The content of the second parameter simply gets appended to the end of the figure's reference-number, thus the example above would still work even if the caption would be 'd) An awesome subfigure'.
See also
Floating_Objects#Subfloats, \startfloatcombination, \startsubfloatnumbering