% plainTEX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  Macros for the operators in a free orthomodular lattice with 2 generators,
%%  introduced in the paper
%%
%%  M. Navara: On generating finite orthomodular sublattices
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Created by Petr Olsak, April 27, 1994

% Usage: \nc????ff, where question marks are 0 (zero) for circle (\circ)
% or 1 (one) for solid circle (\bullet) and . (dot) for empty space
% First one for top, second for left, third for right
% and fourth for bottom circle element. For example 
%    \nc00.1ff
% yields to:
%      o
%    o
%      *
%
% The \nc command can be used only in math mode!

% The f in "ff possition" means three possible symbols: - (minus), | (rule) 
% and _ (underscore). The ff combinations are:
%  -|    ... top-right rule
%  |-    ... left-top rule
%  _|    ... bottom-right rule
%  |_    ... left-bottom rule
%  ||    ... the whole frame
%  --    ... (minus) the empty frame with corners
%  __    ... (underscore) the empty frame without corners

%  the other characters at "ff possitions" yield usually to empty frame
%  with corners.

% For example
%  $a \nc0000-| b$ means four white circles in a top-right frame.
 
\def\nframs#1#2{%
  \if#1|\if#2-\def\framparam{1100}\fi
        \if#2_\def\framparam{0101}\fi\fi
  \if#2|\if#1-\def\framparam{1010}\fi
        \if#1_\def\framparam{0011}\fi\fi
  \if#1|\if#2|\def\framparam{1111}\fi\fi
  \if#1-\if#2-\def\framparam{----}\fi\fi
  \if#1_\if#2_\def\framparam{0000}\fi\fi}

\gdef\framparam{0000}

\def\blackcirc{\hbox{\mathsurround=0pt$\scriptstyle\bullet$}}
\def\whitecirc{\hbox{\mathsurround=0pt$\scriptstyle\circ$}}
\def\emptycirc{\hbox{\mathsurround=0pt$\phantom{\scriptstyle\circ}$}}
\def\centersign{\hbox{\mathsurround=0pt
       $\scriptstyle\cdot$}}

\def\ncerror{\errmessage{bad parameter for \string\nc\space command}}

\def\setcircparam#1#2#3#4{%
   \if#11\let\ucirc=\blackcirc
      \else\if#10\let\ucirc=\whitecirc
      \else\if#1.\let\ucirc=\emptycirc
      \else\ncerror\fi\fi\fi
   \if#21\let\lcirc=\blackcirc
      \else\if#20\let\lcirc=\whitecirc
      \else\if#2.\let\lcirc=\emptycirc
      \else\ncerror\fi\fi\fi
   \if#31\let\rcirc=\blackcirc
      \else\if#30\let\rcirc=\whitecirc
      \else\if#3.\let\rcirc=\emptycirc
      \else\ncerror\fi\fi\fi
   \if#41\let\dcirc=\blackcirc
      \else\if#40\let\dcirc=\whitecirc
      \else\if#4.\let\dcirc=\emptycirc
      \else\ncerror\fi\fi\fi}  

\def\setframparam#1#2#3#4{%
   \if#11\let\ufram=\hrulespec\else\let\ufram=\emptykern\fi
   \if#21\let\lfram=\vrulespec\else\let\lfram=\emptykern\fi
   \if#31\let\rfram=\vrulespec\else\let\rfram=\emptykern\fi
   \if#41\let\dfram=\hrulespec\else\let\dfram=\emptykern\fi
   \if#1-\let\ufram=\hrulecorns\let\dfram=\hrulecorns
         \let\lfram=\emptykern\let\rfram=\emptykern\fi}

\def\hrulespec{\hrule height.08em\relax}
\def\vrulespec{\vrule width .08em}
\def\hrulecorns{\hbox to\hsize{\vrule height.08em width.08em\hss
                               \vrule height.08em width.08em}}
\def\emptykern{\kern.08em}

\let\ufram=\hrulespec
\let\lfram=\vrulespec
\let\rfram=\vrulespec
\let\dfram=\hrulespec

\def\nc#1#2#3#4#5#6{\mathop{\vcenter{\kern.04em
   \hbox{\mathsurround=0pt
   \nframs#5#6\expandafter\setframparam\framparam
   \lfram\kern-.08em
   $\vcenter to1.2em{\offinterlineskip \hsize=1.2em
     \setcircparam#1#2#3#4
     \ufram\kern.05em 
     \hbox to\hsize{\hss\ucirc\hss}
     \vss
     \hbox to\hsize{\kern.08em\lcirc\hss\centersign\hss\rcirc\kern.08em}
     \vss
     \hbox to\hsize{\hss\dcirc\hss}
     \kern.05em\dfram}$\kern-.08em\rfram}\kern.04em
     }}\gdef\fparam{0000}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end of macros



