Skip to content

Instantly share code, notes, and snippets.

@jbaum98
Last active July 28, 2020 22:45
Show Gist options
  • Save jbaum98/1053899bf05711b9bb77a06bf62452bb to your computer and use it in GitHub Desktop.
Save jbaum98/1053899bf05711b9bb77a06bf62452bb to your computer and use it in GitHub Desktop.
Asymptote bug reproduce

This was to reproduce a bug I'd been having with Asymptote, but was actually me not passing the correct arguments. You need to explicitly pass -tex xelatex or whatever TeX engine you're using, and this example has been updated to do that in the Makefile.

size(4 inch);
draw(unitcircle);
label("$A = \pi r^2$");
sub asy {return system("asy \"$_[0]\"");}
add_cus_dep("asy","eps",0,"asy");
add_cus_dep("asy","pdf",0,"asy");
add_cus_dep("asy","tex",0,"asy");
%.pdf: %.tex
latexmk --xelatex $<
test_external.pdf: circle.tex circle_0.eps circle.pre
circle.tex circle_0.eps circle.pre: circle.asy
asy -inlinetex -tex xelatex $<
\documentclass[12pt]{article}
\usepackage[inline]{asymptote}
\begin{document}
\newcommand{\area}[1]{\pi #1^2}
\begin{asy}
size(4 inch);
label("$A = \area{r}$");
draw(unitcircle);
\end{asy}
\end{document}
\documentclass[12pt]{article}
\usepackage{asymptote}
\input circle.pre
\begin{document}
\input circle.tex
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment