2
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning}

\begin{document}

\begin{tikzpicture}

\node (A) [cylinder, shape border rotate=90, draw,minimum
height=3cm,minimum width=2cm] {};

\node (B) [cylinder, shape border rotate=90, draw,minimum
height=3cm,minimum width=2cm, below=0.3cm of A]
{Wider?};

\node (C) [cylinder, shape border rotate=90, draw,minimum
height=3cm,minimum width=2cm, below=0.3cm of B]
{Why is the Ellipse wider?};

\end{tikzpicture}

\end{document}

Generates:

enter image description here

The ellipse at the top of the cylinder node gets less oblate as the text inside the node gets wider. How do you control this?

I would like to keep approximately the same aspect of the ellipse despite stretching to fit text.

  • 1
    Have you read what the manual says about aspect? – cfr Mar 29 '17 at 23:04
  • 1
    I still have not found a direct reference to how aspect affects the cylinder node. I can use this to get my desired effect, but it requires a slightly different aspect depending on the overall width of the cylinder. I would like to understand how to set a single aspect that provides consistent results for a wide range of cyllinder node sizes, i.e. being able to set the aspect of the ellipse at the top, however as far as I can tell this is not what aspect sets as in certain instances, aspect can be set to a number larger than 1 and still produce an oblate ellipse. – user2127595 Mar 30 '17 at 6:16
  • 1
    When you ask why is the ellipse wider?, what do you mean? It is wider, clearly, because the text you are putting in it needs more space, so the cylinder has to expand to accommodate it. That is just how nodes work: unless you override it, they are sized to fit their contents. If the cylinder is wider, obviously the ellipse has to be wider, too, else it would no longer be a cylinder but two lines and two detached ellipses. – cfr Mar 30 '17 at 14:39
  • 1
    And you've still not provided a working example. – cfr Mar 30 '17 at 14:39
  • 1
    The default aspect ratio depends on other factors. See tex.stackexchange.com/questions/267266/… for setting the aspect directly. – John Kormylo Mar 30 '17 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.