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
___________________________________________________________________________________

Reply via email to