[metapost] generic TeX interface?

Stephan Hennig mailing_list at arcor.de
Fri Jan 5 18:58:36 CET 2007


Stephan Hennig schrieb:

> Instead, I tried to collect some features I'd like to see for a new
> TeX interface. Here's the unsorted list:


I would like to add one additional feature:

* The new TeX interface should provide means to declare different TeX
preambles for TeXing different text pictures inside one MetaPost source
file.  In a current application I would like to call LaTeX with
preambles that are basically the same, but differ in document class and
package options.

I can think of two alternative ways to support this:

(a) TeX is called with the (La)TeX preamble declared last:

beginfig(1);
texpreamble
\documentclass{article}
\usepackage{mathptmx}
\begin{document}
endpreamble
draw textext("Times");

texpreamble
\documentclass{article}
\usepackage[sc]{mathpazo}
\begin{document}
endpreamble
draw textext("Palatino");
endfig;

(Macro names are chosen arbitrarily.)


(b) Or one can setup different "TeX profiles" (in the MetaPost preamble)
and switch them in the document:

deftexprofile(1);
\documentclass{article}
\usepackage{mathptmx}
\begin{document}
endprofile;

deftexprofile(2);
\documentclass{article}
\usepackage[sc]{mathpazo}
\begin{document}
endprofile;

beginfig(1);
usetexpreamble(1);
draw textext("Times");
usetexpreamble(2);
draw textext("Palatino");
usetexpreamble(1);
draw textext("Times again");
endfig;

What do you think?

Best regards,
Stephan Hennig



More information about the metapost mailing list