3

The following two pictures are drawn in TikZ 3D (the first) and in Asymptote (the second). It is visible that the letter sizes for the Asymptote picture are bigger than the ones with TikZ 3D (for which they are the same as in text).

Short question: how to make them the same size as in the body text. For your convenience and references, the boxed formula is typed as a simple line of body text.

Details are below the code and pictures.

enter image description here

Code:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[pdftex]{graphicx}
\usepackage{euler,beton}
\usepackage[euler-digits,euler-hat-accent]{eulervm}
\usepackage{pgf,calc}
\usepackage{tikz,tkz-euclide,tikz-3dplot}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\usetkzobj{all}
\usetikzlibrary{fpu}
\usetikzlibrary{arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{intersections}
\usepackage[inline]{asymptote}


\begin{document}

\tikzset{point/.style={circle, thick, draw=black,fill=white, inner sep=0pt,minimum size=3pt}}%стиль вершин
\tikzset{line/.style={line cap=round,line join=round,>=triangle 45}}
\tikzset{point style/.append style = {minimum size = 3pt, fill = white,thick}}


$\boxed{AD=BC}$ 


\pgfmathsetmacro{\rt}{1/(sqrt(3))}
\pgfmathsetmacro{\height}{sqrt(2/3)}

\tdplotsetmaincoords{70}{50}

\begin{tikzpicture}[tdplot_main_coords, scale=4]
\coordinate [label= below:$A$] (A) at (0.5, -\rt/2, 0);
\coordinate [label= right:$B$] (B) at (0, \rt, 0);
\coordinate [label= left:$C$] (C) at (-0.5, -\rt/2, 0);
\coordinate [label= above:$D$] (D) at (0, 0,\height);
\draw [line, dash pattern=on 5pt off 5pt,dash phase=0.6pt] (B)--(C);
\draw [line, thick] (A)--(B)--(D)--(C)--(A)--(D);
\tkzDrawPoints(A,B,C,D) 
\end{tikzpicture}
\begin{asy}
settings.outformat = "pdf";
settings.prc = false;  // IMPORTANT
settings.render = 0;   // IMPORTANT
import three;
import geometry;
include "/home/.../MyAsyCommands.asy";//Insert a proper path to the file MyAsyCommands.asy I provide
texpreamble("\usepackage{euler,beton}");

size(5cm, 0);
currentprojection=orthographic((5,2,3));


real a=3;
real b=4;
real c=4;

triple A=(0,0,a);
triple B=(0,b,0);
triple C=(c,0,0);

draw(A--B--C--A,linewidth(1));
draw(O--A^^O--B^^O--C,dashed);

path3 p=O--(6,6*c/b,0);
path3 q=B--C;
path3 p1=O--(6,0,6*c/a);
path3 q1=A--C;

triple H1=intersectionpoint(p,q);
triple H2=intersectionpoint(p1,q1);

path3 h1=A--H1;
path3 h2=B--H2;
triple H=intersectionpoint(h1,h2);

draw(h1);
draw(h2);
draw(O--H,dashed);
opendot(Label("$H_2$",align=NW),H2);
opendot(Label("$H_1$",align=SE),H1);
opendot(Label("$H$",align=NE),H);
opendot(A);
opendot(Label("$B$",align=E),B);
opendot(Label("$C$",align=SW),C);
opendot(Label("$O$",align=S),O);

interaction constantsize = settings.autobillboard ? interaction(1,true) : interaction(0,true);

label(position=A, L=Label("$A$", align=N), constantsize);

draw(RightAngle(0.4,A,H1,C));
draw(RightAngle(0.4,B,H2,C));
\end{asy}
\end{document}

You could say: draw everything in TikZ 3D. This is not a solution since I need to use Asymptote intersection libraries (you can see in the example above how easy it was to find the points H_1 and H_2 - in TikZ that would be painful as I would need manually compute their coordinates). So I need the Asymptote solution.

I found this answer by Charles Staats. It definitely does the job, but it is not clear whether the final text size is the same as in text or not.

I attach the file MyAsyCommands.asy since this what one needs to compile the code above properly. The trick is definitely in the "opendot" command from this file as it is the one which labels the points. This command comes from my other question also answered by Charles.

//This is MyAsyCommands.asy file 
real UltraThin3=0.1;
real VeryThin3=0.2;
real Thin3=0.4;
real SemiThick3=0.6;
real Thick3=0.8;
real VeryThick3=1.2;
real UltraThick3=1.4;


pen ThickPen=linewidth(Thick3);

//========== Right angle ========================================
path3 RightAngle(real radius=0.2, triple A, triple B, triple C)
{
return B+radius*unit(A-B)--B+radius*(unit(A-B)+unit(C-B))--B+radius*unit(C-B);
}

//Single arced angle
path3 anglearc(real radius, triple A, triple B, triple C) {
  triple center = B;
  triple start = B + radius * unit(A-B);
  return arc(center, start, C,cross(A-B, C-B),CCW);
}

//========== Single arced angle ================================
path3 anglearc(real radius=0.5, triple A, triple B, triple C) {
  triple center = B;
  triple start = B + radius * unit(A-B);
  return arc(center, start, C,cross(A-B, C-B),CCW);
}
//====== Open Dot ========================================
void opendot(picture pic=currentpicture, triple v, material p=currentpen,
         light light=nolight, string name="", render render=defaultrender)
{
  pen q=(pen) p;
  pen fillpen = light.background;
  if (invisible(fillpen)) fillpen = currentlight.background;
  if (invisible(fillpen)) fillpen = white;
  real size=0.5*linewidth(dotsize(q)+q);
  pic.add(new void(frame f, transform3 t, picture pic, projection P) {
      triple V=t*v;
      assert(!is3D(), "opendot() not supported unless settings.prc == false and settings.render != 0");
      if(pic != null)
        dot(pic,project(V,P.t),filltype=FillDraw(fillpen=fillpen, drawpen=q));
    },true);
  triple R=size*(1,1,1);
  pic.addBox(v,v,-R,R);
}
//======= Open Dot ==========================================
void opendot(picture pic=currentpicture, Label L, triple v, align align=NoAlign,
             string format=defaultformat, material p=currentpen,
             light light=nolight, string name="", render render=defaultrender)
{
  Label L=L.copy();
  if(L.s == "") {
    if(format == "") format=defaultformat;
    L.s="("+format(format,v.x)+","+format(format,v.y)+","+
      format(format,v.z)+")";
  }
  L.align(align,E);
  L.p((pen) p);
  opendot(pic,v,p,light,name,render);
  label(pic,L,v,render);
}

dotfactor *= 1 ;  // Make dots twice as big as they are by default.


//====== Projection Point To Line 3================================================
triple ProjectionPointToLine3(triple M, triple B, triple C)
{
real t=dot(B-C,M-C)/((length(B-C))*(length(B-C)));
return C+(B-C)*t;
}
//======= Double Line =========================================================
void dblline(path3 g, real Linewidth=SemiThick3,real Hidewidth=SemiThick3,pen Pen=currentpen)
{
  pen linep=black+linewidth(Linewidth)+Pen;
  pen hidep=white+linewidth(Linewidth+2*Hidewidth)+Pen;

  draw(g,hidep);
  draw(g,linep);
}

//======= Extended Line ======================================================
void ExTendedLine(triple A, triple B, real FirstExtention=0.05,real SecondExtention=0.05,pen Pen=currentpen)
{
  triple A1=(A+(FirstExtention*length(A-B))*(A-B));
  triple B1=(B+(SecondExtention*length(B-A))*(B-A));
  draw(A1--B1,Pen);
}
//=============================================================
//Direction of a point toward the camera.
triple cameradirection(triple pt, projection P=currentprojection) {
if (P.infinity) {
return unit(P.camera);
} else {
return unit(P.camera - pt);
}
}
//=============================================================
//Move a point closer to the camera.
triple towardcamera(triple pt, real distance=1, projection P=currentprojection) {
return pt + distance * cameradirection(pt, P);
}

2 Answers 2

4

I recommend using asypictureB instead of asymptote to embed the picture in your document. Apart from making things more convenient (you only need to run pdflatex -shell-escape on the document and do no longer have to call asy separately) it also fixes the problem of different font sizes.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{euler,beton}
\usepackage[euler-digits,euler-hat-accent]{eulervm}
\usepackage{tikz,tkz-euclide,tikz-3dplot}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\usetkzobj{all}
\usetikzlibrary{fpu}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{intersections}
\usepackage[inline]{asymptote}
\usepackage{asypictureB}

\begin{document}

\tikzset{point/.style={circle, thick, draw=black,fill=white, inner sep=0pt,minimum size=3pt}}%AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAA
\tikzset{line/.style={line cap=round,line join=round,>=triangle 45}}
\tikzset{point style/.append style = {minimum size = 3pt, fill = white,thick}}


$\boxed{AD=BC}$ 


\pgfmathsetmacro{\rt}{1/(sqrt(3))}
\pgfmathsetmacro{\height}{sqrt(2/3)}

\tdplotsetmaincoords{70}{50}

\begin{tikzpicture}[tdplot_main_coords, scale=4]
\coordinate [label= below:$A$] (A) at (0.5, -\rt/2, 0);
\coordinate [label= right:$B$] (B) at (0, \rt, 0);
\coordinate [label= left:$C$] (C) at (-0.5, -\rt/2, 0);
\coordinate [label= above:$D$] (D) at (0, 0,\height);
\draw [line, dash pattern=on 5pt off 5pt,dash phase=0.6pt] (B)--(C);
\draw [line, thick] (A)--(B)--(D)--(C)--(A)--(D);
\tkzDrawPoints(A,B,C,D) 
\end{tikzpicture}
\begin{asypicture}{name=inter}
settings.outformat = "pdf";
settings.prc = false;  // IMPORTANT
settings.render = 0;   // IMPORTANT
import three;
import geometry;
include "MyAsyCommands.asy";//Insert a proper path to the file MyAsyCommands.asy I provide
//texpreamble("\usepackage[utf8]{inputenc}");
//texpreamble("\usepackage[OT1]{fontenc}");
texpreamble("\usepackage{euler,beton}");
texpreamble("\usepackage[euler-digits,euler-hat-accent]{eulervm}");

size(5cm, 0);
currentprojection=orthographic((5,2,3));


real a=3;
real b=4;
real c=4;

triple A=(0,0,a);
triple B=(0,b,0);
triple C=(c,0,0);

draw(A--B--C--A,linewidth(1));
draw(O--A^^O--B^^O--C,dashed);

path3 p=O--(6,6*c/b,0);
path3 q=B--C;
path3 p1=O--(6,0,6*c/a);
path3 q1=A--C;

triple H1=intersectionpoint(p,q);
triple H2=intersectionpoint(p1,q1);

path3 h1=A--H1;
path3 h2=B--H2;
triple H=intersectionpoint(h1,h2);

draw(h1);
draw(h2);
draw(O--H,dashed);
opendot(Label("$H_2$",align=NW),H2);
opendot(Label("$H_1$",align=SE),H1);
opendot(Label("$H$",align=NE),H);
opendot(A);
opendot(Label("$B$",align=E),B);
opendot(Label("$C$",align=SW),C);
opendot(Label("$O$",align=S),O);

interaction constantsize = settings.autobillboard ? interaction(1,true) : interaction(0,true);

label(position=A, L=Label("$A$", align=N), constantsize);

draw(RightAngle(0.4,A,H1,C));
draw(RightAngle(0.4,B,H2,C));
\end{asypicture}
\end{document}

enter image description here

0

I just modify some things from marmot's code.

enter image description here

// http://asymptote.ualberta.ca/
unitsize(1cm);
import three;
size(6cm);
texpreamble("\usepackage{euler,beton}");
texpreamble("\usepackage[euler-digits,euler-hat-accent]{eulervm}");
/////////////////////////////////////////////////////
// The foot of the perpendicular from P to line AB:
triple foot(triple P,triple A, triple B){ 
    real s=dot(P-A,unit(B-A)); 
    return A+s*unit(B-A);
}
/////////////////////////////////////////////////////
path3 markrightangle(triple A, triple B, triple C,real size=.2){
triple At=arcpoint(B--A,size); 
triple Ct=arcpoint(B--C,size);
triple Bt=At+Ct-B;  
return At--Bt--Ct;
}
/////////////////////////////////////////////////////

currentprojection=orthographic(5,2,3,zoom=.8);
real a=3, b=4,c=4;
triple A=(0,0,a), B=(0,b,0), C=(c,0,0);
triple H1=foot(A,B,C);
triple H2=foot(B,A,C);
triple H=intersectionpoint(A--H1,B--H2);
draw(A--H1^^B--H2,blue);
draw(A--B--C--cycle);
draw(O--A^^O--B^^O--C^^O--H,dashed);

dot(Label("$H_2$",align=NW),H2,blue);
dot(Label("$H_1$",align=SE),H1,blue);
dot(Label("$H$",align=NE),H,red);
label("$B$",align=E,B);
label("$C$",align=SW,C);
label("$O$",align=S,O);
//interaction constantsize = settings.autobillboard ? interaction(1,true) : interaction(0,true);
label(position=A, L=Label("$A$", align=N));
//label(position=A, L=Label("$A$", align=N), constantsize);


draw(markrightangle(A,H1,C));
draw(surface(markrightangle(B,H2,C)--H2--cycle),yellow);
draw(markrightangle(B,H2,C));

You must log in to answer this question.

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