[NTG-context] Metapost and TeX [OT]

Taco Hoekwater taco at elvenkind.com
Tue Aug 24 08:14:02 CEST 2004



skhilji at tampabay.rr.com wrote:

> So how does it happen in reality?

Matthias' reply is better for your situation, but for curiosity's
sake, here is what actually happens:

- MetaPost is happily reading MetaPost commands when suddenly it sees
  a "btex" command.

- Now it will throw away everything upto the next "etex", and it will
  run the external command "makempx" with the current filename as argument.
  
* makempx's goal is to create a file with the same name as it's argument, but
  with the extension replaced with ".mpx". That file will contain a series of
  low-level MetaPost commands for each label in the source file, and 
  those lists of commands are separated by the MetaPost command "mpxbreak".

* nothing is done by makempx if the mpx file exists and is newer than the  
  source file.

** otherwise, the source file is scanned for verbatimtex ... etex and btex ... etex
   blocks. These are wrapped in very simple TeX macros and written to a TeX input
   file.

** TeX is run, to produce a DVI file from these commands (each dvi page representing 
   a label)

** The entire DVI file is then converted into the ".mpx" file in a single action.

- MetaPost will now open the ".mpx" file as a concurrent source of commands
  linked to the current source file, and read commands from it up to the
  first "mpxbreak".

- The location pointer in the ".mpx" file is saved for subsequent labels.

Greetings, Taco



More information about the ntg-context mailing list