Changes

Jump to navigation Jump to search
m
added \startTEXpage[pagestate=start] %`pagestate=start` is needed to have incremented page numbering of the pdf
== Finishing Layer ==
The purpose of the finishing layer in the our ConTeXt code is to add the final touches to the drawn layers and to clip the graphic to the same frame. It also includes the addition of page numbering to each page with the help of a Metapost variable, in our case "mypagenumber". We need this method because apparently, it is not possible to use the ConTeXt page numberin numbering on a Metapost page. The finishing layer needs to be applied after drawing all the other layers.
== Layer Sets ==
\startuseMPgraphic{base} %Here in the base, we define the components we will use to draw our images
numeric u; u = 1cm;
numeric framefactor; framefactor = 3.4;path TheFrame ; TheFrame := fullsquare scaled 3.4u xyscaled (framefactor*u, framefactor*u) ; %Needed if you want to have for every page to have the same dimensiondimensions. Use (sqrt(2)*framefactor*u, framefactor*u) for DIN A Landscape ratio of the dimensions.
color stone_color; stone_color = 1/256(199,199,199);
color light_teal_color; light_teal_color = 1/256(154,209,189);
draw textext(decimal(\MPvar{mypagenumber})) scaled .1u withcolor magenta ;
setbounds currentpicture to TheFrame ;
%scaling the page to your preferred dimension:
desiredformat := 150;% In pixels (will be converted by default at 72dpi). The shorter dimension of DIN A4 would be 595 pixels.
currentpicture := currentpicture xysized (desiredformat ,desiredformat ); %for square pages. If DIN A Landscape, use (sqrt(2)*desiredformat ,desiredformat)
\stopuseMPgraphic %finishing
draw layerW ;
draw layerA ;
\includeMPgraphic{finishing}
\stopuseMPgraphic
\includeMPgraphic{layersetpage1} ;
draw layerV ;
\includeMPgraphic{finishing}
\stopuseMPgraphic
\includeMPgraphic{layersetpage2} ;
\includeMPgraphic{Gamma} ;
\includeMPgraphic{finishing}
\stopuseMPgraphic
\includeMPgraphic{layersetpre4} ;
label("special!", (z3+z4)/2) rotated 5 withcolor red;
\includeMPgraphic{finishing}
\stopuseMPgraphic
\includeMPgraphic{layersetpage3} ;
draw layerC ;
\includeMPgraphic{finishing}
\stopuseMPgraphic
\includeMPgraphic{layersetpre4} ;
draw layerC ;
\includeMPgraphic{finishing}
\stopuseMPgraphic
\dorecurse{6}{ %This loop starts from 1 until the set number and draws each layersetpage onto its own page. Don't set a number which is higher than the number of your last layersetpage.
 %By differentiating finishinglayersetpage#1 from layersetpage#1, we can avoid adding \includeMPgraphic{finishing} to each \startuseMPgraphic{layersetpage<number>}. This allows us to apply the scaling of the page to our desiredformat, because the scaling will done only once per \useMPgraphic{}.\startuseMPgraphic{finishinglayersetpage#1}\includeMPgraphic{layersetpage#1} ;\includeMPgraphic{finishing}\stopuseMPgraphic %uncomment if needed: % \setupTEXpage[background=color, backgroundcolor=gray] \startTEXpage[pagestate=start] %`pagestate=start` is needed to have incremented page numbering of the pdf \useMPgraphic{layersetpagefinishinglayersetpage#1}{mypagenumber=#1}
\stopTEXpage
}
12

edits

Navigation menu