Here's a MWE:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\draw[decorate, decoration=random steps] (0,0) -- (10,0);
\node[decorate, decoration=random steps, draw, fill=yellow, inner sep=0.5cm] at (5,-2) {};
\end{tikzpicture}
\end{document}
For a more complex picture, I wanted to apply the same decoration to all lines and nodes, and so I used "every path":
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}[every path/.style={decorate, decoration=random steps}]
\draw (0,0) -- (10,0);
\node[draw, fill=yellow, inner sep=0.5cm] at (5,-2) {};
\end{tikzpicture}
\end{document}
However, this results in an error: "I cannot decorate an empty path". I think I understand what the problem is: \node ...
is replaced with \path node ...
and we thus have an empty path.
But how can I achieve what I want, namely applying the same decoration to all lines AND nodes (let's assume there a lots of them) without having to specify it explicitly for each \draw
and \node
command?