2

I've tried really hard to look for all kinds of solutions but so far nothing seems to have helped.

\begin{figure}
\centering
\begin{asy}
    include graph;
    size(3inch);

    pair A,B,C,D,E,F,G,H,I;
    A = (0,0);
    B = (12/11, 18/11);
    C = (18/11, 27/11);
    D = (24/7, 6/7);
    E = (36/7, 9/7);
    F = (1/10, 59/30);
    G = (9/2, 1/2);
    H = (7/10, 83/30);
    I = (6, 1);

    draw(F--G, Arrows, MidArrow);
    draw(H--I, Arrows, MidArrow);
    draw(E--A--C--D);
    label("test",(0,0),N);

\end{asy}
\end{figure}

Everything seems to work fine until I add the last line with the label.

Even stranger, while it works with my setup in TeXnicCenter, nothing compiles correctly when I run it from the command line:

asy -vvv ".\filename.asy"

Using configuration directory C:/Users/b/.asy
Loading config.asy from C:/Users/b/.asy/config.asy
Using history C:/Users/b/.asy/history
Welcome to miktex-asy version 2.41
cd F:\Documents\Math\
Processing filename
Loading plain from C:\Program Files (x86)\Asymptote/plain.asy
Including plain_constants from C:\Program Files (x86)\Asymptote/plain_constants.asy
Loading version from C:\Program Files (x86)\Asymptote/version.asy
Including plain_strings from C:\Program Files (x86)\Asymptote/plain_strings.asy
C:\Program Files (x86)\Asymptote/plain_strings.asy: 235.16: no matching function 'format(<overloaded>, bool, string, real, <overloaded>)'
C:\Program Files (x86)\Asymptote/plain_strings.asy: 235.17: use of variable 'format' is ambiguous
C:\Program Files (x86)\Asymptote/plain_strings.asy: 235.53: use of variable 'locale' is ambiguousIncluding plain_pens from C:\Program Files (x86)\Asymptote/plain_pens.asy

Including plain_paths from C:\Program Files (x86)\Asymptote/plain_paths.asy
Including plain_filldraw from C:\Program Files (x86)\Asymptote/plain_filldraw.asy
Including plain_margins from C:\Program Files (x86)\Asymptote/plain_margins.asy
Including plain_picture from C:\Program Files (x86)\Asymptote/plain_picture.asy
Loading plain_scaling from C:\Program Files (x86)\Asymptote/plain_scaling.asy
Loading simplex from C:\Program Files (x86)\Asymptote/simplex.asy
Loading plain_bounds from C:\Program Files (x86)\Asymptote/plain_bounds.asy
Including plain_scaling from C:\Program Files (x86)\Asymptote/plain_scaling.asy
Including plain_prethree from C:\Program Files (x86)\Asymptote/plain_prethree.asy
C:\Program Files (x86)\Asymptote/plain_picture.asy: 175.48: no matching variable 'xasyKEY'
C:\Program Files (x86)\Asymptote/plain_picture.asy: 214.51: no matching variable 'xasyKEY'
C:\Program Files (x86)\Asymptote/plain_picture.asy: 702.7: no matching variable 'xasyKEY'
C:\Program Files (x86)\Asymptote/plain_picture.asy: 712.7: no matching variable 'xasyKEY'
C:\Program Files (x86)\Asymptote/plain_picture.asy: 978.9: no matching variable 'xasyKEY'Including plain_Label from C:\Program Files (x86)\Asymptote/plain_Label.asy

Including plain_shipout from C:\Program Files (x86)\Asymptote/plain_shipout.asy
C:\Program Files (x86)\Asymptote/plain_shipout.asy: 5.12: no matching field of name 'xasy' in 'settings'
C:\Program Files (x86)\Asymptote/plain_shipout.asy: 71.14: no matching function 'deconstruct(frame, frame, transform)'
C:\Program Files (x86)\Asymptote/plain_shipout.asy: 89.14: no matching field of name 'xasy' in 'settings'
C:\Program Files (x86)\Asymptote/plain_shipout.asy: 102.3: no matching variable '_shipout'
C:\Program Files (x86)\Asymptote/plain_shipout.asy: 102.37: use of variable 'format' is ambiguous
C:\Program Files (x86)\Asymptote/plain_shipout.asy: 102.49: use of variable 'view' is ambiguousIncluding plain_arcs from C:\Program Files (x86)\Asymptote/plain_arcs.asy

Including plain_boxes from C:\Program Files (x86)\Asymptote/plain_boxes.asy
Including plain_markers from C:\Program Files 
(x86)\Asymptote/plain_markers.asy
Including plain_arrows from C:\Program Files (x86)\Asymptote/plain_arrows.asy
Including plain_debugger from C:\Program Files (x86)\Asymptote/plain_debugger.asy
Loading filename.asy from filename.asy
error: could not load module '.\filename.asy'

The last two lines of this log are mutually exclusive. Some of my files when compiled give the last line, others give the second to last line. Which one it is seems to be random, can't tell what causes one file to output one instead of the other.

I don't understand why other people have such clean outputs, but mine has this "xasy" stuff and errors out at the end. I've spent countless hours digging a rabbit hole and I'm completely out of ideas.

EDIT: MWE as requested.

\documentclass{article}
\usepackage{asymptote}

\begin{document}
\begin{figure}
\begin{asy}
    include graph;
    size(3inch);

    pair A,B;
    A = (0,0);
    B = (2,1);
    draw(A--B);

\end{asy}
\end{figure}
\end{document}

EDIT: @marmot, here's the log when I try your method.

Attempting to run asy on LaTeX2-labels.asy

! Package asypictureB Error:
Possible Asymptote error:
asy: warning: running with administrator privileges
warning: package 'asymptote' is not installed

     run 'mpm --install asymptote' to install it

C:\Program Files (x86)\Asymptote/plain_strings.asy: 235.16: no matching function 'format(<overloaded>, bool, string, real, <overloaded>)'

C:\Program Files (x86)\Asymptote/plain_strings.asy: 235.17: use of variable 'format' is ambiguous

C:\Program Files (x86)\Asymptote/plain_strings.asy: 235.53: use of variable 'locale' is ambiguous

C:\Program Files (x86)\Asymptote/plain_picture.asy: 175.48: no matching variable 'xasyKEY'

C:\Program Files (x86)\Asymptote/plain_picture.asy: 214.51: no matching variable 'xasyKEY'

C:\Program Files (x86)\Asymptote/plain_picture.asy: 702.7: no matching variable 'xasyKEY'

C:\Program Files (x86)\Asymptote/plain_picture.asy: 712.7: no matching variable 'xasyKEY'

C:\Program Files (x86)\Asymptote/plain_picture.asy: 978.9: no matching variable 'xasyKEY'

C:\Program Files (x86)\Asymptote/plain_shipout.asy: 5.12: no matching field of name 'xasy' in 'settings'

C:\Program Files (x86)\Asymptote/plain_shipout.asy: 71.14: no matching function 'deconstruct(frame, frame, transform)'

C:\Program Files (x86)\Asymptote/plain_shipout.asy: 89.14: no matching field of name 'xasy' in 'settings'

C:\Program Files (x86)\Asymptote/plain_shipout.asy: 102.3: no matching variable '_shipout'

C:\Program Files (x86)\Asymptote/plain_shipout.asy: 102.37: use of variable 'format' is ambiguous

C:\Program Files (x86)\Asymptote/plain_shipout.asy: 102.49: use of variable 'view' is ambiguous

.

See the asypictureB package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.27 \end{asypicture}

I attempted to follow the instructions to install asymptote, but I got:

Sorry, but "MiKTeX Package Manager" did not succeed for the following reason:

Package "asymptote" is already installed
6
  • 1
    I have included my MWE, anything else I add to this (declaring a string, adding a label, etc.) does not seem to work. Please let me know if there's anything else you'd like to see or if I did something incorrectly here.
    – CosmoVibe
    Mar 18, 2019 at 15:22
  • As far as I can tell, thats all, and you get my +1 :) Mar 18, 2019 at 15:23
  • 1
    Well you get warning: package 'asymptote' is not installed. And even if you do not get asypictureB running for some reason, you can still add settings.outformat = "pdf"; to your examples and run asy.
    – user121799
    Mar 18, 2019 at 16:23
  • I added more detailed instructions on the compilation chain to my answer. "It does not work" is not a very qualified statement as long as you do not say what "it" is. My codes do work, at least on my TeXLive installation when compiled with the usual chain.
    – user121799
    Mar 18, 2019 at 16:29
  • 1
    This sounds like an installation issue. Most likely you have multiple copies of something (Asymptote, TeX, ...) and incorrectly using each others' files. Mar 18, 2019 at 18:47

1 Answer 1

2

According to what I find you only need to specify the output format. So you need to compile

\documentclass{article}
\usepackage{asymptote}
\begin{document}
\begin{figure}
\centering
\begin{asy}
    include graph;
    size(3inch);
    settings.outformat = "pdf";

    pair A,B,C,D,E,F,G,H,I;
    A = (0,0);
    B = (12/11, 18/11);
    C = (18/11, 27/11);
    D = (24/7, 6/7);
    E = (36/7, 9/7);
    F = (1/10, 59/30);
    G = (9/2, 1/2);
    H = (7/10, 83/30);
    I = (6, 1);

    draw(F--G, Arrows, MidArrow);
    draw(H--I, Arrows, MidArrow);
    draw(E--A--C--D);
    label("test",(0,0),N);

\end{asy}
\end{figure}
\end{document}

with pdflatex, run asy <filename-1.asy>, and then compile the tex file again with pdflatex to obtain

enter image description here

Otherwise the figure becomes too bulky.

As for your original figure, IMHO it is advantageous to use asypictureB. Then you only need to run pdflatex -shell-escape (or replace pdflatex by xelatex or lualatex) on

\documentclass{article}
\usepackage{asypictureB}
\begin{document}
\begin{figure}
\centering
\begin{asypicture}{name=labels}
    include graph;
    size(3inch);
    settings.outformat = "pdf";

    pair A,B,C,D,E,F,G,H,I;
    A = (0,0);
    B = (12/11, 18/11);
    C = (18/11, 27/11);
    D = (24/7, 6/7);
    E = (36/7, 9/7);
    F = (1/10, 59/30);
    G = (9/2, 1/2);
    H = (7/10, 83/30);
    I = (6, 1);


    draw(F--G, Arrows, MidArrow);
    draw(H--I, Arrows, MidArrow);
    draw(E--A--C--D);
    label("test",position=(0,0),align=S);
\end{asypicture}
\caption{Test.}
\end{figure}
\end{document}

to obtain

enter image description here

6
  • Unfortunately this doesn't work. Also fails to compile. Exact same error log (but see edit, I'm getting a mix of the last error message). :(
    – CosmoVibe
    Mar 18, 2019 at 16:07
  • 1
    @CosmoVibe It does work, at least on my machine which has a standard TeXLive installation. Please run pdflatex -shell-escape on my second example.
    – user121799
    Mar 18, 2019 at 16:09
  • added the log after trying your method
    – CosmoVibe
    Mar 18, 2019 at 16:17
  • @CosmoVibe I guess that you are confusing about Asymptote package and Asymptote program. Did you install Asymptote program?
    – Black Mild
    Mar 19, 2019 at 17:01
  • @BlackMild Judging from the question, the answer is probably yes because the output seems to be fine before adding a label.
    – user121799
    Mar 19, 2019 at 17:13

You must log in to answer this question.

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