Hello Hans, Asymptote developers wonder if there's a way to pipe to ConTeXt. I didn't start inspecting anything as I suspect that it's quite possible that nobody has ever tried that so far. The trick that John Bowman decided to use was to "\input null" (an empty tex file "null.tex"), but I already had problems because I (forgot that I) didn't have that file. Mojca
On Sat, 23 May 2009, Mojca Miklavec wrote:
Hello Hans,
Asymptote developers wonder if there's a way to pipe to ConTeXt.
More precisely, they want to do the following: context misc/null ... ... * \newbox\ASYbox \newdimen\ASYdimen \long\def\ASYbase#1#2{\leavevmode\setbox\ASYbox=\hbox{#1}\ASYdimen=\ht\ASYbox% \setbox\ASYbox=\hbox{#2}\lower\ASYdimen\box\ASYbox} \font\ASYfont=lmr12 at 12pt\ASYfont\switchtobodyfont[12pt]% % (Please type a command or say `\end') *\setbox\ASYbox=\hbox{$x$} * * * * * * *(Please type a command or say `\end') *\showthe\wd\ASYbox
6.67703pt.
etc... (for the moment, ignore the fact that the font setup is incorrect)
I didn't start inspecting anything as I suspect that it's quite possible that nobody has ever tried that so far.
Ideal will be to have --interactive switch.
The trick that John Bowman decided to use was to "\input null" (an empty tex file "null.tex"), but I already had problems because I (forgot that I) didn't have that file.
Do you know someone who maintains a major ConText distribution. Maybe you can ask her to add that file :-) Aditya
Aditya Mahajan wrote:
context misc/null .... .... * \newbox\ASYbox \newdimen\ASYdimen \long\def\ASYbase#1#2{\leavevmode\setbox\ASYbox=\hbox{#1}\ASYdimen=\ht\ASYbox%
\setbox\ASYbox=\hbox{#2}\lower\ASYdimen\box\ASYbox} \font\ASYfont=lmr12 at 12pt\ASYfont\switchtobodyfont[12pt]% % (Please type a command or say `\end') *\setbox\ASYbox=\hbox{$x$}
* * * * * * *(Please type a command or say `\end') *\showthe\wd\ASYbox
6.67703pt.
etc... (for the moment, ignore the fact that the font setup is incorrect)
hm, this should be possible but you should keep in mind then that the run is separate from the main run so dimensions (and fonts and ...) might not reflect reality if real integration is needed, a multipass approach might make more sense (ok, one can pass environments to the null run if needed) (1) run asymptote from current run on tex file, (2) during that run asymptote creates a tex file, (3) after the run tex picks up its run and processes that tex file writing dimensions to another file, (4) another asymptote run uses those dimensions anyhow, it all depends on what one wants to achieve ... in mkiv we can also think of: (1) open socket connection, (2) run asymptote from current run on tex file (in parallel), (3) communicate via socket till done i'm not sure how well this works, maybe just pipes are better, but experiments that we did with that (before mplib) made us pessimistic as there are platform and timing issues involved ----------------------------------------------------------------- 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 -----------------------------------------------------------------
On Sat, May 23, 2009 at 17:19, Aditya Mahajan wrote:
Do you know someone who maintains a major ConText distribution.
Indeed I have very poor contacts (I don't know many people even if they live in the same village).
Maybe you can ask her to add that file :-)
Once we figure out if it's needed for this purpose at all. Mojca
On Sun, 24 May 2009, Mojca Miklavec wrote:
Maybe you can ask her to add that file :-)
Once we figure out if it's needed for this purpose at all.
There is already a use for it. When you type \input nonexistantfile, then you can type "null" at the tex prompt to make tex continue with the rest of the compilation. And there is no harm in adding the file, it is really small :) Aditya
Aditya Mahajan wrote:
On Sun, 24 May 2009, Mojca Miklavec wrote:
Maybe you can ask her to add that file :-)
Once we figure out if it's needed for this purpose at all.
There is already a use for it. When you type \input nonexistantfile, then you can type "null" at the tex prompt to make tex continue with the rest of the compilation. And there is no harm in adding the file, it is really small :)
i actually have in the past) removed that null.tex because i don't like that kind of hackery; also there are other ways to stop tex 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 -----------------------------------------------------------------
Aditya Mahajan wrote:
On Sat, 23 May 2009, Mojca Miklavec wrote:
Hello Hans,
Asymptote developers wonder if there's a way to pipe to ConTeXt.
More precisely, they want to do the following:
context misc/null .... .... * \newbox\ASYbox \newdimen\ASYdimen \long\def\ASYbase#1#2{\leavevmode\setbox\ASYbox=\hbox{#1}\ASYdimen=\ht\ASYbox%
\setbox\ASYbox=\hbox{#2}\lower\ASYdimen\box\ASYbox} \font\ASYfont=lmr12 at 12pt\ASYfont\switchtobodyfont[12pt]% % (Please type a command or say `\end') *\setbox\ASYbox=\hbox{$x$}
* * * * * * *(Please type a command or say `\end') *\showthe\wd\ASYbox
6.67703pt.
a more context friendly way would be to load a module that defined a few commands, like \newbox\ASYbox \def\showASYdimensions {\immediate\write16{ASY whd: \the\wd\ASYbox\space \the\ht\ASYbox\space \the\dp\ASYbox\space}} \long\def\setASYhbox#1% {\setbox\ASTbox\hbox{#1}\showASYdimensions} \long\def\setASYvbox#1% {\setbox\ASTbox\vbox{#1}\showASYdimensions} or whatever set of commands is needed. Kind of a ASY interface. That way we can finetune at the tex level, for instance: \long\def\setASYhbox#1% {\setbox\ASTbox\hbox{\strut#1}% \showASYdimensions} \long\def\setASYvbox#1% {\setbox\ASTbox\vbox{\forgetall\begstrut#1\endstrut}% \showASYdimensions} which might give better output ----------------------------------------------------------------- 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:
a more context friendly way would be to load a module that defined a few commands, like
I think that is not the point. The point is that sometimes you want to pipe input directly into context, and you simply can't at the moment, because context and texexec refuse to run without an input file name. Everything else that is discussed in this thread is just a distraction. Best wishes, Taco
Taco Hoekwater wrote:
Hans Hagen wrote:
a more context friendly way would be to load a module that defined a few commands, like
I think that is not the point. The point is that sometimes you want to pipe input directly into context, and you simply can't at the moment, because context and texexec refuse to run without an input file name.
sure, that's why we have --pipe now
Everything else that is discussed in this thread is just a distraction.
indeed, but since we're discussing asymptote support it makes sense to see how we do it as convenient as possible (for instance i can imagine that graphics made that wat somehow need to match the parent doc and so) as a side effect, "context --global m-asymp" with m-asymp being an empty file or one defining a few helpers would automatically enter scroll mode -) 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 -----------------------------------------------------------------
Mojca Miklavec wrote:
Asymptote developers wonder if there's a way to pipe to ConTeXt. I didn't start inspecting anything as I suspect that it's quite possible that nobody has ever tried that so far.
i have no clue what that means; context is just using tex so anything that applies to tex (the engine) applies to context do you know why this piping is needed? 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 -----------------------------------------------------------------
participants (4)
-
Aditya Mahajan
-
Hans Hagen
-
Mojca Miklavec
-
Taco Hoekwater