I would like to define a macro \mynode (to be used inside TikZ) whose behavior depends on the last symbol of its argument as follows:
\mynode{text!} should produce
\node[fill=red] at (0,0) {text};
while \mynode{text} should produce just
\node at (0,0) {text};
In other words, the definition of \mynode should be something like
\newcommand{\mynode}[1]{
\node[fill=red] at (0,0) {#1};
}
where the fill=red parameter is supplied only when #1 ends with ! (if this is the case, the actual node content in the curly braces should be stripped off the exclamation mark).



!supposed to appear in other places? However, wouldn't it be easier to have\mynode{text}for the non filled version and\mynode*{text}for the filled version? – egreg Dec 20 '16 at 23:48\young{{{1,1,1},{2,2,3!},{3}}}and I want the!node to become red. – Māris Ozols Dec 20 '16 at 23:52