I know that it's possible to apply styling to all tikz nodes or paths, as in the following example:
\tikzset{
every node/.style={
text=red
},
every path/.style={
color=green,
thin
}
}
(Which makes all nodes have red text and all paths have thin green lines.)
Is there a similar way to apply styling to all tikz rectangles, so those produced by draw commands such as \draw (1,1) rectangle (3,3);?
I tried the following, on the off-chance it might work (it didn't, hence my question!):
\tikzset{
every rectangle/.style={%
blue,
rounded corners,
ultra thick
}
}
My current work-around is to use a style which I apply to every rectangle manually, although this is a little tedious. This is demonstrated in the below minimal working example.
\documentclass{report}
\usepackage{tikz}
\tikzset{
every rectangle/.style={
blue,
rounded corners,
ultra thick
},
my rectangle/.style={
blue,
rounded corners,
ultra thick
}
}
\begin{document}
\begin{tikzpicture}
% A rectangle which would be styled by the "every rectangle" bit if
% it worked in the way that I would like it to:
\draw (1,5) rectangle (4,7);
% A rectangle with my custom styling applying to it:
\draw [my rectangle] (1,1) rectangle (4,3);
\end{tikzpicture}
\end{document}
The rectangles in the above would be identical (besides position) if every rectangle worked in the way I would like it to or if there's some other way to style all rectangles.
So essentially I would like to know if an actual equivalent to my pseudo every rectangle exists.

rectangleis just a path command that gets translated into coordinates immediately, so it's not really treated as a special object. Also, this would be difficult from another perspective: You could have a\pathcommand with arectangleand acirclein it. If you had anevery rectangleand anevery circlestyle, which one would apply in that case, as paths can only have one drawing style. You might need to work with rectangle nodes in this case. – Jake Mar 6 '12 at 22:47\node [draw, rectangle] ...? Do you know if a style could be applied to all of those in a similar manner to how I've been describing? – Staves Mar 6 '12 at 23:59every rectangle nodeand using rectangle nodes as Jake mentioned. I will post an answer with an example once I am able to do so. (There's a block on me doing so for another 5 hours due to my reputation being less than 100.) – Staves Mar 7 '12 at 0:48every circlestyle exists in the doc pgf 2.1 cvs : "You can use this key to set up, say, a default radius for every circle." but I think we can't do some limited actions like changedradiuswithror setup things likeradius= 1cm. – Alain Matthes Mar 7 '12 at 6:14