Hi all, I like metapost but, according to the following mail (on the metapost ML): [metapost] MP vs. Asymptote I don't want to start a flame, but since someone posted a message some time ago mentioning Asymptote I got curious and I have to say that I was very impressed, even if I still have some problems with it. However, it seems a net improvement over MP, or not? Is there anyone with an informed opinion over Asymptote? Might Asymptote be the killer of MP? Cheers, (and always thanks for the help I got here now and then...) Maurizio _______________________________________________ metapost mailing list http://tug.org/mailman/listinfo/metapost I wonder if someone has already tried to use asymptote with ConTeXt... IMHO, this doesn't seem obvious at all but I'm maybe wrong... Cheers Renaud
Ouch, grep latex * on the source returns ChangeLog: * doc/asymptote.texi, doc/latexusage.tex: ChangeLog: * configure.ac: Use kpsewhich to help find default latex path. ChangeLog: Force quiet mode with running embedded latex files. ChangeLog: * doc/latexusage.tex, base/plain.asy, doc/asymptote.texi, ChangeLog: * doc/generalaxis.asy, doc/generalaxis3.asy, doc/latexusage.tex, ChangeLog: * doc/latexusage.tex, patches/README, patches/dvipdf, drawlabel.cc, ChangeLog: * doc/latexusage.tex: Updated axis call. ChangeLog: * doc/generalaxis.asy, doc/helix.asy, doc/latexusage.tex, ChangeLog: * doc/latexusage.tex, doc/parametricgraph.asy, doc/surface.asy, ChangeLog: * doc/asymptote.texi, doc/latexusage.tex, base/graph.asy, ChangeLog: * doc/asymptote.texi, doc/latexusage.tex: ChangeLog: Fixed texpreamble for multiple files and latex asy environment. ChangeLog: * doc/latexusage.tex, doc/lineargraph.asy, doc/lineargraph0.asy, ChangeLog: * doc/image.asy, doc/latexusage.tex, doc/mosquito.asy, ChangeLog: * examples/venn.asy, doc/latexusage.tex: ChangeLog: pipe and final latex processing and to ensure tex pipe font is properly ChangeLog: * doc/latexusage.tex, doc/lineargraph.asy, doc/linetype.asy, ChangeLog: * Makefile.in, doc/asymptote.texi: Fixed location of latexusage.tex. ChangeLog: * Makefile.in, doc/asymptote.texi: Fixed location of latexusage.tex. ChangeLog: * doc/asymptote.texi, doc/latexusage.tex, examples/sqrtx01.asy, ChangeLog: Included correct latexusage file in documentation. ChangeLog: * doc/asymptote.texi, doc/latexusage.tex, examples/Pythagoras.asy, ChangeLog: Install latexusage.tex with examples. ChangeLog: * doc/labelsquare.asy, doc/latexusage.tex, examples/geometry.asy, ChangeLog: * doc/asymptote.texi, doc/latexusage.tex, ChangeLog: doc/datagraph.asy, doc/latexusage.tex, examples/Pythagoras.asy, ChangeLog: * doc/asymptote.texi, doc/latexusage.tex, examples/lever.asy, ChangeLog: * picture.cc: Improved latex diagnostics. ChangeLog: * picture.cc: Improved latex diagnostics. ChangeLog: * doc/latexusage.tex: updated coordinate ChangeLog: doc/asymptote.texi, doc/diatom.asy, doc/latexusage.tex: Fixed ChangeLog: /usr/share/texmf/tex/latex/ (./configure --with-latex=PATH to ChangeLog: * configure.ac: Fixed -with-latex=PATH. ChangeLog: * Makefile.in, configure.ac: Added --with-latex=PATH configuration ChangeLog: * doc/asymptote.texi, doc/latexusage.tex, base/plain.asy: Updated ChangeLog: * doc/latexusage.tex, base/plain.asy, doc/asymptote.sty, ChangeLog: * doc/asymptote.texi, doc/latexusage.tex: Made import graph local ChangeLog: to each figure in latexusage. ChangeLog: * doc/latexusage.tex: Example of latex usage. ChangeLog: examples/latexusage.tex, doc/asymptote.sty, doc/asymptote.texi, configure:ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION Datadir kpsewhich latexdir LEX CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT LEXLIB LEX_OUTPUT_ROOT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CC CFLAGS ac_ct_CC SET_MAKE YACC CXXCPP EGREP getopt GCDIR GCLIBS INCL OPTIONS LIBOBJS LTLIBOBJS' configure: --with-latex=PATH specify path to LaTeX installation configure:# Check whether --with-latex or --without-latex was given. configure:if test "${with_latex+set}" = set; then configure: withval="$with_latex" configure: latexdir=$withval configure: latexdir=`kpsewhich base/latex.ltx` configure: latexdir=`echo $latexdir | sed -e 's;/base/latex.ltx;;'` configure: latexdir=$prefix/share/texmf/tex/latex configure: as_ac_File=`echo "ac_cv_file_$latexdir/base/latex.ltx" | $as_tr_sh` configure:echo "$as_me:$LINENO: checking for $latexdir/base/latex.ltx" >&5 configure:echo $ECHO_N "checking for $latexdir/base/latex.ltx... $ECHO_C" >&6 configure:if test -r "$latexdir/base/latex.ltx"; then configure: latexdir=/usr/share/texmf/tex/latex configure: as_ac_File=`echo "ac_cv_file_$latexdir/base/latex.ltx" | $as_tr_sh` configure:echo "$as_me:$LINENO: checking for $latexdir/base/latex.ltx" >&5 configure:echo $ECHO_N "checking for $latexdir/base/latex.ltx... $ECHO_C" >&6 configure:if test -r "$latexdir/base/latex.ltx"; then configure:latexdir=$latexdir/asymptote configure:{ echo "$as_me:$LINENO: Using $latexdir for LaTeX style file" >&5 configure:echo "$as_me: Using $latexdir for LaTeX style file" >&6;} configure:s,@latexdir@,$latexdir,;t t configure.ac:AC_ARG_WITH(latex, configure.ac: [ --with-latex=PATH specify path to LaTeX installation ], configure.ac: latexdir=$withval configure.ac: latexdir=`kpsewhich base/latex.ltx` configure.ac: latexdir=`echo $latexdir | sed -e 's;/base/latex.ltx;;'` configure.ac: latexdir=$prefix/share/texmf/tex/latex configure.ac: AC_CHECK_FILE($latexdir/base/latex.ltx,, configure.ac: [latexdir=/usr/share/texmf/tex/latex configure.ac: AC_CHECK_FILE($latexdir/base/latex.ltx,,)]) configure.ac:latexdir=$latexdir/asymptote configure.ac:AC_MSG_NOTICE([Using $latexdir for LaTeX style file]) configure.ac:AC_SUBST(latexdir) Makefile.in:latexdir = @latexdir@ Makefile.in: -${INSTALL} -d $(latexdir) Makefile.in: doc/*.asy doc/*.csv doc/*.dat doc/latexusage.tex $(exampledir) Makefile.in: -${INSTALL} -m644 doc/asymptote.sty $(latexdir) Makefile.in: latexusage.tex Makefile.in: -rm -f $(latexdir)/asymptote.sty Makefile.in: -rmdir $(latexdir) picture.cc:texstream tex; // Bi-directional pipe to latex (to find label bbox) picture.cc: tex.open(getSettingmem::string("latex").c_str(),"latex","latex"); picture.cc: cmd << "'" << getSettingmem::string("latex") << "'" picture.cc: status=System(cmd,quiet,"latex"); picture.cc: if(quiet) status=System(cmd,false,"latex"); picture.h:extern texstream tex; // Bi-directional pipe to latex (to find label bbox) settings.cc: addOption(new envSetting("latex", "latex")); Renaud AUBIN a écrit :
Hi all,
I like metapost but, according to the following mail (on the metapost ML):
[metapost] MP vs. Asymptote I don't want to start a flame, but since someone posted a message some time ago mentioning Asymptote I got curious and I have to say that I was very impressed, even if I still have some problems with it. However, it seems a net improvement over MP, or not? Is there anyone with an informed opinion over Asymptote? Might Asymptote be the killer of MP?
Cheers, (and always thanks for the help I got here now and then...)
Maurizio _______________________________________________ metapost mailing list http://tug.org/mailman/listinfo/metapost
I wonder if someone has already tried to use asymptote with ConTeXt... IMHO, this doesn't seem obvious at all but I'm maybe wrong...
Cheers
Renaud
------------------------------------------------------------------------
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Renaud AUBIN wrote:
Ouch, grep latex * on the source returns i downloade it, and indeed it seems that calling latex is hard coded into the source
of course you can make a batch file latex.cmd that runs context -) integrating does not look that problematic but without proper label support ... . so maybe you can convince the authors to make the --tex switch accept a format 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 -----------------------------------------------------------------
i downloade it, and indeed it seems that calling latex is hard coded into the source
of course you can make a batch file latex.cmd that runs context -)
integrating does not look that problematic but without proper label support ... .
so maybe you can convince the authors to make the --tex switch accept a format
Have a look at this: http://www.kitp.ucsb.edu/~paxton/tioga.html and, please, tell us what do you think about it. jk -- Jilani KHALDI http://jkhaldi.oltrelinux.com
Tioga looks very nice for 2D plots but IMHO, asymptote could provide a good transition for metaposters. Moreover, asymptote is a "all-in-one" tool with 3D support and 2D plots of reasonable quality... The discussion is now, what do you prefer: an integrated tool with a great variety of features (even if a small amount of us are interested by "three" or "graph" in asymptote) or a better tool but with less features ? It is already possible to do 3D with metapost by using featpost, m3d or others but IMHO asymptote seems great because it integrates nativelly this kind of features. I have just send a mail to Andy Hammer to ask him what he thinks about using plainTeX format instead of hardcoded latex calls... Cheers, Renaud Jilani Khaldi a écrit :
Have a look at this: http://www.kitp.ucsb.edu/~paxton/tioga.html and, please, tell us what do you think about it. jk
-- Jilani KHALDI http://jkhaldi.oltrelinux.com
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Renaud AUBIN wrote:
I have just send a mail to Andy Hammer to ask him what he thinks about using plainTeX format instead of hardcoded latex calls...
or configurable calls, i see no reason for binding to whatever format 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 -----------------------------------------------------------------
Renaud AUBIN wrote:
The discussion is now, what do you prefer: an integrated tool with a great variety of features (even if a small amount of us are interested by "three" or "graph" in asymptote) or a better tool but with less features ?
or multiple tools -) 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 -----------------------------------------------------------------
I agree with you, and this is what I do for my document (I use featpost, metaobj and context term of gnuplot). But sometimes, there is some conflicts... That's the reason why I think that an integrated and expandable solution could be interesting. That's my humble opinion ;) Hans Hagen a écrit :
or multiple tools -)
Hans
there's also: ftp://tug.ctan.org/pub/tex-archive/graphics/pgf (although for context i'd rewrite the backend drivers a bit in order to be more integrated) 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 -----------------------------------------------------------------
I discovered conTeXt+metapost because I was not satisfied with the limited capabilties of pgf for my graph music project. I have to say that I was forcing pgf beyond its scope, but in any case it is not intended as a complex, global plotting system, as far as I understand. Best -a- On 22 Apr 2006, at 10:38, Hans Hagen wrote:
ftp://tug.ctan.org/pub/tex-archive/graphics/pgf Andrea Valle DAMS - Facoltà di Scienze della Formazione Università degli Studi di Torino http://www.semiotiche.it/andrea andrea.valle@unito.it
Jilani Khaldi wrote:
i downloade it, and indeed it seems that calling latex is hard coded into the source
of course you can make a batch file latex.cmd that runs context -)
integrating does not look that problematic but without proper label support ... .
so maybe you can convince the authors to make the --tex switch accept a format
Have a look at this: http://www.kitp.ucsb.edu/~paxton/tioga.html and, please, tell us what do you think about it.
interesting (i assume that it produced pdf) 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 -----------------------------------------------------------------
Ok, but how to deal with asymptote like with metapost. For example, if I produce a pdf with asymptote (with embed fonts) and use this pdf into my ConTeXt document with the same fonts... Is the fonts included twice ? I assume that this is the case... Maybe it could be interesting to "integrate" asymptote. I don't know how hard it is at all... It's only an idea...
interesting (i assume that it produced pdf)
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 -----------------------------------------------------------------
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Renaud AUBIN wrote:
Ok, but how to deal with asymptote like with metapost. For example, if I produce a pdf with asymptote (with embed fonts) and use this pdf into my ConTeXt document with the same fonts... Is the fonts included twice ? I assume that this is the case... Maybe it could be interesting to "integrate" asymptote.
I don't know how hard it is at all... It's only an idea...
it depends, if asymptote outputs a parsable format ... 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 -----------------------------------------------------------------
asy -inlinetex results in: - an eps graphics - latex code to use (I've not checked but seems) with asymptote.sty So, we can maybe imagine an -inlinecontext option to add asymptote support in context (???) Hans Hagen a écrit :
Renaud AUBIN wrote:
Ok, but how to deal with asymptote like with metapost. For example, if I produce a pdf with asymptote (with embed fonts) and use this pdf into my ConTeXt document with the same fonts... Is the fonts included twice ? I assume that this is the case... Maybe it could be interesting to "integrate" asymptote.
I don't know how hard it is at all... It's only an idea...
it depends, if asymptote outputs a parsable format ...
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 -----------------------------------------------------------------
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Renaud AUBIN wrote:
asy -inlinetex results in: - an eps graphics - latex code to use (I've not checked but seems) with asymptote.sty
So, we can maybe imagine an -inlinecontext option to add asymptote support in context (???) no, what is needed is an isolation of the tex part, so that the macro package has/can to implement certain 'features'; otherwise it's unmaintainable
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 -----------------------------------------------------------------
Hans Hagen a écrit :
no, what is needed is an isolation of the tex part, so that the macro package has/can to implement certain 'features'; otherwise it's unmaintainable
Hans
euh... The isolation of the tex part is performed for LaTeX with inlinetex option... (an eps file without any text + a tex file) Isn't this kind of isolation sufficient ? Renaud
Renaud AUBIN wrote:
Hans Hagen a écrit :
no, what is needed is an isolation of the tex part, so that the macro package has/can to implement certain 'features'; otherwise it's unmaintainable
Hans
euh... The isolation of the tex part is performed for LaTeX with inlinetex option... (an eps file without any text + a tex file) Isn't this kind of isolation sufficient ? i meant the 'hard coded parts' but then, i must admit that i never saw any real asymptote code -)
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 -----------------------------------------------------------------
Hans Hagen a écrit :
i meant the 'hard coded parts' but then, i must admit that i never saw any real asymptote code -)
Hans
Since asymptote uses gs to generate eps or pdf output, I wander if the generated code can be used by ConTeXt... To integrate asymptote to ConTeXt, what is needed (from the ConTeXt pov I mean) ? I ask that because I don't know ConTeXt internals well... What's the integration scheme for a MPgraphic for example ? (I know that ConTeXt finally use a .mp and a .mpx) I assume after reading a .log that a ps file is needed... but it seems that a "font name mngt" is needed too... Renaud
To integrate asymptote to ConTeXt, what is needed (from the ConTeXt pov I mean) ?
I'm curious about that too. I'm just going through my asymptote diffs (against v0.99) for it to work with plain TeX, and I'm not sure any of my changes will make it easier to integrate with ConTeXt the way MP is integrated. It's depressing how wedded asymptote is to LaTeX, and maybe it's impossible to get it all out (e.g. it uses \minipage and \fontsize). -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
Renaud AUBIN wrote:
Hans Hagen a écrit :
i meant the 'hard coded parts' but then, i must admit that i never saw any real asymptote code -)
Hans
Since asymptote uses gs to generate eps or pdf output, I wander if the generated code can be used by ConTeXt... To integrate asymptote to ConTeXt, what is needed (from the ConTeXt pov I mean) ? I ask that because I don't know ConTeXt internals well... What's the integration scheme for a MPgraphic for example ? (I know that ConTeXt finally use a .mp and a .mpx) I assume after reading a .log that a ps file is needed... but it seems that a "font name mngt" is needed too... context parses the ps code and converts it to pdf and in the process uses tex to do the fonts
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 -----------------------------------------------------------------
context parses the ps code and converts it to pdf and in the process uses tex to do the fonts
Maybe then it's not worth finishing my modifications for asymptote to
use plain tex. The following .asy file (labelbox.asy in the distributed
examples/):
real margin=2mm;
frame b1,b2;
box(b1,Label("small box",(0,0)),margin);
box(b2,Label("LARGER BOX",(0,-2cm)),margin);
add(b1);
add(b2);
draw(point(b1,S)--point(b2,N),currentpen);
produces an 810-line .eps file that includes fonts (cmr12) and the
pstricks headers. The actual page material is:
%%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
338.001841 435.883567 lineto
273.998159 435.883567 lineto
273.998159 412.742829 lineto
closepath
[ 1 0 0 1 0 0] concat
stroke
grestore
gsave
0 0 translate
newpath 258.635763 356.116433 moveto
353.364237 356.116433 lineto
353.364237 379.124359 lineto
258.635763 379.124359 lineto
258.635763 356.116433 lineto
closepath
[ 1 0 0 1 0 0] concat
stroke
grestore
newpath 306 412.242829 moveto
306 379.624359 lineto
stroke
showpage
But I've attached the half-working diff (some would say the glass is
half-broken), against asymptote 0.99. The result is supposed to work as
follows:
asy labelbox.asy [make eps file; use latex for labels]
asy -t latex labelbox.asy [same as above]
asy -t tex labelbox.asy [make eps, use plain tex for labels]
My patches don't break the first or second uses, which is good, but the
third isn't working yet:
$ asy -t tex labelbox.asy
/usr/local/share/asymptote/shipout.asy: 73.10: runtime: camp: shipout failed
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.
From: "Mojca Miklavec"
But I've given up once I saw how harcoded LaTeX was in there.
I've pretty much given up too.
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)
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
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}");
}
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}");
+if (texengine == "tex")
+ abort("No fontsize package in plain TeX.");
texpreamble("\usepackage{type1cm}");
diff -r 57c230047c98 base/latin1.asy
--- a/base/latin1.asy Tue Feb 07 23:34:29 2006 -0500
+++ b/base/latin1.asy Tue Apr 25 00:28:42 2006 -0400
@@ -1,2 +1,4 @@ texpreamble("\usepackage[T1]{fontenc}");
+if (texengine == "tex")
+ abort("No T1 or latin1 packages in plain TeX.");
texpreamble("\usepackage[T1]{fontenc}");
texpreamble("\usepackage[latin1]{inputenc}");
diff -r 57c230047c98 base/plain.asy
--- a/base/plain.asy Tue Feb 07 23:34:29 2006 -0500
+++ b/base/plain.asy Tue Apr 25 00:28:42 2006 -0400
@@ -7,6 +7,9 @@
*****/
include constants;
+
+// tex, latex, or none (for the future: or pdftex, pdflatex, context)
+public string texengine = TEXENGINE(); // what variant will typeset the labels
access version;
if(version.VERSION != VERSION()) {
diff -r 57c230047c98 base/strings.asy
--- a/base/strings.asy Tue Feb 07 23:34:29 2006 -0500
+++ b/base/strings.asy Tue Apr 25 00:28:42 2006 -0400
@@ -81,12 +81,16 @@ string math(string s)
string includegraphics(string name, string options="")
{
+ if (texengine == "tex")
+ return "\hbox{\epsfbox"+"{"+name+"}}";
if(options != "") options="["+options+"]";
return "\includegraphics"+options+"{"+name+"}";
}
string minipage(string s, real width=100pt)
{
+ if (texengine == "tex")
+ abort("No minipage environment in plain TeX.");
return "\begin{minipage}{"+(string) (width*pt)+"pt}"+s+"\end{minipage}";
}
diff -r 57c230047c98 base/unicode.asy
--- a/base/unicode.asy Tue Feb 07 23:34:29 2006 -0500
+++ b/base/unicode.asy Tue Apr 25 00:28:42 2006 -0400
@@ -1,2 +1,4 @@ texpreamble("\usepackage{ucs}");
+if (texengine == "tex")
+ abort("No unicode (ucs,utf8x) packages in plain TeX.");
texpreamble("\usepackage{ucs}");
texpreamble("\usepackage[utf8x]{inputenc}");
diff -r 57c230047c98 doc/asy.1
--- a/doc/asy.1 Tue Feb 07 23:34:29 2006 -0500
+++ b/doc/asy.1 Tue Apr 25 00:28:42 2006 -0400
@@ -35,7 +35,7 @@ View output file.
View output file.
.TP
.B -a, -align C|B|T|Z
-Center, Bottom, Top or Zero page alignment; Z => -notex.
+Center, Bottom, Top or Zero page alignment; Z => -tex none.
.TP
.B -autoplain
Enable automatic importing of plain (default).
@@ -106,8 +106,8 @@ Convert cmyk colors to rgb.
.B -safe
Disable system call (default).
.TP
-.B -tex
-Enable LaTeX label postprocessing (default).
+.B -t, -tex engine
+TeX engine for processing labels: one of latex (default), tex, none.
.TP
.B -s, -translate
Translate test.
diff -r 57c230047c98 doc/asymptote.texi
--- a/doc/asymptote.texi Tue Feb 07 23:34:29 2006 -0500
+++ b/doc/asymptote.texi Tue Apr 25 00:28:42 2006 -0400
@@ -5286,7 +5286,7 @@ Usage: asy [options] [file ...]
Options:
-V,-View View output files
--a,-align C|B|T|Z Center, Bottom, Top or Zero page alignment; Z => -notex
+-a,-align C|B|T|Z Center, Bottom, Top or Zero page alignment; Z => -tex none
-autoplain Enable automatic importing of plain (default)
-batchMask Mask fpu exceptions in batch mode
-batchView View output files in batch mode
@@ -5310,7 +5310,7 @@ Options:
-p,-parseonly Parse test
-rgb Convert cmyk colors to rgb
-safe Disable system call (default)
--tex Enable LaTeX label postprocessing (default)
+-t, -tex engine TeX engine for processing labels (default: latex).
-s,-translate Translate test
-unsafe Enable system call
-v,-verbose Increase verbosity level
diff -r 57c230047c98 drawlabel.cc
--- a/drawlabel.cc Tue Feb 07 23:34:29 2006 -0500
+++ b/drawlabel.cc Tue Apr 25 00:28:42 2006 -0400
@@ -70,7 +70,8 @@ void drawLabel::bounds(bbox& b, iopipest
void drawLabel::bounds(bbox& b, iopipestream& tex, boxvector& labelbounds,
bboxlist&)
{
- if(!settings::getSetting<bool>("tex")) {b += position; return;}
+ if(settings::getSettingmem::string("tex") == "none")
+ {b += position; return;}
pair rotation=expi(radians(angle));
pen Pentype=pentype;
static const double fuzz=1.0+Pentype.size()/24.0;
@@ -79,9 +80,12 @@ void drawLabel::bounds(bbox& b, iopipest
havebounds=true;
if(Pentype.size() != lastpen.size() ||
Pentype.Lineskip() != lastpen.Lineskip()) {
- tex << "\\fontsize{" << Pentype.size() << "}{" << Pentype.Lineskip()
- << "}\\selectfont\n";
- tex.wait("\n*","! ");
+ // need to fix if not using latex (change fontsize and baselineskip)
+ if(settings::getSettingmem::string("tex") == "latex") {
+ tex << "\\fontsize{" << Pentype.size() << "}{" << Pentype.Lineskip()
+ << "}\\selectfont\n";
+ tex.wait("\n*","! ");
+ }
}
string font=Pentype.Font();
@@ -93,8 +97,10 @@ void drawLabel::bounds(bbox& b, iopipest
p += scaled.length();
fontscale=atof(font.substr(p,string::npos).c_str())/1000.0;
}
- tex << font << "\n";
- tex.wait("\n*","! ");
+ if(settings::getSettingmem::string("tex") == "latex") {
+ tex << font << "\n"; // need to change fonts differently in tex
+ tex.wait("\n*","! ");
+ }
}
lastpen=Pentype;
diff -r 57c230047c98 examples/conicurv.asy
--- a/examples/conicurv.asy Tue Feb 07 23:34:29 2006 -0500
+++ b/examples/conicurv.asy Tue Apr 25 00:28:42 2006 -0400
@@ -4,7 +4,8 @@
import three;
import math;
-texpreamble("\usepackage{bm}");
+if (texengine != "tex")
+ texpreamble("\usepackage{bm}");
size(300,0);
diff -r 57c230047c98 picture.cc
--- a/picture.cc Tue Feb 07 23:34:29 2006 -0500
+++ b/picture.cc Tue Apr 25 00:28:42 2006 -0400
@@ -83,7 +83,7 @@ bool picture::havelabels()
bool picture::havelabels()
{
size_t n=nodes.size();
- if(n > lastnumber && !labels && getSetting<bool>("tex")) {
+ if(n > lastnumber && !labels && getSettingmem::string("tex") != "none") {
// Check to see if there are any labels yet
nodelist::iterator p=nodes.begin();
for(size_t i=0; i < lastnumber; ++i) ++p;
@@ -131,7 +131,9 @@ void picture::texinit()
return;
}
- tex.open(getSettingmem::string("latex").c_str(),"latex","latex");
+ tex.open(getSettingmem::string("tex").c_str(),
+ getSettingmem::string("tex").c_str(),
+ getSettingmem::string("tex").c_str());
texdocumentclass(tex,true);
texdefines(tex,TeXpipepreamble,true);
@@ -152,12 +154,12 @@ bool picture::texprocess(const string& t
if(outfile) {
outfile.close();
ostringstream cmd;
- cmd << getSettingmem::string("latex")
+ cmd << getSettingmem::string("tex")
<< " \\scrollmode\\input " << texname;
bool quiet=verbose <= 1;
- status=System(cmd,quiet,true,"latex");
+ status=System(cmd,quiet,true,getSettingmem::string("tex").c_str());
if(status) {
- if(quiet) status=System(cmd,true,"latex");
+ if(quiet) status=System(cmd,true,getSettingmem::string("tex").c_str());
return false;
}
@@ -360,7 +362,8 @@ bool picture::shipout(picture *preamble,
bbox bpos=b;
- bool TeXmode=getSetting<bool>("inlinetex") && getSetting<bool>("tex");
+ bool TeXmode=getSetting<bool>("inlinetex") &&
+ (getSettingmem::string("tex") == "latex");
bool Labels=labels || TeXmode;
if(deconstruct) {
diff -r 57c230047c98 runtime.cc
--- a/runtime.cc Tue Feb 07 23:34:29 2006 -0500
+++ b/runtime.cc Tue Apr 25 00:28:42 2006 -0400
@@ -2599,8 +2599,16 @@ void gen226(stack *Stack)
{Stack->push<string>(VERSION); return;}
}
+// for exporting to the .asy world how labels are to be processed
+// string TEXENGINE();
+void gen227(stack *Stack)
+{
+
+ {Stack->push<string>(getSettingmem::string("tex")); return;}
+}
+
// void quiet(bool v);
-void gen227(stack *Stack)
+void gen228(stack *Stack)
{
bool v = vm::pop<bool>(Stack);
@@ -2610,7 +2618,7 @@ void gen227(stack *Stack)
}
// void atexit(callable *f);
-void gen228(stack *Stack)
+void gen229(stack *Stack)
{
callable * f = vm::pop
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"
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 -----------------------------------------------------------------
Hans Hagen wrote:
looks parsable
But you see only a small bit of the actual output ;-) From Mojca:
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.
I've asked this to a wide range of people and have never, ever gotten an answer that is even close to usable for development purposes: What is actually needed to make it easy to do 3D in MP?
3. Modern color models (cmyk, transparency)
cmyk color model is older.much than rgb :-) It would not be hard to add the cmyk color space, but transparancy can not easily be done in PostScript output (it would require overlap removal code, and that is not present at all).
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
True. But then again, you do not _really_ need vardef macros. Cheers, Taco
From: Hans Hagen
[asymptote eps] looks parsable
Those lines are only a bit of the output. It's preceded by horrible pstricks and font code to parse (about 800 lines in that eps file). I'm not sure why asymptote decided to use pstricks. I think it's for figure inclusion, but there have to be other, less hacky ways.
+ if (texengine == "tex") + abort("No babel package in plain TeX."); texpreamble("\usepackage["+s+"]{babel}");
btw, it should be: if texengine == latex then texpreamble ... else you need an abort for each macro package
Yeah, I'm not proud of it. By that point in the patching, I mostly
despaired of finding all the hardcoded latex spots and just added the
quickest hack to get something to work ("When the going gets tough,
the tough lower their standards.") Not that it worked in the end.
From: Taco Hoekwater
It would not be hard to add the cmyk color space, but transparancy can not easily be done in PostScript output (it would require overlap removal code, and that is not present at all).
That's true, and the pdfmark hack added to postscript doesn't support sending transparency information to a distiller (e.g. ps2pdf or Acrobat distiller). At least, it doesn't from what I could tell by looking in the PDFmark reference manual from Adobe: http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/pdf_creation_a... Maybe it's time to abandon postscript and generate pdf directly? About the only reason I sometimes run (non-pdf)tex is because I was too lazy to convert metapost figures to pdf and hadn't added the scons or Makefile rules to convert them automatically.
I've been browsing a bit and I now know it has more of a C++ style of doing things, but personally I don't see that as a big advantage.
I agree. Although perhaps related to the new syntax or the new implementation: it's useful to have many mathematical functions ready to use for graphing -- the asymptote authors keep adding functions from the GNU scientific library -- instead of having to divide or multiply by 256 (the metapost log and exp functions) or worry about overrunning the integer range (and use the sarith package in MP).
But more importantly, most of my illustrations depend heavily on the equation solving capabilities of MetaPost. I got the impression Asymptote cannot do that (but I may have missed something).
Right, I like the implicit equation solving in MP and find it very intuitive and matched to how I think about figures. Asymptote has only explicit equation solving. Laurence said (on the metapost list) that his 3D package for MP doesn't have implicit solving either -- I guess because the 3D objects are not native to MP so they don't benefit from the built-in equation solver. Maybe making 3d points native to MP is part of an answer to: What is actually needed to make it easy to do 3D in MP? But I'm far from an expert in 3D drawings or MP, and maybe one of the MP experts has more useful thoughts. -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
interesting (i assume that it produced pdf)
Yes with the difference that while Metapost, Asympthote and GLE (http://glx.sourceforge.net/) use their own proprietary language to do PDF graphics, Tioga(*) uses Ruby, a full featrured and very nice language. I even see more presence in the future of Ruby in ConTeXt. Isn'it? jk (*) Tioga has been written by Bill Paxton, a computer scientist. -- Jilani KHALDI http://jkhaldi.oltrelinux.com
I just had a look at the Tioga page and the figures are excellent. Though it looks even more wedded to LaTeX than asymptote is? -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
Jilani Khaldi wrote:
interesting (i assume that it produced pdf)
Yes with the difference that while Metapost, Asympthote and GLE (http://glx.sourceforge.net/) use their own proprietary language to do PDF graphics, Tioga(*) uses Ruby, a full featrured and very nice language. I even see more presence in the future of Ruby in ConTeXt. Isn'it?
well, if we can have \ruby {...} as we will have \lua {...} 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 -----------------------------------------------------------------
Hans Hagen wrote:
Jilani Khaldi wrote:
interesting (i assume that it produced pdf)
Yes with the difference that while Metapost, Asympthote and GLE (http://glx.sourceforge.net/) use their own proprietary language to do PDF graphics, Tioga(*) uses Ruby, a full featrured and very nice language. I even see more presence in the future of Ruby in ConTeXt. Isn'it?
well, if we can have \ruby {...} as we will have \lua {...}
It is just my 2c, but I really dislike the Tioga approach. It feels like typesetting a book in TeX by writing a single-shot pascal program. ;-) Specifically, I find code like this (Tioga): move_to_point(x0, y0) append_curve_to_path(x1, y1, x2, y2, x3, y3) far uglier than this (Asymptote/MetaPost): z0.. controls z1 and z2 .. z3 Taco
It is just my 2c, but I really dislike the Tioga approach. It feels like typesetting a book in TeX by writing a single-shot pascal program. ;-)
Specifically, I find code like this (Tioga):
move_to_point(x0, y0) append_curve_to_path(x1, y1, x2, y2, x3, y3)
far uglier than this (Asymptote/MetaPost):
z0.. controls z1 and z2 .. z3
Very true, but you forgot that in Tioga everything is done inside Ruby interpreter. Tioga is a Ruby extension so you could use the power of Ruby, its standard library and all the other extensions made for it inside Tioga. However, I don't like Asymptote, just seeing things like this: ---------------------- struct parent { real x=1; public void virtual(int) {write (0);} void f() {virtual(1);} } parent operator init() {return new parent;} void write(parent p) {write(p.x);} struct child { parent parent; real y=2; void virtual(int x) {write (x);} parent.virtual=virtual; void f()=parent.f; } parent operator cast(child child) {return child.parent;} child operator init() {return new child;} parent p; child c; write(c); // Outputs 1; p.f(); // Outputs 0; c.f(); // Outputs 1; write(c.parent.x); // Outputs 1; write(c.y); --------------- But, do we really need a baroque language like this to just draw some primitive graphics? jk -- Jilani KHALDI http://jkhaldi.oltrelinux.com
As far as we are discussing about graphics, actually my favorite and quick (and powreful) solution to produce pdf graphics not TeX-related is to use the graphic facilities of R, generating automatically scripts with code (http://www.r-project.org/). Best -a- On 22 Apr 2006, at 14:12, Jilani Khaldi wrote:
It is just my 2c, but I really dislike the Tioga approach. It feels like typesetting a book in TeX by writing a single-shot pascal program. ;-)
Specifically, I find code like this (Tioga):
move_to_point(x0, y0) append_curve_to_path(x1, y1, x2, y2, x3, y3)
far uglier than this (Asymptote/MetaPost):
z0.. controls z1 and z2 .. z3
Very true, but you forgot that in Tioga everything is done inside Ruby interpreter. Tioga is a Ruby extension so you could use the power of Ruby, its standard library and all the other extensions made for it inside Tioga. However, I don't like Asymptote, just seeing things like this: ---------------------- struct parent { real x=1; public void virtual(int) {write (0);} void f() {virtual(1);} } parent operator init() {return new parent;} void write(parent p) {write(p.x);} struct child { parent parent; real y=2; void virtual(int x) {write (x);} parent.virtual=virtual; void f()=parent.f; } parent operator cast(child child) {return child.parent;} child operator init() {return new child;} parent p; child c; write(c); // Outputs 1; p.f(); // Outputs 0; c.f(); // Outputs 1; write(c.parent.x); // Outputs 1; write(c.y); --------------- But, do we really need a baroque language like this to just draw some primitive graphics?
jk
-- Jilani KHALDI http://jkhaldi.oltrelinux.com
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Andrea Valle DAMS - Facoltà di Scienze della Formazione Università degli Studi di Torino http://www.semiotiche.it/andrea andrea.valle@unito.it
I started rewriting the asymptote code to use plain TeX -- I had never used ConTeXt back then, so didn't even try to make that work. But maybe the TeX changes will help those more expert in ConTeXt to make them. I'll dig out my half-finished changes for public onsumption. The asymptote authors said that they welcome asymptote working with other tex formats (someone else had asked about ConTeXt), and prefer, rather than their having to modify it themselves, that users of those formats submit the changes (they use LaTeX themselves). -Sanjoy
On 4/21/06, Sanjoy Mahajan wrote:
I started rewriting the asymptote code to use plain TeX -- I had never used ConTeXt back then, so didn't even try to make that work. But maybe the TeX changes will help those more expert in ConTeXt to make them. I'll dig out my half-finished changes for public onsumption.
The asymptote authors said that they welcome asymptote working with other tex formats (someone else had asked about ConTeXt),
Probably me ;) But I've given up once I saw how harcoded LaTeX was in there. 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. For me Asymptote to Metapost is like XeTeX to TeX: I think that the first one is better, but I "can't" use it. (3D, animation & big numbers support would be more than urgent for metapost, but it's so complex to modify the code that I can understand why it's easier to write a new engine like Asymptote than extending the old metapost.) There's a very similar situation with hardcoded LaTeX in PyX, Wiki2PDF, ... Well, people who write those don't write it with anything else but LaTeX in mind which is a pitty.
and prefer, rather than their having to modify it themselves, that users of those formats submit the changes (they use LaTeX themselves).
And thanks to Jilani for pointing out the existence of Tioga. Mojca
I've posted this to the metapost list as well:
I like metapost but, according to the following mail (on the metapost ML):
[metapost] MP vs. Asymptote I don't want to start a flame, but since someone posted a message some time ago mentioning Asymptote I got curious and I have to say that I was very impressed, even if I still have some problems with it. However, it seems a net improvement over MP, or not? Is there anyone with an informed opinion over Asymptote? Might Asymptote be the killer of MP?
I am extremely interested in what you feel the improvements are in Asymptote compared to MP, because it would give some clues to the direction MP development should take. I've been browsing a bit and I now know it has more of a C++ style of doing things, but personally I don't see that as a big advantage. Just like Laurence, I simply like the MF/MP 'feel'. But more importantly, most of my illustrations depend heavily on the equation solving capabilities of MetaPost. I got the impression Asymptote cannot do that (but I may have missed something). Cheers, Taco
participants (7)
-
andrea valle
-
Hans Hagen
-
Jilani Khaldi
-
Mojca Miklavec
-
Renaud AUBIN
-
Sanjoy Mahajan
-
Taco Hoekwater