2

i like to define \tikzset for bunch of images, in which i define building blocks for control schemes. in defining those block i extensively use path picture where for anchors i use path picture bounding box. for shorter code i like for it define the shortcut ppbb. this is simple to achieve with

\newcommand\ppbb{path picture bounding box}

in document preamble. Unfortunately it can't be included in tikset. is there some way fir defining shortcuts as part of `\tikzest?

as example of use of the \ppbb see my answer here.

  • 1
    Isn't \pgfkeysalsofrom{\ppbb} meant for such things? – user31729 Oct 11 '17 at 11:12
  • i dont know, i'm not familar withpgfkeys. can you explain this? – Zarko Oct 11 '17 at 11:14
  • what is the context where tikzset causes problems? – percusse Oct 11 '17 at 12:51
5

It is entirely personal preference, but considering the use in the linked answer, I wouldn't directly use a macro, I'd use a node alias (which I concede is using a bunch of macros 'under the covers'). Something like this:

\documentclass[tikz,border=5]{standalone}
\tikzset{alias path picture bounding box/.code=%
  \pgfnodealias{#1}{path picture bounding box}}
\begin{document}
\begin{tikzpicture}
\node [fill=red, path picture={%
  \tikzset{alias path picture bounding box=@}
  \fill [orange] (@.north) -- (@.east) -- (@.south) -- (@.west) -- cycle;
}] {A};
\end{tikzpicture}    
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.