I'm trying to define a macro for writing empty nodes in a binary tree using tikz-qtree.
Referring to the code below, I want the string \missing in my code to be replaced by \edge[draw=none]; {} as-is (just like if I simply did a find and replace in my code).
Is this possible and how can it be done? I don't want to paste \edge[draw=none]; {} every time there is an empty node in my binary tree.
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\newcommand{\missing}{ \edge[draw=none]; {} }
%intended usage inside tikzpicture enviornment:
%\Tree [.3 1
% \missing ]
%To producce the same result as code below but
%it gave me an error:
%! Undefined control sequence.
%\missing -> \edge
% [draw=none]; {}
\begin{document}
\begin{tikzpicture}
\Tree [.3 1
\edge[draw=none]; {} ]
\end{tikzpicture}
\end{document}
`to mark your inline code as I did in my edit.:)– Paulo Cereda Jun 7 '12 at 21:35\edgeis not a real command, but a sentinel; if there is, thentikz-qtreeis able to do its business. But you can't hide it in a macro. – egreg Jun 7 '12 at 22:54