% \iffalse meta comment % File: miller.dtx Copyright (C) 2003, 2004 Harald Harders, Bj"orn Pedersen % \fi % % \iffalse %<*driver> \documentclass{ltxdoc} \usepackage[T1]{fontenc} \title{The \texttt{miller} package} \author{Harald Harders (\texttt{h.harders@tu-bs.de})\\ Bj\"orn Pedersen (\texttt{bjoern.pedersen@frm2.tum.de})} \date{Version \fileversion, \filedate} \EnableCrossrefs \CodelineIndex \DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter} \DoNotIndex{\setcounter,\space} \CodelineNumbered \RecordChanges \CheckSum{159} \IfFileExists{miller-v.tex}{% \input{miller-v.tex} \GetFileInfo{miller-v.tex} }{% \PackageError{miller}{File miller-v.tex not found, please\MessageBreak run `latex miller.ins' first}{No additional help}% \def\fileversion{\textbf{??}}% \def\filedate{\textbf{??}}% } \usepackage{miller} \begin{document} \DocInput{miller.dtx} \end{document} % % \fi % % \changes{1.0}{2003/04/11}{Changed \cs{millerminus} from \cs{bar} to % \cs{overline} due to numbers with more than one digit (HH, BP).}% % \changes{1.0}{2003/04/11}{Added support to arguments with space and % numbers with more than one digit (HH, BP).}% % \changes{1.1}{2004/04/07}{Bugfix: In some cases, arguments without % space have been parsed incorrectly (HH).}% % \changes{1.1}{2004/04/07}{Bugfix: Detect isolated minus sign in % argument with spaces (HH).}% % \changes{1.1}{2004/04/07}{Add a documentation (HH).}% % % \maketitle % \begin{abstract} % \noindent % Typeset miller indices, e.g., $\langle 1\bar20\rangle$, used in % material sicence with an easy syntax. % Minus signs are printed as bar above the corresponding number. % \end{abstract} % % \tableofcontents % % \section*{Copyright} % Copyright 2003, 2004 Harald Harders, Bj\"orn Pedersen. % % This program can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN % archives in directory macros/latex/base/lppl.txt; either % version 1.3 of the License, or any later version. % % \section{The user interface} % % To use this package place %\begin{verbatim} %\usepackage{miller} %\end{verbatim} % in the preamble of your document. % % \DescribeMacro{\hkl}% % The \cs{hkl} macro can be used in different ways. % Its argument is surrounded by the parantheses that you want to % appear in the document. % If the argument contains spaces, they are taken as delimiters % between the different components of the hkl vector. % If no spaces are given, each component has exactly one digit (plus % eventually a preceeding minus sign). % The usage is shown with some examples. % % \medskip\noindent % Specify one direction in space: %\begin{verbatim} %\hkl[1 12 3], \hkl[-1 0 -12], \hkl[1 11 -2 0]\\ %\hkl[123], \hkl[-10-2], \hkl[11-20] %\end{verbatim} %\begin{quote} %\hkl[1 12 3], \hkl[-1 0 -12], \hkl[1 11 -2 0]\\ %\hkl[123], \hkl[-10-2], \hkl[11-20] %\end{quote} % Specify all equal directions in space: %\begin{verbatim} %\hkl<1 12 3>, \hkl<-1 0 -12>, \hkl<1 11 -2 0>\\ %\hkl<123>, \hkl<-10-2>, \hkl<11-20> %\end{verbatim} %\begin{quote} %\hkl<1 12 3>, \hkl<-1 0 -12>, \hkl<1 11 -2 0>\\ %\hkl<123>, \hkl<-10-2>, \hkl<11-20> %\end{quote} % Specify one plane in space: %\begin{verbatim} %\hkl(1 12 3), \hkl(-1 0 -12), \hkl(1 11 -2 0)\\ %\hkl(123), \hkl(-10-2), \hkl(11-20) %\end{verbatim} %\begin{quote} %\hkl(1 12 3), \hkl(-1 0 -12), \hkl(1 11 -2 0)\\ %\hkl(123), \hkl(-10-2), \hkl(11-20) %\end{quote} % Specify all equal planes in space: %\begin{verbatim} %\hkl{1 12 3}, \hkl{-1 0 -12}, \hkl{1 11 -2 0}\\ %\hkl{123}, \hkl{-10-2}, \hkl{11-20} %\end{verbatim} %\begin{quote} %\hkl{1 12 3}, \hkl{-1 0 -12}, \hkl{1 11 -2 0}\\ %\hkl{123}, \hkl{-10-2}, \hkl{11-20} %\end{quote} % % The first version (with spaces) allows indices with more than one % digit, while the second one is shorter in the source code. % % The symbol used for the bar is changeable by redefining the % \cs{millerminus} command, e.g., %\begin{verbatim} %\usepackage{ushort} %\ushortCreate:\overline{oshort} %\renewcommand\millerminus{\oshort} %\end{verbatim} % % The space between numbers can be changed, e.g., %\begin{verbatim} %\hkl<123>\\ %\renewcommand\millerskip{\;}\hkl<123>\\ %\renewcommand\millerskip{,\,}\hkl<123>\\ %\renewcommand\millerskip{}\hkl<123> %\end{verbatim} %\begin{quote} %\hkl<123>\\ %\renewcommand\millerskip{\;}\hkl<123>\\ %\renewcommand\millerskip{,\,}\hkl<123>\\ %\renewcommand\millerskip{}\hkl<123> %\end{quote} % % \StopEventually{\PrintChanges \PrintIndex} % % \section{The implementation} % % Heading of the package: % \begin{macrocode} %\ProvidesPackage{miller} %\ProvidesFile{miller-v.tex} % [2004/09/20 v1.2 print miller indices] %<*package> % \end{macrocode} % Define command for space between numbers. % \begin{macrocode} \newcommand*\millerskip{\,} % \end{macrocode} % Define the command for the minus. % \begin{macrocode} \newcommand*\millerminus{\overline} % \end{macrocode} % Check for space in argument. % \begin{macrocode} \def\@millerno#1 #2\@empty{% \xdef\miller@secondarg{#2}% \ifx\@empty\miller@secondarg \@@@millerno#1#2\@empty\@empty\@empty \else \@@millerno#1 #2\@empty \fi }% % \end{macrocode} % Parse for minus sign. % \begin{macrocode} \def\@checkminus#1#2\@empty{% \ifx-#1% \begingroup \edef\@tempa{#2}% \edef\@tempb{}% \ifx\@tempa\@tempb \PackageError{miller}{% \string\hkl\space command contains a single minus}{No entry of the \string\hkl\space command may consist only of a minus.}% #1% \else \millerminus{\vphantom{b}#2}% \fi \endgroup \else #1#2% \fi } % \end{macrocode} % Parse the argument (with spaces). % \begin{macrocode} \def\@@millerno#1 #2{% \ifx\@empty#2% \let\next\relax \else% \let\next\@@millerno \fi% \@checkminus#1\@empty \ifx\@empty#2\else\millerskip\fi \next #2% } % \end{macrocode} % Parse the argument (without spaces). % \begin{macrocode} \def\@@@millerno#1#2#3{% \ifx-#1 \millerminus{\vphantom{b}#2}% \def\miller@nextarg{#3}% \ifx\@empty#3% \let\next\relax \@tempswafalse \ifx-#2 \@tempswatrue\fi \ifx\@empty#2 \@tempswatrue\fi \if@tempswa \PackageError{miller}{% Last character of \string\hkl\space command is a minus}{The last character may not be a minus.}% \fi \else% \let\next\@@@millerno \millerskip \fi% \else #1% \def\miller@nextarg{#2#3}% \ifx\@empty#2% \let\next\relax \ifx-#1 \PackageError{miller}{% Last character of \string\hkl\space command is a minus}{The last character may not be a minus.}% \fi \else% \let\next\@@@millerno \millerskip \fi% \fi \expandafter\next\miller@nextarg } % \end{macrocode} % Commands for the different types. % \begin{macrocode} \def\hkleckig[#1]{\ensuremath{[\@millerno#1 \@empty]}} \def\hklrund(#1){\ensuremath{(\@millerno#1 \@empty)}} \def\hklspitz<#1>{\ensuremath{\langle\@millerno#1 \@empty\rangle}} \def\hklgeschweift#1{\ensuremath{\{\@millerno#1 \@empty\}}} % \end{macrocode} % \begin{macro}{\hkl} % \changes{1.2}{2004/09/20}{Make \cs{hkl} robust}% % The command itself. % \begin{macrocode} \DeclareRobustCommand*\hkl{% \@ifnextchar[{\hkleckig}{% \@ifnextchar({\hklrund}{% \@ifnextchar<{\hklspitz}{\hklgeschweift}}}} % % \end{macrocode} % \end{macro} % % \Finale