1

I am currently refactoring my document and notice many MetaPost graphics that I would like to draw bigger, typically on two pages without any layout borders. Is there an easy way to do that in ConTeXt? I have noticed that this question as already be asked but the answer is LaTeX-centric.

For this question, let's assume that I have a doublesided A4 document with a 42cm width graphic (2 times A4 paper width):

\setuppagenumbering[alternative=doublesided, location=]
\setuppapersize[A4][A4]

\startuseMPgraphic{MyLongGraphic}
  fill origin -- (42cm,0cm) -- (42cm,10cm) -- (0cm,10cm) -- cycle withcolor .3[white,red] ;
\stopuseMPgraphic


\starttext
  \useMPgraphic{MyLongGraphic}
\stoptext

1 Answer 1

0

Thanks to Wolfgang Schuster and Dave Jarvis in this link I found the answer which was easier than I thought; even easier than the original answer since we do not have to adjust the graphic width and height in the layer.

\setuppagenumbering[alternative=doublesided, location=]
\setuppapersize[A4][A4]

\startuseMPgraphic{MyLongGraphic}
  path background;
  background := origin -- (42cm,0cm) -- (42cm,10cm) -- (0cm,10cm) -- cycle ;
  fill background withcolor 0.3[white,red] ;

  label("left",origin) scaled 10 shifted (5cm, ypart(center background)) withcolor white ;
  label("right",origin) scaled 10 shifted (35cm, ypart(center background)) withcolor white ;
\stopuseMPgraphic

\definelayer[BookIllustrationLayer]
            [width=\paperwidth,
             height=\paperheight,
             doublesided=yes]

\startsetups[BookSetupIllustration]
  \setlayer[BookIllustrationLayer]
           [y=.0\paperheight]
           {\clip[nx=2,x=\doifelseoddpage{1}{2}]
             {\useMPgraphic{MyLongGraphic}}}
\stopsetups

\setupbackgrounds[page]
                 [setups=BookSetupIllustration,
                  background=BookIllustrationLayer]

\starttext
Hello \page World
\stoptext

enter image description here

You must log in to answer this question.