[Tex/LaTex] How to draw an ellipse, with the foci, center, and axes labeled

diagramstikz-pgf

How do I plot this modified GeoGebra picture using LaTeX code?

Point X on ellipse with foci F1 and F2, major axis AB, minor axis CD, center S at (p, q) and a red closing curly brace

Best Answer

While the other solution looks great as well, the code is needlessly complicated. This code is very minimal and allows for easy customization by defining the relevant parameters as macros.

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[dot/.style={draw,fill,circle,inner sep=1pt}]
  \def\a{4} % large half axis
  \def\b{3} % small half axis
  \def\angle{-45} % angle at which X is placed
  % Draw the ellipse
  \draw (0,0) ellipse ({\a} and {\b});
  % Draw the inner lines and labels
  \draw (-\a,0) coordinate[label={left:$A$}] (A)
    -- (\a,0) coordinate[label={right:$B$}] (B);
  \draw (0,-\b) coordinate[label={below:$D$}] (D)
    -- (0,\b) coordinate[label={above:$C$}] (C);
  \coordinate[label={below right:$S(p,q)$}] (O) at (0,0);
  % Nodes at the focal points
  \node[dot,label={below:$F_1$}] (F1) at ({-sqrt(\a*\a-\b*\b)},0) {};
  \node[dot,label={below:$F_2$}] (F2) at ({+sqrt(\a*\a-\b*\b)},0) {};
  % Node on the rim, connected to foci
  \node[dot,label={\angle:$X$}] (X) at (\angle:{\a} and {\b}) {};
  \draw (F1) -- (X) (X) -- (F2);
  % Brace
  \draw[decorate,decoration=brace,draw=red] (C) -- (O);
\end{tikzpicture}
\end{document}

enter image description here

For example, we can easily create these nice animations (me, 2016)

enter image description here

enter image description here