% \iffalse
% --------------------------------------------------------------------
%<*chit>
% \fi
% 
% \subsubsection{Predefined \texttt{chit} element pictures}
%
%    \begin{macrocode}
\DeclareRobustCommand\chit@sep[2][/]{%
  \foreach[count=\is] \s in {#2}{%
    \ifnum\is>1\relax#1\fi%
    \s}}
%    \end{macrocode}
% \begin{TikzKey}{/tikz/pics/chit/1 factor,
%   /tikz/pics/chit/2 factors,
%   /tikz/pics/chit/2 factors artillery,
%   /tikz/pics/chit/3 factors,
%   /tikz/pics/chit/4 factors,
%   /tikz/pics/chit/identifier,
%   /tikz/pics/chit/small identifier,
%   /tikz/pics/chit/identifier macro}
%
%   These pictures can be used as the value of \texttt{chit} keys.
%
%    \begin{macrocode}
\def\chit@oset#1#2{%
  %$\stackrel{{}_{\text{\scriptsize #1}}}{\text{#2}}$%
  %$\stackrel{\lower2ex\hbox{\text{\scriptsize #1}}}{\text{#2}}$%
  %${}\overset{\text{\scriptsize #1}}{\text{#2}}{}$%
  \tikz[]{%
    \node[inner sep=0pt](chit@dd){#2};%
    \node[above=-.1ex of chit@dd,inner sep=0pt]{{\scriptsize #1}};%
  }%  
}
\tikzset{%
  chit/1 factor/.pic={
    \chit@dbg{4}{ Chit 1 factor: #1}%
    \node[chit/factor,chit/1 factor,pic actions]{#1};},
  pics/chit/2 factors/.style args={#1,#2}{%
    code={%
      \chit@dbg{4}{ Chit 2 factors: #1 and #2}%
      \node[chit/factor,chit/2 factors,pic actions]{#1--#2};}},
  pics/chit/2 factors artillery/.style args={#1,#2,#3}{%
    code={
      \chit@dbg{4}{ Chit 2 factors w/artillery: `#1' `#2' `#3'}% 
      \node[chit/factor,chit/2 factors]{%
        {#1}\chit@oset{#3}{--}{#2}};}},
  pics/chit/3 factors/.style args={#1,#2,#3}{%
    code={
      \chit@dbg{4}{ Chit 3 factors: `#1' `#2' `#3'}% 
      \node[chit/factor,chit/3 factors]{#1-#2-#3};}},
  pics/chit/4 factors/.style args={#1,#2,#3,#4}{%
    code={
      \chit@dbg{4}{ Chit 3 factors: `#1' `#2' `#3' `#4'}% 
      \node[chit/factor,chit/4 factors]{#1-#2-#3-#4};}},
  chit/identifier/.pic={
    \chit@dbg{4}{  Chit identifier: `#1'}% 
    \node[chit/identifier,pic actions]{#1};
  },
  chit/identifiers/.pic={
    \chit@dbg{4}{  Chit identifiers: `#1'}% 
    \node[chit/identifier,pic actions]{\chit@sep{#1}};
  },
  chit/small identifier/.pic={
    \chit@dbg{4}{  Chit small identifier: `#1'}% 
    \node[chit/small identifier,pic actions]{#1};
  },
  chit/small identifiers/.pic={
    \chit@dbg{4}{  Chit small identifiers: `#1'}% 
    \node[chit/small identifier,pic actions]{\chit@sep{#1}};
  },
  chit/identifier macro/.pic={%
    \chit@dbg{4}{ Chit identifier macro: \meaning#1}
    \edef\chit@i@tmp{#1}
    \node[chit/identifier,pic actions]{\chit@i@tmp};},
}
%    \end{macrocode}
% \end{TikzKey}
% 
% \begin{TikzKey}{/tikz/chit/factor,
%   /tikz/chit/1 factor,
%   /tikz/chit/2 factors,
%   /tikz/chit/3 factors,
%   /tikz/chit/4 factors,
%   /tikz/chit/identifier,
%   /tikz/chit/small identifier}
%
%   Styles used by the above pictures.  Users can change these as they
%   see fit. 
%   
%    \begin{macrocode}
\tikzset{%
  chit/factor/.style={
    shape=rectangle,
    font=\sffamily\bfseries\fontsize{12}{14}\selectfont,
    anchor=base,
    inner sep=0,
    %text=pgfstrokecolor,
    draw=none,
    fill=none,
    transform shape,
  },
  chit/1 factor/.style={},
  chit/2 factors/.style={},
  chit/3 factors/.style={},
  chit/4 factors/.style={text/.append style=\fontsize{10}{12}\selectfont},
  chit/identifier/.style={
    shape=rectangle,
    font=\sffamily\bfseries\fontsize{8}{9}\selectfont,
    inner sep=0,
    % text=pgfstrokecolor,
    draw=none,
    fill=none,
    transform shape,
  },
  chit/small identifier/.style={
    shape=rectangle,
    font=\sffamily\bfseries\fontsize{6}{7}\selectfont,
    inner sep=0,
    % text=pgfstrokecolor,
    draw=none,
    fill=none,
    transform shape,
  },
}
%    \end{macrocode}
% \end{TikzKey}
% \iffalse
%</chit>
% --------------------------------------------------------------------
% \fi
