0

I have a rectangle in tikzpicture that appears to have a minimum size that it can be set to as when I try to reduce the size further it just becomes a square and will not get any smaller. I am trying to make the node width the same as the edge below it in the image.

For example:

\begin{tikzpicture}
[->,  thick, scale=.5, 
rectangle1/.style={rectangle, fill=red,  minimum width=.05cm, minimum height= .2cm},
no node/.style={circle, minimum size=0cm, inner sep=0pt}
]
\node[no node] (1) at (0,0) {$ $};
\node[no node] (2) at (10,0) {$ $};
\node [rectangle1, above] (A) at (5,0) {};

\path [-]
(1) edge[red] node{} (2)
;
\end{tikzpicture}

enter image description here

However, when I change my settings in rectangle1/.style, and reduce the width and height there is no change in the result.

Is there a minimum size the rectangle node can be set at? And if so, can anyone suggest a different node type that I could use?

  • 1
    Does adding transform shape to the tikzpicture options gives you what you want ? – BambOo Apr 29 '18 at 15:00
3

In order to apply a transformation such as scale to a tikz node, one must active the transform shape option. By default tikz does not apply transformations to nodes.

From pgfmanual:

It is possible to transform nodes, but, by default, transformations do not apply to nodes. The reason is that you usually do not want your text to be scaled or rotated even if the main graphic is transformed. Scaling text is evil, rotating slightly less so.

See pgfmanual version 3.0.1a p 234 Section 17.7 for more information.

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.