[Tex/LaTex] Drawing ellipses with pict2e or the like

diagramsgraphics

\usepackage{pict2e}

\usepackage{pstricks-add}

\usepackage{pst-node,pst-plot}

\psset{plotpoints=9,unit=3}

Somehow, acting on various people's advice, I've put the above lines of code above my \begin{document} line, and I'm not sure what the difference is between the contents of the three packages nor what that last command does but I've been able to draw some simple diagrams that I needed, involving lines and dots and circles and text at certain places.

Now I'd like to draw an ellipse. I can specify the endpoints of the major and minor axes, and those are horizontal and vertical rather than at some odd angle, and I can also specify four points in a symmetrical pattern on the curve.

Can that be done?

Best Answer

With pstricks, quite easily:

        \documentclass[a4paper]{article}
        \usepackage[utf8]{inputenc}
        \usepackage[T1]{fontenc}

        \pagestyle{empty}

        \usepackage[pdf, svgnames]{pstricks}%
        \usepackage{pstricks-add}

        \begin{document}

        \begin{pspicture}
        \psaxes{->}(0,0)(-6,-5)(7,5)
        \psclip{
        \psellipse[linewidth = 1.5pt, linecolor = Purple](1,-1)(4,3)}
        \psset{linestyle = dashed, linewidth = 0.6pt}
        \psline(1,-5)(1,7)\psline(-6,-1)(7,-1)
        \endpsclip
        \psEllipseTangents(1,-1)(4,3)(-2,3)
        \psline{*-*}(-2,3)(EllipseT1)
        \psline{*-*}(-2,3)(EllipseT2)
        \end{pspicture}

        \end{document} 

enter image description here

Explanation: \psellipse has the coordinates of its centre for first argument. The second argument gives its horizontal and its vertical semi-axes. To have ans ellipse with other axes, you have to rotate it around its centre.

As for the psEllipseTangent macro, it allows to draw the tangent lines to an ellipse from a given point; it has the coordinates of this point as a third argument. The points of contact with the ellipse are nodes named EllipseT1 and EllipseT2.

Related Question