-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmandi.dtx
10956 lines (10941 loc) · 284 KB
/
mandi.dtx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse meta-comment
% !TEX TS-program = dtxmk
%
% Copyright (C) 2016 by Paul J. Heafner <heafnerj@gmail.com>
% ---------------------------------------------------------------------------
% This work may be distributed and/or modified under the conditions of the
% LaTeX Project Public License, either version 1.3 of this license or (at
% your option) any later version. The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX version
% 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Paul J. Heafner.
%
% This work consists of the files mandi.dtx
% README
% mandi.pdf
%
% and includes the derived files mandi.ins
% mandi.sty and
% vdemo.py.
% ---------------------------------------------------------------------------
%
% \fi
%
% \iffalse
%
%<*internal>
\iffalse
%</internal>
%
%<*package>
\ProvidesPackage{mandi}[2016/03/15 2.5.1 Macros for physics and astronomy]
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%</package>
%
%<*vdemo>
from __future__ import division,print_function
from visual import *
G = 6.7e-11
# create objects
giant = sphere(pos=vector(-1e11,0,0),radius=2e10,mass=2e30,color=color.red)
giant.p = vector(0,0,-1e4) * giant.mass
dwarf = sphere(pos=vector(1.5e11,0,0),radius=1e10,mass=1e30,color=color.yellow)
dwarf.p = -giant.p
for a in [giant,dwarf]:
a.orbit = curve(color=a.color,radius=2e9)
dt = 86400
while 1:
rate(100)
dist = dwarf.pos - giant.pos
force = G * giant.mass * dwarf.mass * dist / mag(dist)**3
giant.p = giant.p + force*dt
dwarf.p = dwarf.p - force*dt
for a in [giant,dwarf]:
a.pos = a.pos + a.p/a.mass * dt
a.orbit.append(pos=a.pos)
%</vdemo>
%
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
%</internal>
%
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\usedir{tex/latex/mandi}
\preamble
Copyright (C) 2016 by Paul J. Heafner <heafnerj@gmail.com>
---------------------------------------------------------------------------
This work may be distributed and/or modified under the conditions of the
LaTeX Project Public License, either version 1.3 of this license or (at
your option) any later version. The latest version of this license is in
http://www.latex-project.org/lppl.txt
and version 1.3 or later is part of all distributions of LaTeX version
2005/12/01 or later.
This work has the LPPL maintenance status `maintained'.
The Current Maintainer of this work is Paul J. Heafner.
This work consists of the files mandi.dtx
README
mandi.pdf
and includes the derived files mandi.ins
mandi.sty and
vdemo.py.
---------------------------------------------------------------------------
\endpreamble
\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}}
\generate{\usepreamble\empty\usepostamble\empty
\file{vdemo.py}{\from{\jobname.dtx}{vdemo}}}
\obeyspaces
\Msg{*************************************************************}
\Msg{* *}
\Msg{* To finish the installation you have to move the following *}
\Msg{* file into a directory searched by TeX: *}
\Msg{* *}
\Msg{* mandi.sty *}
\Msg{* *}
\Msg{* To produce the documentation run the file mandi.dtx *}
\Msg{* through (pdf)LaTeX. *}
\Msg{* *}
\Msg{*************************************************************}
%</install>
%<install>\endbatchfile
%
%<*internal>
\usedir{tex/latex/mandi}
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}}
\generate{\usepreamble\empty\usepostamble\empty
\file{vdemo.py}{\from{\jobname.dtx}{vdemo}}}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%</internal>
%
%<*driver>
\ProvidesFile{mandi.dtx}
%</driver>
%
%<*driver>
\documentclass[10pt]{ltxdoc}
\setlength{\marginparwidth}{0.50in} % placement of todonotes
\usepackage{\jobname} % load mandi
\usepackage{parskip} % no indents/space btwn paras
\usepackage[textwidth=1.0cm]{todonotes} % allow for todonotes
\usepackage[left=0.75in,right=1.00in]{geometry} % main documentation
\usepackage{array,rotating,microtype} % accessory packages
\usepackage[listings,documentation]{tcolorbox} % workhorse package
\tcbset{index german settings,color hyperlink=blue} % set index options
\hypersetup{colorlinks=true}
\newcommandx{\ntodo}[2][1,usedefault]{%
\ifthenelse{\equal{#1}{}}
{\todo[size=\footnotesize,fancyline,caption={#2},color=yellow!40]
{\begin{sideways}#2\end{sideways}}}
{\todo[size=\footnotesize,fancyline,caption={#1},color=yellow!40]
{\begin{sideways}#2\end{sideways}}}}
\DisableCrossrefs % index descriptions only
\PageIndex % index contains page numbers
\CodelineNumbered % number source lines
\RecordChanges % record changes
\begin{document} % main document
\DocInput{\jobname.dtx}
\newgeometry{left=1.00in,right=1.00in,top=1.00in,bottom=1.00in}
\PrintIndex
\restoregeometry
\end{document} % end main document
%</driver>
% \fi
%
% \newcommand*{\pkgname}[1]{\texttt{#1}}
% \newcommand*{\mandi}{\pkgname{mandi}}
% \newcommand*{\mi}{\textit{Matter \& Interactions}}
% \hyphenation{Matter Interactions}
% \newcommand*{\opt}[1]{\textsf{\textbf{#1}}}
% \newcommand*{\baseunits}{\textit{baseunits}}
% \newcommand*{\drvdunits}{\textit{drvdunits}}
% \newcommand*{\tradunits}{\textit{tradunits}}
%
% \IndexPrologue{\section{Index}Page numbers refer to page where the
% corresponding entry is described. Not every command defined in the
% package is indexed. There may be commands similar to indexed commands
% described in relevant parts of the documentation.}
%
% \CheckSum{6069}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
% \providecommand*{\url}{\texttt}
% \GetFileInfo{\jobname.sty}
% \title{The \textsf{mandi} package}
% \author{Paul J. Heafner
% (\href{mailto:heafnerj@gmail.com?subject=[Heafner]\%20mandi}
% {\nolinkurl{heafnerj@gmail.com}})}
% \date{Version \fileversion~dated \filedate}
%
% \newgeometry{left=1.0in,right=1.0in,top=4.0in}
% \maketitle
% \restoregeometry
%
% ^^A \centerline{\textbf{PLEASE DO NOT DISTRIBUTE THIS VERSION.}}
%
% \newgeometry{left=1.0in,right=1.0in,top=1.0in,bottom=1.0in}
% \tableofcontents
% \newpage
% \phantomsection
% \addcontentsline{toc}{section}{Change History}
% \PrintChanges
% \newpage
% \phantomsection
% \addcontentsline{toc}{section}{Possible Future Enhancements}
% \listoftodos[Possible Future Enhancements]
% \newpage
% \phantomsection
% \addcontentsline{toc}{section}{Program Listings}
% \lstlistoflistings
% \newpage
% \restoregeometry
%
% \section{Introduction}
% This package provides a collection of commands useful in introductory physics
% and astronomy. The underlying philosophy is that the user, potentially an
% introductory student, should just type the name of a physical quantity, with a
% numerical value if needed, without having to think about the units. \mandi\
% will typeset everything correctly. For symbolic quantities, the user should
% type only what is necessary to get the desired result. What one types should
% correspond as closely as possible to what one thinks when writing. The package
% name derives from \mi
% \footnote{See the \mi\ home page at \url{http://www.matterandinteractions.org/}
% for more information about this innovative introductory calculus-based physics
% curriculum.} by Ruth Chabay and Bruce Sherwood. The package certainly is rather
% tightly tied to that textbook but can be used for typesetting any document that
% requires consistent physics notation. With \mandi\ many complicated expressions
% can be typeset with just a single command. Great thought has been given to
% command names and I hope users find the conventions logical and easy to remember.
%
% There are other underlying philosophies and goals embedded within \mandi,
% all of which are summarized here. These philosophies are
% \begin{itemize}
% \item to employ a \textit{type what you think} model for remembering commands
% \item to relieve the user of having to explicitly worry about typesetting SI
% units
% \item to enforce certain concepts that are too frequently merged, such as the
% distinction between a vector quantity and its magnitude (e.g.\ we often use
% the same name for both)
% \item to enforce consistent terminology in the naming of quantities, with names
% that are both meaningful to introductory students and accurate
% (e.g.\ \textit{duration} vs.\ \textit{time})
% \item to enforce consistent notation, especially for vector quantities
% \end{itemize}
%
% I hope that using \mandi\ will cause users to form good habits that
% benefit physics students.
%
% \section{Building From Source}
% I am assuming the user will use pdf\LaTeX, which creates PDF files as output,
% to build the documentation. I have not tested the build with with standard \LaTeX,
% which creates DVI files.
%
% \newpage
% \section{Loading the Package}
% To load \mandi\ with its default options, simply put the line |\usepackage{mandi}|
% in your document's preamble. To use the package's available options, put the line
% |\usepackage|\textbf{[}\opt{options}\textbf{]}|{mandi}| in your document's preamble.
% There are six available options, with one option being based on the absence of
% two of the others. The options are described below.
% \changes{v2.4.0}{2014/12/16}{Made option names consistent with default behavior.}
% \changes{v2.4.0}{2014/12/16}{Added option for boldface vector kernels.}
% \changes{v2.4.0}{2014/12/16}{Added option for approximate values of constants.}
% \changes{v2.5.0}{2015/09/13}{Removed autosized parentheses in math mode.}
% \changes{v2.5.0}{2015/12/27}{Added option for radians in certain angular quantities.}
% \changes{v2.5.1}{2016/03/13}{Fixed errors in build for uploading to CTAN.}
%
% \begin{itemize}
% \item \opt{boldvectors} gives bold letters for the kernels of vector names.
% No arrows are used above the kernel.
% \item \opt{romanvectors} gives Roman letters for the kernels of vectors names.
% An arrow appears over the kernel.
% \item If neither \opt{boldvectors} nor \opt{romanvectors} is specified (the
% default), vectors are displayed with italic letters for the kernels of vector
% names and an arrow appears over the kernel.
% \item \opt{singleabsbars} gives single bars in symbols for vector magnitudes.
% Double bars may be more familiar to students from their calculus courses.
% Double bars is the default.
% \item \opt{approxconsts} gives approximate values of constants to one or two
% significant figures, depending on how they appear in \mi. Otherwise, the most
% precise currently available values are used. Precise constants is the default.
% \item \opt{useradians} gives radians in the units of angular momentum,
% angular impulse, and torque. The default is to not use radians in the units
% of these quantities.
% \item \opt{baseunits} causes all units to be displayed in \baseunits\ form, with
% SI base units. No solidi (slashes) are used. Positive and negative exponents
% are used to denote powers of various base units.
% \item \opt{drvdunits} causes all units to be displayed, when possible, in
% \drvdunits\ form, with SI derived units. Students may already be familiar with
% many of these derived units.
% \item If neither \opt{baseunits} nor \opt{drvdunits} is specified (the
% default), units are displayed in what I call \tradunits\ form, which
% is typically the way they would traditionally appear in textbooks. Units in
% this form frequently hide the underlying physical meaning and are probably not
% best pedagogically but are familiar to students and teachers. In this document,
% the default is to use
% \ifthenelse{\boolean{@optbaseunits}}
% {base}
% {\ifthenelse{\boolean{@optdrvdunits}}
% {derived}
% {traditional}}
% units. As you will see later, there are ways to override these options either
% temporarily or permanently.
% \end{itemize}
%
% \changes{v2.4.0}{2014/12/17}{Now coexists with the \pkgname{commath} package.}
% \changes{v2.5.0}{2015/09/13}{Removed compatibility check for the \pkgname{commath}
% package.}
% \mandi\ coexists with the \pkgname{siunitx} package. While there is some
% functional overlap between the two packages, \mandi\ is completely independent of
% \pkgname{siunitx}. The two are designed for different purposes and probably also
% for different audiences, but can be used together if desired. \mandi\ coexists with
% the \pkgname{commath} package. There is no longer a conflict because \mandi's
% |\abs| command has been renamed to |\absof|. \mandi\ no longer checks for the
% presence of the \pkgname{physymb} package. That package now incorporates \mandi\
% dependencies, and the two are completely compatible.
% \changes{v2.4.0}{2014/12/19}{Removed compatibility check for the \pkgname{physymb}
% package.}
%
% \section{Usage}
% So what does \mandi\ allow you to do? There are two main design goals. The first
% is typeset numerical values of scalar and vector physical quantities and their
% SI units. The idea is to simply type a command corresponding to the quantity's
% name, specifying as an argument a single scalar value or the numerical components
% of a traditional Cartesian 3-vector, and let \mandi\ take care of the units.
%
% In introductory physics courses, students typically have trouble remembering
% which units go with which quantities and, more importantly, remembering to include
% units in numerical calculations. \mandi\ is designed to help with these problems.
% Suppose you want to typeset a calculation of a particle's kinetic energy (assume
% the magnitude of the particle's velocity is much less than the magnitude of light's
% velocity). You could use
%
%\iffalse
%<*example>
%\fi
\begin{dispExample}
\[ K \approx \frac{1}{2}(\unit{2}{\kg})(\unit{2}{\m\per\s})^2 \]
\end{dispExample}
%\iffalse
%</example>
%\fi
%
% which is nearly incomprehensible for people new to \LaTeX\ and that (probably)
% includes introductory physics students, but \mandi\ lets you do something more
% logical and more readable, like this
%
%\iffalse
%<*example>
%\fi
\begin{dispExample}
\[ K \approx \onehalf (\mass{2})(\velocity{2})\squared \]
\end{dispExample}
%\iffalse
%</example>
%\fi
%
% which produces the same output. In the second example, note that the units
% are abstracted so the user need not remember them. This doesn't mean that students
% don't need to know what the various units are, but it does mean that now there is
% no way for units to be left out of a calculation. Note also that the commands
% correspond to the actual names of the quantities needed for the calculation. All
% the student needs to do is remember what quantities are needed and then construct
% the appropriate \LaTeX\ expression in a way that is very similar to writing
% program code in a language like Python, with which many students will have had
% previous experience. This may make \LaTeX\ easier for beginners to learn, and
% the second way is more readable if you come back to the source document, perhaps
% having not looked at it for a while.
%
% Suppose you want to use vectors quantities. That's no problem because \mandi\
% handles vector quantities.
%
%\iffalse
%<*example>
%\fi
\begin{dispExample}
Calculate the magnitude of \momentum{\mivector{3,2,5}}.
\end{dispExample}
%\iffalse
%</example>
%\fi
%
% The underlying strategy is to \textit{think about how you would say what you want
% to write and then write it the way you would say it}. With a few exceptions, this
% is how \mandi\ works. You need not worry about units because \mandi\ knows what
% SI units go with which physical quantities. You can define new quantities so that
% \mandi\ knows about them and in doing so, you give the new quantities the same
% names they would normally have.
%
% The second main design goal provides a similar approach to typesetting the most
% frequently used symbolic expressions in introductory physics. If you want to save
% time in writing out the expression for the electric field of a particle, just use
%
%\iffalse
%<*example>
%\fi
\begin{dispExample}
\Efieldofparticle
\end{dispExample}
%\iffalse
%</example>
%\fi
%
% which, as you can see, takes fewer keystrokes and it's easier to remember. Correct
% vector notation is automatically enforced, leading students to get used to seeing
% it and, hopefully, using it in their own calculations. Yes, this is a bit of an
% agenda on my part, but my experience has been that students don't recognize or
% appreciate the utility of vector notation and thus their physical reasoning may
% suffer as a result. So by using \mandi\ they use simple commands that mirror what
% they're thinking, or what they're supposed to be thinking (yes, another agenda),
% and in the process see the correct typeset output.
%
% There is another persistent problem with introductory physics textbooks, and that
% is that many authors do not use consistent notation. Many authors define the
% notation for a vector's magnitude to be either \magvect{a} or \absof{\vect{a}} in
% an early chapter, but then completely ignore that notation and simply use \(a\)
% later in the book. I have never understood the (lack of) logic behind this practice
% and find it more than annoying. Textbooks authors should know better, and should
% set a better example for introductory students. I propose that using \mandi\
% would eliminate all last vestiges of all excuses for not setting this one good
% example for introductory students.
%
% This barely scratches the surface in describing \mandi\ so continue reading this
% document to see everything it can do.
%
% \section{Features and Commands}
% \subsection{Autosized Parentheses Removed}
% An experimental feature of past \mandi\ versions was autosized parentheses in math
% mode. This feature has been removed, mostly because parentheses and some other
% delimiters have been replaced by commands that leave placeholders if the argument
% is empty. Autosized parentheses may return in a future version.
%
% \subsection{SI Base Units and Dimensions}
% This is not a tutorial on SI units and the user is assumed to be familiar with SI
% rules and usage. Begin by defining shortcuts for the units for the seven SI base
% quantities:
% \textit{spatial displacement} (what others call \textit{length}), \textit{mass},
% \textit{temporal displacement} (what others call \textit{time}, but we will call
% it \textit{duration} in most cases), \textit{electric current}, \textit
% {thermodynamic temperature}, \textit{amount}, and \textit{luminous intensity}.
% These shortcuts are used internally and need not explicitly be invoked by the
% user.
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{m}{}
Command for \href{http://en.wikipedia.org/wiki/metre}{metre}, the SI unit of
spatial displacement (length).
\end{docCommand}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{kg}{}
Command for \href{http://en.wikipedia.org/wiki/kilogram}{kilogram}, the SI unit
of mass.
\end{docCommand}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{s}{}
Command for \href{http://en.wikipedia.org/wiki/second}{second}, the SI unit
of temporal displacement (duration).
\end{docCommand}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{A}{}
Command for \href{http://en.wikipedia.org/wiki/ampere}{ampere}, the SI unit
of electric current.
\end{docCommand}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{K}{}
Command for \href{http://en.wikipedia.org/wiki/kelvin}{kelvin}, the SI unit
of thermodynamic temperature.
\end{docCommand}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{mol}{}
Command for \href{http://en.wikipedia.org/wiki/mole}{mole}, the SI unit of
amount.
\end{docCommand}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{cd}{}
Command for \href{http://en.wikipedia.org/wiki/candela}{candela}, the SI
unit of luminous intensity.
\end{docCommand}
%\iffalse
%</example>
%\fi
%
% If \mandi\ was invoked with \opt{baseunits}, then every physical quantity will
% have a unit that is some product of powers of these seven base SI units.
% Exceptions are angular quantities, which will include either degrees or radians
% depending upon the application. Again, this is what we mean by \baseunits\ form.
%
% Certain combinations of the SI base units have nicknames and each such
% combination and nickname constitutes a \textit{derived unit}. Derived units are
% no more physically meaningful than the base units, they are merely nicknames for
% particular combinations of base units. An example of a derived unit is the
% newton, for which the symbol (it is not an abbreviation) is \newton. However,
% the symbol \newton\ is merely a nickname for a particular combination of base
% units. It is not the case that every unique combination of base units has a
% nickname, but those that do are usually named in honor of a scientist.
% Incidentally, in such cases, the symbol is capitalized but the \textit{name}
% of the unit is \textbf{never} capitalized. Thus we would write the name of the
% derived unit of force as newton and not Newton. Again, using these select
% nicknames for certain combinations of base units is what we mean by \drvdunits\
% form.
%
% \subsection{SI Dimensions}
% For each SI unit, there is a corresponding dimension. Every physical quantity
% is some multiplicative product of each of the seven basic SI dimensions raised
% to a power.
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{dimddisplacement}{}
Command for the symbol for the dimension of displacement.
\end{docCommand}
\begin{dispExample*}{sidebyside}
displacement has dimension of \dimdisplacement
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{dimmass}{}
Command for the symbol for the dimension of mass.
\end{docCommand}
\begin{dispExample*}{sidebyside}
mass has dimension of \dimmass
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{dimduration}{}
Command for the symbol for the dimension of duration.
\end{docCommand}
\begin{dispExample*}{sidebyside}
duration has dimension of \dimduration
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{dimcurrent}{}
Command for the symbol for the dimension of current.
\end{docCommand}
\begin{dispExample*}{sidebyside}
current has dimension of \dimcurrent
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{dimtemperature}{}
Command for the symbol for the dimension of temperature.
\end{docCommand}
\begin{dispExample*}{sidebyside}
temperature has dimension of \dimtemperature
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{dimamount}{}
Command for the symbol for the dimension of amount.
\end{docCommand}
\begin{dispExample*}{sidebyside}
amount has dimension of \dimamount
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{dimluminous}{}
Command for the symbol for the dimension of luminous intensity.
\end{docCommand}
\begin{dispExample*}{sidebyside}
luminous has dimension of \dimluminous
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
% \subsection{Defining Physics Quantities}
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{newphysicsquantity}
{\marg{newname}\marg{\baseunits}\oarg{\drvdunits}\oarg{\tradunits}}
Defines a new physics quantity and its associated commands.
\end{docCommand}
%\iffalse
%</example>
%\fi
%
% Using this command causes several things to happen.
% \begin{itemize}
% \item A command \colDef{\cs{newname}}\marg{magnitude}, where \colDef{newname}
% is the first argument of \colDef{\cs{newphysicsquantity}}, is created that
% takes one mandatory argument, a numerical magnitude. Subsequent use of your
% defined scalar quantity can be invoked by typing \colDef{\cs{newname}}
% \marg{magnitude} and the units will be typeset according to the options
% given when \mandi\ was loaded. Note that if the \drvdunits\ and \tradunits\
% forms are not specified, they will be populated with the \baseunits\ form.
% \item A command \colDef{\cs{newnamebaseunit}}\marg{magnitude} is created that
% expresses the quantity and its units in \baseunits\ form.
% \item A command \colDef{\cs{newnamedrvdunit}}\marg{magnitude} is created that
% expresses the quantity and its units in \drvdunits\ form. This command is
% created whether or not the first optional argument is provided.
% \item A command \colDef{\cs{newnametradunit}}\marg{magnitude} is created that
% expresses the quantity and its units in \tradunits\ form. This command is
% created whether or not the first optional argument is provided.
% \item A command \colDef{\cs{newnameonlybaseunit}}\marg{magnitude} is created
% that expresses \textbf{only} the quantity's units in \baseunits\ form.
% \item A command \colDef{\cs{newnameonlydrvdunit}}\marg{magnitude} is created
% that expresses \textbf{only} the quantity's units in \drvdunits\ form.
% \item A command \colDef{\cs{newnameonlytradunit}}\marg{magnitude} is created
% that expresses \textbf{only} the quantity's units in \tradunits\ form.
% \item A command \colDef{\cs{newnamevalue}}\marg{magnitude} is created that
% expresses \textbf{only} the quantity's numerical value.
% \end{itemize}
%
% As an example, consider momentum. The following commands are defined:
%
% \begin{quotation}
% \begin{tabular}{l l l}
% |\momentum{3}| &\momentum{3} & unit set by global options \\
% |\momentumbaseunit{3}| &\momentumbaseunit{3} & quantity with base unit \\
% |\momentumdrvdunit{3}| &\momentumdrvdunit{3} & quantity with derived unit \\
% |\momentumtradunit{3}| &\momentumtradunit{3} & quantity with traditional unit \\
% |\momentumvalue{3}| &\momentumvalue{3} & selects only numerical value \\
% |\momentumonlybaseunit|&\momentumonlybaseunit & selects only base unit \\
% |\momentumonlydrvdunit|&\momentumonlydrvdunit & selects only derived unit \\
% |\momentumonlytradunit|&\momentumonlytradunit & selects only traditional unit
% \end{tabular}
% \end{quotation}
%
% Momentum is a vector quantity, so obviously this command really refers to the
% magnitude of a momentum vector. There is an interesting, and as far as I can
% tell unwritten, convention in physics that we use the same name for a vector
% and its magnitude with one exception, and that is for velocity, the magnitude
% of which we sometimes call speed. Conceptually, however, velocity and speed are
% different entities. Therefore, \mandi\ has different commands for them. Actually,
% the \cs{speed} command is just an alias for \cs{velocity} and should only be used
% for scalars and never for vectors. This convention means that the same name is
% used for vector quantities and the corresponding magnitudes.
%
% \subsubsection{Defining Vector Quantities}
%
% All physical quantities are defined as in the momentum example above regardless
% of whether the quantity is a scalar or a vector. To typeset a vector quantity in
% terms of its components in some coordinate system (usually an orthonormal
% cartesian system, specify an argument consisting of a vector with components as
% a comma separated list in a \cs{mivector} command. So specifying a momentum vector
% is as simple as
%
%\iffalse
%<*example>
%\fi
\begin{dispExample}
\momentum{\mivector{3,2,-1}}
\end{dispExample}
%\iffalse
%</example>
%\fi
%
% where the notation corresponds to that used in \mi.
%
% \subsection{First Semester Physics}
% The first semester of \mi\, and indeed most traditional introductory
% calculus-based physics course, focuses on mechanics, dynamics, and statistical
% mechanics.
%
% \subsubsection{Predefined Quantities}
%
% The seven fundamental quantities are similarly defined and examples of their
% usage is given in the following table.
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{displacement}{\marg{magnitude}}
Command for displacement.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a displacement of \displacement{5} \\
a displacement of \displacement{\mivector{3,2,-1}}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{mass}{\marg{magnitude}}
Command for mass.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a mass of \mass{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{duration}{\marg{magnitude}}
Command for duration.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a duration of \duration{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{current}{\marg{magnitude}}
Command for current.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a current of \current{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{temperature}{\marg{magnitude}}
Command for temperature.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a temperature of \temperature{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{amount}{\marg{magnitude}}
Command for amount.
\end{docCommand}
\begin{dispExample*}{sidebyside}
an amount of \amount{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{luminous}{\marg{magnitude}}
Command for luminous intensity.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a luminous intensity of \luminous{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
% While we're at it, let's also go ahead and define a few non-SI units from
% astronomy and astrophysics.
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{planeangle}{\marg{magnitude}}
Command for plane angle in radians.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a plane angle of \planeangle{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{solidangle}{\marg{magnitude}}
Command for solidangle.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a solid angle of \solidangle{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{indegrees}{\marg{magnitude}}
Command for plane angle in degrees.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a plane angle of \indegrees{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{inarcminutes}{\marg{magnitude}}
Command for plane angle in minutes of arc.
\end{docCommand}
\begin{dispExample*}{sidebyside}
an angle of \inarcminutes{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{inarcseconds}{\marg{magnitude}}
Command for plane angle in seconds of arc.
\end{docCommand}
\begin{dispExample*}{sidebyside}
an angle of \inarcseconds{5}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{inFarenheit}{\marg{magnitude}}
Command for temperature in degrees Farenheit.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a temperature of \inFarenheit{68}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{inCelsius}{\marg{magnitude}}
Command for temperature in degrees Celsius.
\end{docCommand}
\begin{dispExample*}{sidebyside}
a temperature of \inCelsius{20}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{ineV}{\marg{magnitude}}
Command for energy in electron volts.
\end{docCommand}
\begin{dispExample*}{sidebyside}
an energy of \ineV{10.2}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{ineVocs}{\marg{magnitude}}
Command for mass in \(\mathrm{eV}\per c^2\).
\end{docCommand}
\begin{dispExample*}{sidebyside}
a mass of \ineVocs{1.1}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{ineVoc}{\marg{magnitude}}
Command for momentum in \(\mathrm{eV}\per c\).
\end{docCommand}
\begin{dispExample*}{sidebyside}
a momentum of \ineVoc{3.6}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{inMeV}{\marg{magnitude}}
Command for energy in millions of electron volts.
\end{docCommand}
\begin{dispExample*}{sidebyside}
an energy of \inMeV{2.2}
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{inMeVocs}{\marg{magnitude}}
Command for mass in \(\mathrm{MeV}\per c^2\).
\end{docCommand}
\begin{dispExample*}{sidebyside}
a mass of \inMeVocs{0.511}
\end{dispExample*}
%\iffalse
%</example>