In inline Asymptote, I can use packages like so:
usepackage("amsfonts");
label("$\mathbb R$", (0,0));
Generally, this works well. However, running latexmk
on this:
usepackage("myPersonalPackage");
label("$\mathbb R$", (0,0));
causes an Undefined control sequence. l.2 \ASYalign
error. (My personal package loads a bunch of packages, including the amsfonts
package, so it's not an issue with the \mathbb
.)
In fact, when I use vimtex's compiler (I'm not 100% clear what it is, but I think it's some form of latexmk
), I get the following errors:
1 test.aux|3 error| Undefined control sequence. \bbl@cs
2 test.aux|3 error| LaTeX Error: Missing \begin{document}.
3 test-1.tex|13 error| Undefined control sequence. \ASYalign
4 test-1.tex|13 error| Undefined control sequence.
I understand that \ASYalign
is used when labeling things, and playing around with my own package shows me that the issue is that my style file automatically loads \usepackage[inline]{asymptote}
. (Actually, the inline option isn't necessary to break things; \usepackage{asymptote}
causes the same errors, assuming I load the inline option in the tex document itself.)
I was just wondering what it is about the Asymptote package which causes this error (and also what this bbl@cs
error is; I couldn't figure it out since the only thing in my aux file is "\relax
").
A few separate notes, if anybody has time:
- Running vimtex's compiler twice often fixes things, whereas running
latexmk
twice doesn't do anything. - I've heard that removing the
test-1.tex
file will help, but it only sometimes works. - Does anyone have any suggested workarounds that don't require me to manually load Asymptote onto each tex file? (It's okay if not; it's not like it's that much work, since I use a snippet anyway to start tex files.)
- Alternatively, does anyone know how to pass options in the
usepackage("PACKAGE")
command in Asymptote? If so, I can just do something likeusepackage("myPersonalPackage","skipAsy");
instead.
asy
docs, p.53: The routinevoid usepackage(string s, string options="");
provides a convenient abbreviation fortexpreamble("\usepackage["+options+"]{"+s+"}");
that can be used for importing LaTeX packages.