% \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>
%
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%
%<*internal>
\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,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectorgravitationalfield,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{gravitationalfield}
\begin{docCommand}{gravitationalpotential}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{gravitationalpotential}
\begin{docCommand}[doc new = 2021-05-01]{gravitationalpotentialdifference}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{gravitationalpotentialdifference}
\begin{docCommands}
  {%
    {%
      doc name = impulse,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = impulsevector,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectorimpulse,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{impulse}
\begin{docCommand}{indexofrefraction}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{indexofrefraction}
\begin{docCommand}{inductance}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{inductance}
\begin{docCommand}{linearchargedensity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{linearchargedensity}
\begin{docCommand}{linearmassdensity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{linearmassdensity}
\begin{docCommand}[doc new = 2022-01-27]{lorentzfactor}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{lorentzfactor}
\begin{docCommand}[doc updated = 2021-05-02]{luminousintensity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{luminousintensity}
\begin{docCommand}{magneticcharge}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{magneticcharge}
\begin{docCommands}
  {%
    {%
      doc name = magneticdipolemoment,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = magneticdipolemomentvector,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectormagneticdipolemoment,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{magneticdipolemoment}
\begin{docCommands}
  {%
    {%
      doc name = magneticfield,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = magneticfieldvector,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectormagneticfield,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{magneticfield}
\begin{docCommand}{magneticflux}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{magneticflux}
\begin{docCommand}{mass}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{mass}
\begin{docCommand}{mobility}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{mobility}
\begin{docCommand}{momentofinertia}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{momentofinertia}
\begin{docCommands}
  {%
    {%
      doc name = momentum,%
      doc label = momentumdemo,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = momentumvector,%
      doc label = momentumvectordemo,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectormomentum,%
      doc label = vectormomentumdemo,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)} },%
  }%
\end{docCommands}
\CheckQuantity{momentum}
\begin{docCommands}
  {%
    {%
      doc name = momentumflux,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = momentumfluxvector,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {% 
      doc name = vectormomentumflux,% 
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{momentumflux}
\begin{docCommand}{numberdensity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{numberdensity}
\begin{docCommand}{permeability}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{permeability}
\begin{docCommand}{permittivity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{permittivity}
\begin{docCommand}{planeangle}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{planeangle}
\begin{docCommand}{polarizability}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{polarizability}
\begin{docCommand}{power}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{power}
\begin{docCommands}
  {%
    {%
      doc name = poynting,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = poyntingvector,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectorpoynting,% 
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{poynting}
\begin{docCommand}{pressure}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{pressure}
\begin{docCommand}{relativepermeability}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{relativepermeability}
\begin{docCommand}{relativepermittivity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{relativepermittivity}
\begin{docCommand}{resistance}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{resistance}
\begin{docCommand}{resistivity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{resistivity}
\begin{docCommand}{solidangle}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{solidangle}
\begin{docCommand}{specificheatcapacity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{specificheatcapacity}
\begin{docCommand}{springstiffness}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{springstiffness}
\begin{docCommand}{springstretch}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{springstretch}
\begin{docCommand}{stress}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{stress}
\begin{docCommand}{strain}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{strain}
\begin{docCommand}{temperature}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{temperature}
\begin{docCommands}
  {%
    {%
      doc name = torque,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = torquevector,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectortorque,% 
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{torque}
\begin{docCommands}
  {%
    {%
      doc name = velocity,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = velocityvector,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectorvelocity,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{velocity}
\begin{docCommands}
  {%
    {%
      doc name = velocityc,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = velocitycvector,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectorvelocityc,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{velocityc}
\begin{docCommand}{volume}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{volume}
\begin{docCommand}{volumechargedensity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{volumechargedensity}
\begin{docCommand}{volumemassdensity}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{volumemassdensity}
\begin{docCommand}{wavelength}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{wavelength}
\begin{docCommands}
  {%
    {%
      doc name = wavenumber,%
      doc parameter = \marg{magnitude},%
    },%
    {%
      doc new = 2021-02-24,%
      doc name = wavenumbervector,%
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
    {%
      doc name = vectorwavenumber,% 
      doc parameter = \marg{\( c_{1},\dots,c_{n} \)},%
    },%
  }%
\end{docCommands}
\CheckQuantity{wavenumber}
\begin{docCommand}{work}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{work}
\begin{docCommand}{youngsmodulus}{\marg{magnitude}}
\end{docCommand}
\CheckQuantity{youngsmodulus}
%\iffalse
%</example>
%\fi
%
% \subsubsection{Defining and Redefining Physical Quantities}
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}[%
    doc parameter = \marg{name}\marg{base units}\oarg{derived units}\oarg{alternate units},%
  ]%
  {%
    {%
      doc new = 2021-02-16,%
      doc name = NewScalarQuantity,%
    },%
    {%
      doc new = 2021-02-21,%
      doc name = RenewScalarQuantity,%
    },%
  }%
  Command to (re)define a new/existing scalar quantity. 
  If the derived or alternate units are omitted, they are 
  defined to be the same as the base units. Do not use both 
  this command and 
  \refCom{NewVectorQuantity} or \refCom{RenewVectorQuantity} 
  to (re)define a quantity.
\end{docCommands}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}[%
    doc parameter = \marg{name}\marg{base units}\oarg{derived units}\oarg{alternate units},%
  ]%
  {%
    {%
      doc new = 2021-02-16,%
      doc name = NewVectorQuantity,%
    },%
    {%
      doc new = 2021-02-21,%
      doc name = RenewVectorQuantity,%
    },%
  }%
  Command to (re)define a new/existing vector quantity. 
  If the derived or alternate units are omitted, they are 
  defined to be the same as the base units. Do not use both 
  this command and 
  \refCom{NewScalarQuantity} or \refCom{RenewScalarQuantity} 
  to (re)define a quantity.
\end{docCommands}
%\iffalse
%</example>
%\fi
%
% \subsubsection{Changing Units}\setplace{ssec:chgunits}
%
% Units are set when \mandi{} is loaded, but the default setting
% can be easily overridden in four ways: command variants that
% are defined when a \linktoplace{ssec:physquants}{physical quantity}
% or \linktoplace{ssec:physconsts}{physical constant} is
% defined, a global modal command (switch), a 
% command that sets units for a single instance, and an
% environment that sets units for its duration. All of these
% methods work for both physical quantities and physical 
% constants. 
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}[%
    doc updated = 2021-02-26,%
    doc parameter = {},%
  ]%
  {%
    {%
      doc name = alwaysusebaseunits,%
    },%
    {%
      doc name = alwaysusederivedunits,%
    },%
    {%
      doc name = alwaysusealternateunits,%
    },%
  }%
  Modal commands (switches) for setting the default unit form for the entire 
  document. When \mandi{} is loaded, one of these three commands is executed 
  depending on whether the optional |units| key is provided. See the section 
  on loading the package for details. Alternate units are the default because 
  they are the most likely ones to be seen in introductory physics textbooks.
\end{docCommands}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}[%
    doc updated = 2021-02-26,%
    doc parameter = \marg{content},%
  ]%
  {%
    {%
      doc name = hereusebaseunits,%
    },%
    {%
      doc name = hereusederivedunits,%
    },%
    {%
      doc name = hereusealternateunits,%
    },%
  }%
  Commands for setting the unit form on the fly for a single instance. The 
  example uses momentum and the Coulomb constant, but they work for any 
  defined quantity and constant.
\end{docCommands}
\begin{dispExample}
  \( \hereusebaseunits{\momentum{5}} \)      \\
  \( \hereusederivedunits{\momentum{5}} \)   \\
  \( \hereusealternateunits{\momentum{5}} \) \\
  \( \hereusebaseunits{\oofpez} \)           \\
  \( \hereusederivedunits{\oofpez} \)        \\
  \( \hereusealternateunits{\oofpez} \)
\end{dispExample}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docEnvironments}[%
    doc updated = 2021-02-26,%
    doc parameter = {},%
  ]%
  {%
    {% 
      doc name = usebaseunits,%
      doc description = use base units,% 
    },%
    {% 
      doc name = usederivedunits,%
      doc description = use derived units,%
    },%
    {%
      doc name = usealternateunits,% 
      doc description = use alternate units,%
    },%
  }%
  Inside these environments units are changed for the duration 
  of the environment regardless of the global default setting.
\end{docEnvironments}
\begin{dispExample}
  \( \momentum{5} \)   \\
  \( \oofpez \)        \\
  \begin{usebaseunits}
    \( \momentum{5} \) \\
    \( \oofpez \)      \\
  \end{usebaseunits}
  \begin{usederivedunits}
    \( \momentum{5} \) \\
    \( \oofpez \)      \\
  \end{usederivedunits}
  \begin{usealternateunits}
    \( \momentum{5} \) \\
    \( \oofpez \)
  \end{usealternateunits}
\end{dispExample}
%\iffalse
%</example>
%\fi
%
% \subsection{Physical Constants}
% \subsubsection{Typesetting Physical Constants}\setplace{ssec:physconsts}
%
% Take the quantity \( \oofpezmathsymbol \), sometimes called the 
% \href{https://en.wikipedia.org/wiki/Coulomb_constant}{Coulomb constant}, 
% as the prototypical 
% \href{https://en.wikipedia.org/wiki/Physical_constant}{physical constant} 
% in an introductory physics course. Here are all the ways to access this 
% quantity in \mandi. As you can see, these commands are almost identical 
% to the corresponding commands for physical quantities.
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}[doc label = oofpezdemo]{oofpez}{}
  Command for the Coulomb constant. The constant's numerical precision and 
  default units will depend on the options passed to \mandi{} at load time. 
  Alternate units and approximate numerical values are the defaults. Other 
  units can be forced as demonstrated.
\end{docCommand}
\begin{dispExample}
  \( \oofpez \)                   \\
  \( \oofpezapproximatevalue \)   \\
  \( \oofpezprecisevalue \)       \\
  \( \oofpezmathsymbol \)         \\
  \( \oofpezbaseunits \)          \\
  \( \oofpezderivedunits \)       \\
  \( \oofpezalternateunits \)     \\
  \( \oofpezonlybaseunits \)      \\
  \( \oofpezonlyderivedunits \)   \\
  \( \oofpezonlyalternateunits \)
\end{dispExample}
%\iffalse
%</example>
%\fi
%
% \subsubsection{Checking Physical Constants}
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}[doc updated = 2022-01-27]{CheckConstant}{\marg{name}}
  Command to check and typeset the constant's name, mathematical symbol, 
  approximate value, precise value, base units, derived units, and 
  alternate units.
\end{docCommand}
%\iffalse
%</example>
%\fi
%
% \subsubsection{Predefined Physical Constants}
%
% Every other defined physical constant can be treated similarly to
% \refCom{oofpez}. Just replace |oofpez| with the constant's name. 
% Unfortunately, there is no universal agreement on the names of every 
% constant so don't fret if the names used here vary from other sources. 
% Here are all the physical constants, with all their units, defined in 
% \mandi. The constants \refCom{coulombconstant} and 
% \refCom{biotsavartconstant} are defined as semantic aliases for, 
% respectively, \refCom{oofpez} and \refCom{mzofp}.
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}[doc description = exact]{avogadro}{}
\end{docCommand}
\CheckConstant{avogadro}
\begin{docCommand}[doc new = 2021-02-02]{biotsavartconstant}{}
\end{docCommand}
\CheckConstant{biotsavartconstant}
\begin{docCommand}{bohrradius}{}
\end{docCommand}
\CheckConstant{bohrradius}
\begin{docCommand}[doc description = exact]{boltzmann}{}
\end{docCommand}
\CheckConstant{boltzmann}
\begin{docCommand}[doc new = 2021-02-02]{coulombconstant}{}
\end{docCommand}
\CheckConstant{coulombconstant}
\begin{docCommand}{earthmass}{}
\end{docCommand}
\CheckConstant{earthmass}
\begin{docCommand}{earthmoondistance}{}
\end{docCommand}
\CheckConstant{earthmoondistance}
\begin{docCommand}{earthradius}{}
\end{docCommand}
\CheckConstant{earthradius}
\begin{docCommand}{earthsundistance}{}
\end{docCommand}
\CheckConstant{earthsundistance}
\begin{docCommand}{electroncharge}{}
\end{docCommand}
\CheckConstant{electroncharge}
\begin{docCommand}{electronCharge}{}
\end{docCommand}
\CheckConstant{electronCharge}
\begin{docCommand}{electronmass}{}
\end{docCommand}
\CheckConstant{electronmass}
\begin{docCommand}[doc description = exact]{elementarycharge}{}
\end{docCommand}
\CheckConstant{elementarycharge}
\begin{docCommand}{finestructure}{}
\end{docCommand}
\CheckConstant{finestructure}
\begin{docCommand}{hydrogenmass}{}
\end{docCommand}
\CheckConstant{hydrogenmass}
\begin{docCommand}{moonearthdistance}{}
\end{docCommand}
\CheckConstant{moonearthdistance}
\begin{docCommand}{moonmass}{}
\end{docCommand}
\CheckConstant{moonmass}
\begin{docCommand}{moonradius}{}
\end{docCommand}
\CheckConstant{moonradius}
\begin{docCommand}{mzofp}{}
\end{docCommand}
\CheckConstant{mzofp}
\begin{docCommand}{neutronmass}{}
\end{docCommand}
\CheckConstant{neutronmass}
\begin{docCommand}{oofpez}{}
\end{docCommand}
\CheckConstant{oofpez}
\begin{docCommand}{oofpezcs}{}
\end{docCommand}
\CheckConstant{oofpezcs}
\begin{docCommand}[doc description = exact]{planck}{}
\end{docCommand}
\CheckConstant{planck}
\begin{docCommand}{planckbar}{}
\end{docCommand}
\CheckConstant{planckbar}
\begin{docCommand}{planckc}{}
\end{docCommand}
\CheckConstant{planckc}
\begin{docCommand}{protoncharge}{}
\end{docCommand}
\CheckConstant{protoncharge}
\begin{docCommand}{protonCharge}{}
\end{docCommand}
\CheckConstant{protonCharge}
\begin{docCommand}{protonmass}{}
\end{docCommand}
\CheckConstant{protonmass}
\begin{docCommand}{rydberg}{}
\end{docCommand}
\CheckConstant{rydberg}
\begin{docCommand}[doc description = exact]{speedoflight}{}
\end{docCommand}
\CheckConstant{speedoflight}
\begin{docCommand}{stefanboltzmann}{}
\end{docCommand}
\CheckConstant{stefanboltzmann}
\begin{docCommand}{sunearthdistance}{}
\end{docCommand}
\CheckConstant{sunearthdistance}
\begin{docCommand}{sunradius}{}
\end{docCommand}
\CheckConstant{sunradius}
\begin{docCommand}{surfacegravfield}{}
\end{docCommand}
\CheckConstant{surfacegravfield}
\begin{docCommand}{universalgrav}{}
\end{docCommand}
\CheckConstant{universalgrav}
\begin{docCommand}{vacuumpermeability}{}
\end{docCommand}
\CheckConstant{vacuumpermeability}
\begin{docCommand}{vacuumpermittivity}{}
\end{docCommand}
\CheckConstant{vacuumpermittivity}
%\iffalse
%</example>
%\fi
%
% \subsubsection{Defining and Redefining Physical Constants}
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}[%
    doc parameter = {%
    \marg{name}\marg{symbol}\marg{approximate value}\marg{precise value}\marg{base units}\\
    \oarg{derived units}\oarg{alternate units}%
    },%
  ]%
  {%
    {%
      doc new = 2021-02-16,%
      doc name = NewPhysicalConstant,%
    },%
    {%
      doc new = 2021-02-21,%
      doc name = RenewPhysicalConstant,%
    },%
  }%
  Command to define/redefine a new/existing physical constant. 
  If the derived or alternate units are omitted, they are 
  defined to be the same as the base units.
\end{docCommands}
%\iffalse
%</example>
%\fi
%
% \subsubsection{Changing Precision}
%
% \linktoplace{ssec:chgunits}{Changing units} works for
% physical constants just as it does for physical quantities.
% A similar mechanism is provided for changing the precision
% of physical constants' numerical values.
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}[%
    doc new = 2021-02-16,%
    doc parameter = {},%
  ]%
  {%
    {%
      doc name = alwaysuseapproximateconstants,%
    },%
    {%
      doc name = alwaysusepreciseconstants,%
    },%
  }%
  Modal commands (switches) for setting the default precision for the entire 
  document. The default when the package is loaded is set by the presence or
  absence of the \refKey{preciseconstants} key. 
\end{docCommands}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}[%
    doc new = 2021-02-16,%
    doc parameter = \marg{content},%
  ]%
  {%
    {%
      doc name = hereuseapproximateconstants,%
    },%
    {%
      doc name = hereusepreciseconstants,%
    },%
  }%
  Commands for setting the precision on the fly for a single instance.
\end{docCommands}
\begin{dispExample}
  \( \hereuseapproximateconstants{\oofpez} \) \\
  \( \hereusepreciseconstants{\oofpez} \)
\end{dispExample}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docEnvironments}[%
    doc new = 2021-02-16,%
    doc parameter = {},%
  ]%
  {%
    {% 
      doc name = useapproximateconstants,%
      doc description = use approximate constants,% 
    },%
    {% 
      doc name = usepreciseconstants,%
      doc description = use precise constants,%
    },%
  }%
  Inside these environments precision is changed for the duration 
  of the environment regardless of the global default setting.
\end{docEnvironments}
\begin{dispExample}
  \( \oofpez \)                   \\
  \begin{useapproximateconstants}
    \( \oofpez \)                 \\
  \end{useapproximateconstants}
  \begin{usepreciseconstants}
    \( \oofpez \)                 \\
  \end{usepreciseconstants}
  \( \oofpez \)
\end{dispExample}
%\iffalse
%</example>
%\fi
%
% \subsection{Predefined Units and Constructs}
%
% These commands should be used only in defining or
% redefining physical quantities or physical
% constants. One exception is \refCom{emptyunit},
% which may be used for explanatory purposes.
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}[%
    doc parameter = {},%
  ]%
  {%
    {%
      doc name = per,%
    },%
    {%
      doc name = usk,%
    },%
    {%
      doc parameter = \marg{magnitude}\marg{unit},%
      doc updated = 2023-08-01,%
      doc name = units,%
    },%
    {%
      doc name = emptyunit,%
    },%
    {%
      doc name = ampere,%
    },%
    {%
      doc name = atomicmassunit,%
    },%
    {%
      doc name = candela,%
    },%
    {%
      doc name = coulomb,%
    },%
    {%
      doc name = degree,%
    },%
    {%
      doc name = electronvolt,%
      doc description = not SI but common in introductory physics,%
    },%
    {%
      doc new = 2021-04-15,%
      doc name = ev,%
      doc description = alias,%
    },%
    {%
      doc name = farad,%
    },%
    {%
      doc name = henry,%
    },%
    {%
      doc name = hertz,%
    },%
    {%
      doc name = joule,%
    },%
    {%
      doc name = kelvin,%
    },%
    {%
      doc new = 2021-04-15,%
      doc name = kev,%
      doc description = alias,%
    },%
    {%
      doc new = 2021-04-15,%
      doc name = kiloelectronvolt,%
      doc description = not SI but common in introductory physics,%
    },%
    {%
      doc name = kilogram,%
    },%
    {%
      doc name = lightspeed,%
      doc description = not SI but common relativity,%
    },%
    {%
      doc new = 2021-04-15,%
      doc name = megaelectronvolt,%
      doc description = not SI but common in introductory physics,%
    },%
    {%
      doc name = meter,%
    },%
    {%
      doc name = metre,%
      doc description = alias,%
    },%
    {%
      doc new = 2021-04-15,%
      doc name = mev,%
      doc description = alias,%
    },%
    {%
      doc name = mole,%
    },%
    {%
      doc name = newton,%
    },%
    {%
      doc name = ohm,%
    },%
    {%
      doc name = pascal,%
    },%
    {%
      doc name = radian,%
    },%
    {%
      doc name = second,%
    },%
    {%
      doc name = siemens,%
    },%
    {%
      doc name = steradian,%
    },%
    {%
      doc name = tesla,%
    },%
    {%
      doc name = volt,%
    },%
    {%
      doc name = watt,%
    },%
    {%
      doc name = weber,%
    },%
    {%
      doc name = tothetwo,%
      doc description = postfix,%
    },%
    {%
      doc name = tothethree,%
      doc description = postfix,%
    },%
    {%
      doc name = tothefour,%
      doc description = postfix,%
    },%
    {%
      doc name = inverse,%
      doc description = postfix,%
    },%
    {%
      doc name = totheinversetwo,%
      doc description = postfix,%
    },%
    {%
      doc name = totheinversethree,%
      doc description = postfix,%
    },%
    {%
      doc name = totheinversefour,%
      doc description = postfix,%
    },%
  }%
\end{docCommands}
\begin{dispExample}
  \( \per \)                         \\
  \( \usk \)                         \\
  \( \units{3}{\meter\per\second} \) \\
  \( \emptyunit \)                   \\
  \( \ampere \)                      \\
  \( \atomicmassunit \)              \\
  \( \candela \)                     \\
  \( \coulomb \)                     \\
  \( \degree \)                      \\
  \( \electronvolt \)                \\
  \( \farad \)                       \\
  \( \henry \)                       \\
  \( \hertz \)                       \\
  \( \joule \)                       \\
  \( \kelvin \)                      \\
  \( \kev \)                         \\
  \( \kilogram \)                    \\
  \( \lightspeed \)                  \\
  \( \meter \)                       \\
  \( \metre \)                       \\
  \( \mev \)                         \\
  \( \mole \)                        \\
  \( \newton \)                      \\
  \( \ohm \)                         \\
  \( \pascal \)                      \\
  \( \radian \)                      \\
  \( \second \)                      \\
  \( \siemens \)                     \\
  \( \steradian \)                   \\
  \( \tesla \)                       \\
  \( \volt \)                        \\
  \( \watt \)                        \\
  \( \weber \)                       \\
  \( \emptyunit\tothetwo \)          \\
  \( \emptyunit\tothethree \)        \\
  \( \emptyunit\tothefour \)         \\
  \( \emptyunit\inverse \)           \\
  \( \emptyunit\totheinversetwo \)   \\
  \( \emptyunit\totheinversethree \) \\
  \( \emptyunit\totheinversefour \) 
\end{dispExample}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}[doc new = 2022-01-27,]{hbar}{}%
  A better glyph for Planck's constant over \( 2\pi \).
\end{docCommand}
\begin{dispExample}
 \( \hbar \)
\end{dispExample}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommands}[%
    doc parameter = \marg{number},%
  ]%
  {%
    {%
      doc name = tento,%
    },%
    {%
      doc name = timestento,%
    },%
    {%
      doc name = xtento,%
    },%
  }%
  Commands for powers of ten and scientific notation.
\end{docCommands}
\begin{dispExample}
 \( \tento{-4} \)      \\
 \( 3\timestento{8} \) \\
 \( 3\xtento{8} \)
\end{dispExample}
%\iffalse
%</example>
%\fi
%
%\iffalse
%<*example>
%\fi
\begin{docCommand}[doc updated = 2022-01-27]{mivector}{%
    \oarg{delimiter}\marg{\( c_{1},\dots,c_{n} \)}\oarg{units}
  }%
  Typesets a vector as either numeric or symbolic components with an 
  optional unit (for numerical components only). There must be more
  than one component, and there can be more than three components. 
  The delimiter used in the list of components can be specified; 
  the default is a comma. The notation mirrors that of 
  \emph{Matter \& Interactions}.
\end{docCommand}
\begin{dispExample*}{lefthand ratio = 0.70}
  \( \mivector{p_0,p_1,p_2,p_3} \)                                     \\
  \( \mivector{\gamma mc,\gamma mv_{x},\gamma mv_{y},\gamma mv_{z}} \) \\
  \( \mivector{\frac{Q_1Q_2}{x^2},0,0} \)                              \\
  \( \mivector{-1,0,0} \)                                              \\
  \( \mivector{-1,0,0}[\velocityonlyderivedunits] \)                   \\
  \( \mivector{-1,0,0}[\meter\per\second] \)                           \\
  \( \velocity{\mivector{-1,0,0}} \)
\end{dispExample*}
%\iffalse
%</example>
%\fi
%
% \MaybeStop{}
%
% \newgeometry{left=0.50in,right=0.50in,top=1.00in,bottom=1.00in}
% \subsection{\mandi{} Source Code}
%
% \iffalse
%<*package>
% \fi
% Define the package version and date for global use, exploiting the fact
% that in a \pkg{.sty} file there is now no need for |\makeatletter| and
% |\makeatother|. This simplifies defining internal commands (with |@| 
% in the name) that are not for the user to know about.
%
%    \begin{macrocode}
\def\mandi@version{3.2.2}
\def\mandi@date{2024-02-27}
\NeedsTeXFormat{LaTeX2e}[2020-02-02]
\DeclareRelease{v3.2.2}{2024-02-27}{mandi.sty}
\DeclareCurrentRelease{v\mandi@version}{\mandi@date}
\ProvidesPackage{mandi}
  [\mandi@date\space v\mandi@version\space Macros for physical quantities]
%    \end{macrocode}
%
% Define a convenient package version command.
%
%    \begin{macrocode}
\newcommand*{\mandiversion}{v\mandi@version\space dated \mandi@date}
%    \end{macrocode}
%
% Load third party packages, documenting why each one is needed.
%
% We need \pkg{pgfopts} for a key-value interface.
%
%    \begin{macrocode}
\RequirePackage{pgfopts}
%    \end{macrocode}
%
% We need \pkg{array} for |\chkquantity| and |\chkconstant|.
%
%    \begin{macrocode}
\RequirePackage{array}
%    \end{macrocode}
%
% We need \pkg{iftex} so we can require \lualatex.
%
%    \begin{macrocode}
\RequirePackage{iftex}
%    \end{macrocode}
%
% We need \pkg{mathtools} for intelligent delimiters.
%
%    \begin{macrocode}
\RequirePackage{mathtools}
%    \end{macrocode}
%
% We need \pkg{unicode-math} for Unicode support and changing fonts.
%
%    \begin{macrocode}
\RequirePackage{unicode-math}
%    \end{macrocode}
%
% Suppress some annoying warnings.
%
%    \begin{macrocode}
\unimathsetup{warnings-off={mathtools-colon,mathtools-overbracket}}
%    \end{macrocode}
%
% Load \pkg{xparse} if necessary.
%
%    \begin{macrocode}
\IfFormatAtLeastTF{2020-10-01}
  {}%
  {\RequirePackage{xparse}}%
%    \end{macrocode}
%
% We require the \lualatex{} engine.
%
%    \begin{macrocode}
\RequireLuaTeX
%    \end{macrocode}
%
% Parts of the unit engine have been rewritten with 
% \href{https://www.ctan.org/pkg/xparse}{\pkg{xparse}} for both clarity 
% and power. Note that \pkg{xparse} is now part of the \LaTeXe{} kernel. 
% Other parts have been rewritten in 
% \href{https://www.ctan.org/pkg/expl}{\pkg{expl}} with a look to the 
% future.
%
% Define some generic internal selectors.
%
%    \begin{macrocode}
\newcommand*{\mandi@selectunits}{}
\newcommand*{\mandi@selectprecision}{}
%    \end{macrocode}
%
% Define some specific internal selectors. The first two are really just 
% workalikes for |\@firstoftwo| and |\@secondoftwo|. The third, fourth, 
% and fifth are |\@firstofthree|, |\@secondofthree|, and |\@thirdofthree| 
% and apparently do not yet exist.
%
%    \begin{macrocode}
\newcommand*{\mandi@selectapproximate}[2]{#1}
\newcommand*{\mandi@selectprecise}[2]{#2}
\newcommand*{\mandi@selectbaseunits}[3]{#1}
\newcommand*{\mandi@selectderivedunits}[3]{#2}
\newcommand*{\mandi@selectalternateunits}[3]{#3}
%    \end{macrocode}
%
% Document level global switches.
%
%    \begin{macrocode}
\NewDocumentCommand{\alwaysusebaseunits}{}
  {\renewcommand*{\mandi@selectunits}{\mandi@selectbaseunits}}%
\NewDocumentCommand{\alwaysusederivedunits}{}
  {\renewcommand*{\mandi@selectunits}{\mandi@selectderivedunits}}%
\NewDocumentCommand{\alwaysusealternateunits}{}
  {\renewcommand*{\mandi@selectunits}{\mandi@selectalternateunits}}%
\NewDocumentCommand{\alwaysuseapproximateconstants}{}
  {\renewcommand*{\mandi@selectprecision}{\mandi@selectapproximate}}%
\NewDocumentCommand{\alwaysusepreciseconstants}{}
  {\renewcommand*{\mandi@selectprecision}{\mandi@selectprecise}}%
%    \end{macrocode}
%
% Document level localized variants.
%
%    \begin{macrocode}
\NewDocumentCommand{\hereusebaseunits}{ m }{\begingroup\alwaysusebaseunits#1\endgroup}%
\NewDocumentCommand{\hereusederivedunits}{ m }{\begingroup\alwaysusederivedunits#1\endgroup}%
\NewDocumentCommand{\hereusealternateunits}{ m }{\begingroup\alwaysusealternateunits#1\endgroup}%
\NewDocumentCommand{\hereuseapproximateconstants}{ m }{\begingroup\alwaysuseapproximateconstants#1\endgroup}%
\NewDocumentCommand{\hereusepreciseconstants}{ m }{\begingroup\alwaysusepreciseconstants#1\endgroup}%
%    \end{macrocode}
%
% Document level environments.
%
%    \begin{macrocode}
\NewDocumentEnvironment{usebaseunits}{}{\alwaysusebaseunits}{}%
\NewDocumentEnvironment{usederivedunits}{}{\alwaysusederivedunits}{}%
\NewDocumentEnvironment{usealternateunits}{}{\alwaysusealternateunits}{}%
\NewDocumentEnvironment{useapproximateconstants}{}{\alwaysuseapproximateconstants}{}%
\NewDocumentEnvironment{usepreciseconstants}{}{\alwaysusepreciseconstants}{}%
%    \end{macrocode}
%
% \mandi{} now has a key-value interface, implemented with 
% \href{https://www.ctan.org/pkg/pgfopts}{\pkg{pgfopts}} and 
% \href{https://www.ctan.org/pkg/pgfkeys}{\pkg{pgfkeys}}.
% There are two options:\newline
% \refKey{units}, with values \docValue{base}, \docValue{derived}, or 
% \docValue{alternate} selects the default form of units\newline
% \refKey{preciseconstants}, with values \docValue{true} and 
% \docValue{false}, selects precise numerical values for constants 
% rather than approximate values. 
%
% First, define the keys. The key handlers require certain commands defined 
% by the unit engine.
%
% \changes{v3.1.0}{2022-01-27}
%   {\linktoplace{sec:mandia}{mandi} Unknown package options handled safely}
%    \begin{macrocode}
\newif\ifusingpreciseconstants
\pgfkeys{%
  /mandi/options/.cd,
  initial@setup/.style={%
    /mandi/options/buffered@units/.initial=alternate,%
  },%
  initial@setup,%
  preciseconstants/.is if=usingpreciseconstants,%
  units/.is choice,%
  units/.default=derived,%
  units/alternate/.style={/mandi/options/buffered@units=alternate},%
  units/base/.style={/mandi/options/buffered@units=base},%
  units/derived/.style={/mandi/options/buffered@units=derived},%
  .unknown/.code={%
    \typeout{}%
    \typeout{mandi: You used unknown option '\pgfkeyscurrentname'.}%
  },%
}%
%    \end{macrocode}
%
% Process the options.
%
%    \begin{macrocode}
\ProcessPgfPackageOptions{/mandi/options}
%    \end{macrocode}
%
% Write a banner to the console showing the options in use.
%
%    \begin{macrocode}
\typeout{}%
\typeout{mandi: You are using mandi \mandiversion.}%
\typeout{mandi: This package requires LuaLaTeX.}%
\typeout{mandi: Loadtime options...}
%    \end{macrocode}
%
% Complete the banner by showing currently selected options.
% The value of the \refKey{units} key is used in situ to set
% the default units.
%
%    \begin{macrocode}
\newcommand*{\mandi@do@setup}{%
  \csname alwaysuse\pgfkeysvalueof{/mandi/options/buffered@units}units\endcsname%
  \typeout{mandi: You will get \pgfkeysvalueof{/mandi/options/buffered@units}\space units.}%
  \ifusingpreciseconstants
    \alwaysusepreciseconstants
    \typeout{mandi: You will get precise constants.}%
  \else
    \alwaysuseapproximateconstants
    \typeout{mandi: You will get approximate constants.}%
  \fi
  \typeout{}%
}%
\mandi@do@setup
%    \end{macrocode}
%
% Define a setup command that overrides the loadtime options
% when called with new options. A new banner is written to 
% the console.
%
%    \begin{macrocode}
\NewDocumentCommand{\mandisetup}{ m }%
  {%
    \IfValueT{#1}%
      {%
        \pgfqkeys{/mandi/options}{#1}
        \typeout{}%
        \typeout{mandi: mandisetup options...}
        \mandi@do@setup
      }%
  }%
%    \end{macrocode}
%
% Define units and related constructs to be used with the unit engine. 
% All single letter macros are now gone. We basically absorbed and 
% adapted the now outdated 
% \href{https://ctan.org/pkg/siunits}{\pkg{SIunits}} package. 
% We make use of |\symup{...}| from the \pkg{unicode-math} package.
%
% \changes{v3.1.0}{2022-01-27}
%   {\linktoplace{sec:mandia}{mandi} Added a negative space to \refCom{lightspeed}}
% \changes{v3.2.0}{2023-08-01}
%   {\linktoplace{sec:mandia}{mandi} Changed \cs{unit} to \cs{units}}
%    \begin{macrocode}
\NewDocumentCommand{\per}{}{/}
\NewDocumentCommand{\usk}{}{\cdot}
\NewDocumentCommand{\units}{ m m }%
{%
  \IfValueTF{#2}
  {%
    {#1}{\,#2}
  }%
  {%
    {#1}{}
  }%
}%
\NewDocumentCommand{\ampere}{}{\symup{A}}
\NewDocumentCommand{\atomicmassunit}{}{\symup{u}}
\NewDocumentCommand{\candela}{}{\symup{cd}}
\NewDocumentCommand{\coulomb}{}{\symup{C}}
\NewDocumentCommand{\degree}{}{^{\circ}}
\NewDocumentCommand{\electronvolt}{}{\symup{eV}}
\NewDocumentCommand{\ev}{}{\electronvolt}
\NewDocumentCommand{\farad}{}{\symup{F}}
\NewDocumentCommand{\henry}{}{\symup{H}}
\NewDocumentCommand{\hertz}{}{\symup{Hz}}
\NewDocumentCommand{\joule}{}{\symup{J}}
\NewDocumentCommand{\kelvin}{}{\symup{K}}
\NewDocumentCommand{\kev}{}{\kiloelectronvolt}
\NewDocumentCommand{\kiloelectronvolt}{}{\symup{keV}}
\NewDocumentCommand{\kilogram}{}{\symup{kg}}
\NewDocumentCommand{\lightspeed}{}{\!\symup{c}}
\NewDocumentCommand{\megaelectronvolt}{}{\symup{MeV}}
\NewDocumentCommand{\meter}{}{\symup{m}}
\NewDocumentCommand{\metre}{}{\meter}
\NewDocumentCommand{\mev}{}{\megaelectronvolt}
\NewDocumentCommand{\mole}{}{\symup{mol}}
\NewDocumentCommand{\newton}{}{\symup{N}}
\NewDocumentCommand{\ohm}{}{\symup\Omega}
\NewDocumentCommand{\pascal}{}{\symup{Pa}}
\NewDocumentCommand{\radian}{}{\symup{rad}}
\NewDocumentCommand{\second}{}{\symup{s}}
\NewDocumentCommand{\siemens}{}{\symup{S}}
\NewDocumentCommand{\steradian}{}{\symup{sr}}
\NewDocumentCommand{\tesla}{}{\symup{T}}
\NewDocumentCommand{\volt}{}{\symup{V}}
\NewDocumentCommand{\watt}{}{\symup{W}}
\NewDocumentCommand{\weber}{}{\symup{Wb}}
\NewDocumentCommand{\tothetwo}{}{^{2}}
\NewDocumentCommand{\tothethree}{}{^{3}}
\NewDocumentCommand{\tothefour}{}{^{4}}
\NewDocumentCommand{\inverse}{}{^{-1}}
\NewDocumentCommand{\totheinversetwo}{}{^{-2}}
\NewDocumentCommand{\totheinversethree}{}{^{-3}}
\NewDocumentCommand{\totheinversefour}{}{^{-4}}
\NewDocumentCommand{\emptyunit}{}{\mdlgwhtsquare}
\NewDocumentCommand{\tento}{ m }{10^{#1}}
\NewDocumentCommand{\timestento}{ m }{\times\tento{#1}}
\NewDocumentCommand{\xtento}{ m }{\times\tento{#1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\ExplSyntaxOn
\cs_new:Npn \__mandi_newscalarquantity:nnnn #1#2#3#4
  {
    \cs_new:cpn {#1} ##1 {\units{##1}{\mandi@selectunits{#2}{#3}{#4}}}
    \cs_new:cpn {#1value} ##1 {##1}
    \cs_new:cpn {#1baseunits} ##1 {\units{##1}{\mandi@selectbaseunits{#2}{#3}{#4}}}
    \cs_new:cpn {#1derivedunits} ##1 {\units{##1}{\mandi@selectderivedunits{#2}{#3}{#4}}}
    \cs_new:cpn {#1alternateunits} ##1 {\units{##1}{\mandi@selectalternateunits{#2}{#3}{#4}}}
    \cs_new:cpn {#1onlybaseunits} {\mandi@selectbaseunits{#2}{#3}{#4}}
    \cs_new:cpn {#1onlyderivedunits} {\mandi@selectderivedunits{#2}{#3}{#4}}
    \cs_new:cpn {#1onlyalternateunits} {\mandi@selectalternateunits{#2}{#3}{#4}}
  }
\NewDocumentCommand{\NewScalarQuantity}{ m m O{#2} O{#2} }
  {
    \__mandi_newscalarquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 }
  }
%    \end{macrocode}
%
% Redefining an existing scalar quantity.
%
%    \begin{macrocode}
\cs_new:Npn \__mandi_renewscalarquantity:nnnn #1#2#3#4
  {
    \cs_set:cpn {#1} ##1 {\units{##1}{\mandi@selectunits{#2}{#3}{#4}}}
    \cs_set:cpn {#1value} ##1 {##1}
    \cs_set:cpn {#1baseunits} ##1 {\units{##1}{\mandi@selectbaseunits{#2}{#3}{#4}}}
    \cs_set:cpn {#1derivedunits} ##1 {\units{##1}{\mandi@selectderivedunits{#2}{#3}{#4}}}
    \cs_set:cpn {#1alternateunits} ##1 {\units{##1}{\mandi@selectalternateunits{#2}{#3}{#4}}}
    \cs_set:cpn {#1onlybaseunits} {\mandi@selectbaseunits{#2}{#3}{#4}}
    \cs_set:cpn {#1onlyderivedunits} {\mandi@selectderivedunits{#2}{#3}{#4}}
    \cs_set:cpn {#1onlyalternateunits} {\mandi@selectalternateunits{#2}{#3}{#4}}
  }
\NewDocumentCommand{\RenewScalarQuantity}{ m m O{#2} O{#2} }
  {
    \__mandi_renewscalarquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 }
  }
%    \end{macrocode}
%
% Defining a new vector quantity. Note that a corresponding scalar is also defined.
%
%    \begin{macrocode}
\cs_new:Npn \__mandi_newvectorquantity:nnnn #1#2#3#4
  {
    \__mandi_newscalarquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 }
    \cs_new:cpn {vector#1} ##1 {\units{\mivector{##1}}{\mandi@selectunits{#2}{#3}{#4}}}
    \cs_new:cpn {#1vector} ##1 {\units{\mivector{##1}}{\mandi@selectunits{#2}{#3}{#4}}}
    \cs_new:cpn {vector#1value} ##1 {\mivector{##1}}
    \cs_new:cpn {#1vectorvalue} ##1 {\mivector{##1}}
    \cs_new:cpn {vector#1baseunits} ##1 {\units{\mivector{##1}}{\mandi@selectbaseunits{#2}{#3}{#4}}}
    \cs_new:cpn {#1vectorbaseunits} ##1 {\units{\mivector{##1}}{\mandi@selectbaseunits{#2}{#3}{#4}}}
    \cs_new:cpn {vector#1derivedunits} ##1 {\units{\mivector{##1}}{\mandi@selectderivedunits{#2}{#3}{#4}}}
    \cs_new:cpn {#1vectorderivedunits} ##1 {\units{\mivector{##1}}{\mandi@selectderivedunits{#2}{#3}{#4}}}
    \cs_new:cpn {vector#1alternateunits} ##1 {\units{\mivector{##1}}{\mandi@selectalternateunits{#2}{#3}{#4}}}
    \cs_new:cpn {#1vectoralternateunits} ##1 {\units{\mivector{##1}}{\mandi@selectalternateunits{#2}{#3}{#4}}}
    \cs_new:cpn {vector#1onlybaseunits} {\mandi@selectbaseunits{#2}{#3}{#4}}
    \cs_new:cpn {#1vectoronlybaseunits} {\mandi@selectbaseunits{#2}{#3}{#4}}
    \cs_new:cpn {vector#1onlyderivedunits} {\mandi@selectderivedunits{#2}{#3}{#4}}
    \cs_new:cpn {#1vectoronlyderivedunits} {\mandi@selectderivedunits{#2}{#3}{#4}}
    \cs_new:cpn {vector#1onlyalternateunits} {\mandi@selectalternateunits{#2}{#3}{#4}}
    \cs_new:cpn {#1vectoronlyalternateunits} {\mandi@selectalternateunits{#2}{#3}{#4}}
  }
\NewDocumentCommand{\NewVectorQuantity}{ m m O{#2} O{#2} }
  {
    \__mandi_newvectorquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 }
  }
%    \end{macrocode}
%
% Redefining an existing vector quantity. Note that a corresponding scalar is also redefined.
%
%    \begin{macrocode}
\cs_new:Npn \__mandi_renewvectorquantity:nnnn #1#2#3#4
  {
    \__mandi_renewscalarquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 }
    \cs_set:cpn {vector#1} ##1 {\units{\mivector{##1}}{\mandi@selectunits{#2}{#3}{#4}}}
    \cs_set:cpn {#1vector} ##1 {\units{\mivector{##1}}{\mandi@selectunits{#2}{#3}{#4}}}
    \cs_set:cpn {vector#1value} ##1 {\mivector{##1}}
    \cs_set:cpn {#1vectorvalue} ##1 {\mivector{##1}}
    \cs_set:cpn {vector#1baseunits} ##1 {\units{\mivector{##1}}{\mandi@selectbaseunits{#2}{#3}{#4}}}
    \cs_set:cpn {#1vectorbaseunits} ##1 {\units{\mivector{##1}}{\mandi@selectbaseunits{#2}{#3}{#4}}}
    \cs_set:cpn {vector#1derivedunits} ##1 {\units{\mivector{##1}}{\mandi@selectderivedunits{#2}{#3}{#4}}}
    \cs_set:cpn {#1vectorderivedunits} ##1 {\units{\mivector{##1}}{\mandi@selectderivedunits{#2}{#3}{#4}}}
    \cs_set:cpn {vector#1alternateunits} ##1 {\units{\mivector{##1}}{\mandi@selectalternateunits{#2}{#3}{#4}}}
    \cs_set:cpn {#1vectoralternateunits} ##1 {\units{\mivector{##1}}{\mandi@selectalternateunits{#2}{#3}{#4}}}
    \cs_set:cpn {vector#1onlybaseunits} {\mandi@selectbaseunits{#2}{#3}{#4}}
    \cs_set:cpn {#1vectoronlybaseunits} {\mandi@selectbaseunits{#2}{#3}{#4}}
    \cs_set:cpn {vector#1onlyderivedunits} {\mandi@selectderivedunits{#2}{#3}{#4}}
    \cs_set:cpn {#1vectoronlyderivedunits} {\mandi@selectderivedunits{#2}{#3}{#4}}
    \cs_set:cpn {vector#1onlyalternateunits} {\mandi@selectalternateunits{#2}{#3}{#4}}
    \cs_set:cpn {#1vectoronlyalternateunits} {\mandi@selectalternateunits{#2}{#3}{#4}}
  }
\NewDocumentCommand{\RenewVectorQuantity}{ m m O{#2} O{#2} }
  {
    \__mandi_renewvectorquantity:nnnn { #1 }{ #2 }{ #3 }{ #4 }
  }
%    \end{macrocode}
%
% Defining a new physical constant.
%
%    \begin{macrocode}
\cs_new:Npn \__mandi_newphysicalconstant:nnnnnnn #1#2#3#4#5#6#7
  {
    \cs_new:cpn {#1} {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectunits{#5}{#6}{#7}}}
    \cs_new:cpn {#1mathsymbol} {#2}
    \cs_new:cpn {#1approximatevalue} {#3}
    \cs_new:cpn {#1precisevalue} {#4}
    \cs_new:cpn {#1baseunits} 
      {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectbaseunits{#5}{#6}{#7}}}
    \cs_new:cpn {#1derivedunits} 
      {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectderivedunits{#5}{#6}{#7}}}
    \cs_new:cpn {#1alternateunits} 
      {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectalternateunits{#5}{#6}{#7}}}
    \cs_new:cpn {#1onlybaseunits} {\mandi@selectbaseunits{#5}{#6}{#7}}
    \cs_new:cpn {#1onlyderivedunits} {\mandi@selectderivedunits{#5}{#6}{#7}}
    \cs_new:cpn {#1onlyalternateunits} {\mandi@selectalternateunits{#5}{#6}{#7}}
  }
\NewDocumentCommand{\NewPhysicalConstant}{ m m m m m O{#5} O{#5} }
  {
    \__mandi_newphysicalconstant:nnnnnnn { #1 }{ #2 }{ #3 }{ #4 }{ #5 }{ #6 }{ #7 }
  }
%    \end{macrocode}
%
% Redefining an existing physical constant.
%
%    \begin{macrocode}
\cs_new:Npn \__mandi_renewphysicalconstant:nnnnnnn #1#2#3#4#5#6#7
  {
    \cs_set:cpn {#1} {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectunits{#5}{#6}{#7}}}
    \cs_set:cpn {#1mathsymbol} {#2}
    \cs_set:cpn {#1approximatevalue} {#3}
    \cs_set:cpn {#1precisevalue} {#4}
    \cs_set:cpn {#1baseunits} 
      {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectbaseunits{#5}{#6}{#7}}}
    \cs_set:cpn {#1derivedunits} 
      {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectderivedunits{#5}{#6}{#7}}}
    \cs_set:cpn {#1alternateunits} 
      {\units{\mandi@selectprecision{#3}{#4}}{\mandi@selectalternateunits{#5}{#6}{#7}}}
    \cs_set:cpn {#1onlybaseunits} {\mandi@selectbaseunits{#5}{#6}{#7}}
    \cs_set:cpn {#1onlyderivedunits} {\mandi@selectderivedunits{#5}{#6}{#7}}
    \cs_set:cpn {#1onlyalternateunits} {\mandi@selectalternateunits{#5}{#6}{#7}}
  }
\NewDocumentCommand{\RenewPhysicalConstant}{ m m m m m O{#5} O{#5} }
  {
    \__mandi_renewphysicalconstant:nnnnnnn { #1 }{ #2 }{ #3 }{ #4 }{ #5 }{ #6 }{ #7 }
  }
\ExplSyntaxOff
%    \end{macrocode}
%
% Define every quantity we need in introductory physics, alphabetically
% for convenience. This is really the core feature of \mandi{} that no other
% package offers. There are commands for quantities that have no dimensions 
% or units, and these quantities are defined for semantic completeness.
%
%    \begin{macrocode}
\NewVectorQuantity{acceleration}%
  {\meter\usk\second\totheinversetwo}%
  [\newton\per\kilogram]%
  [\meter\per\second\tothetwo]%
\NewScalarQuantity{amount}%
  {\mole}%
\NewVectorQuantity{angularacceleration}%
  {\radian\usk\second\totheinversetwo}%
  [\radian\per\second\tothetwo]%
  [\radian\per\second\tothetwo]%
\NewScalarQuantity{angularfrequency}%
  {\radian\usk\second\inverse}%
  [\radian\per\second]%
  [\radian\per\second]%
%    \end{macrocode}
%
% Angular impulse may also be |\newton\usk\meter\usk\second| or
% |\joule\usk\second|.
%
%    \begin{macrocode}
\NewVectorQuantity{angularimpulse}%
  {\kilogram\usk\meter\tothetwo\usk\second\inverse}%
  [\kilogram\usk\meter\tothetwo\per\second]%
  [\kilogram\usk\meter\tothetwo\per\second]%
%    \end{macrocode}
%
% Angular momentum may also be |\joule\usk\second| or 
% |\newton\usk\meter\usk\second|.
%
%    \begin{macrocode}
\NewVectorQuantity{angularmomentum}%
  {\kilogram\usk\meter\tothetwo\usk\second\inverse}%
  [\kilogram\usk\meter\tothetwo\per\second]%
  [\kilogram\usk\meter\tothetwo\per\second]%
%    \end{macrocode}
%
%    \begin{macrocode}
\NewVectorQuantity{angularvelocity}%
  {\radian\usk\second\inverse}%
  [\radian\per\second]%
  [\radian\per\second]%
\NewScalarQuantity{area}%
  {\meter\tothetwo}%
\NewScalarQuantity{areachargedensity}%
  {\ampere\usk\second\usk\meter\totheinversetwo}%
  [\coulomb\per\meter\tothetwo]%
  [\coulomb\per\meter\tothetwo]%
\NewScalarQuantity{areamassdensity}%
  {\kilogram\usk\meter\totheinversetwo}%
  [\kilogram\per\meter\tothetwo]%
  [\kilogram\per\meter\tothetwo]%
%    \end{macrocode}
%
% Capacitance may also be |\coulomb\tothetwo\per\newton\usk\meter| or
% |\second\per\ohm|.
%
%    \begin{macrocode}
\NewScalarQuantity{capacitance}%
  {\ampere\tothetwo\usk\second\tothefour\usk\kilogram\inverse\usk\meter\totheinversetwo}%
  [\farad]%
  [\coulomb\per\volt]%
%    \end{macrocode}
%
% Charge may also be |\farad\usk\volt|.
%
%    \begin{macrocode}
\NewScalarQuantity{charge}%
  {\ampere\usk\second}%
  [\coulomb]%
  [\coulomb]%
%    \end{macrocode}
%
% Magnetic field times \(\symup{c}\) may also be |\volt\per\meter|.
%
%    \begin{macrocode}
\NewVectorQuantity{cmagneticfield}%
  {\kilogram\usk\meter\usk\ampere\inverse\usk\second\totheinversethree}%  
  [\newton\per\coulomb]%
  [\newton\per\coulomb]%
%    \end{macrocode}
%
%    \begin{macrocode}
\NewScalarQuantity{conductance}%
  {\ampere\tothetwo\usk\second\tothethree\usk\kilogram\inverse\usk\meter\totheinversetwo}%
  [\siemens]%
  [\ampere\per\volt]%
\NewScalarQuantity{conductivity}%
  {\ampere\tothetwo\usk\second\tothethree\usk\kilogram\inverse\usk\meter\totheinversethree}%
  [\siemens\per\meter]%
  [\ampere\per\volt\usk\meter]%
\NewScalarQuantity{conventionalcurrent}%
  {\ampere}%
  [\coulomb\per\second]%
  [\ampere]%
\NewScalarQuantity{current}%
  {\ampere}%
\NewScalarQuantity{currentdensity}%
  {\ampere\usk\meter\totheinversetwo}%
  [\coulomb\per\second\usk\meter\tothetwo]%
  [\ampere\per\meter\tothetwo]%
\NewScalarQuantity{dielectricconstant}%
  {}%
\NewVectorQuantity{direction}%
  {}%
\NewVectorQuantity{displacement}%
  {\meter}
\NewScalarQuantity{duration}%
  {\second}%
\NewVectorQuantity{electricdipolemoment}%
  {\ampere\usk\second\usk\meter}%
  [\coulomb\usk\meter]%
  [\coulomb\usk\meter]%
\NewVectorQuantity{electricfield}%
  {\kilogram\usk\meter\usk\ampere\inverse\usk\second\totheinversethree}%
  [\volt\per\meter]%
  [\newton\per\coulomb]%
\NewScalarQuantity{electricflux}%
  {\kilogram\usk\meter\tothethree\usk\ampere\inverse\usk\second\totheinversethree}%
  [\volt\usk\meter]%
  [\newton\usk\meter\tothetwo\per\coulomb]%
%    \end{macrocode}
%
% Electric potential, electric potential difference, and emf 
% may also be |\joule\per\coulomb|.
%
%    \begin{macrocode}
\NewScalarQuantity{electricpotential}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\inverse\usk\second\totheinversethree}%
  [\volt]%
  [\volt]%
%    \end{macrocode}
%
%    \begin{macrocode} 
\NewScalarQuantity{electricpotentialdifference}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\inverse\usk\second\totheinversethree}%
  [\volt]%
  [\volt]%
\NewScalarQuantity{electroncurrent}%
  {\second\inverse}%
  [\ensuremath{\symup{e}}\per\second]%
  [\ensuremath{\symup{e}}\per\second]%
\NewScalarQuantity{emf}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\inverse\usk\second\totheinversethree}%
  [\volt]%
  [\volt]%
%    \end{macrocode}
%
% Energy may also be |\newton\usk\meter|.
%
%    \begin{macrocode}
\NewScalarQuantity{energy}%
  {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo}%
  [\joule]%
  [\joule]%
%    \end{macrocode}
%
%    \begin{macrocode} 
\NewScalarQuantity{energyinev}%
  {\electronvolt}%
\NewScalarQuantity{energyinkev}%
  {\kiloelectronvolt}%
\NewScalarQuantity{energyinmev}%
  {\megaelectronvolt}%
\NewScalarQuantity{energydensity}%
  {\kilogram\usk\meter\inverse\usk\second\totheinversetwo}%
  [\joule\per\meter\tothethree]%
  [\joule\per\meter\tothethree]%
\NewScalarQuantity{energyflux}%
  {\kilogram\usk\second\totheinversethree}%
  [\watt\per\meter\tothetwo]%
  [\watt\per\meter\tothetwo]%
\NewScalarQuantity{entropy}%
  {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo\usk\kelvin\inverse}%
  [\joule\per\kelvin]%
  [\joule\per\kelvin]%
%    \end{macrocode}
%
% Force may also be |\kilogram\usk\meter\per\second\tothetwo|.
%
%    \begin{macrocode}
\NewVectorQuantity{force}%
  {\kilogram\usk\meter\usk\second\totheinversetwo}%
  [\newton]%
  [\newton]%
%    \end{macrocode}
%
%    \begin{macrocode}
\NewScalarQuantity{frequency}%
  {\second\inverse}%
  [\hertz]%
  [\hertz]%
\NewVectorQuantity{gravitationalfield}%
  {\meter\usk\second\totheinversetwo}%
  [\newton\per\kilogram]%
  [\newton\per\kilogram]%
\NewScalarQuantity{gravitationalpotential}%
  {\meter\tothetwo\usk\second\totheinversetwo}%
  [\joule\per\kilogram]%
  [\joule\per\kilogram]%
\NewScalarQuantity{gravitationalpotentialdifference}%
  {\meter\tothetwo\usk\second\totheinversetwo}%
  [\joule\per\kilogram]%
  [\joule\per\kilogram]%
\NewVectorQuantity{impulse}%
  {\kilogram\usk\meter\usk\second\inverse}%
  [\newton\usk\second]%
  [\newton\usk\second]%
\NewScalarQuantity{indexofrefraction}%
  {}%
%    \end{macrocode}
%
% Inductance may also be |\square\meter\usk\kilogram\per\coulomb\tothetwo| or
% |\Wb\per\ampere|.
%
%    \begin{macrocode}
\NewScalarQuantity{inductance}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\totheinversetwo\usk\second\totheinversetwo}%
  [\henry]%
  [\volt\usk\second\per\ampere]%
%    \end{macrocode}
%
%    \begin{macrocode}
\NewScalarQuantity{linearchargedensity}%
  {\ampere\usk\second\usk\meter\inverse}%
  [\coulomb\per\meter]%
  [\coulomb\per\meter]%
\NewScalarQuantity{linearmassdensity}%
  {\kilogram\usk\meter\inverse}%
  [\kilogram\per\meter]%
  [\kilogram\per\meter]%
%    \end{macrocode}
%
% \changes{v3.1.0}{2022-01-27}
%   {\linktoplace{sec:mandia}{mandi} Added \refCom{lorentzfactor}}
%    \begin{macrocode}
\NewScalarQuantity{lorentzfactor}%
  {}%
\NewScalarQuantity{luminousintensity}%
  {\candela}%
%    \end{macrocode}
%
% There is another convention for magnetic charge, so be careful.
%
%    \begin{macrocode}
\NewScalarQuantity{magneticcharge}%
  {\ampere\usk\meter}%
%    \end{macrocode}
%
%    \begin{macrocode}
\NewVectorQuantity{magneticdipolemoment}%
  {\ampere\usk\meter\tothetwo}%
  [\ampere\usk\meter\tothetwo]%
  [\joule\per\tesla]%
%    \end{macrocode}
%
% Magnetic field may also be |\Wb\per\meter\tothetwo|.
%
%    \begin{macrocode}
\NewVectorQuantity{magneticfield}%
  {\kilogram\usk\ampere\inverse\usk\second\totheinversetwo}%
  [\newton\per\ampere\usk\meter]%
  [\tesla]%
%    \end{macrocode}
%
% Magnetic flux may also be |\Wb| or
% |\joule\per\ampere|.
%
%    \begin{macrocode}
\NewScalarQuantity{magneticflux}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\inverse\usk\second\totheinversetwo}%
  [\tesla\usk\meter\tothetwo]%
  [\volt\usk\second]%
%    \end{macrocode}
%
%    \begin{macrocode}
\NewScalarQuantity{mass}%
  {\kilogram}%
\NewScalarQuantity{mobility}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\inverse\usk\second\totheinversefour}%
  [\meter\tothetwo\per\volt\usk\second]%
  [\coulomb\usk\meter\per\newton\usk\second]%
\NewScalarQuantity{momentofinertia}%
  {\kilogram\usk\meter\tothetwo}%
  [\joule\usk\second\tothetwo]%
  [\kilogram\usk\meter\tothetwo]%
\NewVectorQuantity{momentum}%
  {\kilogram\usk\meter\usk\second\inverse}%
  [\kilogram\usk\meter\per\second]%
  [\kilogram\usk\meter\per\second]%
\NewVectorQuantity{momentumflux}%
  {\kilogram\usk\meter\inverse\usk\second\totheinversetwo}%
  [\newton\per\meter\tothetwo]%
  [\newton\per\meter\tothetwo]%
\NewScalarQuantity{numberdensity}%
  {\meter\totheinversethree}%
  [\per\meter\tothethree]%
  [\per\meter\tothethree]%
\NewScalarQuantity{permeability}%
  {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}%
  [\henry\per\meter]%
  [\tesla\usk\meter\per\ampere]%
\NewScalarQuantity{permittivity}%
  {\ampere\tothetwo\usk\second\tothefour\usk\kilogram\inverse\usk\meter\totheinversethree}%
  [\farad\per\meter]%
  [\coulomb\tothetwo\per\newton\usk\meter\tothetwo]%
\NewScalarQuantity{planeangle}%
  {\meter\usk\meter\inverse}%
  [\radian]%
  [\radian]%
\NewScalarQuantity{polarizability}%
  {\ampere\tothetwo\usk\second\tothefour\usk\kilogram\inverse}%
  [\coulomb\usk\meter\tothetwo\per\volt]%
  [\coulomb\tothetwo\usk\meter\per\newton]%
\NewScalarQuantity{power}%
  {\kilogram\usk\meter\tothetwo\usk\second\totheinversethree}%
  [\watt]%
  [\joule\per\second]%
\NewVectorQuantity{poynting}%
  {\kilogram\usk\second\totheinversethree}%
  [\watt\per\meter\tothetwo]%
  [\watt\per\meter\tothetwo]%
\NewScalarQuantity{pressure}%
  {\kilogram\usk\meter\inverse\usk\second\totheinversetwo}%
  [\pascal]%
  [\newton\per\meter\tothetwo]%
\NewScalarQuantity{relativepermeability}
  {}%
\NewScalarQuantity{relativepermittivity}%
  {}%
%    \end{macrocode}
%
% Resistance may also be |\volt\per\ampere|.
%
%    \begin{macrocode}
\NewScalarQuantity{resistance}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\totheinversetwo\usk\second\totheinversethree}%
  [\ohm]%
  [\ohm]%
%    \end{macrocode}
%
%    \begin{macrocode}
\NewScalarQuantity{resistivity}%
  {\kilogram\usk\meter\tothethree\usk\ampere\totheinversetwo\usk\second\totheinversethree}%
  [\ohm\usk\meter]%
  [\volt\usk\meter\per\ampere]%
\NewScalarQuantity{solidangle}%
  {\meter\tothetwo\usk\meter\totheinversetwo}%
  [\steradian]%
  [\steradian]%
\NewScalarQuantity{specificheatcapacity}%
  {\meter\tothetwo\usk\second\totheinversetwo\usk\kelvin\inverse}%
  [\joule\per\kelvin\usk\kilogram]%
  [\joule\per\kelvin\usk\kilogram]
\NewScalarQuantity{springstiffness}%
  {\kilogram\usk\second\totheinversetwo}%
  [\newton\per\meter]%
  [\newton\per\meter]%
%    \end{macrocode}
%
% Spring stretch is really just a displacement.
%
%    \begin{macrocode}
\NewScalarQuantity{springstretch}%
  {\meter}%
%    \end{macrocode}
%
%    \begin{macrocode}
\NewScalarQuantity{stress}%
  {\kilogram\usk\meter\inverse\usk\second\totheinversetwo}%
  [\pascal]%
  [\newton\per\meter\tothetwo]%
\NewScalarQuantity{strain}%
  {}%
\NewScalarQuantity{temperature}%
  {\kelvin}%
\NewVectorQuantity{torque}%
  {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo}%
  [\newton\usk\meter]%
  [\newton\usk\meter]%
\NewVectorQuantity{velocity}%
  {\meter\usk\second\inverse}%
  [\meter\per\second]%
  [\meter\per\second]%
\NewVectorQuantity{velocityc}%
  {\lightspeed}%
  [\lightspeed]%
  [\lightspeed]%
\NewScalarQuantity{volume}%
  {\meter\tothethree}%
\NewScalarQuantity{volumechargedensity}%
  {\ampere\usk\second\per\meter\totheinversethree}%
  [\coulomb\per\meter\tothethree]%
  [\coulomb\per\meter\tothethree]%
\NewScalarQuantity{volumemassdensity}%
  {\kilogram\usk\meter\totheinversethree}%
  [\kilogram\per\meter\tothethree]%
  [\kilogram\per\meter\tothethree]%
%    \end{macrocode}
%
% Wavelength is really just a displacement.
%
%    \begin{macrocode}
\NewScalarQuantity{wavelength}%
  {\meter}%
%    \end{macrocode}
%
%    \begin{macrocode}
\NewVectorQuantity{wavenumber}%
  {\meter\inverse}%
  [\per\meter]%
  [\per\meter]%
%    \end{macrocode}
%
% Work may also be |\newton\usk\meter| but this 
% is discouraged to avoid confusion with torque.
%
%    \begin{macrocode}
\NewScalarQuantity{work}%
  {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo}%
  [\joule]%
  [\joule]%
%    \end{macrocode}
%
% Young's modulus is really just a stress.
%
%    \begin{macrocode}
\NewScalarQuantity{youngsmodulus}%
  {\kilogram\usk\meter\inverse\usk\second\totheinversetwo}%
  [\pascal]%
  [\newton\per\meter\tothetwo]%
%    \end{macrocode}
%
% We need a better glyph for Planck's constant over \( 2\pi \).
%
% \changes{v3.1.0}{2022-01-27}
%   {\linktoplace{sec:mandia}{mandi} Added \refCom{hbar}}
%    \begin{macrocode}
\AtBeginDocument{%
  \DeclareRobustCommand{\hbar}{{\mathpalette\hbar@\relax\symup{h}}}%
}%
\newcommand*{\hbar@}[2]{%
  \makebox[0pt][l]{\raisebox{-0.07\height}{\(\m@th#1\mkern-2mu\mathchar"AF\)}}%
%    \end{macrocode}
%
% Optional line to make the bar thicker; must use \(-0.11\)
% in |\raisebox|.
%
%    \begin{macrocode}
  \makebox[0pt][l]{\raisebox{-0.11\height}{\(\m@th#1\mkern-2mu\mathchar"AF\)}}%
}%
%    \end{macrocode}
%
% Define physical constants for introductory physics, again alphabetically
% for convenience.
%
% \changes{v3.1.0}{2022-01-27}
%   {\linktoplace{sec:mandia}{mandi} Constants' values now use only \cs{times}}
%    \begin{macrocode}
\NewPhysicalConstant{avogadro}%
  {\symup{N_{A}}}%
  {6\times10^{23}}{6.02214076\times10^{23}}%
  {\mole\inverse}%
  [\per\mole]%
  [\per\mole]%
%    \end{macrocode}
%
% |\biotsavartconstant| is an alias for |\mzofp|.
%
%    \begin{macrocode}
\NewPhysicalConstant{biotsavartconstant}%
  {\symup{\frac{\mu_{o}}{4\pi}}}%
  {10^{-7}}{10^{-7}}%
  {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}%
  [\henry\per\meter]%
  [\tesla\usk\meter\per\ampere]%
\NewPhysicalConstant{bohrradius}%
  {\symup{a_{o}}}%
  {5.3\times10^{-11}}{5.29177210903\times10^{-11}}%
  {\meter}%
\NewPhysicalConstant{boltzmann}%
  {\symup{k_{B}}}%
  {1.4\times10^{-23}}{1.380649\times10^{-23}}%
  {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo\usk\kelvin\inverse}%
  [\joule\per\kelvin]%
  [\joule\per\kelvin]%
%    \end{macrocode}
%
% |\coulombconstant| is an alias for |\oofpez|.
%
%    \begin{macrocode}
\NewPhysicalConstant{coulombconstant}%
  {\symup{\frac{1}{4\pi\epsilon_{o}}}}%
  {9\times10^{9}}{8.9875517923\times10^{9}}%
  {\kilogram\usk\meter\tothethree\usk\ampere\totheinversetwo\usk\second\totheinversefour}%
  [\meter\per\farad]%
  [\newton\usk\meter\tothetwo\per\coulomb\tothetwo]%
\NewPhysicalConstant{earthmass}%
  {\symup{M_{Earth}}}%
  {6.0\times10^{24}}{5.9722\times10^{24}}%
  {\kilogram}%
\NewPhysicalConstant{earthmoondistance}%
  {\symup{d_{EM}}}%
  {3.8\times10^{8}}{3.81550\times10^{8}}%
  {\meter}%
\NewPhysicalConstant{earthradius}%
  {\symup{R_{Earth}}}%
  {6.4\times10^{6}}{6.3781\times10^{6}}%
  {\meter}%
\NewPhysicalConstant{earthsundistance}%
  {\symup{d_{ES}}}%
  {1.5\times10^{11}}{1.496\times10^{11}}%
  {\meter}%
\NewPhysicalConstant{electroncharge}%
  {\symup{q_{e}}}%
  {-\elementarychargeapproximatevalue}{-\elementarychargeprecisevalue}%
  {\ampere\usk\second}%
  [\coulomb]%
  [\coulomb]%
\NewPhysicalConstant{electronCharge}%
  {\symup{Q_{e}}}%
  {-\elementarychargeapproximatevalue}{-\elementarychargeprecisevalue}%
  {\ampere\usk\second}%
  [\coulomb]%
  [\coulomb]%
\NewPhysicalConstant{electronmass}%
  {\symup{m_{e}}}%
  {9.1\times10^{-31}}{9.1093837015\times10^{-31}}%
  {\kilogram}%
\NewPhysicalConstant{elementarycharge}%
  {\symup{e}}%
  {1.6\times10^{-19}}{1.602176634\times10^{-19}}%
  {\ampere\usk\second}%
  [\coulomb]%
  [\coulomb]%
\NewPhysicalConstant{finestructure}%
  {\symup{\alpha}}%
  {\frac{1}{137}}{7.2973525693\times10^{-3}}%
  {}%
\NewPhysicalConstant{hydrogenmass}%
  {\symup{m_{H}}}%
  {1.7\times10^{-27}}{1.6737236\times10^{-27}}%
  {\kilogram}%
\NewPhysicalConstant{moonearthdistance}%
  {\symup{d_{ME}}}%
  {3.8\times10^{8}}{3.81550\times10^{8}}%
  {\meter}%
\NewPhysicalConstant{moonmass}%
  {\symup{M_{Moon}}}%
  {7.3\times10^{22}}{7.342\times10^{22}}%
  {\kilogram}%
\NewPhysicalConstant{moonradius}%
  {\symup{R_{Moon}}}%
  {1.7\times10^{6}}{1.7371\times10^{6}}%
  {\meter}%
\NewPhysicalConstant{mzofp}%
  {\symup{\frac{\mu_{o}}{4\pi}}}%
  {10^{-7}}{10^{-7}}%
  {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}%
  [\henry\per\meter]%
  [\tesla\usk\meter\per\ampere]%
\NewPhysicalConstant{neutronmass}%
  {\symup{m_{n}}}%
  {1.7\times10^{-27}}{1.67492749804\times10^{-27}}%
  {\kilogram}%
\NewPhysicalConstant{oofpez}%
  {\symup{\frac{1}{4\pi\epsilon_{o}}}}%
  {9\times10^{9}}{8.9875517923\times10^{9}}%
  {\kilogram\usk\meter\tothethree\usk\ampere\totheinversetwo\usk\second\totheinversefour}%
  [\meter\per\farad]%
  [\newton\usk\meter\tothetwo\per\coulomb\tothetwo]%
\NewPhysicalConstant{oofpezcs}%
  {\symup{\frac{1}{4\pi\epsilon_{o} c^2}}}%
  {10^{-7}}{10^{-7}}%
  {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}%
  [\tesla\usk\meter\tothetwo]%
  [\newton\usk\second\tothetwo\per\coulomb\tothetwo]%
\NewPhysicalConstant{planck}%
  {\symup{h}}%
  {6.6\times10^{-34}}{6.62607015\times10^{-34}}%
  {\kilogram\usk\meter\tothetwo\usk\second\inverse}%
  [\joule\usk\second]%
  [\joule\usk\second]%
%    \end{macrocode}
%
% See \url{https://tex.stackexchange.com/a/448565/218142}.
%
%    \begin{macrocode}
\NewPhysicalConstant{planckbar}%
  {\hbar}%
  {1.1\times10^{-34}}{1.054571817\times10^{-34}}%
  {\kilogram\usk\meter\tothetwo\usk\second\inverse}%
  [\joule\usk\second]%
  [\joule\usk\second]
\NewPhysicalConstant{planckc}%
  {\symup{hc}}%
  {2.0\times10^{-25}}{1.98644586\times10^{-25}}%
  {\kilogram\usk\meter\tothethree\usk\second\totheinversetwo}%
  [\joule\usk\meter]%
  [\joule\usk\meter]%
\NewPhysicalConstant{protoncharge}%
  {\symup{q_p}}%
  {+\elementarychargeapproximatevalue}{+\elementarychargeprecisevalue}%
  {\ampere\usk\second}%
  [\coulomb]%
  [\coulomb]%
\NewPhysicalConstant{protonCharge}%
  {\symup{Q_p}}%
  {+\elementarychargeapproximatevalue}{+\elementarychargeprecisevalue}%
  {\ampere\usk\second}%
  [\coulomb]%
  [\coulomb]%
\NewPhysicalConstant{protonmass}%
  {\symup{m_p}}%
  {1.7\times10^{-27}}{1.672621898\times10^{-27}}%
  {\kilogram}%
\NewPhysicalConstant{rydberg}%
  {\symup{R_{\infty}}}%
  {1.1\times10^{7}}{1.0973731568160\times10^{7}}%
  {\meter\inverse}%
\NewPhysicalConstant{speedoflight}%
  {\symup{c}}%
  {3\times10^{8}}{2.99792458\times10^{8}}%
  {\meter\usk\second\inverse}%
  [\meter\per\second]%
  [\meter\per\second]
\NewPhysicalConstant{stefanboltzmann}%
  {\symup{\sigma}}%
  {5.7\times10^{-8}}{5.670374\times10^{-8}}%
  {\kilogram\usk\second\totheinversethree\usk\kelvin\totheinversefour}%
  [\watt\per\meter\tothetwo\usk\kelvin\tothefour]%
  [\watt\per\meter\tothetwo\usk\kelvin\tothefour]
\NewPhysicalConstant{sunearthdistance}%
  {\symup{d_{SE}}}%
  {1.5\times10^{11}}{1.496\times10^{11}}%
  {\meter}%
\NewPhysicalConstant{sunmass}%
  {\symup{M_{Sun}}}%
  {2.0\times10^{30}}{1.98855\times10^{30}}%
  {\kilogram}%
\NewPhysicalConstant{sunradius}%
  {\symup{R_{Sun}}}%
  {7.0\times10^{8}}{6.957\times10^{8}}%
  {\meter}%
\NewPhysicalConstant{surfacegravfield}%
  {\symup{g}}%
  {9.8}{9.807}%
  {\meter\usk\second\totheinversetwo}%
  [\newton\per\kilogram]%
  [\newton\per\kilogram]%
%    \end{macrocode}
%
% The gravitational constant may also have units of 
% |\joule\usk\meter\per\kilogram\tothetwo|.
%
%    \begin{macrocode}
\NewPhysicalConstant{universalgrav}%
  {\symup{G}}%
  {6.7\times10^{-11}}{6.67430\times10^{-11}}%
  {\meter\tothethree\usk\kilogram\inverse\usk\second\totheinversetwo}%
  [\newton\usk\meter\tothetwo\per\kilogram\tothetwo]%
  [\newton\usk\meter\tothetwo\per\kilogram\tothetwo]%
%    \end{macrocode}
%
% As of 2018 the vacuum permeability is no longer defined as
% \( 4\pi\times10^{-7} \).
%
%    \begin{macrocode}
\NewPhysicalConstant{vacuumpermeability}%
  {\symup{\mu_o}}%
  {4\pi\times10^{-7}}{4\pi\times10^{-7}}%
  {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}%
  [\henry\per\meter]%
  [\tesla\usk\meter\per\ampere]%
\NewPhysicalConstant{vacuumpermittivity}%
  {\symup{\epsilon_o}}%
  {9\times10^{-12}}{8.854187817\times10^{-12}}%
  {\ampere\tothetwo\usk\second\tothefour\usk\kilogram\inverse\usk\meter\totheinversethree}%
  [\farad\per\meter]%
  [\coulomb\tothetwo\per\newton\usk\meter\tothetwo]%
%    \end{macrocode}
%
% Diagnostic commands to provide sanity checks on commands that 
% represent physical quantities and constants.
%
% \changes{v3.1.0}{2022-01-27}
%   {\linktoplace{sec:mandia}{mandi} Improved \refCom{CheckQuantity}}
% \changes{v3.1.0}{2022-01-27}
%   {\linktoplace{sec:mandia}{mandi} Improved \refCom{CheckConstant}}
%    \begin{macrocode}
\ExplSyntaxOn
\NewDocumentCommand{\@aux}{ m }
  {
    \use:c { #1 }
  }
\NewDocumentCommand{\@auy}{ m }
  {
    \normalfont\ttfamily\token_to_str:c { #1 }
  }
\ExplSyntaxOff
\newcolumntype{M}{>{\(}p{0.25\linewidth}<{\)}}
\NewDocumentCommand{\CheckQuantity}{ m }
  {%
    \begin{center}
      \begin{tabular}{MMM}
        \textbf{command}       & \multicolumn{2}{l}{\@auy{#1}}                             \tabularnewline
        \text{\textbf{base}}   & \text{\textbf{derived}}     & \text{\textbf{alternate}}   \tabularnewline
        \@aux{#1onlybaseunits} & \@aux{#1onlyderivedunits}   & \@aux{#1onlyalternateunits} \tabularnewline
      \end{tabular}
    \end{center}
  }%
\NewDocumentCommand{\CheckConstant}{ m }
  {%
    \begin{center}
      \begin{tabular}{MMM}
        \textbf{command}       & \multicolumn{2}{l}{\@auy{#1}}                             \tabularnewline
        \text{\textbf{symbol}} & \text{\textbf{approximate}} & \text{\textbf{precise}}     \tabularnewline
        \@aux{#1mathsymbol}    & \@aux{#1approximatevalue}   & \@aux{#1precisevalue}       \tabularnewline
        \text{\textbf{base}}   & \text{\textbf{derived}}     & \text{\textbf{alternate}}   \tabularnewline
        \@aux{#1onlybaseunits} & \@aux{#1onlyderivedunits}   & \@aux{#1onlyalternateunits} \tabularnewline
      \end{tabular}
    \end{center}
  }%
%    \end{macrocode}
%
% \refCom{mivector} is a workhorse command.\newline
% See \url{https://tex.stackexchange.com/a/39054/218142}.
%
% \changes{v3.1.0}{2022-01-27}
%   {\linktoplace{sec:mandia}{mandi} \refCom{mivector} now
%     requires more than one component}
%    \begin{macrocode}
\ExplSyntaxOn
\NewDocumentCommand{\mivector}{ O{,} m o }
  {
    \__mandi_vector:nn { #1 } { #2 }
    \IfValueT{#3}{\,{#3}}
  }
\seq_new:N \l__mandi_list_seq
\cs_new_protected:Npn \__mandi_vector:nn #1#2
  {
      \seq_set_split:Nnn \l__mandi_list_seq { , } { #2 }
      \int_compare:nT { \seq_count:N \l__mandi_list_seq = 1 } 
       { 
         \msg_new:nnnn { mandi } { onecomponent } 
           { 
             More~than~one~component~expected.       \iow_newline:
             You~provided~one~component~to~a~command \iow_newline:
             that~expects~a~vector.~Either~you~don't \iow_newline:
             need~a~vector~here~or~you~didn't~supply \iow_newline:
             all~the~components.
           }
           { 
             Decide~whether~or~not~you~really~need~a~vector~command~here. \iow_newline:
             \msg_see_documentation_text:n { mandi }
           } 
         \msg_fatal:nn { mandi } { onecomponent }
         
       }
      \left\langle
        \seq_use:Nnnn \l__mandi_list_seq { #1 } { #1 } { #1 }
      \right\rangle
  }
\ExplSyntaxOff
%    \end{macrocode}
% \restoregeometry
%
% \iffalse
%</package>
% \fi
%
% \Finale
