29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

This table is defined as:<br />

\bTABLE[frame=off,meta:hash:linecolor=darkyellow,offset=3ex]<br />

\bTR<br />

\bTD[background=meta:hash:right] right \eTD<br />

\bTD[background=meta:hash:left] left \eTD<br />

\bTD[background=meta:hash:horizontal] horizontal \eTD<br />

\bTD[background=meta:hash:vertical] vertical \eTD<br />

\eTR<br />

\eTABLE<br />

The graphics themselves are defined in a METAPOST module. In this particular example, the macro<br />

some_hash is defined in the file mp-back.mp. This macro takes six arguments:<br />

some_hash (width, height, linewidth, linecolor, angle, gap) ;<br />

Because we don't want to define a specific overlay for each color and linewidth, we will use variables<br />

in the definition of the unique graphic.<br />

\startuniqueMPgraphic{meta:hash}{linewidth,linecolor,angle,gap}<br />

if unknown context_back : input mp-back ; fi ;<br />

some_hash ( \overlaywidth, \overlayheight ,<br />

\MPvar{linewidth}, \MPvar{linecolor} ,<br />

\MPvar{angle}, \MPvar{gap} ) ;<br />

\stopuniqueMPgraphic<br />

These variables are preset using \setupMPvariables:<br />

\setupMPvariables<br />

[meta:hash]<br />

[gap=.25\bodyfontsize,<br />

angle=45,<br />

linewidth=\overlaylinewidth,<br />

linecolor=\overlaylinecolor]<br />

The last step in this process is to define the different alternatives as overlays:<br />

\def\metahashoverlay#1{\uniqueMPgraphic{meta:hash}{angle=#1}}<br />

\defineoverlay[meta:hash:right] [\metahashoverlay{ +45}]<br />

\defineoverlay[meta:hash:left] [\metahashoverlay{ -45}]<br />

\defineoverlay[meta:hash:horizontal][\metahashoverlay{+180}]<br />

\defineoverlay[meta:hash:vertical] [\metahashoverlay{ -90}]<br />

As we can see in the definition of the table, we can pass settings to the \bTABLE command. Actually,<br />

we can pass such settings to each command that supports backgrounds, or more precisely \framed.<br />

Table 7.3 is for instance defined as:<br />

\bTABLE[frame=off,meta:hash:linewidth=.4pt,align=middle,offset=2ex]<br />

\bTR<br />

\bTD[background={meta:hash:left,meta:hash:right},<br />

Shape libraries Shapes, symbols and buttons<br />

181

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!