32

When I set the minimum size of an ellipse in a tikzpicture environment, it expands into a circle if the inner content does not grow as large as the ellipse shape itself.

Is there any way around it?

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\tikzstyle{every node}=[draw, ellipse, minimum size=100pt,
    align=center]
\node (a) {Alpha};
\node[left=150pt, below=30pt] (b) at (a) {Beta};
\end{tikzpicture}
\end{document}

It seems to me that, without something as wide as the ellipse length, TikZ is not able to define the width and height of the ellipse, but how can I set these variables?

2

1 Answer 1

25

You can set minimum height=<length>, or minimum width=<length> as shown in MWE:

enter image description here

Notes:

  • As Qrrbrbirlbel commented, setting minimum size is setting both the values of minimum width and minimum height and hence you end up with a circle.
  • If you want to specify both the minimum height= and minimum width= parameters you need to set them to different values, otherwise you will again end up with a circle.

Code:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\tikzstyle{every node}=[ultra thick, draw=blue, ellipse, minimum width=100pt,
    align=center]
\node (a) {Alpha};
\node[left=150pt, below=30pt] (b) at (a) {Beta};
\end{tikzpicture}
\end{document}
4
  • +1 And that's an else. That's really something else (: Didn't know this width argument. Thanks!
    – Rubens
    Mar 21, 2013 at 2:57
  • 1
    @Rubens You can also set the size of the TeX box (that is used inside the node) with text width, text height and text depth. Those are explicitly not minimum values and have very different outputs than the minimum values. They also need the align=center option to center the content. Mar 21, 2013 at 3:04
  • @Qrrbrbirlbel: Hmmm, Good point. I think that that is a more correct solution. You want to post an answer? Mar 21, 2013 at 3:05
  • @Qrrbrbirlbel: Yeah, sloppy verbiage. Have clarified, I think? Mar 21, 2013 at 3:09

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.