%%% This file provides symbols for accumulation modalities.
%%%
%%% It should be included in the documents preamble, as it
%%% \usepackage's tikz and amssymb.
%%%
%%% USAGE
%%% =====
%%%
%%% The following zero-parameter macros are provided:
%%%
%%% \accdiaplus  - "diamond plus"
%%% \accdiaminus - "diamond minus"
%%% \accboxplus  - "box plus"  (this is an alias for \boxplus)
%%% \accboxminus - "box minus" (this is an alias for \boxminus)
%%%
%%% CAVEATS
%%% =======
%%%
%%% To make compilation times bearable, the diamond operators are
%%% drawn once and then put into a savebox and some resizing-magic. To
%%% have, e.g., a colored symbol you will need to use the raw (slow)
%%% variants as seen below.

\usepackage{amssymb}
\usepackage{tikz}

%%% high-level macros (use these!)
\newcommand{\accdiaplus}{%
\ensuremath{\diamondplus}}

\newcommand{\accdiaminus}{%
\ensuremath{\diamondminus}}

\newcommand{\accboxminus}{%
\ensuremath{\boxminus}}

\newcommand{\accboxplus}{%
\ensuremath{\boxplus}}

%%% diamond plus operator
%% raw version
\newcommand{\rawdiaplus}{%
  \begin{tikzpicture}
    \useasboundingbox (-0.7ex, -0.9ex) rectangle (0.7ex, 0.9ex);
    \node (w) at (-0.7ex,0) {};
    \node (e) at (+0.7ex,0) {};
    \node (s) at (0,-0.9ex) {};
    \node (n) at (0,+0.9ex) {};
    \draw (n.center) -- (e.center) -- (s.center) -- (w.center) -- (n.center);
    \draw (n.center) -- (s.center);
    \draw (e.center) -- (w.center);
  \end{tikzpicture}}

%% save-boxed version
\newsavebox{\diamondplusbox}
\savebox{\diamondplusbox}{\rawdiaplus}
\DeclareRobustCommand{\diamondplus}{\texorpdfstring{\mathop{\raisebox{-0.25ex}{\resizebox{1.45ex}{!}{\usebox{\diamondplusbox}}}}\nolimits}{diamondplus}}

%%% diamond minus operator
%% raw version
\newcommand{\rawdiaminus}{%
  \begin{tikzpicture}
    \useasboundingbox (-0.7ex, -0.9ex) rectangle (0.7ex, 0.9ex);
    \node (w) at (-0.7ex,0) {};
    \node (e) at (+0.7ex,0) {};
    \node (s) at (0,-0.9ex) {};
    \node (n) at (0,+0.9ex) {};
    \draw (n.center) -- (e.center) -- (s.center) -- (w.center) -- (n.center);
    \draw (e.center) -- (w.center);
  \end{tikzpicture}}

%% save-boxed version
\newsavebox{\diamondminusbox}
\savebox{\diamondminusbox}{\rawdiaminus}
\DeclareRobustCommand{\diamondminus}{\texorpdfstring{\mathop{\raisebox{-0.25ex}{\resizebox{1.45ex}{!}{\usebox{\diamondminusbox}}}}\nolimits}{diamondminus}}
