-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmandi.dtx
3281 lines (3261 loc) · 102 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 program = lualatexmk
%
% Copyright (C) 2021-2024 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.3c of this license or (at
% your option) any later version. The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c 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
% mandistudent.dtx
% mandiexp.dtx
% mandi.ins
% mandi.pdf
% README.md
%
% and includes the derived files mandi.sty
% mandistudent.sty
% mandiexp.sty
% vdemo.py (not needed)
% ---------------------------------------------------------------------------
%
%<*internal>
\iffalse
%</internal>
%
%<*readme>
# mandi - Macros for introductory physics
## Description
`mandi` (which can be pronounced with two syllables rhyming with _candy_, or with three
as _M and I_, referencing a popular introductory physics textbook) is for students and
instructors in an introductory physics course. They can use `mandi` to write solutions,
class notes, handouts, assessments, and other such documents. Using physical quantities
(and constants) by name eliminates missing units. Step-by-step solutions and reasoning
eliminates missing work, and consistent notation can be employed.
### `mandi`
The `mandi` package defines every physical quantity and constant used in introductory
physics by its name. SI units are included by default in any of three different kinds
(base, derived, and alternate). A simple interface for defining additional quantities
and constants is provided.
### `mandistudent`
The `mandistudent` package defines additional commands and environments for writing
solutions to physics problems. The `physicsproblem` and `physicssolution` environments
allow for semantically structured solutions. Computational problems are accommodated
as [Web VPython](https://glowscript.org/) and [VPython](https://vpython.org/) code.
### `mandiexp`
The `mandiexp` package defines commands for typesetting the equations and expressions
most frequently used in introductory physics. The equations and expressions are based
on those found in [*Matter & Interactions*](https://matterandinteractions.org/) but
are certainly applicable to any introductory physics textbook.
## Author and Maintainer
`mandi` is authored and maintained by
[Paul J. Heafner](mailto:heafnerj@gmail.com?subject=[Heafner]%20mandi).
## License
`mandi` is released under [LPPL](https://www.latex-project.org/lppl.txt) 1.3c and later.
%</readme>
%
%<*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) 2021-2024 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.3c of this license or (at
your option) any later version. The latest version of this license is in
https://www.latex-project.org/lppl.txt
and version 1.3c 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
mandistudent.dtx
mandiexp.dtx
mandi.ins
mandi.pdf
README.md
and includes the derived files mandi.sty
mandistudent.sty
mandiexp.sty
vdemo.py (not needed)
---------------------------------------------------------------------------
\endpreamble
\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
\generate{\file{mandistudent.sty}{\from{mandistudent.dtx}{package}}}
\generate{\file{mandiexp.sty}{\from{mandiexp.dtx}{package}}}
\generate{\usepreamble\empty\usepostamble\empty
\file{vdemo.py}{\from{mandistudent.dtx}{vdemo}}}
\obeyspaces
\Msg{**************************************************************}
\Msg{* v3.2.2a 2024-09-13 *}
\Msg{* Process this file with lualatex or pdflatex and then *}
\Msg{* type the following, repeating 1-3 until there are no *}
\Msg{* warnings: *}
\Msg{* 1. lualatex mandi.dtx (lualatex is required) *}
\Msg{* 2. makeindex -s gind.ist -o mandi.ind mandi.idx *}
\Msg{* 3. makeindex -s gglo.ist -o mandi.gls mandi.glo *}
\Msg{* Move the *.sty files into a directory searched by TeX. *}
\Msg{* Delete vdemo.py because it is not needed. *}
\Msg{* *}
\Msg{**************************************************************}
%</install>
%<install>\endbatchfile
%
%<*internal>
\usedir{tex/latex/mandi}
\generate{\usepreamble\empty\usepostamble\empty
\file{README.md}{\from{\jobname.dtx}{readme}}}
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%</internal>
%
%<*driver>
\ProvidesFile{mandi.dtx}
% As of 2021-12-02 ltxdoc.cls picks up ltxdoc.cfg and sets
% the default paper size to a4paper rather than letter.
% This can be changed in a local ltxdoc.cfg file but it is
% easier to just use the article class and the doc package
% instead and force letterpaper size.
%\documentclass[10pt,letterpaper]{ltxdoc}
%\SetupDoc{reportchangedates}
\documentclass[10pt,letterpaper]{article}
\usepackage[reportchangedates]{doc} % THIS SUDDENLY WORKS!
%\usepackage{hypdoc} % THIS ALSO WORKS!
\PassOptionsToPackage{listings,documentation}{tcolorbox} % prevent option clash
\usepackage{\jobname} % load mandi.sty
\usepackage{mandistudent} % load mandistudent.sty
\usepackage{mandiexp} % load mandiexp.sty
\usepackage{mwe} % provides test images
\usepackage[left = 1.00in,% %
right = 1.00in,% %
marginparwidth = 0.70in]{geometry} % main documentation
\usepackage[listings,documentation]{tcolorbox} % workhorse package
\tcbset{% % tcolorbox options
index german settings,%
index gather commands = false,%
index colorize = false,%
lefthand ratio = 0.50,%
color hyperlink = blue,%
color command = purple,%
color environment = purple!65!black,%
doc left = 0.5in,%
doc marginnote = {colframe = blue!50!white,colback = blue!5!white},%
doc head command = {interior style = {fill,left color = blue!15!white}},%
doc head environment = {interior style = {fill,left color = blue!15!white}},%
doc head key = {interior style = {fill,left color = blue!15!white}},%
docexample/.style = {%
colback = gray!10!white,sidebyside,lefthand ratio = 0.5,center},%
listing style = vpython,%
}%
% See https://tex.stackexchange.com/q/156383/218142
\newcommand*{\pkg}[1]{\textsf{#1}} % typeset package names
\newcommand*{\mandi}{\textsf{mandi}} % typeset mandi
\newcommand*{\mandistudent}{\textsf{mandistudent}} % typeset mandistudent
\newcommand*{\mandiexp}{\textsf{mandiexp}} % typeset mandiexp
\newcommand*{\WebVPython}{\texttt{Web VPython}} % typeset Web VPython
\newcommand*{\WebVPythonorg}{\texttt{WebVPython.org}} % typeset WebVPython.org
\newcommand*{\VPython}{\texttt{VPython}} % typeset VPython
\newcommand*{\VPythonorg}{\texttt{VPython.org}} % typeset VPython.org
\newcommand*{\gsurl}{webvpython.org} % Web VPython URL
\newcommand*{\vpurl}{vpython.org} % VPython URL
\newcommand*{\lualatex}{Lua\LaTeX} % typeset LuaLaTeX
%%%%% Some local hacks to make things better.
% Redefine tcolorbox's \tcbdocnew and \tcbdocupdated defaults.
\renewcommand*{\tcbdocnew}[1]
{\textcolor{green!50!black}{\sffamily\bfseries N} #1}
\renewcommand*{\tcbdocupdated}[1]
{\textcolor{blue!75!black}{\sffamily\bfseries U} #1}
\hypersetup{colorlinks=true} % colored links; no borders
% A customized internal hyperref tool to mimic that in tcolorbox.
% In fact, I borrowed it from tcolorbox.
\NewDocumentCommand{\setplace}{ s m }%
{%
\IfBooleanTF {#1}%
{\phantomsection}%
{}%
\label{#2}%
}%
\NewDocumentCommand{\linktoplace}{ m m }%
{%
\hyperref[#1]{\texttt{#2}%
\ifnum\getpagerefnumber{#1}=\thepage\relax%
\else%
%\textsuperscript{\ding{213}\,{P.}\,\pageref*{#1}}%
% Changed with tcolorbox 4.51
\textsuperscript{{\fontfamily{pzd}\fontencoding{U}\fontseries{m}\fontshape{n}\selectfont\char213}
\,{P.}\,\pageref*{#1}}%
\fi%
}%
}%
% We need a new command for in-line listings to prevent overfull boxes.
% Anything in |...| will be in small plain text.
% Previously used !...! but that conflicts with colors.
\lstMakeShortInline[basicstyle=\normalfont\ttfamily\small]|
\DisableCrossrefs % index descriptions only
\PageIndex % index refers to page numbers
\CodelineNumbered % number source lines
\RecordChanges % record changes
\begin{document} % main document
\DocInput{\jobname.dtx} %
\setcounter{CodelineNo}{0} % reset line numbers if desired
\DocInput{\jobname student.dtx} %
\setcounter{CodelineNo}{0} % reset line numbers if desired
\DocInput{\jobname exp.dtx} %
\phantomsection\addcontentsline{toc}{section}{Index}\PrintIndex%
\end{document} % end main document
%</driver>
% \fi
%
% ^^A Put unnumbered Index entry in TOC
% \IndexPrologue{\section*{Index}Page numbers refer to page where the
% corresponding entry is documented and/or referenced.\vspace{\baselineskip}}
%
% ^^A Local hack to Change History to remove `General:`
% ^^A See https://tex.stackexchange.com/a/283894/218142
% \makeatletter
% \renewcommand{\generalname}{}
% \renewcommand{\changes@}[3]{%
% \protected@edef\@tempa{\noexpand\glossary{#1%
% \ifdoc@reportchangedates%
% \space -- #2\fi%
% \levelchar%
% \ifx\saved@macroname\@empty%
% \quotechar!%
% \actualchar%
% \generalname%
% \else%
% \saved@indexname%
% \actualchar%
% \string\verb% % to fool emacs highlighting
% \quotechar*%
% \verbatimchar\saved@macroname%
% \verbatimchar%
% \fi%
% #3}}%
% \@tempa\endgroup\@esphack}%
% \makeatother
%
% \title{The \href{https://ctan.org/pkg/mandi}{\mandi} Bundle}
% \author{^^A
% Paul J. Heafner\thanks{^^A
% Email: \href{mailto:heafnerj@gmail.com?subject=from mandi documentation}
% {heafnerj@gmail.com}^^A
% }^^A
% }^^A
% \date{Printed \today}
%
% \newgeometry{left=1.0in,right=1.0in,top=4.0in}
% \maketitle
% \thispagestyle{empty}
% \centerline{\mandi{} version \mandiversion}
% \centerline{\mandistudent{} version \mandistudentversion}
% \centerline{\mandiexp{} version \mandiexpversion}
% ^^A\centerline{\textbf{PLEASE DO NOT DISTRIBUTE THIS BUILD.}}
% \restoregeometry
%
% \newgeometry{left=1.0in,right=1.0in,top=0.5in,bottom=1.0in}
% \tableofcontents
% \newpage
% \phantomsection
% \addcontentsline{toc}{section}{Acknowledgements}
% \section*{Acknowledgements}
% To all of the students who have learned \LaTeXe{} in my introductory
% physics courses over the years, I say a heartfelt thank you. You
% have contributed directly to the state of this software and to its
% use in introductory physics courses and to innovating how physics
% is taught.
%
% I also acknowledge the \LaTeXe{} developers who inhabit the
% \href{https://tex.stackexchange.com/}{\TeX{} StackExchange} site.
% Entering a new culture is daunting for anyone, especially for
% newcomers; the \LaTeXe{} development culture is no exception. We all
% share a passion for creating beautiful documents and I learned
% much over the summers of 2020 and 2021 that improved my ability to
% do just that. There are too many of you to list individually, and I
% would surely accidentally omit some were I to try. Collectively, I
% thank you all for your patience and advice.
% \newpage
% \phantomsection
% \addcontentsline{toc}{section}{Change History}
% \PrintChanges
% \newpage
% \phantomsection
% \addcontentsline{toc}{section}{List of \texttt{Web VPython} Programs}
% \listofwebvpythonprograms
% \phantomsection
% \addcontentsline{toc}{section}{List of \texttt{VPython} Programs}
% \listofvpythonprograms
% \phantomsection
% \addcontentsline{toc}{section}{List of Figures}
% \listoffigures
% \restoregeometry
%
% \changes{v3.0.0}{2021-08-22}
% {\linktoplace{sec:mandia}{mandi} \linktoplace{sec:mandib}{mandistudent}
% \linktoplace{sec:mandic}{mandiexp} Initial release}
% \changes{v3.0.1}{2021-08-24}
% {\linktoplace{sec:mandia}{mandi} \linktoplace{sec:mandib}{mandistudent}
% \linktoplace{sec:mandic}{mandiexp}Minor doc changes}
% \changes{v3.1.0}{2022-01-27}
% {\linktoplace{sec:mandia}{mandi} \linktoplace{sec:mandib}{mandistudent}
% \linktoplace{sec:mandic}{mandiexp} Code formatted for better readability}
% \changes{v3.1.0}{2022-01-27}
% {\linktoplace{sec:mandia}{mandi} \linktoplace{sec:mandib}{mandistudent}
% \linktoplace{sec:mandic}{mandiexp} \pkg{xparse} is loaded for older formats}
% \changes{v3.1.0}{2022-01-27}
% {\linktoplace{sec:mandia}{mandi} \linktoplace{sec:mandib}{mandistudent}
% \LaTeX3 code now conforms to formatting standards}
% \changes{v3.2.0}{2023-08-01}
% {\linktoplace{sec:mandia}{mandi} \linktoplace{sec:mandib}{mandistudent}
% \linktoplace{sec:mandic}{mandiexp} Source updated}
% \changes{v3.2.1}{2023-11-22}{Improved \texttt{README.md} at request of \texttt{CTAN}
% maintainer}
% \changes{v3.2.1}{2023-11-22}{\linktoplace{sec:mandia}{mandi} Minor changes to
% \texttt{mandi.ins} inside \texttt{mandi.dtx}}
% \changes{v3.2.1}{2023-11-22}
% {\linktoplace{sec:mandia}{mandi} \linktoplace{sec:mandib}{mandistudent}
% \linktoplace{sec:mandic}{mandiexp} Source updated and bumped version for new
% \texttt{CTAN} upload}
% \changes{v3.2.2}{2024-02-27}{\linktoplace{sec:mandia}{mandi} Removed unnecessary
% \cs{ExplSyntaxOn} and \cs{ExplSyntaxOff} pairs}
% \changes{v3.2.2}{2024-02-27}{\linktoplace{sec:mandia}{mandi} Ensured all
% subscripts and superscripts are braced}
%
% \section{Introduction}
% The \mandi \footnote{The bundle name can be pronounced either with two
% syllables, to rhyme with \emph{candy}, or with three syllables, as
% \emph{M and I}.} bundle consists of three packages: \mandi, \mandistudent,
% and \mandiexp. Package \linktoplace{sec:mandia}{mandi} provides the
% core functionality, namely correctly typesetting physical quantities
% and constants with their correct SI units as either scalars or vectors,
% depending on which is appropriate. Package
% \linktoplace{sec:mandib}{mandistudent} provides other typesetting
% capability appropriate for written problem solutions. Finally, package
% \linktoplace{sec:mandic}{mandiexp} provides commands for typesetting
% expressions from \emph{Matter \& Interactions}\footnote{See
% \href{https://www.wiley.com/en-us/Matter+and+Interactions%2C+4th+Edition-p-9781118875865}
% {\emph{Matter \& Interactions}} and
% \url{https://matterandinteractions.org/} for details.}
%
% So many changes have been made that I think the best approach for all
% users is to treat this as a brand new experience. I think the most
% important thing to keep in mind is that I assume all users will have a
% relatively recent \TeX\ distribution (like \TeX~Live) that includes an
% updated kernel. If users report that this is a major problem, I can provide
% some degree of backwards compatibility. However, I use a fully updated
% \TeX~Live distribution.
%
% \section{Getting Help}
% If you have a question about \mandi, first please read this documentation to make
% sure your question is not addressed here. Then if you wish, email me. As a user,
% you deserve courteous and timely help if you need it. You will never get a
% response from me saying that because this software is free you are not entitled
% to help using it. It is sad that some developers take that attitude. Using free
% software does not absolve the developer of helping users unless the license
% specifically says so.
%
% \changes{v3.1.0}{2022-01-27}
% {\linktoplace{sec:mandia}{mandi} Added GitHub links to code}
% \section{Code Availability}
% The \mandi{} source repository's \texttt{main} branch is at
% \url{https://github.com/heafnerj/mandi}. This code will usually coincide
% with that found on \href{https://ctan.org/pkg/mandi}{CTAN}. The very latest
% build can be found on the \texttt{dev} branch found at
% \url{https://github.com/heafnerj/mandi/tree/dev}. Students and other academic
% academic users should probably get the \texttt{dev} branch code since it is
% stable and may contain improvements over the \texttt{main} branch code.
%
% \changes{v3.2.0}{2023-08-01}
% {\linktoplace{sec:mandib}{mandistudent} Added statement about \textsc{beamer}
% compatibility}
% \section{Compatibility with Other Packages and Classes}
% When using \textsc{beamer}, certain commands in the \mandistudent{} package
% are not defined. Because \textsc{beamer} uses the \pkg{enumitem} package,
% the \refEnv{physicsproblem} and \refEnv{physicsproblem*} environments are not
% defined. The \refCom{hilite} command is also not defined because it does not
% work and I do not currently know why.
%
% \newpage
% \section{Student/Instructor Quick Guide}
% Use \refCom{vec} to typeset the symbol for a vector. Use \refCom{magnitude}
% to typeset the symbol for a vector's magnitude. Use \refCom{dirvec} to
% typeset the symbol for a vector's direction. Use \refCom{changein} to
% typeset the symbol for the change in a vector or scalar. Use
% \refCom{zerovec} to typeset the zero vector. Use \refCom{timestento} to
% typeset scientific notation.
%
%\iffalse
%<*example>
%\fi
\begin{dispExample*}{lefthand ratio = 0.80}
\( \vec{p} \) or \( \vec*{p} \) \\
\( \vec{p}_{\symup{final}} \) or \( \vec*{p}_{\symup{final}} \) \\
\( \magnitude{\vec{p}} \) or \( \magnitude*{\vec{p}_{\symup{final}}} \) \\
\( \dirvec{p} \) or \( \dirvec*{p} \) \\
\( \changein \vec{p} \) or \( \changein t \) \\
\( \zerovec \) or \( \zerovec* \) \\
\( 6.02\timestento{-19} \)
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
% Use a \linktoplace{ssec:physquants}{physical quantity's} name to typeset
% a magnitude and that quantity's units. If the quantity is a vector, you
% can add |vector| either to the beginning or the end of the quantity's
% name. For example, if you want momentum, use \refCom{momentum} and
% its variants.
%
%\iffalse
%<*example>
%\fi
\begin{dispExample}
\( \momentum{7.071} \) \\
\( \vectormomentum{3,-4,5} \) \\
\( \momentumvector{3,-4,5} \)
\end{dispExample}
%\iffalse
%</example>
%\fi
%
% Use a \linktoplace{ssec:physconsts}{physical constant's} name
% to typeset its numerical value and units. Append |mathsymbol|
% to the constant's name to get its mathematical symbol. For
% example, if you want to typeset the vacuum permittivity, use
% \refCom{vacuumpermittivity} and its variant.
%
%\iffalse
%<*example>
%\fi
\begin{dispExample*}{lefthand ratio = 0.70}
\( \vacuumpermittivitymathsymbol = \vacuumpermittivity \)
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
% Use \refCom{mivector} to typeset symbolic vectors with components.
% Use the alias \refCom{direction} to typeset a direction or unit
% vector.
%\iffalse
%<*example>
%\fi
\begin{dispExample*}{sidebyside = false}
\( \mivector{\slot,\slot,\slot} \) or \( \mivector{p_{x},p_{y},p_{z}} \) \\
\( \direction{\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}} \) or
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
% Use \refEnv{physicsproblem} and \refEnv{parts} and \refCom{problempart}
% for problems. For step-by-step mathematical solutions use
% \refEnv{physicssolution}. Use \refEnv{webvpythonblock} to typeset
% \href{https://\gsurl}{\WebVPython} programs. Use \refCom{vpythonfile} to
% typeset \href{https://\vpurl}{VPython} program files.
%
% \newpage
% \section{The \mandi{} Package}\setplace{sec:mandia}
%
% Load \mandi{} as you would any package in your preamble.
%
%\iffalse
%<*example>
%\fi
\begin{dispListing*}{sidebyside = false,listing only}
\usepackage[options]{mandi}
\end{dispListing*}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}{mandiversion}{}
Typesets the current version and build date.
\end{docCommand}
\begin{dispExample*}{sidebyside = false}
The version is \mandiversion{} and is a stable build.
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
% \subsection{Package Options}
%
%\iffalse
%<*example>
%\fi
\begin{docKeys}[%
doc new = 2021-01-30,%
doc keypath = {},%
]%
{%
{%
doc name = units,%
doc parameter = {=\meta{type of unit}},%
doc description = {initially unspecified, set to \docValue{alternate}},%
},%
{%
doc name = preciseconstants,%
doc parameter = {=\meta{boolean}},%
doc description = {initially unspecified, set to \docValue{false}},%
},%
}%
Now \mandi{} uses a key-value interface for options.
The \refKey{units} key can be set to \docValue{base}, \docValue{derived},
or \docValue{alternate}. The \refKey{preciseconstants} key is always
either \docValue{true} or \docValue{false}.
\end{docKeys}
%\iffalse
%</example>
%\fi
%
% \subsection{The \texttt{\small mandisetup} Command}
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}[doc new = 2021-02-17]{mandisetup}{\marg{options}}
Command to set package options on the fly after loadtime. This
can be done in the preamble or inside the
|\begin{document}...\end{document}| environment.
\end{docCommand}
\begin{dispListing*}{sidebyside = false,listing only}
\mandisetup{units=base}
\end{dispListing*}
\begin{dispListing*}{sidebyside = false,listing only}
\mandisetup{preciseconstants}
\end{dispListing*}
\begin{dispListing*}{sidebyside = false,listing only}
\mandisetup{preciseconstants = false}
\end{dispListing*}
%\iffalse
%</example>
%\fi
%
% \subsection{\lualatex{} is Required}
%
% In order to make use of better fonts and Unicode features, \mandi{} now
% requires the \lualatex{} engine for processing documents. It will not
% work with other engines.
%
% \newpage
% \subsection{Physical Quantities}
% \subsubsection{Typesetting Physical Quantities}\setplace{ssec:physquants}
%
% Typesetting physical quantities and constants using semantically appropriate
% names, along with the correct
% \href{https://en.wikipedia.org/wiki/International_System_of_Units}{SI units},
% is the core function of \mandi. Take momentum as the prototypical physical
% quantity in an introductory physics course.
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}
{%
{%
doc name = momentum,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = momentumvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectormomentum,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
Command for momentum and its vector variants. The default units will depend
on the options passed to \mandi{} at load time. Alternate units are the
default. Other units can be forced as demonstrated. The vector variants can
take more than three components. Note the other variants for the quantity's
value and units.
\end{docCommands}
\begin{dispExample*}{lefthand ratio = 0.60}
\( \momentum{5} \) \\
\( \momentumvalue{5} \) \\
\( \momentumbaseunits{5} \) \\
\( \momentumderivedunits{5} \) \\
\( \momentumalternateunits{5} \) \\
\( \momentumvector{2,3,4} \) \\
\( \vectormomentum{2,3,4} \) \\
\( \momentum{\mivector{2,3,4}} \) \\
\( \momentumonlybaseunits \) \\
\( \momentumonlyderivedunits \) \\
\( \momentumonlyalternateunits \) \\
\( \momentumvectorvalue{2,3,4} \) \\
\( \vectormomentumvalue{2,3,4} \) \\
\( \momentumvectorbaseunits{2,3,4} \) \\
\( \vectormomentumbaseunits{2,3,4} \) \\
\( \momentumvectorderivedunits{2,3,4} \) \\
\( \vectormomentumderivedunits{2,3,4} \) \\
\( \momentumvectoralternateunits{2,3,4} \) \\
\( \vectormomentumalternateunits{2,3,4} \) \\
\( \momentumvectoronlybaseunits \) \\
\( \vectormomentumonlybaseunits \) \\
\( \momentumvectoronlyderivedunits \) \\
\( \vectormomentumonlyderivedunits \) \\
\( \momentumvectoronlyalternateunits \) \\
\( \vectormomentumonlyalternateunits \)
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
% Commands that include the name of a physical quantity typeset units, so
% they shouldn't be used for algebraic or symbolic values of components.
% Don't use
% |\vectormomentum{mv_{x},mv_{y},mv_{z}}| but
% instead the generic |\mivector{mv_{x},mv_{y},mv_{z}}| instead.
%
% \subsubsection{Checking Physical Quantities}
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}[doc updated = 2022-01-27]{CheckQuantity}{\marg{name}}
Command to check and typeset the command, base units,
derived units, and alternate units of a defined physical
quantity.
\end{docCommand}
%\iffalse
%</example>
%\fi
%
% \subsubsection{Predefined Physical Quantities}
%
% Every other defined physical quantity can be treated similarly. Just replace
% |momentum| with the quantity's name. Obviously, the variants that begin with
% |\vector| will not be defined for scalar quantities. Here are all the
% physical quantities, with all their units, defined in \mandi. Remember that
% units are not present with symbolic (algebraic) quantities, so do not use
% the |\vector| variants of these commands for symbolic components.
% Use \refCom{mivector} instead.
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}
{%
{%
doc name = acceleration,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = accelerationvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectoracceleration,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{acceleration}
\begin{docCommand}{amount}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{amount}
\begin{docCommands}
{%
{%
doc name = angularacceleration,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = angularaccelerationvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectorangularacceleration,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{angularacceleration}
\begin{docCommand}{angularfrequency}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{angularfrequency}
\begin{docCommands}
{%
{%
doc name = angularimpulse,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = angularimpulsevector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectorangularimpulse,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{angularimpulse}
\begin{docCommands}
{%
{%
doc name = angularmomentum,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = angularmomentumvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectorangularmomentum,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{angularmomentum}
\begin{docCommands}
{%
{%
doc name = angularvelocity,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = angularvelocityvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectorangularvelocity,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{angularvelocity}
\begin{docCommand}{area}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{area}
\begin{docCommand}{areachargedensity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{areachargedensity}
\begin{docCommand}{areamassdensity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{areamassdensity}
\begin{docCommand}{capacitance}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{capacitance}
\begin{docCommand}{charge}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{charge}
\begin{docCommands}
{%
{%
doc name = cmagneticfield,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = cmagneticfieldvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectorcmagneticfield,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{cmagneticfield}
\begin{docCommand}{conductance}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{conductance}
\begin{docCommand}{conductivity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{conductivity}
\begin{docCommand}{conventionalcurrent}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{conventionalcurrent}
\begin{docCommand}{current}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{current}
\begin{docCommands}
{%
{%
doc name = currentdensity,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = currentdensityvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectorcurrentdensity,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{currentdensity}
\begin{docCommand}{dielectricconstant}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{dielectricconstant}
\begin{docCommands}
{%
{%
doc new = 2021-02-24,%
doc name = direction,%
doc parameter = \marg{magnitude},%
},%
{%
doc name = directionvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectordirection,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{direction}
\begin{docCommands}
{%
{%
doc name = displacement,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = displacementvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectordisplacement,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{displacement}
\begin{docCommand}{duration}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{duration}
\begin{docCommands}
{%
{%
doc name = electricdipolemoment,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = electricdipolemomentvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{ doc name = vectorelectricdipolemoment,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{electricdipolemoment}
\begin{docCommands}
{%
{%
doc name = electricfield,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = electricfieldvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectorelectricfield,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{electricfield}
\begin{docCommand}{electricflux}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{electricflux}
\begin{docCommand}{electricpotential}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{electricpotential}
\begin{docCommand}[doc new = 2021-05-01]{electricpotentialdifference}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{electricpotentialdifference}
\begin{docCommand}{electroncurrent}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{electroncurrent}
\begin{docCommand}{emf}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{emf}
\begin{docCommand}{energy}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{energy}
\begin{docCommand}[doc new = 2021-04-15]{energyinev}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{energyinev}
\begin{docCommand}[doc new = 2021-04-15]{energyinkev}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{energyinkev}
\begin{docCommand}[doc new = 2021-04-15]{energyinmev}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{energyinmev}
\begin{docCommand}{energydensity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{energydensity}
\begin{docCommands}
{%
{%
doc name = energyflux,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = energyfluxvector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectorenergyflux,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{energyflux}
\begin{docCommand}{entropy}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{entropy}
\begin{docCommands}
{%
{%
doc name = force,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = forcevector,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
{%
doc name = vectorforce,%
doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
},%
}%
\end{docCommands}
\CheckQuantity{force}
\begin{docCommand}{frequency}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{frequency}
\begin{docCommands}
{%
{%
doc name = gravitationalfield,%
doc parameter = \marg{magnitude},%
},%
{%
doc new = 2021-02-24,%
doc name = gravitationalfieldvector,%