# [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?

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}


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