10

This question may seem repetitive to many, but as I am very new to Latex, even after reading many posts, could not get to draw what I wanted, so asking. I want to draw as the following. enter image description here

I have written the following code, Please help further.

\documentclass[11pt, oneside]{article}
\usepackage{geometry}                       % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                          % ... or a4paper or a5paper or ... 
\geometry{landscape}  
\usepackage{tikz}   % TeX will automatically convert eps --> pdf in pdflatex    
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{gensymb}
\usepackage{tkz-euclide}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}
\usepackage{graphicx}
\usetikzlibrary{plotmarks}  
\title{}
\author{}

\begin{document}
\begin{tikzpicture}

\draw (0,0) circle(2) node [left] {P};
\draw (3.5,0) circle(1.5) node [below] {Q};
\draw (0,0) -- (14,0) node [right] {O};

\newcommand*{\Radius}{2cm}%
   \coordinate (Origin) at (0,0);
   \coordinate (O) at (14,0);% External point

\tkzDrawCircle[R](Origin,\Radius)
   \tkzTangent[from with R= O](Origin,\Radius)  \tkzGetPoints{R}{I} 

   \tkzDrawSegments[ultra thick](O,R)% First tangent
   \tkzDrawSegments[ultra thick](O,I)% Second tangent
\end{tikzpicture}
\end{document}
4
7

I give my personal answer because It's preferable to avoid to mix syntaxes ( tikz and euclide ) and I added some remarks. I take big parts from hpesoj626's answer.

Firstly, I prefer to use several parts in my code, I created tkz-euclide to do this: definition, calculations, drawings and labels. If you study tikz enough, you will be able to use only tikz and to put tkz-euclide in the trash.

Remarks about definitions

  1. You can use coordinate here from tikz but if you use another system of coordinates from tkz then you can go down some complications.
  2. \pgfmathsetmacro is more tikzien but you need to add the unity after

Remarks about calculations : none it's fine

Remarks about drawings :

  1. In general with tkz-euclide macros come by pair like \tkzDrawSegment and \tkzDrawSegments. The second is to draw several objects with the same options but if you need specific options, then you need to use the first form.
  2. option add. I added to tkz-euclide the possibility to use tikz option but I added somme specific option that I created. You can use add = n and m to extend a line (n and m are a percent of the length of the line. I prefer this possibility because it's easy to add half of a line or to double the line.

Remarks about labels :

The same remarks about the pair of macros. You can add labels with general options or with specific ones.

Conclusion tkz-euclide is useful only if you need to draw several pictures and if you want to write rapidly your code but for one picture, I think it's preferable to study tikz. With tkz-euclide you need to know some options from tikz.

So a tkz-euclide solution is

\documentclass{article}
\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}[scale=.8]

% definitions
\tkzDefPoint(0,0){Origin}
\tkzDefPoint(3.5,0){Q}
\tkzDefPoint(14,0){O}
\pgfmathsetmacro{\Radius}{2}

% calculations
\tkzTangent[from with R = O](Origin,\Radius cm)  \tkzGetPoints{R}{I} 
\tkzInterLC[R](Q,Origin)(Q,1.5cm) \tkzGetPoints{M}{N}
\tkzTangent[from=O](Q,M) \tkzGetPoints{S}{II}

% drawing
\tkzDrawCircle[R](Origin,\Radius cm)
\tkzDrawCircle(Q,M)
\tkzDrawSegments[ultra thick,orange,add = 0 and .2](O,R O,I)
\tkzDrawSegments[thick,gray](Origin,O)
\tkzDrawPoints(Origin,O,Q,R,I,II,S)

% labels
\tkzLabelPoints(R,S,Q,I,II,O)
\tkzLabelPoint[below right](Origin){$P$}
\tkzLabelPoints[above,text=red](R,S)
\tkzLabelPoints[above,text=blue](I,II)
\end{tikzpicture}
\end{document}

enter image description here

1
  • Would you kindly explain “what” and “how” of the code below calculations? (For example: What is R in \tkzDrawCircle[R], and what does \tkzTangent[from with R = O] do? – blackened Dec 10 '18 at 5:51
9

You can get the tangents to extend by adding shorten >=<negative length>, and use the intersections library to locate the points of intersection and add the appropriate labels:

enter image description here

If you use \coordinates for the poitns then using a \foreach is a convienent way to mark each of the points.

Code:

\documentclass[11pt, oneside]{article}
\usepackage{geometry}                       % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                          % ... or a4paper or a5paper or ... 
\geometry{landscape}  
\usepackage{tikz}   % TeX will automatically convert eps --> pdf in pdflatex    
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{gensymb}
\usepackage{tkz-euclide}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}
\usepackage{graphicx}
\usetikzlibrary{plotmarks}  
\usetikzlibrary{intersections}  
\title{}
\author{}

\begin{document}
\begin{tikzpicture}

\newcommand*{\Radius}{2cm}%
   \coordinate (Origin) at (0,0);
   \coordinate (OriginQ) at (3.5,0);
   \coordinate (O) at (14,0);% External point


\draw [name path global=circle P] (Origin)  circle(2.0) node [left]  {P};
\draw [name path global=circle Q] (OriginQ) circle(1.5) node [below] {Q};
\draw (Origin) -- (14,0) node [right] {O};



\tkzDrawCircle[R](Origin,\Radius)
   \tkzTangent[from with R= O](Origin,\Radius)  \tkzGetPoints{R}{I} 

   \tkzDrawSegments[ultra thick, blue, shorten >=-2.5cm, name path global=top tangent](O,R)% First tangent
   \tkzDrawSegments[ultra thick, red, shorten >=-2.5cm, name path global=bottom tangent](O,I)% Second tangent


\path [name intersections={of=circle P and top tangent, by=circlePTop}];
\node [above] at (circlePTop) {$R$};

\path [name intersections={of=circle Q and top tangent, by=circleQTop}];
\node [above] at (circleQTop) {$S$};

\path [name intersections={of=circle P and bottom tangent, by=circlePBot}];
\node [below] at (circlePBot) {$I$};

\path [name intersections={of=circle Q and bottom tangent, by=circleQBot}];
\node [below] at (circleQBot) {$II$};

\foreach \Point in {circlePTop, circleQTop, circlePBot, circleQBot, Origin, OriginQ} {
    \draw [fill=gray, draw=black] (\Point) circle (2.5pt);
}

\end{tikzpicture}
\end{document}
8

enter image description here

Here is an attempt trying to stick closely to tkz-euclide commands.

\documentclass[11pt]{standalone}
\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}

\tkzDefPoint(0,0){Origin}
\tkzDefPoint(3.5,0){Q}
\tkzDefPoint(14,0){O}

\node [left] at (Origin) {$P$};
\node [right] at (O) {$O$};

\newcommand*{\Radius}{2cm}%

\tkzDrawCircle[R](Origin,\Radius)
\tkzTangent[from with R= O](Origin,\Radius)  \tkzGetPoints{R}{I} 
\tkzLabelPoints(R,I,Q)
\node [above, red] at (R) {$R$};

\tkzInterLC[R](Q,Origin)(Q,1.5cm) \tkzGetPoints{M}{N}
\tkzDrawCircle(Q,M)

\tkzTangent[from=O](Q,M) \tkzGetPoints{S}{II}
\node [above] at (S) {$S$};
\node [below] at (II) {$II$};

\tkzDrawSegments[ultra thick,orange,shorten >=-1cm](O,R)% First tangent
\tkzDrawSegments[ultra thick,orange,shorten >=-1cm](O,I)% Second tangent
\tkzDrawSegments[thick,gray](Origin,O)

\tkzDrawPoints(Origin,O,Q,R,I,II,S)
\end{tikzpicture}
\end{document}

You can also use regular tikz commands, so instead of writing \tkzLabelPoints(R) you can also write \node [above, red] at (R) {$R$};.

4
  • Do you know if there English documentation available yet for tkz-euclide? – Peter Grill Mar 22 '13 at 6:47
  • Thanks.. @Peter : No, I haven't found English documentation for tkz-euclide? – Divya Mar 22 '13 at 7:12
  • @PeterGrill Afaik, There is none. I just follow the examples. If I only know French, I would offer to help Alain Matthes with the translation. – hpesoj626 Mar 22 '13 at 7:22
  • Yes a translation would be perhaps useful but my english is not very fine. I don't know if there are a lot of users. Perhaps it's preferable to recommend to study tikz. The different syntax is a big problem nd perhaps it's a wrong way ... – Alain Matthes Mar 22 '13 at 11:59
5

run with xelatex. All important points are marked as nodes, see documentation.

\documentclass{article}
\usepackage{pstricks-add}
\begin{document}

\begin{pspicture}[showgrid=false](-4,-2)(5,3)
\pscircle*[linecolor=red!30!white!100](0,0){1}
\pscircle*[linecolor=green!30!white!100](3,0){2}
\psCircleTangents(0,0){1}(3,0){2}% coordinates/radius of the 2 circles
\pcline[nodesep=-1cm,linecolor=blue](CircleTO1)(CircleTC2)
\pcline[nodesep=-1cm,linecolor=blue](CircleTO3)(CircleTC2)
\psdots(CircleTC2)(CircleTO1)(CircleTO2)(CircleTO3)(CircleTO4)
\uput[-90](CircleTC2){TC2}
\uput[-80](CircleTO1){TO1}\uput[45](CircleTO2){TO2}
\uput[150](CircleTO3){TO3}\uput[-45](CircleTO4){TO4}
\end{pspicture}

\end{document}

enter image description here

enter image description here

4

With PSTricks.

enter image description here

\documentclass[pstricks]{standalone}
\usepackage{pst-eucl}
\newpsstyle{N}{PointName=none,PointSymbol=none}
\newpsstyle{A}{PointNameA=,PointSymbolA=none}
\begin{document}
\begin{pspicture}(-3,-3)(7,3)
    \pstGeonode[PosAngle={180,-45}](0,0){P}(3.5,0){Q}
    \pstGeonode[style=N](2.5,0){T}
    \pstCircleOA{P}{T}
    \pstCircleOA{Q}{T}
    \pstMiddleAB[style=N]{P}{Q}{M}
    \pstInterLC[style=N,Radius=\pstDistAB{T}{Q}]{P}{Q}{P}{}{LC1}{LC2}
    \pstInterCC[style=N,RadiusA=\pstDistAB{T}{LC2}]{P}{}{M}{P}{CC1}{CC2}
    \pstInterLC[style=A,PosAngleB=90]{P}{CC1}{P}{T}{LC3}{R}
    \pstTranslation[PosAngle=90]{CC1}{R}{Q}[S]
    \pstInterLL{R}{S}{P}{Q}{O}
    \pstLineAB[nodesepA=-1]{R}{O}
    \pstOrtSym[PosAngle=-90]{P}{Q}{R,S}[I,II]
    \pstLineAB[nodesepA=-1]{I}{O}
    \pstLineAB{P}{O}
\end{pspicture}
\end{document}

A funny "bug/feature" found:

Normally node label can be hidden by passing none to PointName. However, PointNameA cannot be set to none to hide its label. But it accepts nothing or {} instead.

Animated

enter image description here

\documentclass[pstricks]{standalone}
\usepackage{pst-eucl,multido}
\newpsstyle{N}{PointName=none,PointSymbol=none}
\newpsstyle{A}{PointNameA=,PointSymbolA=none}

\def\Picture#1{%
\begin{pspicture}(-3,-3)(15,3)
    \pstGeonode[PosAngle={180,-45}](0,0){P}(3.5,0){Q}
    \pstGeonode[style=N](#1,0){T}
    \pstCircleOA{P}{T}
    \pstCircleOA{Q}{T}
    \pstMiddleAB[style=N]{P}{Q}{M}
    \pstInterLC[style=N,Radius=\pstDistAB{T}{Q}]{P}{Q}{P}{}{LC1}{LC2}
    \pstInterCC[style=N,RadiusA=\pstDistAB{T}{LC2}]{P}{}{M}{P}{CC1}{CC2}
    \pstInterLC[style=A,PosAngleB=90]{P}{CC1}{P}{T}{LC3}{R}
    \pstTranslation[PosAngle=90]{CC1}{R}{Q}[S]
    \pstInterLL{R}{S}{P}{Q}{O}
    \pstLineAB[nodesepA=-1]{R}{O}
    \pstOrtSym[PosAngle=-90]{P}{Q}{R,S}[I,II]
    \pstLineAB[nodesepA=-1]{I}{O}
    \pstLineAB{P}{O}
\end{pspicture}%
}

\begin{document}
\multido{\n=2.0+0.1}{10}{\Picture{\n}}
\multido{\n=2.8+-0.1}{8}{\Picture{\n}}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.