* TIL: figure combinations
@ 2022-08-11 21:14 Henning Hraban Ramm via ntg-context
0 siblings, 0 replies; only message in thread
From: Henning Hraban Ramm via ntg-context @ 2022-08-11 21:14 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm
You probably know about combinations to place images side by side:
\startcombination[3*1]
{\externalfigure[cow]}{cow}
{\externalfigure[mill]}{mill}
{\externalfigure[hacker]}{hacker}
\stopcombination
Now, the widths aren’t calculated automatically.
You could define them on your own:
\startcombination[3*1]
{\externalfigure[cow] [width=.3\textwidth]}{cow}
{\externalfigure[mill] [width=.3\textwidth]}{mill}
{\externalfigure[hacker][width=.3\textwidth]}{hacker}
\stopcombination
But that’s ugly and tedious. Hans did it for you:
\definemeasure[combination][
(\textwidth
-\effectiveleftskip
-\effectiverightskip
-\numexpr\combinationparameter\nx-\plusone\relax\dimexpr\combinationparameter\distance\relax
)/\combinationparameter]
So you can say:
\startcombination[3*1]
{\externalfigure[cow] [width=\measure{combination}]}{cow}
{\externalfigure[mill] [width=\measure{combination}]}{mill}
{\externalfigure[hacker][width=\measure{combination}]}{hacker}
\stopcombination
But that’s still tedious.
With the power of \defineexternalfigure:
\defineexternalfigure[combination][width=\measure{combination}]
(That’s predefined, no need to copy!)
\startcombination[3*1]
{\externalfigure[cow] [combination]}{cow}
{\externalfigure[mill] [combination]}{mill}
{\externalfigure[hacker][combination]}{hacker}
\stopcombination
Beautiful. ;)
Have fun,
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-11 21:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 21:14 TIL: figure combinations Henning Hraban Ramm via ntg-context
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).