Changes

Jump to navigation Jump to search
Add overlay example
== Description ==
Define code for a MetaPost graphic. The graphic can be placed in the document with {{cmd|uniqueMPgraphic}}, and will be recompiled ; every time it it the placement dimensions change, the graphic is placedrecompiled.
== Example ==
\def\mycolor{.625blue}
blue: \uniqueMPgraphic{name}
</context>
 
This illustrates the fact that graphic is reused if the dimensions don't change.
 
<context source=yes>
\startuniqueMPgraphic{randomcolor}
fill unitsquare
xyscaled (\overlaywidth, \overlayheight)
% `uniformdeviate 1` produces a random number between 0 and 1
withcolor (uniformdeviate 1, uniformdeviate 1, uniformdeviate 1);
\stopuniqueMPgraphic
 
\defineoverlay
[beta]
[\uniqueMPgraphic{randomcolor}]
 
\dontleavehmode
\framed[background=beta]{narrow}
\framed[background=beta]{narrow}
\framed[background=beta]{rather wide}
</context>

Navigation menu