Home Reading Searching Subscribe Sponsors Statistics Posting Contact Spam Lists Links About Hosting Filtering Features Download Marketing Archives FAQ Blog From: Mark Wibrow googlemail.com> Subject: Re: Question about \tikzset, maybe related to \pgfkeys Newsgroups: gmane.comp.tex.pgf.user Date: Tuesday 16th March 2010 21:00:45 UTC (over 8 years ago) Hi, I'm not that familiar with the internals of keys so there may be some fantastically simple solution that I don't know about. Basically it seems that when you use \tikzset{my style/.style={some keys}}, what you are ultimately doing is defining a macro \[email protected]/tikz/my style/[email protected] with one argument delimeted by \pgfeov (this argument is is for saying things like my style={color=#1}). The content of the macro is \pgfkeysalso{some keys}. If the style is empty \tikzset{my style/.style={}} then the content of the macro is \pgfkeysalso{}. So... \documentclass{article} \usepackage{tikz} \begin{document} \makeatletter \def\pgfkeysifstyleisempty#1{% \expandafter\let\expandafter\[email protected]\csname [email protected]#1/[email protected]\endcsname% \expandafter\[email protected]\[email protected]\relax\pgfeov\[email protected]% } \def\[email protected]\pgfkeysalso#1\[email protected]{% \def\[email protected]{#1}% \ifx\[email protected]\[email protected]% \let\[email protected]=\[email protected]% \else% \let\[email protected]=\[email protected]% \fi \[email protected]} \makeatother \tikzset{my style/.style={}} \pgfkeysifstyleisempty{/tikz/my style}{Empty}{Not Empty} \tikzset{my style/.style={some keys}} \pgfkeysifstyleisempty{/tikz/my style}{Empty}{Not Empty} \end{document} A bit ugly. But it *seems* to work. Caveat Emptor (or something like that). Hope this helps Mark On 16 March 2010 16:22, Rouben Rostamian wrote: > In a style file I am writing, the tikz style "my style" may > be set set as > >   \tikzset{my style/.style={}} > > or > >   \tikzset{my style/.style={fill=red}} > > Is there a way to tell, further down in the file, which of the > two choices were taken?  In other words, I would like to make > a decision based on whether "my style" is {} or not. > > -- > Rouben Rostamian > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > pgf-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pgf-users > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
CD: 3ms