Debian Codegraph @

texmf-dist/source/latex/mandi/mandiexp.dtx

raw
1 % \iffalse meta-comment
2 % !TEX program = lualatexmk
3 %
4 % Copyright (C) 2021-2024 by Paul J. Heafner <[email protected]>
5 % ---------------------------------------------------------------------------
6 % This work may be distributed and/or modified under the conditions of the
7 % LaTeX Project Public License, either version 1.3c of this license or (at
8 % your option) any later version. The latest version of this license is in
9 % https://www.latex-project.org/lppl.txt
10 % and version 1.3c or later is part of all distributions of LaTeX version
11 % 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is Paul J. Heafner.
16 %
17 % This work consists of the files mandi.dtx
18 % mandistudent.dtx
19 % mandiexp.dtx
20 % mandi.ins
21 % mandi.pdf
22 % README.md
23 %
24 % and includes the derived files mandi.sty
25 % mandistudent.sty
26 % mandiexp.sty
27 % vdemo.py (not needed)
28 % ---------------------------------------------------------------------------
29 %
30 %<*internal>
31 \iffalse
32 %</internal>
33 %
34 %<*internal>
35 \fi
36 \def\nameofplainTeX{plain}
37 \ifx\fmtname\nameofplainTeX\else
38 \expandafter\begingroup
39 \fi
40 %</internal>
41 %
42 %<*internal>
43 \usedir{tex/latex/mandi}
44 \ifx\fmtname\nameofplainTeX
45 \expandafter\endbatchfile
46 \else
47 \expandafter\endgroup
48 \fi
49 %</internal>
50 %
51 %<*driver>
52 \ProvidesFile{mandiexp.dtx}
53 \DisableCrossrefs % index descriptions only
54 \PageIndex % index refers to page numbers
55 \CodelineNumbered % number source lines
56 \RecordChanges % record changes
57 \begin{document} % main document
58 \DocInput{\jobname.dtx} %
59 \PrintIndex %
60 \end{document} % end main document
61 %</driver>
62 % \fi
63 %
64 % ^^A DO NOT TRY TO COMPILE THIS DTX FILE BY ITSELF. IT WILL FAIL.
65 %
66 % \section{The \mandiexp{} Package}\setplace{sec:mandic}
67 %
68 % \mandi{} comes with an accessory package \mandiexp{}
69 % which extends \mandi{} with commands specific to
70 % \emph{Matter \& Interactions}.\footnote{See
71 % \href{https://www.wiley.com/en-us/Matter+and+Interactions%2C+4th+Edition-p-9781118875865}
72 % {\emph{Matter \& Interactions}} and
73 % \url{https://matterandinteractions.org/} for details.}
74 % The commands are primarily for typesetting
75 % mathematical expressions used in that text. \mandiexp{}
76 % requires, and loads, \mandi{} but \mandi{} doesn't require,
77 % and doesn't load, \mandiexp. \mandiexp{} requires the \cs{vec*}
78 % command and so loads \mandistudent{} if it has not already been
79 % loaded.
80 %
81 % Load \mandiexp{} as you would any package in your preamble.
82 % There are no package options.
83 %
84 %\iffalse
85 %<*example>
86 %\fi
87 \begin{dispListing*}{sidebyside = false,listing only}
88 \usepackage{mandiexp}
89 \end{dispListing*}
90 %\iffalse
91 %</example>
92 %\fi
93 %
94 %\iffalse
95 %<*example>
96 %\fi
97 \begin{docCommand}{mandiexpversion}{}
98 Typesets the current version and build date.
99 \end{docCommand}
100 \begin{dispExample*}{sidebyside = false}
101 The version is \mandiexpversion{} and is a stable build.
102 \end{dispExample*}
103 %\iffalse
104 %</example>
105 %\fi
106 %
107 % \subsection{The Fundamenal Principles}
108 %
109 %\iffalse
110 %<*example>
111 %\fi
112 \begin{docCommands}[%
113 doc parameter = {},%
114 ]%
115 {%
116 {%
117 doc name = lhsmomentumprinciple,%
118 doc description = {LHS of delta form, bold vectors},%
119 },%
120 {%
121 doc name = rhsmomentumprinciple,%
122 doc description = {RHS of delta form, bold vectors},%
123 },%
124 {%
125 doc name = lhsmomentumprincipleupdate,%
126 doc description = {LHS of update form, bold vectors},%
127 },%
128 {%
129 doc name = rhsmomentumprincipleupdate,%
130 doc description = {RHS of update form, bold vectors},%
131 },%
132 {%
133 doc name = momentumprinciple,%
134 doc description = {delta form, bold vectors},%
135 },%
136 {%
137 doc name = momentumprincipleupdate,%
138 doc description = {update form, bold vectors},%
139 },%
140 {%
141 doc name = lhsmomentumprinciple*,%
142 doc description = {LHS of delta form, arrow vectors},%
143 },%
144 {%
145 doc name = rhsmomentumprinciple*,%
146 doc description = {RHS of delta form, arrow vectors},%
147 },%
148 {%
149 doc name = lhsmomentumprincipleupdate*,%
150 doc description = {LHS of update form, arrow vectors},%
151 },%
152 {%
153 doc name = rhsmomentumprincipleupdate*,%
154 doc description = {RHS of update form, arrow vectors},%
155 },%
156 {%
157 doc name = momentumprinciple*,%
158 doc description = {delta form, arrow vectors},%
159 },%
160 {%
161 doc name = momentumprincipleupdate*,%
162 doc description = {update form, arrow vectors},%
163 },%
164 }%
165 Variants of command for typesetting the momentum principle.
166 Use starred variants to get arrow notation for vectors.
167 \end{docCommands}
168 \begin{dispExample}
169 \( \lhsmomentumprinciple \) \\
170 \( \rhsmomentumprinciple \) \\
171 \( \lhsmomentumprincipleupdate \) \\
172 \( \rhsmomentumprincipleupdate \) \\
173 \( \momentumprinciple \) \\
174 \( \momentumprincipleupdate \) \\
175 \( \lhsmomentumprinciple* \) \\
176 \( \rhsmomentumprinciple* \) \\
177 \( \lhsmomentumprincipleupdate* \) \\
178 \( \rhsmomentumprincipleupdate* \) \\
179 \( \momentumprinciple* \) \\
180 \( \momentumprincipleupdate* \)
181 \end{dispExample}
182 %\iffalse
183 %</example>
184 %\fi
185 %
186 %\iffalse
187 %<*example>
188 %\fi
189 \begin{docCommands}[%
190 doc parameter = {},%
191 ]%
192 {%
193 {%
194 doc name = lhsenergyprinciple,%
195 doc description = {LHS of delta form},%
196 },%
197 {%
198 doc name = rhsenergyprinciple,%
199 doc parameter = \oarg{\(+\)process...},%
200 doc description = {RHS of delta form},%
201 },%
202 {%
203 doc name = lhsenergyprincipleupdate,%
204 doc description = {LHS of update form},%
205 },%
206 {%
207 doc name = rhsenergyprincipleupdate,%
208 doc parameter = \oarg{\(+\)process...},%
209 doc description = {RHS of update form},%
210 },%
211 {%
212 doc name = energyprinciple,%
213 doc parameter = \oarg{\(+\)process...},%
214 doc description = {delta form},%
215 },%
216 {%
217 doc name = energyprincipleupdate,%
218 doc parameter = \oarg{\(+\)process...},%
219 doc description = {update form},%
220 },%
221 }%
222 Variants of command for typesetting the energy principle.
223 \end{docCommands}
224 \begin{dispExample}
225 \( \lhsenergyprinciple \) \\
226 \( \rhsenergyprinciple \) \\
227 \( \rhsenergyprinciple[+Q] \) \\
228 \( \energyprinciple \) \\
229 \( \energyprinciple[+Q] \) \\
230 \( \lhsenergyprincipleupdate \) \\
231 \( \rhsenergyprincipleupdate \) \\
232 \( \rhsenergyprincipleupdate[+Q] \) \\
233 \( \energyprincipleupdate \) \\
234 \( \energyprincipleupdate[+Q] \)
235 \end{dispExample}
236 %\iffalse
237 %</example>
238 %\fi
239 %
240 %\iffalse
241 %<*example>
242 %\fi
243 \begin{docCommands}[%
244 doc parameter = {},%
245 ]%
246 {%
247 {%
248 doc name = lhsangularmomentumprinciple,%
249 doc description = {LHS of delta form, bold vectors},%
250 },%
251 {%
252 doc name = rhsangularmomentumprinciple,%
253 doc description = {RHS of delta form, bold vectors},%
254 },%
255 {%
256 doc name = lhsangularmomentumprincipleupdate,%
257 doc description = {LHS of update form, bold vectors},%
258 },%
259 {%
260 doc name = rhsangularmomentumprincipleupdate,%
261 doc description = {RHS of update form, bold vectors},%
262 },%
263 {%
264 doc name = angularmomentumprinciple,%
265 doc description = {delta form, bold vectors},%
266 },%
267 {%
268 doc name = angularmomentumprincipleupdate,%
269 doc description = {update form, bold vectors},%
270 },%
271 {%
272 doc name = lhsangularmomentumprinciple*,%
273 doc description = {LHS of delta form, arrow vectors},%
274 },%
275 {%
276 doc name = rhsangularmomentumprinciple*,%
277 doc description = {RHS of delta form, arrow vectors},%
278 },%
279 {%
280 doc name = lhsangularmomentumprincipleupdate*,%
281 doc description = {LHS of update form, arrow vectors},%
282 },%
283 {%
284 doc name = rhsangularmomentumprincipleupdate*,%
285 doc description = {RHS of update form, arrow vectors},%
286 },%
287 {%
288 doc name = angularmomentumprinciple*,%
289 doc description = {delta form, arrow vectors},%
290 },%
291 {%
292 doc name = angularmomentumprincipleupdate*,%
293 doc description = {update form, arrow vectors},%
294 },%
295 }%
296 Variants of command for typesetting the angular momentum principle.
297 Use starred variants to get arrow notation for vectors.
298 \end{docCommands}
299 \begin{dispExample}
300 \( \lhsangularmomentumprinciple \) \\
301 \( \rhsangularmomentumprinciple \) \\
302 \( \lhsangularmomentumprincipleupdate \) \\
303 \( \rhsangularmomentumprincipleupdate \) \\
304 \( \angularmomentumprinciple \) \\
305 \( \angularmomentumprincipleupdate \) \\
306 \( \lhsangularmomentumprinciple* \) \\
307 \( \rhsangularmomentumprinciple* \) \\
308 \( \lhsangularmomentumprincipleupdate* \) \\
309 \( \rhsangularmomentumprincipleupdate* \) \\
310 \( \angularmomentumprinciple* \) \\
311 \( \angularmomentumprincipleupdate* \)
312 \end{dispExample}
313 %\iffalse
314 %</example>
315 %\fi
316 %
317 % \subsection{Other Symbols}
318 %
319 %\iffalse
320 %<*example>
321 %\fi
322 \begin{docCommand}[doc new = 2021-02-13]{energyof}{\marg{label}\oarg{label}}
323 Generic symbol for the energy of some entity.
324 \end{docCommand}
325 \begin{dispExample*}{lefthand ratio = 0.6}
326 \( \energyof{\symup{electron}} \) \\
327 \( \energyof{\symup{electron}}[\symup{final}] \)
328 \end{dispExample*}
329 %\iffalse
330 %</example>
331 %\fi
332 %
333 %\iffalse
334 %<*example>
335 %\fi
336 \begin{docCommand}[doc new = 2021-02-13]{systemenergy}{\oarg{label}}
337 Symbol for system energy.
338 \end{docCommand}
339 \begin{dispExample}
340 \( \systemenergy \) \\
341 \( \systemenergy[\symup{final}] \)
342 \end{dispExample}
343 %\iffalse
344 %</example>
345 %\fi
346 %
347 %\iffalse
348 %<*example>
349 %\fi
350 \begin{docCommand}[doc new = 2021-02-13]{particleenergy}{\oarg{label}}
351 Symbol for particle energy.
352 \end{docCommand}
353 \begin{dispExample}
354 \( \particleenergy \) \\
355 \( \particleenergy[\symup{final}] \)
356 \end{dispExample}
357 %\iffalse
358 %</example>
359 %\fi
360 %
361 %\iffalse
362 %<*example>
363 %\fi
364 \begin{docCommand}[doc new = 2021-02-13]{restenergy}{\oarg{label}}
365 Symbol for rest energy.
366 \end{docCommand}
367 \begin{dispExample}
368 \( \restenergy \) \\
369 \( \restenergy[\symup{final}] \)
370 \end{dispExample}
371 %\iffalse
372 %</example>
373 %\fi
374 %
375 %\iffalse
376 %<*example>
377 %\fi
378 \begin{docCommand}[doc new = 2021-02-13]{internalenergy}{\oarg{label}}
379 Symbol for internal energy.
380 \end{docCommand}
381 \begin{dispExample}
382 \( \internalenergy \) \\
383 \( \internalenergy[\symup{final}] \)
384 \end{dispExample}
385 %\iffalse
386 %</example>
387 %\fi
388 %
389 %\iffalse
390 %<*example>
391 %\fi
392 \begin{docCommand}[doc new = 2021-02-13]{chemicalenergy}{\oarg{label}}
393 Symbol for chemical energy.
394 \end{docCommand}
395 \begin{dispExample}
396 \( \chemicalenergy \) \\
397 \( \chemicalenergy[\symup{final}] \)
398 \end{dispExample}
399 %\iffalse
400 %</example>
401 %\fi
402 %
403 %\iffalse
404 %<*example>
405 %\fi
406 \begin{docCommand}[doc new = 2021-02-13]{thermalenergy}{\oarg{label}}
407 Symbol for thermal energy.
408 \end{docCommand}
409 \begin{dispExample}
410 \( \thermalenergy \) \\
411 \( \thermalenergy[\symup{final}] \)
412 \end{dispExample}
413 %\iffalse
414 %</example>
415 %\fi
416 %
417 %\iffalse
418 %<*example>
419 %\fi
420 \begin{docCommand}[doc new = 2021-02-13]{photonenergy}{\oarg{label}}
421 Symbol for photon energy.
422 \end{docCommand}
423 \begin{dispExample}
424 \( \photonenergy \) \\
425 \( \photonenergy[\symup{final}] \)
426 \end{dispExample}
427 %\iffalse
428 %</example>
429 %\fi
430 %
431 %\iffalse
432 %<*example>
433 %\fi
434 \begin{docCommands}[%
435 doc new = 2021-02-13,%
436 doc parameter = \oarg{label},%
437 ]%
438 {%
439 {%
440 doc name = translationalkineticenergy,%
441 },%
442 {%
443 doc name = translationalkineticenergy*,%
444 },%
445 }%
446 Symbol for translational kinetic energy.
447 The starred variant gives \(E\) notation.
448 \end{docCommands}
449 \begin{dispExample*}{lefthand ratio = 0.6}
450 \( \translationalkineticenergy \) \\
451 \( \translationalkineticenergy[\symup{initial}] \) \\
452 \( \translationalkineticenergy* \) \\
453 \( \translationalkineticenergy*[\symup{initial}] \)
454 \end{dispExample*}
455 %\iffalse
456 %</example>
457 %\fi
458 %
459 %\iffalse
460 %<*example>
461 %\fi
462 \begin{docCommands}[%
463 doc new = 2021-02-13,%
464 doc parameter = \oarg{label},%
465 ]%
466 {%
467 {%
468 doc name = rotationalkineticenergy,%
469 },%
470 {%
471 doc name = rotationalkineticenergy*,%
472 },%
473 }%
474 Symbol for rotational kinetic energy.
475 The starred variant gives \(E\) notation.
476 \end{docCommands}
477 \begin{dispExample*}{lefthand ratio = 0.6}
478 \( \rotationalkineticenergy \) \\
479 \( \rotationalkineticenergy[\symup{initial}] \) \\
480 \( \rotationalkineticenergy* \) \\
481 \( \rotationalkineticenergy*[\symup{initial}] \)
482 \end{dispExample*}
483 %\iffalse
484 %</example>
485 %\fi
486 %
487 %\iffalse
488 %<*example>
489 %\fi
490 \begin{docCommands}[%
491 doc new = 2021-02-13,%
492 doc parameter = \oarg{label},%
493 ]%
494 {%
495 {%
496 doc name = vibrationalkineticenergy,%
497 },%
498 {%
499 doc name = vibrationalkineticenergy*,%
500 },%
501 }%
502 Symbol for vibrational kinetic energy.
503 The starred variant gives \(E\) notation.
504 \end{docCommands}
505 \begin{dispExample*}{lefthand ratio = 0.6}
506 \( \vibrationalkineticenergy \) \\
507 \( \vibrationalkineticenergy[\symup{initial}] \) \\
508 \( \vibrationalkineticenergy* \) \\
509 \( \vibrationalkineticenergy*[\symup{initial}] \)
510 \end{dispExample*}
511 %\iffalse
512 %</example>
513 %\fi
514 %
515 %\iffalse
516 %<*example>
517 %\fi
518 \begin{docCommand}[doc new = 2021-02-13]{gravitationalpotentialenergy}
519 {\oarg{label}}
520 Symbol for gravitational potential energy.
521 \end{docCommand}
522 \begin{dispExample*}{lefthand ratio = 0.6}
523 \( \gravitationalpotentialenergy \) \\
524 \( \gravitationalpotentialenergy[\symup{final}] \)
525 \end{dispExample*}
526 %\iffalse
527 %</example>
528 %\fi
529 %
530 %\iffalse
531 %<*example>
532 %\fi
533 \begin{docCommand}[doc new = 2021-02-13]{electricpotentialenergy}{\oarg{label}}
534 Symbol for electric potential energy.
535 \end{docCommand}
536 \begin{dispExample*}{lefthand ratio = 0.6}
537 \( \electricpotentialenergy \) \\
538 \( \electricpotentialenergy[\symup{final}] \)
539 \end{dispExample*}
540 %\iffalse
541 %</example>
542 %\fi
543 %
544 %\iffalse
545 %<*example>
546 %\fi
547 \begin{docCommand}[doc new = 2021-02-13]{springpotentialenergy}{\oarg{label}}
548 Symbol for spring potential energy.
549 \end{docCommand}
550 \begin{dispExample*}{lefthand ratio = 0.6}
551 \( \springpotentialenergy \) \\
552 \( \springpotentialenergy[\symup{final}] \)
553 \end{dispExample*}
554 %\iffalse
555 %</example>
556 %\fi
557 %
558 % \MaybeStop{}
559 %
560 % \newgeometry{left=0.50in,right=0.50in,top=1.00in,bottom=1.00in}
561 % \subsection{\mandiexp{} Source Code}
562 %
563 % \iffalse
564 %<*package>
565 % \fi
566 % Definine the package version and date for global use, exploiting the fact
567 % that in a \pkg{.sty} file there is now no need for |\makeatletter| and
568 % |\makeatother|. This simplifies defining internal commands, with |@|
569 % in the name, that are not for the user to know about.
570 %
571 % \changes{v3.1.0}{2022-01-27}
572 % {\linktoplace{sec:mandic}{mandiexp} Version number works}
573 % \begin{macrocode}
574 \def\mandiexp@version{3.2.2}
575 \def\mandiexp@date{2024-02-27}
576 \NeedsTeXFormat{LaTeX2e}[2020-02-02]
577 \DeclareRelease{v3.2.2}{2024-02-27}{mandiexp.sty}
578 \DeclareCurrentRelease{v\mandiexp@version}{\mandiexp@date}
579 \ProvidesPackage{mandiexp}
580 [\mandiexp@date\space v\mandiexp@version\space Macros for Matter & Interactions]
581 % \end{macrocode}
582 %
583 % Define a convenient package version command.
584 %
585 % \begin{macrocode}
586 \newcommand*{\mandiexpversion}{v\mandiexp@version\space dated \mandiexp@date}
587 % \end{macrocode}
588 %
589 % We need \mandi{} to load \pkg{mathtools} and \pkg{unicode-math}.
590 %
591 % \begin{macrocode}
592 \IfPackageLoadedTF{mandi}%
593 {}%
594 {%
595 \RequirePackage{mandi}%
596 }%
597 % \end{macrocode}
598 %
599 % \changes{v3.2.0}{2023-08-01}
600 % {\linktoplace{sec:mandic}{mandiexp} \pkg{mandistudent} is loaded for \cs{vec*}}
601 %
602 % We need \mandistudent{} for the new \cs{vec*} command.
603 %
604 % \begin{macrocode}
605 \IfPackageLoadedTF{mandistudent}%
606 {}%
607 {%
608 \RequirePackage{mandistudent}%
609 }%
610 % \end{macrocode}
611 %
612 % Load \pkg{xparse} if necessary.
613 %
614 % \begin{macrocode}
615 \IfFormatAtLeastTF{2020-10-01}%
616 {}%
617 {\RequirePackage{xparse}}%
618 % \end{macrocode}
619 %
620 % We require the \lualatex{} engine.
621 %
622 % \begin{macrocode}
623 \RequireLuaTeX
624 % \end{macrocode}
625 %
626 % \begin{macrocode}
627 \typeout{}%
628 \typeout{mandiexp: You are using mandiexp \mandiexpversion.}
629 \typeout{mandiexp: This package requires LuaLaTeX.}%
630 \typeout{}%
631 % \end{macrocode}
632 %
633 % The momentum principle's lefthand and righthand sides.
634 %
635 % \begin{macrocode}
636 \NewDocumentCommand{\lhsmomentumprinciple}{ s }%
637 {%
638 \Delta
639 \IfBooleanTF{#1}%
640 {%
641 \vec*{p}
642 }%
643 {%
644 \vec{p}%
645 }%
646 \sb{\symup{sys}}%
647 }%
648 \NewDocumentCommand{\rhsmomentumprinciple}{ s }%
649 {%
650 \IfBooleanTF{#1}%
651 {%
652 \vec*{F}%
653 }%
654 {%
655 \vec{F}%
656 }%
657 \sb{\symup{sys,net}}\,\Delta t%
658 }%
659 % \end{macrocode}
660 %
661 % The momentum principle in update form, lefthand and
662 % righthand sides.
663 %
664 % \begin{macrocode}
665 \NewDocumentCommand{\lhsmomentumprincipleupdate}{ s }%
666 {%
667 \IfBooleanTF{#1}%
668 {%
669 \vec*{p}%
670 }%
671 {%
672 \vec{p}%
673 }%
674 \sb{\symup{sys,final}}%
675 }%
676 \NewDocumentCommand{\rhsmomentumprincipleupdate}{ s }%
677 {%
678 \IfBooleanTF{#1}%
679 {%
680 \vec*{p}%
681 }%
682 {%
683 \vec{p}%
684 }%
685 \sb{\symup{sys,initial}}+%
686 \IfBooleanTF{#1}%
687 {%
688 \vec*{F}%
689 }%
690 {%
691 \vec{F}%
692 }%
693 \sb{\symup{sys,net}}\,\Delta t%
694 }%
695 % \end{macrocode}
696 %
697 % The full momentum principle as an expression.
698 %
699 % \begin{macrocode}
700 \NewDocumentCommand{\momentumprinciple}{ s }%
701 {%
702 \IfBooleanTF{#1}%
703 {%
704 \lhsmomentumprinciple* = \rhsmomentumprinciple*%
705 }%
706 {%
707 \lhsmomentumprinciple = \rhsmomentumprinciple%
708 }%
709 }%
710 % \end{macrocode}
711 %
712 % The full momentum principle in update form as an expression.
713 %
714 % \begin{macrocode}
715 \NewDocumentCommand{\momentumprincipleupdate}{ s }%
716 {%
717 \IfBooleanTF{#1}%
718 {%
719 \lhsmomentumprincipleupdate* = \rhsmomentumprincipleupdate*%
720 }%
721 {%
722 \lhsmomentumprincipleupdate = \rhsmomentumprincipleupdate%
723 }%
724 }%
725 % \end{macrocode}
726 %
727 % The energy principle's lefthand and righthand sides.
728 %
729 % \begin{macrocode}
730 \NewDocumentCommand{\lhsenergyprinciple}{}%
731 {%
732 \Delta E_{\symup{sys}}%
733 }%
734 \NewDocumentCommand{\rhsenergyprinciple}{ O{} }%
735 {%
736 W_{\symup{ext}}#1%
737 }%
738 % \end{macrocode}
739 %
740 % The energy principle in update form, lefthand and
741 % righthand sides.
742 %
743 % \begin{macrocode}
744 \NewDocumentCommand{\lhsenergyprincipleupdate}{}%
745 {%
746 E_{\symup{sys,final}}%
747 }%
748 \NewDocumentCommand{\rhsenergyprincipleupdate}{ O{} }%
749 {%
750 E_{\symup{sys,initial}}+%
751 W_{\symup{ext}}#1%
752 }%
753 % \end{macrocode}
754 %
755 % The full energy principle as an expression.
756 %
757 % \begin{macrocode}
758 \NewDocumentCommand{\energyprinciple}{ O{} }%
759 {%
760 \lhsenergyprinciple = \rhsenergyprinciple[#1]%
761 }%
762 % \end{macrocode}
763 %
764 % The full energy principle in update form as an expression.
765 %
766 % \begin{macrocode}
767 \NewDocumentCommand{\energyprincipleupdate}{ O{} }%
768 {%
769 \lhsenergyprincipleupdate = \rhsenergyprincipleupdate[#1]%
770 }%
771 % \end{macrocode}
772 %
773 % The angular momentum principle's lefthand and righthand sides.
774 %
775 % \begin{macrocode}
776 \NewDocumentCommand{\lhsangularmomentumprinciple}{ s }%
777 {%
778 \Delta%
779 \IfBooleanTF{#1}%
780 {%
781 \vec*{L}%
782 }%
783 {%
784 \vec{L}%
785 }%
786 \sb{A\symup{,sys,net}}%
787 }%
788 \NewDocumentCommand{\rhsangularmomentumprinciple}{ s }%
789 {%
790 \IfBooleanTF{#1}%
791 {%
792 \vec*{\tau}%
793 }%
794 {%
795 \vec{\tau}%
796 }%
797 \sb{A\symup{,sys,net}}\,\Delta t%
798 }%
799 % \end{macrocode}
800 %
801 % The energy principle in update form, lefthand and
802 % righthand sides.
803 %
804 % \begin{macrocode}
805 \NewDocumentCommand{\lhsangularmomentumprincipleupdate}{ s }%
806 {%
807 \IfBooleanTF{#1}%
808 {%
809 \vec*{L}%
810 }%
811 {%
812 \vec{L}%
813 }%
814 \sb{A,\symup{sys,final}}%
815 }%
816 \NewDocumentCommand{\rhsangularmomentumprincipleupdate}{ s }%
817 {%
818 \IfBooleanTF{#1}%
819 {%
820 \vec*{L}%
821 }%
822 {%
823 \vec{L}%
824 }%
825 \sb{A\symup{,sys,initial}}+%
826 \IfBooleanTF{#1}%
827 {%
828 \vec*{\tau}%
829 }%
830 {%
831 \vec{\tau}%
832 }%
833 \sb{A\symup{,sys,net}}\,\Delta t%
834 }%
835 % \end{macrocode}
836 %
837 % The full angular momentum principle as an expression.
838 %
839 % \begin{macrocode}
840 \NewDocumentCommand{\angularmomentumprinciple}{ s }%
841 {%
842 \IfBooleanTF{#1}%
843 {%
844 \lhsangularmomentumprinciple* = \rhsangularmomentumprinciple*%
845 }%
846 {%
847 \lhsangularmomentumprinciple = \rhsangularmomentumprinciple%
848 }%
849 }%
850 % \end{macrocode}
851 %
852 % The full angular momentum principle in update form as an expression.
853 %
854 % \begin{macrocode}
855 \NewDocumentCommand{\angularmomentumprincipleupdate}{ s }%
856 {%
857 \IfBooleanTF{#1}%
858 {%
859 \lhsangularmomentumprincipleupdate* = \rhsangularmomentumprincipleupdate*%
860 }%
861 {%
862 \lhsangularmomentumprincipleupdate = \rhsangularmomentumprincipleupdate%
863 }%
864 }%
865 % \end{macrocode}
866 %
867 % The symbol for an arbitrary entity.
868 %
869 % \begin{macrocode}
870 \NewDocumentCommand{\energyof}{ m o }%
871 {%
872 E_{#1%
873 \IfValueT{#2}%
874 {,#2}%
875 }%
876 }%
877 % \end{macrocode}
878 %
879 % The symbol for a system's energy.
880 %
881 % \begin{macrocode}
882 \NewDocumentCommand{\systemenergy}{ o }%
883 {%
884 E_{\symup{sys}%
885 \IfValueT{#1}%
886 {,#1}%
887 }%
888 }%
889 % \end{macrocode}
890 %
891 %
892 %
893 % \begin{macrocode}
894 \NewDocumentCommand{\particleenergy}{ o }%
895 {%
896 E_{\symup{particle}%
897 \IfValueT{#1}%
898 {,#1}%
899 }%
900 }%
901 % \end{macrocode}
902 %
903 % The symbol for a particle's rest energy.
904 %
905 % \begin{macrocode}
906 \NewDocumentCommand{\restenergy}{ o }%
907 {%
908 E_{\symup{rest}%
909 \IfValueT{#1}%
910 {,#1}%
911 }%
912 }%
913 % \end{macrocode}
914 %
915 % The symbol for a system's internal energy.
916 %
917 % \begin{macrocode}
918 \NewDocumentCommand{\internalenergy}{ o }%
919 {%
920 E_{\symup{internal}%
921 \IfValueT{#1}%
922 {,#1}%
923 }%
924 }%
925 % \end{macrocode}
926 %
927 % The symbol for a system's chemical energy.
928 %
929 % \begin{macrocode}
930 \NewDocumentCommand{\chemicalenergy}{ o }%
931 {%
932 E_{\symup{chem}%
933 \IfValueT{#1}%
934 {,#1}%
935 }%
936 }%
937 % \end{macrocode}
938 %
939 % The symbol for a system's thermal energy.
940 %
941 % \begin{macrocode}
942 \NewDocumentCommand{\thermalenergy}{ o }%
943 {%
944 E_{\symup{therm}%
945 \IfValueT{#1}%
946 {,#1}%
947 }%
948 }%
949 % \end{macrocode}
950 %
951 % The symbol for a photon's energy.
952 %
953 % \begin{macrocode}
954 \NewDocumentCommand{\photonenergy}{ o }%
955 {%
956 E_{\symup{photon}%
957 \IfValueT{#1}%
958 {,#1}%
959 }%
960 }%
961 % \end{macrocode}
962 %
963 % The symbol for translational kinetic energy.
964 % |d[]| must be used because of the way consecutive optional
965 % arguments are handled. See \pkg{xparse} docs for details.\newline
966 % See \url{https://tex.stackexchange.com/a/569011/218142}.
967 %
968 % \begin{macrocode}
969 \NewDocumentCommand{\translationalkineticenergy}{ s d[] }%
970 {%
971 \IfBooleanTF{#1}%
972 {%
973 E_\bgroup \symup{K}%
974 }%
975 {%
976 K_\bgroup\symup{trans}%
977 }%
978 \IfValueT{#2}{,#2}%
979 \egroup%
980 }%
981 % \end{macrocode}
982 %
983 % The symbol for rotational kinetic energy.
984 %
985 % \begin{macrocode}
986 \NewDocumentCommand{\rotationalkineticenergy}{ s d[] }%
987 {%
988 \IfBooleanTF{#1}%
989 {%
990 E_\bgroup%
991 }%
992 {%
993 K_\bgroup%
994 }%
995 \symup{rot}\IfValueT{#2}{,#2}%
996 \egroup%
997 }%
998 % \end{macrocode}
999 %
1000 % The symbol for vibrational kinetic energy.
1001 %
1002 % \begin{macrocode}
1003 \NewDocumentCommand{\vibrationalkineticenergy}{ s d[] }%
1004 {%
1005 \IfBooleanTF{#1}%
1006 {%
1007 E_\bgroup%
1008 }%
1009 {%
1010 K_\bgroup%
1011 }%
1012 \symup{vib}\IfValueT{#2}{,#2}%
1013 \egroup%
1014 }%
1015 % \end{macrocode}
1016 %
1017 % The symbol for a system's gravitational potential energy.
1018 %
1019 % \begin{macrocode}
1020 \NewDocumentCommand{\gravitationalpotentialenergy}{ o }%
1021 {%
1022 U_{\symup{g}%
1023 \IfValueT{#1}%
1024 {,#1}%
1025 }%
1026 }%
1027 % \end{macrocode}
1028 %
1029 % The symbol for a system's electric potential energy.
1030 %
1031 % \begin{macrocode}
1032 \NewDocumentCommand{\electricpotentialenergy}{ o }%
1033 {%
1034 U_{\symup{e}%
1035 \IfValueT{#1}%
1036 {,#1}%
1037 }%
1038 }%
1039 % \end{macrocode}
1040 %
1041 % The symbol for a system's spring potential energy.
1042 %
1043 % \begin{macrocode}
1044 \NewDocumentCommand{\springpotentialenergy}{ o }%
1045 {%
1046 U_{\symup{s}%
1047 \IfValueT{#1}%
1048 {,#1}%
1049 }%
1050 }%
1051 % \end{macrocode}
1052 %
1053 % \restoregeometry
1054 %
1055 % \iffalse
1056 %</package>
1057 % \fi
1058 %
1059 % \Finale