2

KtikZ/QtikZ is handy for previewing TikZ code.

Is there an equivalent for Asymptote?

2
  • I haven't used it, but have you tried Asymptote's interactive drawing mode? asymptote.sourceforge.net/doc/Tutorial.html Commented Oct 22, 2013 at 12:11
  • @mrc, yes, the problem is that drawings in interactive mode are definitive, we can't erase mistakes, at least I don't know how. I'm very new to Asymptote.
    – juliohm
    Commented Oct 22, 2013 at 12:17

2 Answers 2

1

xasy provides a rudimentary but usable graphical interface for Asymptote.

see: http://asymptote.sourceforge.net/doc/GUI.html#GUI

3
  • I tried xasy before asking the question. Could you please explain how it is equivalent to KtikZ/QtikZ?
    – juliohm
    Commented Oct 22, 2013 at 14:39
  • Maybe you could expand on what type of equivalence you're looking for? Your response about the asymptote interactive mode seemed to suggest you were looking for a more graphical interface. Otherwise, simply open your myfig.asy file in your text editor of choice and repeatedly call "input myfig" from interactive drawing mode as you update your code.
    – Paul M.
    Commented Oct 23, 2013 at 2:25
  • 1
    I looking for automatic save/preview whenever I stop typing. A window in the left where I insert the code, and one in the right where I see the results instantaneously. No need for switching focus over multiple disconnected windows on the desktop.
    – juliohm
    Commented Oct 23, 2013 at 21:11
1

Because Asymptote can be used inside TeX with asymptote or asypictureB package, any solution in Is there any way to get real-time compilation for LaTeX? would trivially work here.

Example:

\documentclass{article}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{}
    unitsize(1cm);
    settings.outformat="pdf";
    draw("Hello world", (0, 0)--(1, 1));
\end{asypicture}
\end{document}

I'd recommend putting settings.outformat="pdf"; (alternatively put in asyheader block) in order to speed things up, because otherwise output format would be eps and LaTeX would have to manually convert it to PDF. Letting Asymptote output PDF directly is faster.


That having said, passing through a layer of TeX and/or latexmk consumes some extra time. So, normally I open vim a.asy, and run a script such as

echo a.asy | entr asy -f pdf a.asy

in a separate terminal for automatically recompiling on changes (make sure the terminal is visible so that you can read the error messages, if any), then use zathura or something with automatic update to view the resulting PDF.

The a.asy file maybe something like the following

settings.tex="latex";
settings.inlineimage=true;
settings.embed=true;
size(6cm);
defaultpen(fontsize(11pt));

draw("Hello world", (0, 0)--(1, 1));

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .