[NTG-context] ConTeXt + asymptote
Hans Hagen
pragma at wxs.nl
Tue Apr 25 09:04:45 CEST 2006
Sanjoy Mahajan wrote:
>> context parses the ps code and converts it to pdf and in the process
>> uses tex to do the fonts
>>
>
> %%Page: 1 1
> 0 0.5 dtransform truncate idtransform setlinewidth pop
> 1 setlinecap
> 1 setlinejoin
> gsave
> 0 0 translate
> newpath 273.998159 412.742829 moveto
> 338.001841 412.742829 lineto
>
...
> stroke
> showpage
>
looks parsable
> asy -t tex labelbox.asy [make eps, use plain tex for labels]
>
> which is failing, I think, in this line from the intermediate
> labelbox_.tex file:
>
> \setbox\ASYpsbox=\hbox{\epsfbox{labelbox_0.eps}}%
>
> But I haven't figured out who generates labelbox_0.eps and why it isn't
> being generated when using tex but is when using latex. Obviously I
> haven't found all the places where latex is hardwired into asymptote.
>
> And even what I did is incomplete. The latex interface code spits out
> e.g. \fontsize{12}{14.4}, which I just ignore if plain tex is being
> used.
>
> Compared to the monster .eps files that asymptote produces, I now love
> metapost's simple postscript files and one-line, easily parsed font
> commands.
>
if metapost had path bound specials and a few more features ...
> From: "Mojca Miklavec" <mojca.miklavec.lists at gmail.com>
>
>> But I've given up once I saw how harcoded LaTeX was in there.
>>
>
> I've pretty much given up too.
>
from what you describe it sounds like generic usage was not one part of
the design
>
>> Metapost support in ConTeXt is much deeper and I wonder how much work
>> should be invested into making as good support for Asymptote in
>> ConTeXt as it is now for metapost.
>>
>
> Whoever is game can start with the diff below, but I'm also not sure
> it's worth it. My ideal figure program:
>
> 1. Agnostic about the tex engine (tex/latex/context), easy to integrate
> with any of them. MP is good here.
> 2. 3D built in.
> 3. Modern color models (cmyk, transparency)
>
and even then, most of that has to take place in the backend in order to
get proper integration (efficiency and such), so if for instance mp had
a model for arbitrary collections, like:
(r,g,b) == (c,m,y,k) => (a,b,c,d,...)
actually, colors in mp are just triplets
> 4. Decent syntax. MP is a bit ghastly, and writing macros is horrible
> esp. with vardefs. I prefer a non-macro language, and asymptote is
> good that way
>
well, mp misses a few things but should not be compared to tex
(different model for globals, grouping, functions)
> But it's a lot of work to get it right.
>
> -Sanjoy
>
> `A society of sheep must in time beget a government of wolves.'
> - Bertrand de Jouvenal
>
>
> diff -r 57c230047c98 base/babel.asy
> --- a/base/babel.asy Tue Feb 07 23:34:29 2006 -0500
> +++ b/base/babel.asy Tue Apr 25 00:28:42 2006 -0400
> @@ -1,4 +1,6 @@ void babel(string s)
> void babel(string s)
> {
> + if (texengine == "tex")
> + abort("No babel package in plain TeX.");
> texpreamble("\usepackage["+s+"]{babel}");
> }
>
such code should not be inline, but in a config file or variable, seeing
this i'd say: for the moment forget about patching since it's hard to
keep up with such changes
btw, it should be:
if texengine == latex then texpreamble ...
else you need an abort for each macro package
> diff -r 57c230047c98 base/fontsize.asy
> --- a/base/fontsize.asy Tue Feb 07 23:34:29 2006 -0500
> +++ b/base/fontsize.asy Tue Apr 25 00:28:42 2006 -0400
> @@ -1,1 +1,3 @@ texpreamble("\usepackage{type1cm}");
> +
etc
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
More information about the ntg-context
mailing list