ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* metafun: verbatimtex coming too late?
@ 2006-09-24 22:30 Sanjoy Mahajan
  2006-09-24 23:25 ` Sanjoy Mahajan
  0 siblings, 1 reply; 2+ messages in thread
From: Sanjoy Mahajan @ 2006-09-24 22:30 UTC (permalink / raw)


In this file, I intended that all labels would come out in 7pt:

===========================  cut here ============================
\starttext

\startMPenvironment
\setupbodyfont[7pt]
\stopMPenvironment

\startMPinclusions
def drawtext =
  label(btex In drawtext() macro. etex, origin);
enddef;
\stopMPinclusions

\startstaticMPfigure{fig}
  drawtext;
  label(btex Inline in the figure. etex, (2in,0));
\stopstaticMPfigure

hello, in 12pt, for comparison.

\placefigure[force,none]{}{\usestaticMPfigure[fig]}

\stoptext
===========================  cut here ============================

However, only the label that is directly in the figure ("Inline in the
figure.") comes out in 7pt.  The other one, produced by the drawtext
macro, comes out in 12pt.  The resulting metapost file is file-fig.mp
and the key portions are (with spacing adjusted a bit):

  def drawtext =
  label(btex In drawtext() macro. etex, origin);
  enddef;

  beginfig(1);
  verbatimtex \global \loadfontfileoncetrue \setupbodyfont [7pt]  etex;
  drawtext;
  label(btex  Inline in the figure. etex, (2in,0));
  endfig;

The verbatimtex..etex block inside the beginfig..endfig doesn't affect
the btex..etex in the drawtext macro, I guess because drawtext is
defined outside of the beginfig..endfig.

This is all with context 2006.08.08.  I tested it on the live context,
but the transcript says "figure texweb-fig.pdf can not be found".

A possible solution is to put the verbatimtex at the beginning of the mp
file or after the input mp-grph, making it like this:

  verbatimtex \global \loadfontfileoncetrue \setupbodyfont [7pt]  etex;
  def drawtext =
  label(btex In drawtext() macro. etex, origin);
  enddef;

  beginfig(1);
  drawtext;
  label(btex  Inline in the figure. etex, (2in,0));
  endfig;

but does that break other assumptions?

Another solution is textext instead of btex..etex, though I don't
understand the differences between the two.  The main one: textext
expands the tex commands in its argument whereas btex..etex does not.
But in regular metapost btex..etex does expand, so I'm confused a bit.
For example, you can do "mpost file.mp" with file.mp being

  verbatimtex \def\M{{\rm M}} etex
  beginfig(1)
  label (btex mass $\M$ etex, origin);
  endfig;
  end

-Sanjoy

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: metafun: verbatimtex coming too late?
  2006-09-24 22:30 metafun: verbatimtex coming too late? Sanjoy Mahajan
@ 2006-09-24 23:25 ` Sanjoy Mahajan
  0 siblings, 0 replies; 2+ messages in thread
From: Sanjoy Mahajan @ 2006-09-24 23:25 UTC (permalink / raw)


I had wondered:
> only the label that is directly in the figure ("Inline in the
> figure.") comes out in 7pt.  The other one, produced by the drawtext
> macro, comes out in 12pt.

> A possible solution is to put the verbatimtex at the beginning of
> the mp file or after the input mp-grph, making it like this:

The following lines do the above, and make all the btex..etex texts
come out in the small size:

\startMPextensions
verbatimtex \the\everyMPTEXgraphic etex;
\stopMPextensions

It works okay on a few test files, but are there bad interactions?

-Sanjoy

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-24 23:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-24 22:30 metafun: verbatimtex coming too late? Sanjoy Mahajan
2006-09-24 23:25 ` Sanjoy Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).