I found that I cannot creating ellipse with Tikz 3.0.1a for the following example

\begin{tikzpicture}
   \node(a) [ellipse,draw] {};
\end{tikzpicture}

with error message:

Package pgfkeys Error: I do not know the key '/tikz/ellipse' and I am going 
to ignore it. Perhaps you misspelled it. \node(a) [ellipse,draw]

while the following code works well

\begin{tikzpicture}
  \draw (0,0) ellipse [x radius=20pt, y radius=10pt];
\end{tikzpicture}

Do I miss something here?

  • 5
    If you want an ellipse-shaped node, you need to load the tikz shapes.geometric library. Only circle, rectangle and coordinateare defined initially. see section 67 p 693 of the manual – BambOo Oct 12 at 9:31
  • @BambOo Would you be willing to turn this into a real answer? – marmot Oct 12 at 18:54
  • 1
    @marmot, will do – BambOo Oct 12 at 22:24
up vote 5 down vote accepted

If you want an ellipse-shaped node, you need to load tikz shapes.geometric library. Only circle, rectangle and coordinate are defined initially. See section 67 p 693 of the manual.

Please note that though Hirak's answer provides ways to obtain ellipses, some comments can be formulated

  • \draw ... ellipse is an ellipse-shaped path not a node
  • scaling tikzpictures can lead to great modifications in a graphic and should be done carefully
  • the shapes library is provided in the latest versions of pgf-tikz for compatibility reasons, it has been superseded by the shapes.geometric and shapes.misc libraries.
  • 2
    Very good and I upvote you, – Sebastiano Oct 12 at 22:36
  • Thank you. I accept your answer. I was trying to search in the manual but still could not the answer. Thank you – zhidayat Oct 13 at 8:47
  • @zhidayat, after some time it gets easier :) – BambOo Oct 13 at 15:38

An easy and simple way to draw an ellipse is as follows:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) ellipse (2.5cm and 1cm);
\end{tikzpicture}
\end{document}

Another way is to do the following:

\documentclass{article}
\usepackage{tikz}
\begin{document} 
\begin{tikzpicture}[xscale=2]
\draw (0,0) circle (3);
\end{tikzpicture}
\end{document}

EDIT : This may possibly be closer to what you are asking.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[thin, draw=black, ellipse, minimum width=10cm,minimum height=5cm,align=center]
\node (a) {};
\end{tikzpicture}
\end{document}
  • 5
    Though what you propose allows to draw ellipses with tikz, this does not answer the OP's question. – BambOo Oct 12 at 11:04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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