%%
%% miller.sty
%%
%% Harald Harders, h.harders@tu-bs.de
%%
%% License: LPPL
%%
%% Prints Miller indices with minus sign as bar.
%%
%% The symbol used for the bar is changeable by redefining the
%% \millerminus command, e.g. 
%%   \usepackage{ushort}
%%   \ushortCreate:\overline{oshort}
%%   \renewcommand\millerminus{\oshort}
%% 
%% Usage (in examples):
%%
%% \usepackage{miller}
%% 
%% \hkl[123], \hkl[-10-2], \hkl[11-20]    for one direction
%% \hkl<123>, \hkl<-10-2>, \hkl<11-20>    for all equal directions
%% \hkl(123), \hkl(-10-2), \hkl(11-20)    for one plane
%% \hkl{123}, \hkl{-10-2}, \hkl{11-20}    for all equal planes
%%
%%
\ProvidesPackage{miller}[2002/09/28 v0.03 print miller indices]
%%
%% Define the command for the minus
\newcommand\millerminus{\bar}
%%
%% Parse the argument
\def\@zahl#1#2#3\@empty{%
  \def\@minus{-}%
  \def\@eins{#1}%
  \def\@zwei{#2}%
  \def\@drei{#3}%
  \ifx\@eins\@minus
    \millerminus{\vphantom{8}#2}%
    \ifx\@drei\@empty
    \else
      \@zahl#3\@empty\@empty\@empty
    \fi
  \else
    #1%
    \ifx\@zwei\@empty
    \else
      \ifx\@drei\@empty
       \ifx\@zwei\@minus
         \PackageError{miller}{%
           Last character of \string\hkl\space command is a minus}{The
           last character may not be a minus.}%
       \else
         #2%
       \fi
      \else
       \@zahl#2#3\@empty\@empty
      \fi
    \fi
  \fi
}
%%
%% Commands for the different types
\def\hkleckig[#1]{\ensuremath{[\@zahl#1\@empty]}}
\def\hklrund(#1){\ensuremath{(\@zahl#1\@empty)}}
\def\hklspitz<#1>{\ensuremath{\langle\@zahl#1\@empty\rangle}}
\def\hklgeschweift#1{\ensuremath{\{\@zahl#1\@empty\}}}
%%
%% The command itself
\def\hkl{%
  \@ifnextchar[{\hkleckig}{%
    \@ifnextchar({\hklrund}{%
      \@ifnextchar<{\hklspitz}{\hklgeschweift}}}}
%%
\endinput
%%
%% EOF
