Debian Codegraph @

texmf-dist/source/latex/miller/miller.dtx

raw
1 % \iffalse meta comment
2 % File: miller.dtx Copyright (C) 2003, 2004 Harald Harders, Bj"orn Pedersen
3 % \fi
4 %
5 % \iffalse
6 %<*driver>
7 \documentclass{ltxdoc}
8 \usepackage[T1]{fontenc}
9 \title{The \texttt{miller} package}
10 \author{Harald Harders (\texttt{[email protected]})\\
11 Bj\"orn Pedersen (\texttt{[email protected]})}
12 \date{Version \fileversion, \filedate}
13 \EnableCrossrefs
14 \CodelineIndex
15 \DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter}
16 \DoNotIndex{\setcounter,\space}
17 \CodelineNumbered
18 \RecordChanges
19 \CheckSum{159}
20 \IfFileExists{miller-v.tex}{%
21 \input{miller-v.tex}
22 \GetFileInfo{miller-v.tex}
23 }{%
24 \PackageError{miller}{File miller-v.tex not found,
25 please\MessageBreak
26 run `latex miller.ins' first}{No additional help}%
27 \def\fileversion{\textbf{??}}%
28 \def\filedate{\textbf{??}}%
29 }
30 \usepackage{miller}
31 \begin{document}
32 \DocInput{miller.dtx}
33 \end{document}
34 %</driver>
35 % \fi
36 %
37 % \changes{1.0}{2003/04/11}{Changed \cs{millerminus} from \cs{bar} to
38 % \cs{overline} due to numbers with more than one digit (HH, BP).}%
39 % \changes{1.0}{2003/04/11}{Added support to arguments with space and
40 % numbers with more than one digit (HH, BP).}%
41 % \changes{1.1}{2004/04/07}{Bugfix: In some cases, arguments without
42 % space have been parsed incorrectly (HH).}%
43 % \changes{1.1}{2004/04/07}{Bugfix: Detect isolated minus sign in
44 % argument with spaces (HH).}%
45 % \changes{1.1}{2004/04/07}{Add a documentation (HH).}%
46 %
47 % \maketitle
48 % \begin{abstract}
49 % \noindent
50 % Typeset miller indices, e.g., $\langle 1\bar20\rangle$, used in
51 % material sicence with an easy syntax.
52 % Minus signs are printed as bar above the corresponding number.
53 % \end{abstract}
54 %
55 % \tableofcontents
56 %
57 % \section*{Copyright}
58 % Copyright 2003, 2004 Harald Harders, Bj\"orn Pedersen.
59 %
60 % This program can be redistributed and/or modified under the terms
61 % of the LaTeX Project Public License Distributed from CTAN
62 % archives in directory macros/latex/base/lppl.txt; either
63 % version 1.3 of the License, or any later version.
64 %
65 % \section{The user interface}
66 %
67 % To use this package place
68 %\begin{verbatim}
69 %\usepackage{miller}
70 %\end{verbatim}
71 % in the preamble of your document.
72 %
73 % \DescribeMacro{\hkl}%
74 % The \cs{hkl} macro can be used in different ways.
75 % Its argument is surrounded by the parantheses that you want to
76 % appear in the document.
77 % If the argument contains spaces, they are taken as delimiters
78 % between the different components of the hkl vector.
79 % If no spaces are given, each component has exactly one digit (plus
80 % eventually a preceeding minus sign).
81 % The usage is shown with some examples.
82 %
83 % \medskip\noindent
84 % Specify one direction in space:
85 %\begin{verbatim}
86 %\hkl[1 12 3], \hkl[-1 0 -12], \hkl[1 11 -2 0]\\
87 %\hkl[123], \hkl[-10-2], \hkl[11-20]
88 %\end{verbatim}
89 %\begin{quote}
90 %\hkl[1 12 3], \hkl[-1 0 -12], \hkl[1 11 -2 0]\\
91 %\hkl[123], \hkl[-10-2], \hkl[11-20]
92 %\end{quote}
93 % Specify all equal directions in space:
94 %\begin{verbatim}
95 %\hkl<1 12 3>, \hkl<-1 0 -12>, \hkl<1 11 -2 0>\\
96 %\hkl<123>, \hkl<-10-2>, \hkl<11-20>
97 %\end{verbatim}
98 %\begin{quote}
99 %\hkl<1 12 3>, \hkl<-1 0 -12>, \hkl<1 11 -2 0>\\
100 %\hkl<123>, \hkl<-10-2>, \hkl<11-20>
101 %\end{quote}
102 % Specify one plane in space:
103 %\begin{verbatim}
104 %\hkl(1 12 3), \hkl(-1 0 -12), \hkl(1 11 -2 0)\\
105 %\hkl(123), \hkl(-10-2), \hkl(11-20)
106 %\end{verbatim}
107 %\begin{quote}
108 %\hkl(1 12 3), \hkl(-1 0 -12), \hkl(1 11 -2 0)\\
109 %\hkl(123), \hkl(-10-2), \hkl(11-20)
110 %\end{quote}
111 % Specify all equal planes in space:
112 %\begin{verbatim}
113 %\hkl{1 12 3}, \hkl{-1 0 -12}, \hkl{1 11 -2 0}\\
114 %\hkl{123}, \hkl{-10-2}, \hkl{11-20}
115 %\end{verbatim}
116 %\begin{quote}
117 %\hkl{1 12 3}, \hkl{-1 0 -12}, \hkl{1 11 -2 0}\\
118 %\hkl{123}, \hkl{-10-2}, \hkl{11-20}
119 %\end{quote}
120 %
121 % The first version (with spaces) allows indices with more than one
122 % digit, while the second one is shorter in the source code.
123 %
124 % The symbol used for the bar is changeable by redefining the
125 % \cs{millerminus} command, e.g.,
126 %\begin{verbatim}
127 %\usepackage{ushort}
128 %\ushortCreate:\overline{oshort}
129 %\renewcommand\millerminus{\oshort}
130 %\end{verbatim}
131 %
132 % The space between numbers can be changed, e.g.,
133 %\begin{verbatim}
134 %\hkl<123>\\
135 %\renewcommand\millerskip{\;}\hkl<123>\\
136 %\renewcommand\millerskip{,\,}\hkl<123>\\
137 %\renewcommand\millerskip{}\hkl<123>
138 %\end{verbatim}
139 %\begin{quote}
140 %\hkl<123>\\
141 %\renewcommand\millerskip{\;}\hkl<123>\\
142 %\renewcommand\millerskip{,\,}\hkl<123>\\
143 %\renewcommand\millerskip{}\hkl<123>
144 %\end{quote}
145 %
146 % \StopEventually{\PrintChanges \PrintIndex}
147 %
148 % \section{The implementation}
149 %
150 % Heading of the package:
151 % \begin{macrocode}
152 %<package>\ProvidesPackage{miller}
153 %<version>\ProvidesFile{miller-v.tex}
154 %<package|version> [2004/09/20 v1.2 print miller indices]
155 %<*package>
156 % \end{macrocode}
157 % Define command for space between numbers.
158 % \begin{macrocode}
159 \newcommand*\millerskip{\,}
160 % \end{macrocode}
161 % Define the command for the minus.
162 % \begin{macrocode}
163 \newcommand*\millerminus{\overline}
164 % \end{macrocode}
165 % Check for space in argument.
166 % \begin{macrocode}
167 \def\@millerno#1 #2\@empty{%
168 \xdef\miller@secondarg{#2}%
169 \ifx\@empty\miller@secondarg
170 \@@@millerno#1#2\@empty\@empty\@empty
171 \else
172 \@@millerno#1 #2\@empty
173 \fi
174 }%
175 % \end{macrocode}
176 % Parse for minus sign.
177 % \begin{macrocode}
178 \def\@checkminus#1#2\@empty{%
179 \ifx-#1%
180 \begingroup
181 \edef\@tempa{#2}%
182 \edef\@tempb{}%
183 \ifx\@tempa\@tempb
184 \PackageError{miller}{%
185 \string\hkl\space command contains a single minus}{No entry of
186 the \string\hkl\space command may consist only of a minus.}%
187 #1%
188 \else
189 \millerminus{\vphantom{b}#2}%
190 \fi
191 \endgroup
192 \else
193 #1#2%
194 \fi
195 }
196 % \end{macrocode}
197 % Parse the argument (with spaces).
198 % \begin{macrocode}
199 \def\@@millerno#1 #2{%
200 \ifx\@empty#2%
201 \let\next\relax
202 \else%
203 \let\next\@@millerno
204 \fi%
205 \@checkminus#1\@empty
206 \ifx\@empty#2\else\millerskip\fi
207 \next #2%
208 }
209 % \end{macrocode}
210 % Parse the argument (without spaces).
211 % \begin{macrocode}
212 \def\@@@millerno#1#2#3{%
213 \ifx-#1
214 \millerminus{\vphantom{b}#2}%
215 \def\miller@nextarg{#3}%
216 \ifx\@empty#3%
217 \let\next\relax
218 \@tempswafalse
219 \ifx-#2 \@tempswatrue\fi
220 \ifx\@empty#2 \@tempswatrue\fi
221 \if@tempswa
222 \PackageError{miller}{%
223 Last character of \string\hkl\space command is a minus}{The
224 last character may not be a minus.}%
225 \fi
226 \else%
227 \let\next\@@@millerno
228 \millerskip
229 \fi%
230 \else
231 #1%
232 \def\miller@nextarg{#2#3}%
233 \ifx\@empty#2%
234 \let\next\relax
235 \ifx-#1
236 \PackageError{miller}{%
237 Last character of \string\hkl\space command is a minus}{The
238 last character may not be a minus.}%
239 \fi
240 \else%
241 \let\next\@@@millerno
242 \millerskip
243 \fi%
244 \fi
245 \expandafter\next\miller@nextarg
246 }
247 % \end{macrocode}
248 % Commands for the different types.
249 % \begin{macrocode}
250 \def\hkleckig[#1]{\ensuremath{[\@millerno#1 \@empty]}}
251 \def\hklrund(#1){\ensuremath{(\@millerno#1 \@empty)}}
252 \def\hklspitz<#1>{\ensuremath{\langle\@millerno#1 \@empty\rangle}}
253 \def\hklgeschweift#1{\ensuremath{\{\@millerno#1 \@empty\}}}
254 % \end{macrocode}
255 % \begin{macro}{\hkl}
256 % \changes{1.2}{2004/09/20}{Make \cs{hkl} robust}%
257 % The command itself.
258 % \begin{macrocode}
259 \DeclareRobustCommand*\hkl{%
260 \@ifnextchar[{\hkleckig}{%
261 \@ifnextchar({\hklrund}{%
262 \@ifnextchar<{\hklspitz}{\hklgeschweift}}}}
263 %</package>
264 % \end{macrocode}
265 % \end{macro}
266 %
267 % \Finale