
たとえば、パス コマンド内で描画する tikz レイヤーを定義することは可能ですか\node[on main layer] at (0,0) {foo};
? スコープ環境に単一のマクロを配置するのは少し面倒です。
答え1
オプションを使用するbehind path
と、in front of path
同じコマンドで描画されるノードと線を重ね合わせることができます。
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[thick, draw=green] (0,0) --
node[pos=0.25, behind path, fill=red!30 ]{A}
node[pos=0.75, fill=red!30 ]{A} (2,0);
\path (1,1) node[fill=blue!20] {A}
node[fill=green, behind path, inner sep=3mm] {A}
node[fill=red, inner sep=1mm, in front of path] {};
\end{tikzpicture}
\end{document}