% \iffalse meta-comment % !TEX program = lualatexmk % % Copyright (C) 2021 by Paul J. Heafner % --------------------------------------------------------------------------- % 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 % --------------------------------------------------------------------------- % % \fi % % \iffalse % %<*internal> \iffalse % % %<*internal> \fi \def\nameofplainTeX{plain} \ifx\fmtname\nameofplainTeX\else \expandafter\begingroup \fi % % %<*internal> \ifx\fmtname\nameofplainTeX \expandafter\endbatchfile \else \expandafter\endgroup \fi % % %<*driver> \ProvidesFile{mandi.dtx} \documentclass[10pt]{ltxdoc} \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 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,% }% % 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 % 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*{\GlowScript}{\texttt{GlowScript}} % typeset GlowScript \newcommand*{\GlowScriptorg}{\texttt{GlowScript.org}} % typeset GlowScript.org \newcommand*{\VPython}{\texttt{VPython}} % typeset VPython \newcommand*{\VPythonorg}{\texttt{VPython.org}} % typeset VPython.org \newcommand*{\gsurl}{glowscript.org} % GlowScript URL \newcommand*{\vpurl}{vpython.org} % VPython URL \newcommand*{\lualatex}{Lua\LaTeX} % typeset LuaLaTeX % 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} % \PrintIndex % \end{document} % end main document % % \fi % % \IndexPrologue{\section{Index}Page numbers refer to page where the % corresponding entry is documented and/or referenced.} % % \CheckSum{2171} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \title{The \href{https://ctan.org/pkg/mandi}{\mandi} Bundle} % \author{^^A % Paul J. Heafner\thanks{^^A % Email: \href{mailto:heafnerj@gmail.com?subject=[Heafner]\%20mandi} % {heafnerj@gmail.com}^^A % }^^A % }^^A % \date{\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 \LaTeX\ 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 \LaTeX\ developers who inhabit the % \href{https://tex.stackexchange.com/}{\TeX\ StackExchange} site. % Entering a new culture is daunting for anyone, especially for % newcomers. The \LaTeX\ development culture is no exception. We all % share a passion for creating beautiful documents and I have learned % much over the past year 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{GlowScript} Programs} % \listofglowscriptprograms % \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}{\mandi\ initial release} % \changes{v3.0.0}{2021-08-22}{\mandistudent\ initial release} % \changes{v3.0.0}{2021-08-22}{\mandiexp\ initial release} % % \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:mandipkg}{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:mandistudentpkg}{mandistudent} provides other typesetting % capability appropriate for written problem solutions. Finally, package % \linktoplace{sec:mandiexppkg}{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.} % % \mandi\ has been completely rewritten from the ground up. It had gotten too % large and clumsy to use and maintain. It (unknowingly) used deprecated % packages. It had too many arcane ``features'' that were never used. It % did not support Unicode. It was not compatible with modern engines, like % \lualatex. It did not have a key-value interface. Options could not be % changed on the fly within a document. In short, it was a mess. I hope % this rewrite addresses all of the bad things and forms a better code base % for maintenance, useability, and future improvements. % % So many changes have been made that I think the best approach for former, % as well as new, users is to treat this as a brand new experience. I think % the most important thing to keep in mind is that I assume users, % expecially new users, will have a relatively recent TeX distribution % (like TeX Live) that includes a recently updated \LaTeX\ kernel. If users % report that this is a major problem, I can provide some degree of % backwards compatibility. % % \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 % %\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 % %\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 % %\fi % % Use \refCom{mivector} to typeset symbolic vectors with components. % Use the aliases \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 % %\fi % % Use \refEnv{physicsproblem} and \refEnv{parts} and \refCom{problempart} % for problems. For step-by-step mathematical solutions use % \refEnv{physicssolution}. Use \refEnv{glowscriptblock} to typeset % \href{https://\gsurl}{\GlowScript} programs. Use \refCom{vpythonfile} to % typeset \href{https://\vpurl}{VPython} program files. % % \newpage % \section{The \mandi\ Package}\setplace{sec:mandipkg} % % 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 % %\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 % %\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 % %\fi % % \subsection{The \texttt{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 % %\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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectormomentum,% doc parameter = \marg{\ensuremath{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 % %\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. % For example, one shouldn'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 new = 2021-02-16]{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 % %\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. Rememeber 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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectoracceleration,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorangularacceleration,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorangularimpulse,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorangularmomentum,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorangularvelocity,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorcmagneticfield,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorcurrentdensity,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectordirection,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectordisplacement,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% { doc name = vectorelectricdipolemoment,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorelectricfield,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorenergyflux,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorforce,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorgravitationalfield,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorimpulse,% doc parameter = \marg{\ensuremath{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 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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectormagneticdipolemoment,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectormagneticfield,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectormomentum,% doc label = vectormomentumdemo,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectormomentumflux,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorpoynting,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectortorque,% doc parameter = \marg{\ensuremath{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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorvelocity,% doc parameter = \marg{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = velocityc,% doc parameter = \marg{magnitude},% },% {% doc new = 2021-02-24,% doc name = velocitycvector,% doc parameter = \marg{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorvelocityc,% doc parameter = \marg{\ensuremath{c_1,\dots,c_n}},% },% }% \end{docCommands} \checkquantity{velocity} \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{\ensuremath{c_1,\dots,c_n}},% },% {% doc name = vectorwavenumber,% doc parameter = \marg{\ensuremath{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 % %\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 % %\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 % %\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 % %\fi % %\iffalse %<*example> %\fi \begin{docCommands}[% doc updated = 2021-02-26,% doc parameter = \marg{content},% ]% {% {% doc name = hereusebaseunits,% },% {% doc name = hereusederivedunits,% },% {% doc name = hereusedalternateunits,% },% }% 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 % %\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 % %\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 % %\fi % % \subsubsection{Checking Physical Constants} % %\iffalse %<*example> %\fi \begin{docCommand}[doc updated = 2021-02-26]{checkconstant}{\marg{name}} Command to check and typeset the constant's name, base units, derived units, alternate units, mathematical symbol, approximate value, and precise value. \end{docCommand} %\iffalse % %\fi % % \subsubsection{Predefined Physical Constants} % % Every other defined physical constant can be treated similarly. 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 % %\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 % %\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 % %\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 % %\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 % %\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 name = unit,% },% {% 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 \) \\ \( \unit{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 % %\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 % %\fi % %\iffalse %<*example> %\fi \begin{docCommand}{mivector}{% \oarg{delimiter}\marg{\ensuremath{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 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.65} \( \mivector{p_0,p_1,p_2,p_3} \) \\ \( \mivector{\gamma m v_x,\gamma m v_y,\gamma m v_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 % %\fi % % \StopEventually{} % % \newgeometry{left=0.50in,right=0.50in,top=1.00in,bottom=1.00in} % \subsection{\mandi\ Source Code} % % \iffalse %<*package> % \fi % Definine 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.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] % \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. % % \begin{macrocode} \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 % \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 \LaTeX\ kernel. % Other parts have been rewriten in % \href{https://www.ctan.org/pkg/expl}{\pkg{expl}} with a look to the % future. % % Generic internal selectors. % % \begin{macrocode} \newcommand*{\mandi@selectunits}{} \newcommand*{\mandi@selectprecision}{} % \end{macrocode} % % Specific internal selectors. % % \begin{macrocode} \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 % \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. % % \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},% }% % \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. % % \begin{macrocode} \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}} % \end{macrocode} % % \begin{macrocode} \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 % \end{macrocode} % % Redefining an existing scalar quantity. % % \begin{macrocode} \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 % \end{macrocode} % % Defining a new vector quantity. Note that a corresponding scalar is also defined. % % \begin{macrocode} \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 % \end{macrocode} % % Redefining an existing vector quantity. Note that a corresponding scalar is also redefined. % % \begin{macrocode} \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 % \end{macrocode} % % Defining a new physical constant. % % \begin{macrocode} \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 % \end{macrocode} % % Redefining an existing physical constant. % % \begin{macrocode} \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 % \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]% %\ifmandi@rotradians % \newphysicalquantity{angularimpulse}% % {\meter\tothetwo\usk\kilogram\usk\second\inverse\usk\radian\inverse}% % [\joule\usk\second\per\radian]% % [\newton\usk\meter\usk\second\per\radian]% % \newphysicalquantity{angularmomentum}% % {\meter\tothetwo\usk\kilogram\usk\second\inverse\usk\radian\inverse}% % [\kilogram\usk\meter\tothetwo\per(\second\usk\radian)]% % [\newton\usk\meter\usk\second\per\radian]% %\else \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 %\fi \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}% %\ifmandi@rotradians % \newphysicalquantity{torque}% % {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo\usk\radian\inverse}% % [\newton\usk\meter\per\radian]% % [\newton\usk\meter\per\radian]% %\else \newvectorquantity{torque}% {\kilogram\usk\meter\tothetwo\usk\second\totheinversetwo}% [\newton\usk\meter]% [\newton\usk\meter]% %\fi \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]% % \end{macrocode} % % Define physical constants for introductory physics, again alphabetically % for convenience. % % \begin{macrocode} \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]% % \end{macrocode} % % See \url{https://tex.stackexchange.com/a/448565/218142}. % % % \begin{macrocode} \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]% % \end{macrocode} % % Diagnostic commands to provide sanity checks on commands that % represent physical quantities and constants. % % \begin{macrocode} \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 % \end{macrocode} % % \refCom{mivector} is a workhorse command. % Orginal code provided by |@egreg|.\newline % See \url{https://tex.stackexchange.com/a/39054/218142}. % % % \begin{macrocode} \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 % \end{macrocode} % \restoregeometry % % \iffalse % % \fi % % \Finale