| 1 |
% \iffalse |
| 2 |
% -------------------------------------------------------------------- |
| 3 |
%<*chit> |
| 4 |
% \fi |
| 5 |
% |
| 6 |
% \subsubsection{Predefined \texttt{chit} element pictures} |
| 7 |
% |
| 8 |
% \begin{macrocode} |
| 9 |
\DeclareRobustCommand\chit@sep[2][/]{% |
| 10 |
\foreach[count=\is] \s in {#2}{% |
| 11 |
\ifnum\is>1\relax#1\fi% |
| 12 |
\s}} |
| 13 |
% \end{macrocode} |
| 14 |
% \begin{TikzKey}{/tikz/pics/chit/1 factor, |
| 15 |
% /tikz/pics/chit/2 factors, |
| 16 |
% /tikz/pics/chit/2 factors artillery, |
| 17 |
% /tikz/pics/chit/3 factors, |
| 18 |
% /tikz/pics/chit/4 factors, |
| 19 |
% /tikz/pics/chit/identifier, |
| 20 |
% /tikz/pics/chit/small identifier, |
| 21 |
% /tikz/pics/chit/identifier macro} |
| 22 |
% |
| 23 |
% These pictures can be used as the value of \texttt{chit} keys. |
| 24 |
% |
| 25 |
% \begin{macrocode} |
| 26 |
\def\chit@oset#1#2{% |
| 27 |
%$\stackrel{{}_{\text{\scriptsize #1}}}{\text{#2}}$% |
| 28 |
%$\stackrel{\lower2ex\hbox{\text{\scriptsize #1}}}{\text{#2}}$% |
| 29 |
%${}\overset{\text{\scriptsize #1}}{\text{#2}}{}$% |
| 30 |
\tikz[]{% |
| 31 |
\node[inner sep=0pt](chit@dd){#2};% |
| 32 |
\node[above=-.1ex of chit@dd,inner sep=0pt]{{\scriptsize #1}};% |
| 33 |
}% |
| 34 |
} |
| 35 |
\tikzset{% |
| 36 |
chit/1 factor/.pic={ |
| 37 |
\chit@dbg{4}{ Chit 1 factor: #1}% |
| 38 |
\node[chit/factor,chit/1 factor,pic actions]{#1};}, |
| 39 |
pics/chit/2 factors/.style args={#1,#2}{% |
| 40 |
code={% |
| 41 |
\chit@dbg{4}{ Chit 2 factors: #1 and #2}% |
| 42 |
\node[chit/factor,chit/2 factors,pic actions]{#1--#2};}}, |
| 43 |
pics/chit/2 factors artillery/.style args={#1,#2,#3}{% |
| 44 |
code={ |
| 45 |
\chit@dbg{4}{ Chit 2 factors w/artillery: `#1' `#2' `#3'}% |
| 46 |
\node[chit/factor,chit/2 factors]{% |
| 47 |
{#1}\chit@oset{#3}{--}{#2}};}}, |
| 48 |
pics/chit/3 factors/.style args={#1,#2,#3}{% |
| 49 |
code={ |
| 50 |
\chit@dbg{4}{ Chit 3 factors: `#1' `#2' `#3'}% |
| 51 |
\node[chit/factor,chit/3 factors]{#1-#2-#3};}}, |
| 52 |
pics/chit/4 factors/.style args={#1,#2,#3,#4}{% |
| 53 |
code={ |
| 54 |
\chit@dbg{4}{ Chit 3 factors: `#1' `#2' `#3' `#4'}% |
| 55 |
\node[chit/factor,chit/4 factors]{#1-#2-#3-#4};}}, |
| 56 |
chit/identifier/.pic={ |
| 57 |
\chit@dbg{4}{ Chit identifier: `#1'}% |
| 58 |
\node[chit/identifier,pic actions]{#1}; |
| 59 |
}, |
| 60 |
chit/identifiers/.pic={ |
| 61 |
\chit@dbg{4}{ Chit identifiers: `#1'}% |
| 62 |
\node[chit/identifier,pic actions]{\chit@sep{#1}}; |
| 63 |
}, |
| 64 |
chit/small identifier/.pic={ |
| 65 |
\chit@dbg{4}{ Chit small identifier: `#1'}% |
| 66 |
\node[chit/small identifier,pic actions]{#1}; |
| 67 |
}, |
| 68 |
chit/small identifiers/.pic={ |
| 69 |
\chit@dbg{4}{ Chit small identifiers: `#1'}% |
| 70 |
\node[chit/small identifier,pic actions]{\chit@sep{#1}}; |
| 71 |
}, |
| 72 |
chit/identifier macro/.pic={% |
| 73 |
\chit@dbg{4}{ Chit identifier macro: \meaning#1} |
| 74 |
\edef\chit@i@tmp{#1} |
| 75 |
\node[chit/identifier,pic actions]{\chit@i@tmp};}, |
| 76 |
} |
| 77 |
% \end{macrocode} |
| 78 |
% \end{TikzKey} |
| 79 |
% |
| 80 |
% \begin{TikzKey}{/tikz/chit/factor, |
| 81 |
% /tikz/chit/1 factor, |
| 82 |
% /tikz/chit/2 factors, |
| 83 |
% /tikz/chit/3 factors, |
| 84 |
% /tikz/chit/4 factors, |
| 85 |
% /tikz/chit/identifier, |
| 86 |
% /tikz/chit/small identifier} |
| 87 |
% |
| 88 |
% Styles used by the above pictures. Users can change these as they |
| 89 |
% see fit. |
| 90 |
% |
| 91 |
% \begin{macrocode} |
| 92 |
\tikzset{% |
| 93 |
chit/factor/.style={ |
| 94 |
shape=rectangle, |
| 95 |
font=\sffamily\bfseries\fontsize{12}{14}\selectfont, |
| 96 |
anchor=base, |
| 97 |
inner sep=0, |
| 98 |
%text=pgfstrokecolor, |
| 99 |
draw=none, |
| 100 |
fill=none, |
| 101 |
transform shape, |
| 102 |
}, |
| 103 |
chit/1 factor/.style={}, |
| 104 |
chit/2 factors/.style={}, |
| 105 |
chit/3 factors/.style={}, |
| 106 |
chit/4 factors/.style={text/.append style=\fontsize{10}{12}\selectfont}, |
| 107 |
chit/identifier/.style={ |
| 108 |
shape=rectangle, |
| 109 |
font=\sffamily\bfseries\fontsize{8}{9}\selectfont, |
| 110 |
inner sep=0, |
| 111 |
% text=pgfstrokecolor, |
| 112 |
draw=none, |
| 113 |
fill=none, |
| 114 |
transform shape, |
| 115 |
}, |
| 116 |
chit/small identifier/.style={ |
| 117 |
shape=rectangle, |
| 118 |
font=\sffamily\bfseries\fontsize{6}{7}\selectfont, |
| 119 |
inner sep=0, |
| 120 |
% text=pgfstrokecolor, |
| 121 |
draw=none, |
| 122 |
fill=none, |
| 123 |
transform shape, |
| 124 |
}, |
| 125 |
} |
| 126 |
% \end{macrocode} |
| 127 |
% \end{TikzKey} |
| 128 |
% \iffalse |
| 129 |
%</chit> |
| 130 |
% -------------------------------------------------------------------- |
| 131 |
% \fi |