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
-----------------------------------------------------------------
_______________________________________________
dev-context mailing list
dev-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/dev-context

Reply via email to