KtikZ/QtikZ is handy for previewing TikZ code.
Is there an equivalent for Asymptote?
KtikZ/QtikZ is handy for previewing TikZ code.
Is there an equivalent for Asymptote?
xasy provides a rudimentary but usable graphical interface for Asymptote.
xasy before asking the question. Could you please explain how it is equivalent to KtikZ/QtikZ?
– juliohm
Oct 22 '13 at 14:39
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.
Oct 23 '13 at 02:25
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));