[NTG-context] \sometxt in staticMPfigure

Sanjoy Mahajan sanjoy at mrao.cam.ac.uk
Tue Sep 26 15:33:22 CEST 2006


> you can test the beta

This gives the clearboxes error:

=================== box.tex ===================
\startMPinclusions
  input boxes
\stopMPinclusions

\starttext
\startstaticMPfigure{fig}
  boxit.h(btex h etex);
  drawboxed(h);
\stopstaticMPfigure
\usestaticMPfigure[fig]
\stoptext
=====================================

The cause is that it produces this intermediate mp file:

========= box-fig.mp ===============
input boxes
boxit.h(btex h etex);
drawboxed(h);
===================================

This fails because all three lines go into a beginfig..endfig and
metapost fails.  That may be a metapost bug in this case, but for
robustness I think it should become:

input boxes
beginfig(1)
boxit.h(btex h etex);
drawboxed(h);
endfig;
end

In order to do that transformation, box-fig.mp would need separate
sections for the inclusions and for the main figure code.

Am I using inclusions incorrectly?  i.e. Should I instead use
MPextensions to get material placed at the top of the metapost file
for use by all figures?  Like this:

=============== box-e.tex ================
\startMPextensions
  input boxes
\stopMPextensions

\starttext
\startstaticMPfigure{fig}
  boxit.h(btex h etex);
  drawboxed(h);
\stopstaticMPfigure
\usestaticMPfigure[fig]
\stoptext
=======================================

But that produces 

  (texexec-mpgraph.mp
  >> boxit.h
  ! Isolated expression.
  <to be read again> 
		     (
  l.148  boxit.h(
		 btex  h etex
  ? 

because the added extensions ('input boxes') are not included in
texexec-mpgraph.mp.

-Sanjoy

`Never underestimate the evil of which men of power are capable.'
         --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.


More information about the ntg-context mailing list