TeX - LaTeX Asked by Allok on December 8, 2020
I want to draw this simple picture:
The shapes of points (blue circles) are not important, they are just for example.
The point is that I want to have smth like variable R inside {tikzpicture} drawing the picture. It will give an opportunity to generate automatically different pictures. I’ve found some examples of using variables, but they are not, what I want.
A pseudocode of what I expect:
double R = 10;
coordinate (A) at (0, 0);
coordinate (B) at (-R, 0);
coordinate (C) at (-R, R);
draw (A) circle (R);
draw (B) -- (C);
fill[blue] (A) circle (1pt);
fill[blue] (B) circle (1pt);
fill[blue] (C) circle (1pt);
How can I do that in tex?
like this
documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
begin{document}
defR{3cm}
begin{tikzpicture}
coordinate (A) at (0, 0);
coordinate (B) at ({-R}, 0);
coordinate (C) at (-R, R);
draw (A) circle ({R});
draw (B) -- (C);
fill[blue] (A) circle (1pt);
fill[blue] (B) circle (1pt);
fill[blue] (C) circle (1pt);
end{tikzpicture}
end{document}
Answered by rpapa on December 8, 2020
a rough approximation with tkz-euclide
documentclass{article}
usepackage{tkz-euclide}
begin{document}
begin{tikzpicture}[]
%arbitrary points
tkzDefPoint(0,3){A}
tkzDefPoint(0,-3){B}
%tangent to circle
%mid point of tangent line
tkzDefMidPoint(B,A)tkzGetPoint{P}
tkzDrawLine[add=0.8 and 0](A,P)
tkzDrawPoint(P)
%perpendicular to tangent
tkzDefLine[orthogonal =through P](A,B)tkzGetPoint{X}tkzDrawPoint(X)
%draw circle with radius XP
tkzDefCircle[through](X,P)
tkzDrawCircle(X,P)
end{tikzpicture}
end{document}
Answered by js bibra on December 8, 2020
You can use your syntax almost literally except that you have to add backslashes. I also use circle[radius=R]
instead of circle (R)
, but the latter would work, too, and use a loop for the blue circles.
documentclass[tikz,border=3mm]{standalone}
begin{document}
begin{tikzpicture}[declare function={R = 4;}]
coordinate (A) at (0, 0);
coordinate (B) at (-R, 0);
coordinate (C) at (-R, R);
draw (A) circle[radius=R];
draw (B) -- (C);
foreach X in {A,B,C}
{fill[blue] (X) circle[radius=1pt];}
end{tikzpicture}
end{document}
Answered by user229669 on December 8, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP