vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
542 stars 90 forks source link

Displaying labels including imported images seems to be problematic #344

Closed ghost closed 1 year ago

ghost commented 1 year ago

Setup:

Windows 10 Asymptote 2.83 Ghostscript 10.0.0


After compiling

import geometry;
import math;

size(7cm,0);

real theta=degrees(asin(0.5/sqrt(7)));

pair B=(0,sqrt(7));
pair A=B+2sqrt(3)*dir(270-theta);
pair C=A+sqrt(21);
pair O=0;

pair Ap=extension(A,O,B,C);
pair Bp=extension(B,O,C,A);
pair Cp=extension(C,O,A,B);

perpendicular(Ap,NE,Ap--O,blue);
perpendicular(Bp,NE,Bp--C,blue);
perpendicular(Cp,NE,Cp--O,blue);

draw(A--B--C--cycle);

draw("1",A--O,-0.25*I*dir(A--O));
draw(O--Ap);
draw("$\sqrt{7}$",B--O,LeftSide);
draw(O--Bp);
draw("4",C--O);
draw(O--Cp);

dot("$O$",O,dir(B--Bp,Cp--C),red);
dot("$A$",A,dir(C--A,B--A),red);
dot("$B$",B,NW,red);
dot("$C$",C,dir(A--C,B--C),red);
dot("$A'$",Ap,dir(A--Ap),red);
dot("$B'$",Bp,dir(B--Bp),red);
dot("$C'$",Cp,dir(C--Cp),red);

Label(graphic("piicon.png","width=2.5cm, bb=0 0 147 144"),Ap,5ENE);

by

asy.exe -f pdf <file_name>.asy,

in which piicon.png may be found here, one expects the following output

tttttt

But, the insertion of the last label (including the png file above), as the last line of the code intends, does not happen:

qqqqqq

johncbowman commented 1 year ago

You are missing the line: settings.tex="pdflatex";

ghost commented 1 year ago

In addition to the absence of

settings.tex="pdflatex";

another issue was indeed Label which should be label, in the last line.

johncbowman commented 1 year ago

Yes, otherwise you would simply create the Label without actually applying it. The original example is posted here: orthocenter.asy