%%
%% This is file `mandi.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mandi.dtx  (with options: `package')
%% 
%%  Copyright (C) 2021 by Paul J. Heafner <heafnerj@gmail.com>
%%  ---------------------------------------------------------------------------
%%  This  work may be  distributed and/or modified  under the conditions of the
%%  LaTeX Project Public  License, either  version 1.3  of this  license or (at
%%  your option) any later version. The  latest  version  of this license is in
%%             http://www.latex-project.org/lppl.txt
%%  and  version 1.3 or  later is  part of  all distributions of  LaTeX version
%%  2005/12/01 or later.
%% 
%%  This work has the LPPL maintenance status `maintained'.
%% 
%%  The Current Maintainer of this work is Paul J. Heafner.
%% 
%%  This work consists of the files mandi.dtx
%%                                  mandistudent.dtx
%%                                  mandiexp.dtx
%%                                  mandi.ins
%%                                  mandi.pdf
%%                                  README.md
%% 
%%  and includes the derived files  mandi.sty
%%                                  mandistudent.sty
%%                                  mandiexp.sty
%%                                  vdemo.py
%%  ---------------------------------------------------------------------------
%% 
\def\mandi@version{3.0.0}
\def\mandi@date{2021-08-22}
\NeedsTeXFormat{LaTeX2e}[2020-02-02]
\DeclareRelease{v3.0.0}{2021-08-22}{mandi.sty}
\DeclareCurrentRelease{v\mandi@version}{\mandi@date}
\ProvidesPackage{mandi}
  [\mandi@date\space v\mandi@version\space Macros for physical quantities]
\newcommand*{\mandiversion}{v\mandi@version\space dated \mandi@date}
\RequirePackage{pgfopts}      % needed for key-value interface
\RequirePackage{array}        % needed for \checkquantity and \checkconstant
\RequirePackage{iftex}        % needed for requiring LuaLaTeX
\RequirePackage{unicode-math} % needed for Unicode support
\RequireLuaTeX                % require this engine
\newcommand*{\mandi@selectunits}{}
\newcommand*{\mandi@selectprecision}{}
\newcommand*{\mandi@selectapproximate}[2]{#1}    % really \@firstoftwo
\newcommand*{\mandi@selectprecise}[2]{#2}        % really \@secondoftwo
\newcommand*{\mandi@selectbaseunits}[3]{#1}      % really \@firstofthree
\newcommand*{\mandi@selectderivedunits}[3]{#2}   % really \@secondofthree
\newcommand*{\mandi@selectalternateunits}[3]{#3} % really \@thirdofthree
\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}}%
\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}%
\NewDocumentEnvironment{usebaseunits}{}{\alwaysusebaseunits}{}%
\NewDocumentEnvironment{usederivedunits}{}{\alwaysusederivedunits}{}%
\NewDocumentEnvironment{usealternateunits}{}{\alwaysusealternateunits}{}%
\NewDocumentEnvironment{useapproximateconstants}{}{\alwaysuseapproximateconstants}{}%
\NewDocumentEnvironment{usepreciseconstants}{}{\alwaysusepreciseconstants}{}%
\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},%
}%
\ProcessPgfPackageOptions{/mandi/options}
\typeout{}%
\typeout{mandi: You are using mandi \mandiversion.}%
\typeout{mandi: This package requires LuaLaTeX.}%
\typeout{mandi: Loadtime options...}
\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
\NewDocumentCommand{\mandisetup}{ m }{%
  \IfValueT{#1}{%
    \pgfqkeys{/mandi/options}{#1}
    \typeout{}%
    \typeout{mandi: mandisetup options...}
    \mandi@do@setup
  }%
}%
\NewDocumentCommand{\per}{}{/}
\NewDocumentCommand{\usk}{}{\cdot}
\NewDocumentCommand{\unit}{ m m }{{#1}{\,#2}}
\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}             % postfix  2
\NewDocumentCommand{\tothethree}{}{^3}           % postfix  3
\NewDocumentCommand{\tothefour}{}{^4}            % postfix  4
\NewDocumentCommand{\inverse}{}{^{-1}}           % postfix -1
\NewDocumentCommand{\totheinversetwo}{}{^{-2}}   % postfix -2
\NewDocumentCommand{\totheinversethree}{}{^{-3}} % postfix -3
\NewDocumentCommand{\totheinversefour}{}{^{-4}}  % postfix -4
\NewDocumentCommand{\emptyunit}{}{\mdlgwhtsquare}
\NewDocumentCommand{\tento}{ m }{10^{#1}}
\NewDocumentCommand{\timestento}{ m }{\times\tento{#1}}
\NewDocumentCommand{\xtento}{ m }{\times\tento{#1}}
\ExplSyntaxOn
\cs_new:Npn \mandi_newscalarquantity #1#2#3#4
{%
  \cs_new:cpn {#1} ##1 {\unit{##1}{\mandi@selectunits{#2}{#3}{#4}}}%
  \cs_new:cpn {#1value} ##1 {##1}%
  \cs_new:cpn {#1baseunits} ##1 {\unit{##1}{\mandi@selectbaseunits{#2}{#3}{#4}}}%
  \cs_new:cpn {#1derivedunits} ##1 {\unit{##1}{\mandi@selectderivedunits{#2}{#3}{#4}}}%
  \cs_new:cpn {#1alternateunits} ##1 {\unit{##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 { #1 }{ #2 }{ #3 }{ #4 }%
}%
\ExplSyntaxOff
\ExplSyntaxOn
\cs_new:Npn \mandi_renewscalarquantity #1#2#3#4
{%
  \cs_set:cpn {#1} ##1 {\unit{##1}{\mandi@selectunits{#2}{#3}{#4}}}%
  \cs_set:cpn {#1value} ##1 {##1}%
  \cs_set:cpn {#1baseunits} ##1 {\unit{##1}{\mandi@selectbaseunits{#2}{#3}{#4}}}%
  \cs_set:cpn {#1derivedunits} ##1 {\unit{##1}{\mandi@selectderivedunits{#2}{#3}{#4}}}%
  \cs_set:cpn {#1alternateunits} ##1 {\unit{##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 { #1 }{ #2 }{ #3 }{ #4 }%
}%
\ExplSyntaxOff
\ExplSyntaxOn
\cs_new:Npn \mandi_newvectorquantity #1#2#3#4
{%
  \mandi_newscalarquantity { #1 }{ #2 }{ #3 }{ #4 }%
  \cs_new:cpn {vector#1} ##1 {\unit{\mivector{##1}}{\mandi@selectunits{#2}{#3}{#4}}}%
  \cs_new:cpn {#1vector} ##1 {\unit{\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 {\unit{\mivector{##1}}{\mandi@selectbaseunits{#2}{#3}{#4}}}%
  \cs_new:cpn {#1vectorbaseunits} ##1 {\unit{\mivector{##1}}{\mandi@selectbaseunits{#2}{#3}{#4}}}%
  \cs_new:cpn {vector#1derivedunits} ##1 {\unit{\mivector{##1}}{\mandi@selectderivedunits{#2}{#3}{#4}}}%
  \cs_new:cpn {#1vectorderivedunits} ##1 {\unit{\mivector{##1}}{\mandi@selectderivedunits{#2}{#3}{#4}}}%
  \cs_new:cpn {vector#1alternateunits} ##1 {\unit{\mivector{##1}}{\mandi@selectalternateunits{#2}{#3}{#4}}}%
  \cs_new:cpn {#1vectoralternateunits} ##1 {\unit{\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 { #1 }{ #2 }{ #3 }{ #4 }%
}%
\ExplSyntaxOff
\ExplSyntaxOn
\cs_new:Npn \mandi_renewvectorquantity #1#2#3#4
{%
  \mandi_renewscalarquantity { #1 }{ #2 }{ #3 }{ #4 }%
  \cs_set:cpn {vector#1} ##1 {\unit{\mivector{##1}}{\mandi@selectunits{#2}{#3}{#4}}}%
  \cs_set:cpn {#1vector} ##1 {\unit{\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 {\unit{\mivector{##1}}{\mandi@selectbaseunits{#2}{#3}{#4}}}%
  \cs_set:cpn {#1vectorbaseunits} ##1 {\unit{\mivector{##1}}{\mandi@selectbaseunits{#2}{#3}{#4}}}%
  \cs_set:cpn {vector#1derivedunits} ##1 {\unit{\mivector{##1}}{\mandi@selectderivedunits{#2}{#3}{#4}}}%
  \cs_set:cpn {#1vectorderivedunits} ##1 {\unit{\mivector{##1}}{\mandi@selectderivedunits{#2}{#3}{#4}}}%
  \cs_set:cpn {vector#1alternateunits} ##1 {\unit{\mivector{##1}}{\mandi@selectalternateunits{#2}{#3}{#4}}}%
  \cs_set:cpn {#1vectoralternateunits} ##1 {\unit{\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 { #1 }{ #2 }{ #3 }{ #4 }%
}%
\ExplSyntaxOff
\ExplSyntaxOn
\cs_new:Npn \mandi_newphysicalconstant #1#2#3#4#5#6#7
{%
  \cs_new:cpn {#1} {\unit{\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}
    {\unit{\mandi@selectprecision{#3}{#4}}{\mandi@selectbaseunits{#5}{#6}{#7}}}%
  \cs_new:cpn {#1derivedunits}
    {\unit{\mandi@selectprecision{#3}{#4}}{\mandi@selectderivedunits{#5}{#6}{#7}}}%
  \cs_new:cpn {#1alternateunits}
    {\unit{\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 { #1 }{ #2 }{ #3 }{ #4 }{ #5 }{ #6 }{ #7 }%
}%
\ExplSyntaxOff
\ExplSyntaxOn
\cs_new:Npn \mandi_renewphysicalconstant #1#2#3#4#5#6#7
{%
  \cs_set:cpn {#1} {\unit{\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}
    {\unit{\mandi@selectprecision{#3}{#4}}{\mandi@selectbaseunits{#5}{#6}{#7}}}%
  \cs_set:cpn {#1derivedunits}
    {\unit{\mandi@selectprecision{#3}{#4}}{\mandi@selectderivedunits{#5}{#6}{#7}}}%
  \cs_set:cpn {#1alternateunits}
    {\unit{\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 { #1 }{ #2 }{ #3 }{ #4 }{ #5 }{ #6 }{ #7 }%
}%
\ExplSyntaxOff
\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]%
  \newvectorquantity{angularimpulse}%
    {\kilogram\usk\meter\tothetwo\usk\second\inverse}%
    [\kilogram\usk\meter\tothetwo\per\second]% % also \joule\usk\second
    [\kilogram\usk\meter\tothetwo\per\second]% % also \newton\usk\meter\usk\second
  \newvectorquantity{angularmomentum}%
    {\kilogram\usk\meter\tothetwo\usk\second\inverse}%
    [\kilogram\usk\meter\tothetwo\per\second]% % also \joule\usk\second
    [\kilogram\usk\meter\tothetwo\per\second]% % also \newton\usk\meter\usk\second
\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]%
\newscalarquantity{capacitance}%
  {\ampere\tothetwo\usk\second\tothefour\usk\kilogram\inverse\usk\meter\totheinversetwo}%
  [\farad]%
  [\coulomb\per\volt]% % also \coulomb\tothetwo\per\newton\usk\meter, \second\per\ohm
\newscalarquantity{charge}%
  {\ampere\usk\second}%
  [\coulomb]%
  [\coulomb]% % also \farad\usk\volt
\newvectorquantity{cmagneticfield}%
  {\kilogram\usk\meter\usk\ampere\inverse\usk\second\totheinversethree}%
  [\newton\per\coulomb]% % also \volt\per\meter
  [\newton\per\coulomb]%
\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]%
\newscalarquantity{electricpotential}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\inverse\usk\second\totheinversethree}%
  [\volt]% % also \joule\per\coulomb
  [\volt]%
\newscalarquantity{electricpotentialdifference}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\inverse\usk\second\totheinversethree}%
  [\volt]% % also \joule\per\coulomb
  [\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]% % also \joule\per\coulomb
  [\volt]%
\newscalarquantity{energy}%
  {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo}%
  [\joule]% % also \newton\usk\meter
  [\joule]%
\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]%
\newvectorquantity{force}%
  {\kilogram\usk\meter\usk\second\totheinversetwo}%
  [\newton]%
  [\newton]% % also \kilogram\usk\meter\per\second\tothetwo
\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}%
  {}%
\newscalarquantity{inductance}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\totheinversetwo\usk\second\totheinversetwo}%
  [\henry]%
  [\volt\usk\second\per\ampere]% % also \square\meter\usk\kilogram\per\coulomb\tothetwo, \Wb\per\ampere
\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]%
\newscalarquantity{luminousintensity}%
  {\candela}%
\newscalarquantity{magneticcharge}%
  {\ampere\usk\meter}% % There is another convention. Be careful!
\newvectorquantity{magneticdipolemoment}%
  {\ampere\usk\meter\tothetwo}%
  [\ampere\usk\meter\tothetwo]%
  [\joule\per\tesla]%
\newvectorquantity{magneticfield}%
  {\kilogram\usk\ampere\inverse\usk\second\totheinversetwo}%
  [\newton\per\ampere\usk\meter]% % also \Wb\per\meter\tothetwo
  [\tesla]%
\newscalarquantity{magneticflux}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\inverse\usk\second\totheinversetwo}%
  [\tesla\usk\meter\tothetwo]%
  [\volt\usk\second]% % also \Wb and \joule\per\ampere
\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}%
  {}%
\newscalarquantity{resistance}%
  {\kilogram\usk\meter\tothetwo\usk\ampere\totheinversetwo\usk\second\totheinversethree}%
  [\ohm]% % also \volt\per\ampere
  [\ohm]%
\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]%
\newscalarquantity{springstretch}% % This is really just a displacement.
  {\meter}%
\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]%
\newscalarquantity{wavelength}% % This is really just a displacement.
  {\meter}%
\newvectorquantity{wavenumber}%
  {\meter\inverse}%
  [\per\meter]%
  [\per\meter]%
\newscalarquantity{work}%
  {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo}%
  [\joule]% % also \newton\usk\meter but discouraged
  [\joule]%
\newscalarquantity{youngsmodulus}% % This is really just a stress.
  {\kilogram\usk\meter\inverse\usk\second\totheinversetwo}%
  [\pascal]%
  [\newton\per\meter\tothetwo]%
\newphysicalconstant{avogadro}%
  {\symup{N_A}}%
  {6\timestento{23}}{6.02214076\timestento{23}}% % exact 2019 value
  {\mole\inverse}%
  [\per\mole]%
  [\per\mole]%
\newphysicalconstant{biotsavartconstant}% % alias for \mzofp
  {\symup{\frac{\mu_o}{4\pi}}}%
  {\tento{-7}}{\tento{-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\timestento{-11}}{5.29177210903\timestento{-11}}%
  {\meter}%
\newphysicalconstant{boltzmann}%
  {\symup{k_B}}%
  {1.4\timestento{-23}}{1.380649\timestento{-23}}% % exact 2019 value
  {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo\usk\kelvin\inverse}%
  [\joule\per\kelvin]%
  [\joule\per\kelvin]%
\newphysicalconstant{coulombconstant}% % alias for \oofpez
  {\symup{\frac{1}{4\pi\epsilon_o}}}%
  {9\timestento{9}}{8.9875517923\timestento{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\timestento{24}}{5.9722\timestento{24}}%
  {\kilogram}%
\newphysicalconstant{earthmoondistance}%
  {\symup{d_{EM}}}%
  {3.8\timestento{8}}{3.81550\timestento{8}}%
  {\meter}%
\newphysicalconstant{earthradius}%
  {\symup{R_{Earth}}}%
  {6.4\timestento{6}}{6.3781\timestento{6}}%
  {\meter}%
\newphysicalconstant{earthsundistance}%
  {\symup{d_{ES}}}%
  {1.5\timestento{11}}{1.496\timestento{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\timestento{-31}}{9.1093837015\timestento{-31}}%
  {\kilogram}%
\newphysicalconstant{elementarycharge}%
  {\symup{e}}%
  {1.6\timestento{-19}}{1.602176634\timestento{-19}}% % exact 2019 value
  {\ampere\usk\second}%
  [\coulomb]%
  [\coulomb]%
\newphysicalconstant{finestructure}%
  {\symup{\alpha}}%
  {\frac{1}{137}}{7.2973525693\timestento{-3}}%
  {}%
\newphysicalconstant{hydrogenmass}%
  {\symup{m_H}}%
  {1.7\timestento{-27}}{1.6737236\timestento{-27}}%
  {\kilogram}%
\newphysicalconstant{moonearthdistance}%
  {\symup{d_{ME}}}%
  {3.8\timestento{8}}{3.81550\timestento{8}}%
  {\meter}%
\newphysicalconstant{moonmass}%
  {\symup{M_{Moon}}}%
  {7.3\timestento{22}}{7.342\timestento{22}}%
  {\kilogram}%
\newphysicalconstant{moonradius}%
  {\symup{R_{Moon}}}%
  {1.7\timestento{6}}{1.7371\timestento{6}}%
  {\meter}%
\newphysicalconstant{mzofp}%
  {\symup{\frac{\mu_o}{4\pi}}}%
  {\tento{-7}}{\tento{-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\timestento{-27}}{1.67492749804\timestento{-27}}%
  {\kilogram}%
\newphysicalconstant{oofpez}%
  {\symup{\frac{1}{4\pi\epsilon_o}}}%
  {9\timestento{9}}{8.9875517923\timestento{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}}}%
  {\tento{-7}}{\tento{-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\timestento{-34}}{6.62607015\timestento{-34}}% % exact 2019 value
  {\kilogram\usk\meter\tothetwo\usk\second\inverse}%
  [\joule\usk\second]%
  [\joule\usk\second]%
\newphysicalconstant{planckbar}%
  {\symup{\lower0.18ex\hbox{\mathchar"AF}\mkern-7mu h}}%
  {1.1\timestento{-34}}{1.054571817\timestento{-34}}%
  {\kilogram\usk\meter\tothetwo\usk\second\inverse}%
  [\joule\usk\second]%
  [\joule\usk\second]
\newphysicalconstant{planckc}%
  {\symup{hc}}%
  {2.0\timestento{-25}}{1.98644586\timestento{-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\timestento{-27}}{1.672621898\timestento{-27}}%
  {\kilogram}%
\newphysicalconstant{rydberg}%
  {\symup{R_{\infty}}}%
  {1.1\timestento{7}}{1.0973731568160\timestento{7}}%
  {\meter\inverse}%
\newphysicalconstant{speedoflight}%
  {\symup{c}}%
  {3\timestento{8}}{2.99792458\timestento{8}}% % exact value
  {\meter\usk\second\inverse}%
  [\meter\per\second]%
  [\meter\per\second]
\newphysicalconstant{stefanboltzmann}%
  {\symup{\sigma}}%
  {5.7\timestento{-8}}{5.670374\timestento{-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\timestento{11}}{1.496\timestento{11}}%
  {\meter}%
\newphysicalconstant{sunmass}%
  {\symup{M_{Sun}}}%
  {2.0\timestento{30}}{1.98855\timestento{30}}%
  {\kilogram}%
\newphysicalconstant{sunradius}%
  {\symup{R_{Sun}}}%
  {7.0\timestento{8}}{6.957\timestento{8}}%
  {\meter}%
\newphysicalconstant{surfacegravfield}%
  {\symup{g}}%
  {9.8}{9.807}%
  {\meter\usk\second\totheinversetwo}%
  [\newton\per\kilogram]%
  [\newton\per\kilogram]%
\newphysicalconstant{universalgrav}%
  {\symup{G}}%
  {6.7\timestento{-11}}{6.67430\timestento{-11}}%
  {\meter\tothethree\usk\kilogram\inverse\usk\second\totheinversetwo}%
  [\newton\usk\meter\tothetwo\per\kilogram\tothetwo]% % also \joule\usk\meter\per\kilogram\tothetwo
  [\newton\usk\meter\tothetwo\per\kilogram\tothetwo]%
\newphysicalconstant{vacuumpermeability}%
  {\symup{\mu_o}}%
  {4\pi\timestento{-7}}{4\pi\timestento{-7}}% % as of 2018 no longer 4\pi\timestento{-7}
  {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}%
  [\henry\per\meter]%
  [\tesla\usk\meter\per\ampere]%
\newphysicalconstant{vacuumpermittivity}%
  {\symup{\epsilon_o}}%
  {9\timestento{-12}}{8.854187817\timestento{-12}}%
  {\ampere\tothetwo\usk\second\tothefour\usk\kilogram\inverse\usk\meter\totheinversethree}%
  [\farad\per\meter]%
  [\coulomb\tothetwo\per\newton\usk\meter\tothetwo]%
\ExplSyntaxOn
\NewDocumentCommand{\checkquantity}{ m }%
{%
  % Works for both scalar and vector quantities (without vector in the name!).
  \begin{center}
    \begin{tabular}{%
        >{\bfseries\small}
        p{0.5\linewidth}
        p{0.1\linewidth}
        p{0.1\linewidth}
        p{0.1\linewidth}
      }%
      name & & & \tabularnewline
      \ttfamily\footnotesize{\token_to_str:c {#1}} & & & \tabularnewline
    \end{tabular}~ % This nonbreaking space is important!
    \begin{tabular}{%
        >{\bfseries\small}p{0.25\linewidth}
        >{\bfseries\small}p{0.25\linewidth}
        >{\bfseries\small}p{0.25\linewidth}
      }%
      base & derived & alternate \tabularnewline
      \footnotesize{\( \use:c {#1onlybaseunits}      \)} &
      \footnotesize{\( \use:c {#1onlyderivedunits}   \)} &
      \footnotesize{\( \use:c {#1onlyalternateunits} \)}
    \end{tabular}
  \end{center}
}%
\NewDocumentCommand{\checkconstant}{ m }%
{%
  \begin{center}
    \begin{tabular}{%
        >{\bfseries\small}
        p{0.5\linewidth}
        p{0.1\linewidth}
        p{0.1\linewidth}
        p{0.1\linewidth}
      }%
      name & & & \tabularnewline
      \ttfamily\footnotesize{\token_to_str:c {#1}} & & & \tabularnewline
    \end{tabular}~ % This nonbreaking space is important!
    \begin{tabular}{%
        >{\bfseries\small}p{0.25\linewidth}
        >{\bfseries\small}p{0.25\linewidth}
        >{\bfseries\small}p{0.25\linewidth}
      }%
      symbol & approximate & precise \tabularnewline
      \footnotesize{\( \use:c {#1mathsymbol}       \)} &
      \footnotesize{\( \use:c {#1approximatevalue} \)} &
      \footnotesize{\( \use:c {#1precisevalue}     \)}
    \end{tabular}~ % This nonbreaking space is important!
    \begin{tabular}{%
        >{\bfseries\small}p{0.25\linewidth}
        >{\bfseries\small}p{0.25\linewidth}
        >{\bfseries\small}p{0.25\linewidth}
      }%
      base & derived & alternate \tabularnewline
      \footnotesize{\( \use:c {#1onlybaseunits}      \)} &
      \footnotesize{\( \use:c {#1onlyderivedunits}   \)} &
      \footnotesize{\( \use:c {#1onlyalternateunits} \)}
    \end{tabular}
  \end{center}
}%
\ExplSyntaxOff
\ExplSyntaxOn
\NewDocumentCommand{\mivector}{ O{,} m o }%
 {%
   \mi_vector:nn { #1 } { #2 }%
   \IfValueT{#3}{\,{#3}}%
 }%
\seq_new:N \l__mi_list_seq
\cs_new_protected:Npn \mi_vector:nn #1 #2
{%
  \ensuremath{%
    \seq_set_split:Nnn \l__mi_list_seq { , } { #2 }
    \int_compare:nF { \seq_count:N \l__mi_list_seq = 1 } { \left\langle }
    \seq_use:Nnnn \l__mi_list_seq { #1 } { #1 } { #1 }
    \int_compare:nF { \seq_count:N \l__mi_list_seq = 1 } { \right\rangle }
  }%
}%
\ExplSyntaxOff
\endinput
%%
%% End of file `mandi.sty'.
