0

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:

  1. Running vimtex's compiler twice often fixes things, whereas running latexmk twice doesn't do anything.
  2. I've heard that removing the test-1.tex file will help, but it only sometimes works.
  3. 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.)
  4. Alternatively, does anyone know how to pass options in the usepackage("PACKAGE") command in Asymptote? If so, I can just do something like usepackage("myPersonalPackage","skipAsy"); instead.
2
  • 1
    From asy docs, p.53: The routine void usepackage(string s, string options=""); provides a convenient abbreviation for texpreamble("\usepackage["+options+"]{"+s+"}"); that can be used for importing LaTeX packages.
    – g.kov
    Jan 25, 2021 at 15:31
  • Oh, that's great! I don't know if you want, but if you just make that an answer and nobody has a better one, I can just give you the bounty? Since I guess the 50 points would otherwise just go to waste
    – boink
    Jan 25, 2021 at 17:17

1 Answer 1

1
+50

Answer copied from comment.

From asy docs, p.53:

The routine

void usepackage(string s, string options="");

provides a convenient abbreviation for

texpreamble("\usepackage["+options+"]{"+s+"}");

that can be used for importing LaTeX packages.

You must log in to answer this question.

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