2

In 2D pictures the inline mode works well; the labels are typeset with the right font. In 3D pictures I get labels in Computer Modern.

What is wrong here?

MWE:

% LuaLaTeX
\documentclass[12pt]{article}

\usepackage[math-style=upright]{unicode-math}
\setmainfont{Tex Gyre Pagella}
\setmathfont{Tex Gyre Pagella Math}


\usepackage[inline]{asymptote}


\begin{document}

Labels in Computer Modern (bad):
\begin{asy}
import three;
import graph3;
currentprojection=orthographic(8,4,2,center=true);
size(10cm);
size3(3cm,5cm,8cm);
draw(unitbox,dashed);
dot(unitbox,red);
xaxis3(Label("$x$",1),xmax=1.25,Arrow3);
yaxis3(Label("$y$",1),ymax=1.25,Arrow3);
zaxis3(Label("$z$",1),zmax=1.25,Arrow3);
xaxis3(Label("$\hat x$",.5),xmax=.5,Arrow3);
yaxis3(Label("$\hat y$",.5),ymax=.5,Arrow3);
zaxis3(Label("$\hat z$",.5),zmax=.5,Arrow3);
label("$O$",(0,0,0),NW);
draw ((0,0,0) --(1,1,1),Arrow3);
draw(arc(c=O,0.5*X,X+Y+Z), L = Label("$a$", position=MidPoint,align=(0,1)));
draw(arc(c=O,0.5*Y,X+Y+Z), L = Label("$b$", position=MidPoint,align=(0,1)));
draw(arc(c=O,0.5*Z,X+Y+Z), L = Label("$c$", position=MidPoint,align=(0,1)));
\end{asy}
\vskip\baselineskip
Labels in Pagella (good):
\begin{asy}
settings.render = 4;
size(4cm,0);
pen colour1=red;
pen colour2=green;
pair z0=(0,0);
pair z1=(-1,0);
pair z2=(1,0);
real r=1.5;
path c1=circle(z1,r);
path c2=circle(z2,r);
fill(c1,colour1);
fill(c2,colour2);
picture intersection=new picture;
fill(intersection,c1,colour1+colour2);
clip(intersection,c2);
add(intersection);
draw(c1);
draw(c2);
draw("$A$",box,z1); // Requires [inline] package option.
draw("$B$",box,z2); // Requires [inline] package option.
pair z=(0,-2);
real m=3;
margin BigMargin=Margin(0,m*dot(unit(z1-z),unit(z0-z)));
draw(Label("$A\cap B$",0),conj(z)--z0,Arrow,BigMargin);
draw(Label("$A\cup B$",0),z--z0,Arrow,BigMargin);
draw(z--z1,Arrow,Margin(0,m));
draw(z--z2,Arrow,Margin(0,m));
shipout(bbox(0.25cm));
\end{asy}

\end{document}

enter image description here

1 Answer 1

3

You need to tell Asymptote about your non-standard fonts at the beginning of your 3D asy code (or within a \begin{asydef}\end{asydef} section); otherwise it has no way of knowing about them (the typesetting of the 2D fonts is delegated to TeX via the inline option, but TeX knows nothing about 3D):

 texpreamble("\usepackage[math-style=upright]{unicode-math}");
 defaultpen(fontcommand("\setmainfont{Tex Gyre Pagella}"));
 defaultpen(fontcommand("\setmathfont{Tex Gyre Pagella Math}"));
4
  • Can you give us the complete code that allows us to test your solution easily?
    – AndréC
    Aug 10, 2020 at 16:09
  • 2
    General note: Please don't downvote the author of the package under discussion. Aug 11, 2020 at 1:00
  • 1
    Trying to summarize this answer: the inline option does not really apply to 3D labels, only 2D labels. If you want to apply TeX changes to 3D labels, you have to tell Asymptote about those changes directly, exactly as if you were not using the inline option. Aug 11, 2020 at 1:06
  • OK, I see. So the ìnline mode is useless when you draw many pictures in 3D. Aug 11, 2020 at 8:44

You must log in to answer this question.

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