TikZ: Omit {} after \node declaration for unlabelled node?
The {}
are part of the internal used syntax and can't be avoided (just replaced by \bgroup \egroup
, but that doesn't help you).
If your \node
s don't have any content and size and are only used to store the coordinates, then I would use \coordinate
instead (or \path coordinate
). It is basically a \node
without content. IIRC it uses \node [..] {};
internally.
Alternatively just write your own macro which inserts the correct \node
syntax itself.
The node contents
option can be used instead of the curley braces.
You can apply it to all nodes:
\documentclass{article}
\usepackage{tikz}
\tikzset{
every node/.append style = {
node contents =,
},
}
\begin{document}
\begin{tikzpicture}
\node[fill=red];
\end{tikzpicture}
\end{document}
Or you can define a custom style that you apply to all nodes in question:
\documentclass{article}
\usepackage{tikz}
\tikzset{
notext/.style = {
node contents =,
},
}
\begin{document}
\begin{tikzpicture}
\node[notext, fill=red];
\end{tikzpicture}
\end{document}
See TikZ documentation page 215.
Please note that "When the option [node contents
] is used inside the options of a node, the parsing of the node stops immediately after the end of the option block."
But it is still possible to name a node with the name
option.