Mark Wibrow - 2006-09-06

Hi, thanks for the quick response.

I hope this is minimal enough. In the back of my mind I'm wondering whether it is my implementaion of optional arguments that is at fault, but it works everywhere else, just not inside paths.

\makeatletter

\def\branch{\futurelet\@test@char\@branch}
\def\@branch{%
    \ifx[\@test@char
        \let\next@action\do@options
    \else
        \let\next@action\no@options
    \fi
\next@action}

\def\do@options[#1]#2{edge from parent [#1, #2]}
\def\no@options#1{edge from parent [#1]}

% A1 - A3 work
% A4 - A5 don't work
\tikz \node {A1} child {node{B1} edge from parent [red, dashed]};
\tikz \node {A2} child {node{B2} \no@options{dashed}};               
\tikz \node {A3} child {node{B3} \do@options[red]{dashed}};
\tikz \node {A4} child {node{B4} \branch{dashed}};
\tikz \node {A5} child {node{B5} \branch[red]{dashed}};

 

Related

Installation Problems: #1