1

In the following MWE I would like to forward a list of key-value-pairs to the \node command. I tried to store the list in \nodeparam, but this seems to not work:

\documentclass{article}

\usepackage{tikz,pgfkeys}

\pgfkeys{
    /absolutenode/.is family, /absolutenode,
    default/.style = {},
    node/.store in = \nodeparam,
}

\newcommand\absolutenode[2][]{%
    \pgfkeys{/absolutenode, default, #1}%
    \tikz[]{%
        \node[\nodeparams] {#2};
    }
}

\begin{document}
    \absolutenode[node={draw=black, fill=green}]{Test}
\end{document}

How can I "forward" the list {draw=black, fill=green} to \node[]?

0

1 Answer 1

2

Probably not what you are looking for but at least this allows you to do what you want, and hopefully allows others to understand your question better. (I do not understand the full picture, i.e. I am struggling to see what that should be ultimately be good for.)

\documentclass{article}

\usepackage{tikz,pgfkeys}

\pgfkeys{
    /absolutenode/.is family, /absolutenode/.cd,
    default/.style = {},
    node/.code=\tikzset{mynodestyle/.style={#1}},
}

\newcommand\absolutenode[2][]{%
    \pgfkeys{/absolutenode, default, #1}%
    \tikz[]{%
        \node[mynodestyle] {#2};
    }
}

\begin{document}
    \absolutenode[node={draw=black, fill=green}]{Test}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .