From df6b587b2e27c8feb1d15b398cafa51305e9ae69 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 27 Jan 2022 21:41:19 +0000 Subject: mandi (27jan22) git-svn-id: svn://tug.org/texlive/trunk@61764 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/mandi/mandi.sty | 512 ++++++++--------- Master/texmf-dist/tex/latex/mandi/mandiexp.sty | 459 ++++++++++------ Master/texmf-dist/tex/latex/mandi/mandistudent.sty | 611 ++++++++++++--------- 3 files changed, 914 insertions(+), 668 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/mandi/mandi.sty b/Master/texmf-dist/tex/latex/mandi/mandi.sty index 508e7317e50..8d712ebb943 100644 --- a/Master/texmf-dist/tex/latex/mandi/mandi.sty +++ b/Master/texmf-dist/tex/latex/mandi/mandi.sty @@ -6,7 +6,7 @@ %% %% mandi.dtx (with options: `package') %% -%% Copyright (C) 2021 by Paul J. Heafner +%% Copyright (C) 2021,2022 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 @@ -29,22 +29,25 @@ %% and includes the derived files mandi.sty %% mandistudent.sty %% mandiexp.sty -%% vdemo.py +%% vdemo.py (not needed) %% --------------------------------------------------------------------------- %% -\def\mandi@version{3.0.0} -\def\mandi@date{2021-08-22} +\def\mandi@version{3.1.0} +\def\mandi@date{2022-01-27} \NeedsTeXFormat{LaTeX2e}[2020-02-02] -\DeclareRelease{v3.0.0}{2021-08-22}{mandi.sty} +\DeclareRelease{v3.1.0}{2022-01-27}{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 +\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 +\IfFormatAtLeastTF {2020-10-01} % load xparse if necessary + {}% + {\RequirePackage{xparse}}% +\RequireLuaTeX % require this engine \newcommand*{\mandi@selectunits}{} \newcommand*{\mandi@selectprecision}{} \newcommand*{\mandi@selectapproximate}[2]{#1} % really \@firstoftwo @@ -85,6 +88,10 @@ units/alternate/.style={/mandi/options/buffered@units=alternate},% units/base/.style={/mandi/options/buffered@units=base},% units/derived/.style={/mandi/options/buffered@units=derived},% + .unknown/.code={% + \typeout{}% + \typeout{mandi: You used unknown option '\pgfkeyscurrentname'.}% + },% }% \ProcessPgfPackageOptions{/mandi/options} \typeout{}% @@ -104,14 +111,16 @@ \typeout{}% }% \mandi@do@setup -\NewDocumentCommand{\mandisetup}{ m }{% - \IfValueT{#1}{% - \pgfqkeys{/mandi/options}{#1} - \typeout{}% - \typeout{mandi: mandisetup options...} - \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}} @@ -130,7 +139,7 @@ \NewDocumentCommand{\kev}{}{\kiloelectronvolt} \NewDocumentCommand{\kiloelectronvolt}{}{\symup{keV}} \NewDocumentCommand{\kilogram}{}{\symup{kg}} -\NewDocumentCommand{\lightspeed}{}{\symup{c}} +\NewDocumentCommand{\lightspeed}{}{\!\symup{c}} \NewDocumentCommand{\megaelectronvolt}{}{\symup{MeV}} \NewDocumentCommand{\meter}{}{\symup{m}} \NewDocumentCommand{\metre}{}{\meter} @@ -159,134 +168,134 @@ \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 }% -}% +\cs_new:Npn \__mandi_newscalarquantity:nnnn #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:nnnn { #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 }% -}% +\cs_new:Npn \__mandi_renewscalarquantity:nnnn #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:nnnn { #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 }% -}% +\cs_new:Npn \__mandi_newvectorquantity:nnnn #1#2#3#4 + { + \__mandi_newscalarquantity:nnnn { #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:nnnn { #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 }% -}% +\cs_new:Npn \__mandi_renewvectorquantity:nnnn #1#2#3#4 + { + \__mandi_renewscalarquantity:nnnn { #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:nnnn { #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 }% -}% +\cs_new:Npn \__mandi_newphysicalconstant:nnnnnnn #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:nnnnnnn { #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 }% -}% +\cs_new:Npn \__mandi_renewphysicalconstant:nnnnnnn #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:nnnnnnn { #1 }{ #2 }{ #3 }{ #4 }{ #5 }{ #6 }{ #7 } + } \ExplSyntaxOff \newvectorquantity{acceleration}% {\meter\usk\second\totheinversetwo}% @@ -302,14 +311,14 @@ {\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{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]% @@ -450,6 +459,8 @@ {\kilogram\usk\meter\inverse}% [\kilogram\per\meter]% [\kilogram\per\meter]% +\newscalarquantity{lorentzfactor}% + {}% \newscalarquantity{luminousintensity}% {\candela}% \newscalarquantity{magneticcharge}% @@ -586,49 +597,57 @@ {\kilogram\usk\meter\inverse\usk\second\totheinversetwo}% [\pascal]% [\newton\per\meter\tothetwo]% +\AtBeginDocument{% + \DeclareRobustCommand{\hbar}{{\mathpalette\hbar@\relax\symup{h}}}% +}% +\newcommand*{\hbar@}[2]{% + \makebox[0pt][l]{\raisebox{-0.07\height}{\(\m@th#1\mkern-2mu\mathchar"AF\)}}% + % optional line to make the bar thicker; must use -0.11 + \makebox[0pt][l]{\raisebox{-0.11\height}{\(\m@th#1\mkern-2mu\mathchar"AF\)}}% +}% \newphysicalconstant{avogadro}% {\symup{N_A}}% - {6\timestento{23}}{6.02214076\timestento{23}}% % exact 2019 value + {6\times10^{23}}{6.02214076\times10^{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}}% + {10^{-7}}{10^{-7}}% {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}% [\henry\per\meter]% [\tesla\usk\meter\per\ampere]% \newphysicalconstant{bohrradius}% {\symup{a_o}}% - {5.3\timestento{-11}}{5.29177210903\timestento{-11}}% + {5.3\times10^{-11}}{5.29177210903\times10^{-11}}% {\meter}% \newphysicalconstant{boltzmann}% {\symup{k_B}}% - {1.4\timestento{-23}}{1.380649\timestento{-23}}% % exact 2019 value + {1.4\times10^{-23}}{1.380649\times10^{-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}}% + {9\times10^{9}}{8.9875517923\times10^{9}}% {\kilogram\usk\meter\tothethree\usk\ampere\totheinversetwo\usk\second\totheinversefour}% [\meter\per\farad]% [\newton\usk\meter\tothetwo\per\coulomb\tothetwo]% \newphysicalconstant{earthmass}% {\symup{M_{Earth}}}% - {6.0\timestento{24}}{5.9722\timestento{24}}% + {6.0\times10^{24}}{5.9722\times10^{24}}% {\kilogram}% \newphysicalconstant{earthmoondistance}% {\symup{d_{EM}}}% - {3.8\timestento{8}}{3.81550\timestento{8}}% + {3.8\times10^{8}}{3.81550\times10^{8}}% {\meter}% \newphysicalconstant{earthradius}% {\symup{R_{Earth}}}% - {6.4\timestento{6}}{6.3781\timestento{6}}% + {6.4\times10^{6}}{6.3781\times10^{6}}% {\meter}% \newphysicalconstant{earthsundistance}% {\symup{d_{ES}}}% - {1.5\timestento{11}}{1.496\timestento{11}}% + {1.5\times10^{11}}{1.496\times10^{11}}% {\meter}% \newphysicalconstant{electroncharge}% {\symup{q_e}}% @@ -644,71 +663,71 @@ [\coulomb]% \newphysicalconstant{electronmass}% {\symup{m_e}}% - {9.1\timestento{-31}}{9.1093837015\timestento{-31}}% + {9.1\times10^{-31}}{9.1093837015\times10^{-31}}% {\kilogram}% \newphysicalconstant{elementarycharge}% {\symup{e}}% - {1.6\timestento{-19}}{1.602176634\timestento{-19}}% % exact 2019 value + {1.6\times10^{-19}}{1.602176634\times10^{-19}}% % exact 2019 value {\ampere\usk\second}% [\coulomb]% [\coulomb]% \newphysicalconstant{finestructure}% {\symup{\alpha}}% - {\frac{1}{137}}{7.2973525693\timestento{-3}}% + {\frac{1}{137}}{7.2973525693\times10^{-3}}% {}% \newphysicalconstant{hydrogenmass}% {\symup{m_H}}% - {1.7\timestento{-27}}{1.6737236\timestento{-27}}% + {1.7\times10^{-27}}{1.6737236\times10^{-27}}% {\kilogram}% \newphysicalconstant{moonearthdistance}% {\symup{d_{ME}}}% - {3.8\timestento{8}}{3.81550\timestento{8}}% + {3.8\times10^{8}}{3.81550\times10^{8}}% {\meter}% \newphysicalconstant{moonmass}% {\symup{M_{Moon}}}% - {7.3\timestento{22}}{7.342\timestento{22}}% + {7.3\times10^{22}}{7.342\times10^{22}}% {\kilogram}% \newphysicalconstant{moonradius}% {\symup{R_{Moon}}}% - {1.7\timestento{6}}{1.7371\timestento{6}}% + {1.7\times10^{6}}{1.7371\times10^{6}}% {\meter}% \newphysicalconstant{mzofp}% {\symup{\frac{\mu_o}{4\pi}}}% - {\tento{-7}}{\tento{-7}}% + {10^{-7}}{10^{-7}}% {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}% [\henry\per\meter]% [\tesla\usk\meter\per\ampere]% \newphysicalconstant{neutronmass}% {\symup{m_n}}% - {1.7\timestento{-27}}{1.67492749804\timestento{-27}}% + {1.7\times10^{-27}}{1.67492749804\times10^{-27}}% {\kilogram}% \newphysicalconstant{oofpez}% {\symup{\frac{1}{4\pi\epsilon_o}}}% - {9\timestento{9}}{8.9875517923\timestento{9}}% + {9\times10^{9}}{8.9875517923\times10^{9}}% {\kilogram\usk\meter\tothethree\usk\ampere\totheinversetwo\usk\second\totheinversefour}% [\meter\per\farad]% [\newton\usk\meter\tothetwo\per\coulomb\tothetwo]% \newphysicalconstant{oofpezcs}% {\symup{\frac{1}{4\pi\epsilon_o c^2}}}% - {\tento{-7}}{\tento{-7}}% + {10^{-7}}{10^{-7}}% {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}% [\tesla\usk\meter\tothetwo]% [\newton\usk\second\tothetwo\per\coulomb\tothetwo]% \newphysicalconstant{planck}% {\symup{h}}% - {6.6\timestento{-34}}{6.62607015\timestento{-34}}% % exact 2019 value + {6.6\times10^{-34}}{6.62607015\times10^{-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}}% + {\hbar}% + {1.1\times10^{-34}}{1.054571817\times10^{-34}}% {\kilogram\usk\meter\tothetwo\usk\second\inverse}% [\joule\usk\second]% [\joule\usk\second] \newphysicalconstant{planckc}% {\symup{hc}}% - {2.0\timestento{-25}}{1.98644586\timestento{-25}}% + {2.0\times10^{-25}}{1.98644586\times10^{-25}}% {\kilogram\usk\meter\tothethree\usk\second\totheinversetwo}% [\joule\usk\meter]% [\joule\usk\meter]% @@ -726,35 +745,35 @@ [\coulomb]% \newphysicalconstant{protonmass}% {\symup{m_p}}% - {1.7\timestento{-27}}{1.672621898\timestento{-27}}% + {1.7\times10^{-27}}{1.672621898\times10^{-27}}% {\kilogram}% \newphysicalconstant{rydberg}% {\symup{R_{\infty}}}% - {1.1\timestento{7}}{1.0973731568160\timestento{7}}% + {1.1\times10^{7}}{1.0973731568160\times10^{7}}% {\meter\inverse}% \newphysicalconstant{speedoflight}% {\symup{c}}% - {3\timestento{8}}{2.99792458\timestento{8}}% % exact value + {3\times10^{8}}{2.99792458\times10^{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}}% + {5.7\times10^{-8}}{5.670374\times10^{-8}}% {\kilogram\usk\second\totheinversethree\usk\kelvin\totheinversefour}% [\watt\per\meter\tothetwo\usk\kelvin\tothefour]% [\watt\per\meter\tothetwo\usk\kelvin\tothefour] \newphysicalconstant{sunearthdistance}% {\symup{d_{SE}}}% - {1.5\timestento{11}}{1.496\timestento{11}}% + {1.5\times10^{11}}{1.496\times10^{11}}% {\meter}% \newphysicalconstant{sunmass}% {\symup{M_{Sun}}}% - {2.0\timestento{30}}{1.98855\timestento{30}}% + {2.0\times10^{30}}{1.98855\times10^{30}}% {\kilogram}% \newphysicalconstant{sunradius}% {\symup{R_{Sun}}}% - {7.0\timestento{8}}{6.957\timestento{8}}% + {7.0\times10^{8}}{6.957\times10^{8}}% {\meter}% \newphysicalconstant{surfacegravfield}% {\symup{g}}% @@ -764,101 +783,86 @@ [\newton\per\kilogram]% \newphysicalconstant{universalgrav}% {\symup{G}}% - {6.7\timestento{-11}}{6.67430\timestento{-11}}% + {6.7\times10^{-11}}{6.67430\times10^{-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} + {4\pi\times10^{-7}}{4\pi\times10^{-7}}% % as of 2018 no longer 4\pi\times10^{-7} {\kilogram\usk\meter\usk\ampere\totheinversetwo\usk\second\totheinversetwo}% [\henry\per\meter]% [\tesla\usk\meter\per\ampere]% \newphysicalconstant{vacuumpermittivity}% {\symup{\epsilon_o}}% - {9\timestento{-12}}{8.854187817\timestento{-12}}% + {9\times10^{-12}}{8.854187817\times10^{-12}}% {\ampere\tothetwo\usk\second\tothefour\usk\kilogram\inverse\usk\meter\totheinversethree}% [\farad\per\meter]% [\coulomb\tothetwo\per\newton\usk\meter\tothetwo]% \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} -}% +\NewDocumentCommand{\@aux}{ m } + { + \use:c { #1 } + } +\NewDocumentCommand{\@auy}{ m } + { + \normalfont\ttfamily\token_to_str:c { #1 } + } \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 } +\newcolumntype{M}{>{\(}p{0.25\linewidth}<{\)}} +\NewDocumentCommand{\checkquantity}{ m } + {% + \begin{center} + \begin{tabular}{MMM} + \textbf{command} & \multicolumn{2}{l}{\@auy{#1}} \tabularnewline + \text{\textbf{base}} & \text{\textbf{derived}} & \text{\textbf{alternate}} \tabularnewline + \@aux{#1onlybaseunits} & \@aux{#1onlyderivedunits} & \@aux{#1onlyalternateunits} \tabularnewline + \end{tabular} + \end{center} }% -}% +\NewDocumentCommand{\checkconstant}{ m } + {% + \begin{center} + \begin{tabular}{MMM} + \textbf{command} & \multicolumn{2}{l}{\@auy{#1}} \tabularnewline + \text{\textbf{symbol}} & \text{\textbf{approximate}} & \text{\textbf{precise}} \tabularnewline + \@aux{#1mathsymbol} & \@aux{#1approximatevalue} & \@aux{#1precisevalue} \tabularnewline + \text{\textbf{base}} & \text{\textbf{derived}} & \text{\textbf{alternate}} \tabularnewline + \@aux{#1onlybaseunits} & \@aux{#1onlyderivedunits} & \@aux{#1onlyalternateunits} \tabularnewline + \end{tabular} + \end{center} + }% +\ExplSyntaxOn +\NewDocumentCommand{\mivector}{ O{,} m o } + { + \__mandi_vector:nn { #1 } { #2 } + \IfValueT{#3}{\,{#3}} + } +\seq_new:N \l__mandi_list_seq +\cs_new_protected:Npn \__mandi_vector:nn #1#2 + { + \seq_set_split:Nnn \l__mandi_list_seq { , } { #2 } + \int_compare:nT { \seq_count:N \l__mandi_list_seq = 1 } + { + \msg_new:nnnn { mandi } { onecomponent } + { + More~than~one~component~expected. \iow_newline: + You~provided~one~component~to~a~command \iow_newline: + that~expects~a~vector.~Either~you~don't \iow_newline: + need~a~vector~here~or~you~didn't~supply \iow_newline: + all~the~components. + } + { + Decide~whether~or~not~you~really~need~a~vector~command~here. \iow_newline: + \msg_see_documentation_text:n { mandi } + } + \msg_fatal:nn { mandi } { onecomponent } + + } + \left\langle + \seq_use:Nnnn \l__mandi_list_seq { #1 } { #1 } { #1 } + \right\rangle + } \ExplSyntaxOff \endinput %% diff --git a/Master/texmf-dist/tex/latex/mandi/mandiexp.sty b/Master/texmf-dist/tex/latex/mandi/mandiexp.sty index a6c44a2b290..2dbc81637ee 100644 --- a/Master/texmf-dist/tex/latex/mandi/mandiexp.sty +++ b/Master/texmf-dist/tex/latex/mandi/mandiexp.sty @@ -6,7 +6,7 @@ %% %% mandiexp.dtx (with options: `package') %% -%% Copyright (C) 2021 by Paul J. Heafner +%% Copyright (C) 2021,2022 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 @@ -29,173 +29,318 @@ %% and includes the derived files mandi.sty %% mandistudent.sty %% mandiexp.sty -%% vdemo.py +%% vdemo.py (not needed) %% --------------------------------------------------------------------------- %% -\def\mandiexp@version{\mandi@version} -\def\mandiexp@date{\mandi@date} +\def\mandiexp@version{3.1.0} +\def\mandiexp@date{2022-01-27} \NeedsTeXFormat{LaTeX2e}[2020-02-02] -\DeclareRelease{v3.0.0}{2021-08-22}{mandiexp.sty} -\DeclareCurrentRelease{v\mandi@version}{\mandi@date} +\DeclareRelease{v3.1.0}{2022-01-27}{mandiexp.sty} +\DeclareCurrentRelease{v\mandiexp@version}{\mandiexp@date} \ProvidesPackage{mandiexp} [\mandiexp@date\space v\mandiexp@version\space Macros for Matter & Interactions] \newcommand*{\mandiexpversion}{v\mandiexp@version\space dated \mandiexp@date} \RequirePackage{mandi} +\IfFormatAtLeastTF {2020-10-01} % load xparse if necessary + {}% + {\RequirePackage{xparse}}% \typeout{}% \typeout{mandiexp: You are using mandiexp \mandiexpversion.} \typeout{mandiexp: This package requires LuaLaTeX.}% \typeout{}% -\NewDocumentCommand{\lhsmomentumprinciple}{ s }{% - \Delta - \IfBooleanTF{#1}% - {\vec*{p}}% - {\vec{p}}% - _{\symup{sys}}% -}% -\NewDocumentCommand{\rhsmomentumprinciple}{ s }{% - \IfBooleanTF{#1}% - {\vec*{F}}% - {\vec{F}}% - _{\symup{sys,net}}\,\Delta t% -}% -\NewDocumentCommand{\lhsmomentumprincipleupdate}{ s }{% - \IfBooleanTF{#1}% - {\vec*{p}}% - {\vec{p}}% - _{\symup{sys,final}}% -}% -\NewDocumentCommand{\rhsmomentumprincipleupdate}{ s }{% - \IfBooleanTF{#1}% - {\vec*{p}}% - {\vec{p}}% - _{\symup{sys,initial}}+% - \IfBooleanTF{#1}% - {\vec*{F}}% - {\vec{F}}% - _{\symup{sys,net}}\,\Delta t% -}% -\NewDocumentCommand{\momentumprinciple}{ s }{% - \IfBooleanTF{#1}% - {\lhsmomentumprinciple* = \rhsmomentumprinciple*}% - {\lhsmomentumprinciple = \rhsmomentumprinciple}% -}% -\NewDocumentCommand{\momentumprincipleupdate}{ s }{% - \IfBooleanTF{#1}% - {\lhsmomentumprincipleupdate* = \rhsmomentumprincipleupdate*}% - {\lhsmomentumprincipleupdate = \rhsmomentumprincipleupdate}% -}% -\NewDocumentCommand{\lhsenergyprinciple}{}{% - \Delta E_{\symup{sys}}% -}% -\NewDocumentCommand{\rhsenergyprinciple}{ O{} }{% - W_{\symup{ext}}#1% -}% -\NewDocumentCommand{\lhsenergyprincipleupdate}{}{% - E_{\symup{sys,final}}% -}% -\NewDocumentCommand{\rhsenergyprincipleupdate}{ O{} }{% - E_{\symup{sys,initial}}+% - W_{\symup{ext}}#1% -}% -\NewDocumentCommand{\energyprinciple}{ O{} }{% - \lhsenergyprinciple = \rhsenergyprinciple[#1]% -}% -\NewDocumentCommand{\energyprincipleupdate}{ O{} }{% - \lhsenergyprincipleupdate = \rhsenergyprincipleupdate[#1]% -}% -\NewDocumentCommand{\lhsangularmomentumprinciple}{ s }{% - \Delta - \IfBooleanTF{#1}% - {\vec*{L}}% - {\vec{L}}% - _{A\symup{,sys,net}}% -}% -\NewDocumentCommand{\rhsangularmomentumprinciple}{ s }{% - \IfBooleanTF{#1}% - {\vec*{\tau}}% - {\vec{\tau}}% - _{A\symup{,sys,net}}\,\Delta t% -}% -\NewDocumentCommand{\lhsangularmomentumprincipleupdate}{ s }{% - \IfBooleanTF{#1}% - {\vec*{L}}% - {\vec{L}}% - _{A,\symup{sys,final}}% -}% -\NewDocumentCommand{\rhsangularmomentumprincipleupdate}{ s }{% - \IfBooleanTF{#1}% - {\vec*{L}}% - {\vec{L}}% - _{A\symup{,sys,initial}}+% - \IfBooleanTF{#1}% - {\vec*{\tau}}% - {\vec{\tau}}% - _{A\symup{,sys,net}}\,\Delta t% -}% -\NewDocumentCommand{\angularmomentumprinciple}{ s }{% - \IfBooleanTF{#1}% - {\lhsangularmomentumprinciple* = \rhsangularmomentumprinciple*}% - {\lhsangularmomentumprinciple = \rhsangularmomentumprinciple}% -}% -\NewDocumentCommand{\angularmomentumprincipleupdate}{ s }{% - \IfBooleanTF{#1}% - {\lhsangularmomentumprincipleupdate* = \rhsangularmomentumprincipleupdate*}% - {\lhsangularmomentumprincipleupdate = \rhsangularmomentumprincipleupdate}% -}% -\NewDocumentCommand{\energyof}{ m o }{% - E_{#1\IfValueT{#2}{,#2}}% -}% -\NewDocumentCommand{\systemenergy}{ o }{% - E_{\symup{sys}\IfValueT{#1}{,#1}}% -}% -\NewDocumentCommand{\particleenergy}{ o }{% - E_{\symup{particle}\IfValueT{#1}{,#1}}% -}% -\NewDocumentCommand{\restenergy}{ o }{% - E_{\symup{rest}\IfValueT{#1}{,#1}}% -}% -\NewDocumentCommand{\internalenergy}{ o }{% - E_{\symup{internal}\IfValueT{#1}{,#1}}% -}% -\NewDocumentCommand{\chemicalenergy}{ o }{% - E_{\symup{chem}\IfValueT{#1}{,#1}}% -}% -\NewDocumentCommand{\thermalenergy}{ o }{% - E_{\symup{therm}\IfValueT{#1}{,#1}}% -}% -\NewDocumentCommand{\photonenergy}{ o }{% - E_{\symup{photon}\IfValueT{#1}{,#1}}% -}% -\NewDocumentCommand{\translationalkineticenergy}{ s d[] }{% - \IfBooleanTF{#1}% - {E_\bgroup \symup{K}}% - {K_\bgroup\symup{trans}}% - \IfValueT{#2}{,#2}% - \egroup% -}% -\NewDocumentCommand{\rotationalkineticenergy}{ s d[] }{% - \IfBooleanTF{#1}% - {E_\bgroup}% - {K_\bgroup}% - \symup{rot}\IfValueT{#2}{,#2}% - \egroup% -}% -\NewDocumentCommand{\vibrationalkineticenergy}{ s d[] }{% - \IfBooleanTF{#1}% - {E_\bgroup}% - {K_\bgroup}% - \symup{vib}\IfValueT{#2}{,#2}% - \egroup% -}% -\NewDocumentCommand{\gravitationalpotentialenergy}{ o }{% - U_{\symup{g}\IfValueT{#1}{,#1}}% -}% -\NewDocumentCommand{\electricpotentialenergy}{ o }{% - U_{\symup{e}\IfValueT{#1}{,#1}}% -}% -\NewDocumentCommand{\springpotentialenergy}{ o }{% - U_{\symup{s}\IfValueT{#1}{,#1}}% -}% +\NewDocumentCommand{\lhsmomentumprinciple}{ s }% + {% + \Delta + \IfBooleanTF{#1}% + {% + \vec*{p} + }% + {% + \vec{p}% + }% + \sb{\symup{sys}}% + }% +\NewDocumentCommand{\rhsmomentumprinciple}{ s }% + {% + \IfBooleanTF{#1}% + {% + \vec*{F}% + }% + {% + \vec{F}% + }% + \sb{\symup{sys,net}}\,\Delta t% + }% +\NewDocumentCommand{\lhsmomentumprincipleupdate}{ s }% + {% + \IfBooleanTF{#1}% + {% + \vec*{p}% + }% + {% + \vec{p}% + }% + \sb{\symup{sys,final}}% + }% +\NewDocumentCommand{\rhsmomentumprincipleupdate}{ s }% + {% + \IfBooleanTF{#1}% + {% + \vec*{p}% + }% + {% + \vec{p}% + }% + \sb{\symup{sys,initial}}+% + \IfBooleanTF{#1}% + {% + \vec*{F}% + }% + {% + \vec{F}% + }% + \sb{\symup{sys,net}}\,\Delta t% + }% +\NewDocumentCommand{\momentumprinciple}{ s }% + {% + \IfBooleanTF{#1}% + {% + \lhsmomentumprinciple* = \rhsmomentumprinciple*% + }% + {% + \lhsmomentumprinciple = \rhsmomentumprinciple% + }% + }% +\NewDocumentCommand{\momentumprincipleupdate}{ s }% + {% + \IfBooleanTF{#1}% + {% + \lhsmomentumprincipleupdate* = \rhsmomentumprincipleupdate*% + }% + {% + \lhsmomentumprincipleupdate = \rhsmomentumprincipleupdate% + }% + }% +\NewDocumentCommand{\lhsenergyprinciple}{}% + {% + \Delta E_{\symup{sys}}% + }% +\NewDocumentCommand{\rhsenergyprinciple}{ O{} }% + {% + W_{\symup{ext}}#1% + }% +\NewDocumentCommand{\lhsenergyprincipleupdate}{}% + {% + E_{\symup{sys,final}}% + }% +\NewDocumentCommand{\rhsenergyprincipleupdate}{ O{} }% + {% + E_{\symup{sys,initial}}+% + W_{\symup{ext}}#1% + }% +\NewDocumentCommand{\energyprinciple}{ O{} }% + {% + \lhsenergyprinciple = \rhsenergyprinciple[#1]% + }% +\NewDocumentCommand{\energyprincipleupdate}{ O{} }% + {% + \lhsenergyprincipleupdate = \rhsenergyprincipleupdate[#1]% + }% +\NewDocumentCommand{\lhsangularmomentumprinciple}{ s }% + {% + \Delta% + \IfBooleanTF{#1}% + {% + \vec*{L}% + }% + {% + \vec{L}% + }% + \sb{A\symup{,sys,net}}% + }% +\NewDocumentCommand{\rhsangularmomentumprinciple}{ s }% + {% + \IfBooleanTF{#1}% + {% + \vec*{\tau}% + }% + {% + \vec{\tau}% + }% + \sb{A\symup{,sys,net}}\,\Delta t% + }% +\NewDocumentCommand{\lhsangularmomentumprincipleupdate}{ s }% + {% + \IfBooleanTF{#1}% + {% + \vec*{L}% + }% + {% + \vec{L}% + }% + \sb{A,\symup{sys,final}}% + }% +\NewDocumentCommand{\rhsangularmomentumprincipleupdate}{ s }% + {% + \IfBooleanTF{#1}% + {% + \vec*{L}% + }% + {% + \vec{L}% + }% + \sb{A\symup{,sys,initial}}+% + \IfBooleanTF{#1}% + {% + \vec*{\tau}% + }% + {% + \vec{\tau}% + }% + \sb{A\symup{,sys,net}}\,\Delta t% + }% +\NewDocumentCommand{\angularmomentumprinciple}{ s }% + {% + \IfBooleanTF{#1}% + {% + \lhsangularmomentumprinciple* = \rhsangularmomentumprinciple*% + }% + {% + \lhsangularmomentumprinciple = \rhsangularmomentumprinciple% + }% + }% +\NewDocumentCommand{\angularmomentumprincipleupdate}{ s }% + {% + \IfBooleanTF{#1}% + {% + \lhsangularmomentumprincipleupdate* = \rhsangularmomentumprincipleupdate*% + }% + {% + \lhsangularmomentumprincipleupdate = \rhsangularmomentumprincipleupdate% + }% + }% +\NewDocumentCommand{\energyof}{ m o }% + {% + E_{#1% + \IfValueT{#2}% + {,#2}% + }% + }% +\NewDocumentCommand{\systemenergy}{ o }% + {% + E_{\symup{sys}% + \IfValueT{#1}% + {,#1}% + }% + }% +\NewDocumentCommand{\particleenergy}{ o }% + {% + E_{\symup{particle}% + \IfValueT{#1}% + {,#1}% + }% + }% +\NewDocumentCommand{\restenergy}{ o }% + {% + E_{\symup{rest}% + \IfValueT{#1}% + {,#1}% + }% + }% +\NewDocumentCommand{\internalenergy}{ o }% + {% + E_{\symup{internal}% + \IfValueT{#1}% + {,#1}% + }% + }% +\NewDocumentCommand{\chemicalenergy}{ o }% + {% + E_{\symup{chem}% + \IfValueT{#1}% + {,#1}% + }% + }% +\NewDocumentCommand{\thermalenergy}{ o }% + {% + E_{\symup{therm}% + \IfValueT{#1}% + {,#1}% + }% + }% +\NewDocumentCommand{\photonenergy}{ o }% + {% + E_{\symup{photon}% + \IfValueT{#1}% + {,#1}% + }% + }% +\NewDocumentCommand{\translationalkineticenergy}{ s d[] }% + {% + % d[] must be used because of the way consecutive optional + % arguments are handled. See xparse docs for details. + % See https://tex.stackexchange.com/a/569011/218142 + \IfBooleanTF{#1}% + {% + E_\bgroup \symup{K}% + }% + {% + K_\bgroup\symup{trans}% + }% + \IfValueT{#2}{,#2}% + \egroup% + }% +\NewDocumentCommand{\rotationalkineticenergy}{ s d[] }% + {% + % d[] must be used because of the way consecutive optional + % arguments are handled. See xparse docs for details. + % See https://tex.stackexchange.com/a/569011/218142 + \IfBooleanTF{#1}% + {% + E_\bgroup% + }% + {% + K_\bgroup% + }% + \symup{rot}\IfValueT{#2}{,#2}% + \egroup% + }% +\NewDocumentCommand{\vibrationalkineticenergy}{ s d[] }% + {% + % d[] must be used because of the way consecutive optional + % arguments are handled. See xparse docs for details. + % See https://tex.stackexchange.com/a/569011/218142 + \IfBooleanTF{#1}% + {% + E_\bgroup% + }% + {% + K_\bgroup% + }% + \symup{vib}\IfValueT{#2}{,#2}% + \egroup% + }% +\NewDocumentCommand{\gravitationalpotentialenergy}{ o }% + {% + U_{\symup{g}% + \IfValueT{#1}% + {,#1}% + }% + }% +\NewDocumentCommand{\electricpotentialenergy}{ o }% + {% + U_{\symup{e}% + \IfValueT{#1}% + {,#1}% + }% + }% +\NewDocumentCommand{\springpotentialenergy}{ o }% + {% + U_{\symup{s}% + \IfValueT{#1}% + {,#1}% + }% + }% \endinput %% %% End of file `mandiexp.sty'. diff --git a/Master/texmf-dist/tex/latex/mandi/mandistudent.sty b/Master/texmf-dist/tex/latex/mandi/mandistudent.sty index ff5edb5e546..3bfe3b00531 100644 --- a/Master/texmf-dist/tex/latex/mandi/mandistudent.sty +++ b/Master/texmf-dist/tex/latex/mandi/mandistudent.sty @@ -6,7 +6,7 @@ %% %% mandistudent.dtx (with options: `package') %% -%% Copyright (C) 2021 by Paul J. Heafner +%% Copyright (C) 2021,2022 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 @@ -29,14 +29,14 @@ %% and includes the derived files mandi.sty %% mandistudent.sty %% mandiexp.sty -%% vdemo.py +%% vdemo.py (not needed) %% --------------------------------------------------------------------------- %% -\def\mandistudent@version{\mandi@version} -\def\mandistudent@date{\mandi@date} +\def\mandistudent@version{3.1.0} +\def\mandistudent@date{2022-01-27} \NeedsTeXFormat{LaTeX2e}[2020-02-02] -\DeclareRelease{v3.0.0}{2021-08-22}{mandistudent.sty} -\DeclareCurrentRelease{v\mandi@version}{\mandi@date} +\DeclareRelease{v3.1.0}{2022-01-27}{mandistudent.sty} +\DeclareCurrentRelease{v\mandistudent@version}{\mandistudent@date} \ProvidesPackage{mandistudent} [\mandistudent@date\space v\mandistudent@version\space Macros for introductory physics] \newcommand*{\mandistudentversion}{v\mandistudent@version\space dated \mandistudent@date} @@ -50,11 +50,16 @@ \RequirePackage{mandi} \RequirePackage{mathtools} % needed for paired delimiters; extends amsmath \RequirePackage{nicematrix} % needed for column and row vectors +\RequirePackage{qrcode} % needed for QR codes in webvpythonblock +\qrset{height=1.5cm} % set default size of QR code \RequirePackage[most]{tcolorbox} % needed for program listings \RequirePackage{tensor} % needed for index notation \RequirePackage{tikz} % needed for \hilite \usetikzlibrary{shapes,fit,tikzmark} % needed for \hilite \RequirePackage{unicode-math} % needed for Unicode support +\IfFormatAtLeastTF {2020-10-01} % load xparse if necessary + {}% + {\RequirePackage{xparse}}% \RequirePackage{hyperref} % load last \RequireLuaTeX % require this engine \unimathsetup{math-style=ISO} @@ -166,56 +171,73 @@ \typeout{mandistudent: This package changes the default math font(s).}% \typeout{mandistudent: This package redefines the \protect\vec\space command.}% \typeout{}% -\RenewDocumentCommand{\vec}{ s m e{_^} }{% +\RenewDocumentCommand{\vec}{ s m e{_^} }% + {% % Note the \, used to make superscript look better. - \IfBooleanTF {#1} - {\vv{#2}% % * gives an arrow - % Use \sp{} primitive for superscript. - % Adjust superscript for the arrow. - \sp{\IfValueT{#4}{\,#4}\vphantom{\smash[t]{\big|}}} + \IfBooleanTF{#1} + {% + \vv{#2}% % * gives an arrow + % Use \sp{} primitive for superscript. + % Adjust superscript for the arrow. + \IfValueT{#4}% + {\sp{\,#4\vphantom{\smash[t]{\big|}}}} }% - {\symbfit{#2} % no * gives us bold - % Use \sp{} primitive for superscript. - % No superscript adjustment needed. - \sp{\IfValueT{#4}{#4}\vphantom{\smash[t]{\big|}}} + {% + \symbfit{#2} % no * gives us bold + % Use \sp{} primitive for superscript. + % No superscript adjustment needed. + \IfValueT{#4}% + {\sp{#4\vphantom{\smash[t]{\big|}}}} }% - % Use \sb{} primitive for subscript. - \sb{\IfValueT{#3}{#3}\vphantom{\smash[b]{|}}} -}% -\NewDocumentCommand{\dirvec}{ s m e{_^} }{% - \widehat{\makebox*{\(w\)}{\ensuremath{% - \IfBooleanTF {#1} - {% - #2 - }% - {% - \symbfit{#2} - }% - }% + % Use \sb{} primitive for subscript. + \IfValueT{#3}% + {\sb{#3\vphantom{\smash[b]{|}}}} + }% +\NewDocumentCommand{\dirvec}{ s m e{_^} }% + {% + \widehat% + {% + \makebox*{\(w\)}% + {% + \ensuremath{% + \IfBooleanTF {#1}% + {% + #2% + }% + {% + \symbfit{#2}% + }% + }% + }% }% - }% - \sb{\IfValueT{#3}{#3}\vphantom{\smash[b]{|}}} - \sp{\IfValueT{#4}{\,#4}\vphantom{\smash[t]{\big|}}} -}% -\NewDocumentCommand{\zerovec}{ s }{% - \IfBooleanTF {#1} - {\vv{0}}% - {\symbfup{0}}% -}% + \IfValueT{#3}% + {\sb{#3\vphantom{\smash[b]{|}}}}% + \IfValueT{#4}% + {\sp{\,#4\vphantom{\smash[t]{\big|}}}}% + }% +\NewDocumentCommand{\zerovec}{ s }% + {% + \IfBooleanTF {#1} + {\vv{0}}% + {\symbfup{0}}% + }% \ExplSyntaxOn -\NewDocumentCommand{\colvec}{ O{,} m }{% - \vector_main:nnnn { p } { \\ } { #1 } { #2 } -}% -\NewDocumentCommand{\rowvec}{ O{,} m }{% - \vector_main:nnnn { p } { & } { #1 } { #2 } -}% -\seq_new:N \l__vector_arg_seq -\cs_new_protected:Npn \vector_main:nnnn #1 #2 #3 #4 {% - \seq_set_split:Nnn \l__vector_arg_seq { #3 } { #4 } - \begin{#1NiceMatrix}[r] - \seq_use:Nnnn \l__vector_arg_seq { #2 } { #2 } { #2 } - \end{#1NiceMatrix} -}% +\NewDocumentCommand{\colvec}{ O{,} m } + { + \__mandi_vectormain:nnnn { p } { \\ } { #1 } { #2 } + } +\NewDocumentCommand{\rowvec}{ O{,} m } + { + \__mandi_vectormain:nnnn { p } { & } { #1 } { #2 } + } +\seq_new:N \l__mandi_vectorarg_seq +\cs_new_protected:Npn \__mandi_vectormain:nnnn #1#2#3#4 + { + \seq_set_split:Nnn \l__mandi_vectorarg_seq { #3 } { #4 } + \begin{#1NiceMatrix}[r] + \seq_use:Nnnn \l__mandi_vectorarg_seq { #2 } { #2 } { #2 } + \end{#1NiceMatrix} + } \ExplSyntaxOff \NewDocumentCommand{\changein}{}{\Delta} \DeclarePairedDelimiterX{\doublebars}[1]{\lVert}{\rVert}{\ifblank{#1}{\:\cdot\:}{#1}} @@ -227,120 +249,153 @@ \NewDocumentCommand{\magnitude}{}{\doublebars} \NewDocumentCommand{\norm}{}{\doublebars} \NewDocumentCommand{\absolutevalue}{}{\singlebars} -\NewDocumentCommand{\parallelto}{} - {\mkern3mu\vphantom{\perp}\vrule depth 0pt\mkern2mu\vrule depth 0pt\mkern3mu} +\NewDocumentCommand{\parallelto}{}% + {% + \mkern3mu\vphantom{\perp}\vrule depth 0pt\mkern2mu\vrule depth 0pt\mkern3mu% + }% \NewDocumentCommand{\perpendicularto}{}{\perp} -\NewDocumentEnvironment{physicsproblem}{ m }{% - \newpage% - \section*{#1}% - \newlist{parts}{enumerate}{2}% - \setlist[parts]{label=\bfseries(\alph*)}}% +\NewDocumentEnvironment{physicsproblem}{ m }% + {% + \newpage% + \section*{#1}% + \newlist{parts}{enumerate}{2}% + \setlist[parts]{label=\bfseries(\alph*)}% + }% {}% -\NewDocumentEnvironment{physicsproblem*}{ m }{% - \newpage% - \section*{#1}% - \newlist{parts}{enumerate*}{2}% - \setlist[parts]{label=\bfseries(\alph*)}}% +\NewDocumentEnvironment{physicsproblem*}{ m }% + {% + \newpage% + \section*{#1}% + \newlist{parts}{enumerate*}{2}% + \setlist[parts]{label=\bfseries(\alph*)}% + }% {}% \NewDocumentCommand{\problempart}{}{\item}% -\NewDocumentEnvironment{physicssolution}{ +b }{% - % Make equation numbering consecutive through the document. - \begin{align} - #1 - \end{align} -}{}% -\NewDocumentEnvironment{physicssolution*}{ +b }{% - % Make equation numbering consecutive through the document. - \begin{align*} - #1 - \end{align*} -}{}% -\NewDocumentCommand{\reason}{ O{4cm} m } - {&&\begin{minipage}{#1}\raggedright\small #2\end{minipage}} +\NewDocumentEnvironment{physicssolution}{ +b }% + {% + % Make equation numbering consecutive through the document. + \begin{align} + #1 + \end{align} + }% + {}% +\NewDocumentEnvironment{physicssolution*}{ +b }% + {% + % Make equation numbering consecutive through the document. + \begin{align*} + #1 + \end{align*} + }% + {}% +\NewDocumentCommand{\reason}{ O{4cm} m }% + {% + &&\begin{minipage}{#1}\raggedright\small #2\end{minipage}% + }% \newcounter{tikzhighlightnode} -\NewDocumentCommand{\hilite}{ O{magenta!60} m O{rectangle} }{% - \stepcounter{tikzhighlightnode}% - \tikzmarknode{highlighted-node-\number\value{tikzhighlightnode}}{#2}% - \edef\temp{% - \noexpand\AddToShipoutPictureBG{% - \noexpand\begin{tikzpicture}[overlay,remember picture]% - \noexpand\iftikzmarkoncurrentpage{highlighted-node-\number\value{tikzhighlightnode}}% - \noexpand\node[inner sep=1.0pt,fill=#1,#3,fit=(highlighted-node-\number\value{tikzhighlightnode})]{};% - \noexpand\fi - \noexpand\end{tikzpicture}% +\NewDocumentCommand{\hilite}{ O{magenta!60} m O{rectangle} }% + {% + \stepcounter{tikzhighlightnode}% + \tikzmarknode{highlighted-node-\number\value{tikzhighlightnode}}{#2}% + \edef\temp{% + \noexpand\AddToShipoutPictureBG{% + \noexpand\begin{tikzpicture}[overlay,remember picture]% + \noexpand\iftikzmarkoncurrentpage{highlighted-node-\number\value{tikzhighlightnode}}% + \noexpand\node[inner sep=1.0pt,fill=#1,#3,fit=(highlighted-node-\number\value{tikzhighlightnode})]{};% + \noexpand\fi + \noexpand\end{tikzpicture}% + }% }% + \temp% }% - \temp% -}% -\NewDocumentCommand{\image}{ O{scale=1} m m m }{% - \begin{figure}[ht!] - \begin{center}% +\NewDocumentCommand{\image}{ O{scale=1} m m m }% + {% + \par + \begin{figure}[ht!] + \centering% \includegraphics[#1]{#2}% - \end{center}% - \caption{#3}% - \label{#4}% - \end{figure}% -}% -\NewDocumentCommand{\veccomp}{ s m }{% - % Consider renaming this to \vectorsym. - \IfBooleanTF{#1} + \caption{#3}% + \label{#4}% + \end{figure}% + \par + }% +\NewDocumentCommand{\veccomp}{ s m }% {% - \symnormal{#2}% + % Consider renaming this to \vectorsym. + \IfBooleanTF{#1} + {% + \symnormal{#2}% + }% + {% + \symbfit{#2}% + }% }% +\NewDocumentCommand{\tencomp}{ s m }% {% - \symbfit{#2}% + % Consider renaming this to \tensororsym. + \IfBooleanTF{#1}% + {% + \symsfit{#2}% + }% + {% + \symbfsfit{#2}% + }% }% -}% -\NewDocumentCommand{\tencomp}{ s m }{% - % Consider renaming this to \tensororsym. - \IfBooleanTF{#1} +\NewDocumentCommand{\valence}{ s m m }% {% - \symsfit{#2}% + \IfBooleanTF{#1}% + {% + (#2,#3)% + }% + {% + \binom{#2}{#3}% + }% }% +\NewDocumentCommand{\contraction}{ s m }% {% - \symbfsfit{#2} + \IfBooleanTF{#1} + {% + \mathsf{C}% + }% + {% + \symbb{C}% + }% + _{#2} }% -}% -\NewDocumentCommand{\valence}{ s m m }{% - \IfBooleanTF{#1} - {(#2,#3)} - {\binom{#2}{#3}} -}% -\NewDocumentCommand{\contraction}{ s m }{% - \IfBooleanTF{#1} - {\mathsf{C}}% - {\symbb{C}}% - _{#2} -}% -\NewDocumentCommand{\slot}{ s d[] }{% - % d[] must be used because of the way consecutive optional - % arguments are handled. See xparse docs for details. - \IfBooleanTF{#1} +\NewDocumentCommand{\slot}{ s d[] }% {% - \IfValueTF{#2} - {% Insert a vector, but don't show the slot. - \smash{\makebox[1.5em]{\ensuremath{#2}}} + % d[] must be used because of the way consecutive optional + % arguments are handled. See xparse docs for details. + \IfBooleanTF{#1} + {% + \IfValueTF{#2} + {% Insert a vector, but don't show the slot. + \smash{\makebox[1.5em]{\ensuremath{#2}}} + }% + {% No vector, no slot. + \smash{\makebox[1.5em]{\ensuremath{}}} + }% }% - {% No vector, no slot. - \smash{\makebox[1.5em]{\ensuremath{}}} + {% + \IfValueTF{#2} + {% Insert a vector and show the slot. + \underline{\smash{\makebox[1.5em]{\ensuremath{#2}}}} + }% + {% No vector; just show the slot. + \underline{\smash{\makebox[1.5em]{\ensuremath{}}}} + }% }% }% +\NewDocumentCommand{\df}{ s }% {% - \IfValueTF{#2} - {% Insert a vector and show the slot. - \underline{\smash{\makebox[1.5em]{\ensuremath{#2}}}} - }% - {% No vector; just show the slot. - \underline{\smash{\makebox[1.5em]{\ensuremath{}}}} - }% + \mathop{}\!% + \IfBooleanTF{#1}% + {% + \symbfsfup{d}% + }% + {% + \symsfup{d}% + }% }% -}% -\NewDocumentCommand{\diff}{ s }{% - \mathop{}\! - \IfBooleanTF{#1} - {\symbfsfup{d}}% - {\symsfup{d}}% -}% \directlua{% luaotfload.add_colorscheme("colordigits", {["8000FF"] = {"one","two","three","four","five","six","seven","eight","nine","zero"}}) @@ -354,120 +409,162 @@ \definecolor{gspeach} {rgb}{1.00,0.90,0.71} % peach \definecolor{gspearl} {rgb}{0.94,0.92,0.84} % pearl \definecolor{gsplum} {rgb}{0.74,0.46,0.70} % plum -\lstdefinestyle{vpython}{% % style for listings - backgroundcolor=\color{gsbggray},% % background color - basicstyle=\colordigits\footnotesize,% % default style - breakatwhitespace=true% % break at whitespace - breaklines=true,% % break long lines - captionpos=b,% % position caption - classoffset=1,% % STILL DON'T UNDERSTAND THIS - commentstyle=\color{gsgray},% % font for comments - deletekeywords={print},% % delete keywords from the given language - emph={self,cls,@classmethod,@property},% % words to emphasize - emphstyle=\color{gsorange}\itshape,% % font for emphasis - escapeinside={(*@}{@*)},% % add LaTeX within your code - frame=tb,% % frame style - framerule=2.0pt,% % frame thickness - framexleftmargin=5pt,% % extra frame left margin - %identifierstyle=\sffamily,% % style for identifiers - keywordstyle=\gsfontfamily\color{gsplum},% % color for keywords - language=Python,% % select language - linewidth=\linewidth,% % width of listings - morekeywords={% % VPython/GlowScript specific keywords - __future__,abs,acos,align,ambient,angle,append,append_to_caption,% - append_to_title,arange,arrow,asin,astuple,atan,atan2,attach_arrow,% - attach_trail,autoscale,axis,background,billboard,bind,black,blue,border,% - bounding_box,box,bumpaxis,bumpmap,bumpmaps,camera,canvas,caption,capture,% - ceil,center,clear,clear_trail,click,clone,CoffeeScript,coils,color,combin,% - comp,compound,cone,convex,cos,cross,curve,cyan,cylinder,data,degrees,del,% - delete,depth,descender,diff_angle,digits,division,dot,draw_complete,% - ellipsoid,emissive,end_face_color,equals,explog,extrusion,faces,factorial,% - False,floor,follow,font,format,forward,fov,frame,gcurve,gdisplay,gdots,% - get_library,get_selected,ghbars,global,GlowScript,graph,graphs,green,gvbars,% - hat,headlength,headwidth,height,helix,hsv_to_rgb,index,interval,keydown,% - keyup,label,length,lights,line,linecolor,linewidth,logx,logy,lower_left,% - lower_right,mag,mag2,magenta,make_trail,marker_color,markers,material,% - max,min,mouse,mousedown,mousemove,mouseup,newball,norm,normal,objects,% - offset,one,opacity,orange,origin,path,pause,pi,pixel_to_world,pixels,plot,% - points,pos,pow,pps,print,print_function,print_options,proj,purple,pyramid,% - quad,radians,radius,random,rate,ray,read_local_file,readonly,red,redraw,% - retain,rgb_to_hsv,ring,rotate,round,scene,scroll,shaftwidth,shape,shapes,% - shininess,show_end_face,show_start_face,sign,sin,size,size_units,sleep,% - smooth,space,sphere,sqrt,start,start_face_color,stop,tan,text,textpos,% - texture,textures,thickness,title,trail_color,trail_object,trail_radius,% - trail_type,triangle,trigger,True,twist,unbind,up,upper_left,upper_right,% - userpan,userspin,userzoom,vec,vector,vertex,vertical_spacing,visible,% - visual,vpython,VPython,waitfor,white,width,world,xtitle,yellow,yoffset,% - ytitle% - },% - morekeywords={print,None,TypeError},% % additional keywords - morestring=[b]{"""},% % treat triple quotes as strings - numbers=left,% % where to put line numbers - numbersep=10pt,% % how far line numbers are from code - numberstyle=\bfseries\tiny,% % set to 'none' for no line numbers - showstringspaces=false,% % show spaces in strings - showtabs=false,% % show tabs within strings - stringstyle=\gsfontfamily\color{gsgreen},% % color for strings - upquote=true,% % how to typeset quotes -}% -\NewTCBListing[auto counter,list inside=gsprogs]{glowscriptblock} - { O{} D(){glowscript.org} m }{% - breakable,% - center,% - code = \newpage,% - %derivpeach,% - enhanced,% - hyperurl interior = https://#2,% - label = {gs:\thetcbcounter},% - left = 8mm,% - list entry = \thetcbcounter~~~~~#3,% - listing only,% - listing style = vpython,% - nameref = {#3},% - title = \texttt{GlowScript} Program \thetcbcounter: #3,% - width = 0.9\textwidth,% - {#1}, -}% -\NewDocumentCommand{\listofglowscriptprograms}{}{\tcblistof[\section*]{gsprogs} - {List of \texttt{GlowScript} Programs}}% -\NewTCBInputListing[auto counter,list inside=vpprogs]{\vpythonfile} - { O{} m m }{% - breakable,% - center,% - code = \newpage,% - %derivgray,% - enhanced,% - hyperurl interior = https://,% - label = {vp:\thetcbcounter},% - left = 8mm,% - list entry = \thetcbcounter~~~~~#3,% - listing file = {#2},% - listing only,% - listing style = vpython,% - nameref = {#3},% - title = \texttt{VPython} Program \thetcbcounter: #3,% - width = 0.9\textwidth,% - {#1},% -}% -\NewDocumentCommand{\listofvpythonprograms}{}{\tcblistof[\section*]{vpprogs} - {List of \texttt{VPython} Programs}}% -\DeclareTotalTCBox{\glowscriptinline}{ m }{% - bottom = 0pt,% - bottomrule = 0.0mm,% - boxsep = 1.0mm,% - colback = gsbggray,% - colframe = gsbggray,% - left = 0pt,% - leftrule = 0.0mm,% - nobeforeafter,% - right = 0pt,% - rightrule = 0.0mm,% - sharp corners,% - tcbox raise base,% - top = 0pt,% - toprule = 0.0mm,% -}{\lstinline[style = vpython]{#1}}% -\NewDocumentCommand{\vpythoninline}{}{\glowscriptinline}% +\lstdefinestyle{vpython}% + {% % style for listings + backgroundcolor=\color{gsbggray},% % background color + basicstyle=\colordigits\footnotesize,% % default style + breakatwhitespace=true% % break at whitespace + breaklines=true,% % break long lines + captionpos=b,% % position caption + classoffset=1,% % STILL DON'T UNDERSTAND THIS + commentstyle=\color{gsgray},% % font for comments + deletekeywords={print},% % delete keywords from the given language + emph={self,cls,@classmethod,@property},% % words to emphasize + emphstyle=\color{gsorange}\itshape,% % font for emphasis + escapeinside={(*@}{@*)},% % add LaTeX within your code + frame=tb,% % frame style + framerule=2.0pt,% % frame thickness + framexleftmargin=5pt,% % extra frame left margin + %identifierstyle=\sffamily,% % style for identifiers + keywordstyle=\gsfontfamily\color{gsplum},% % color for keywords + language=Python,% % select language + linewidth=\linewidth,% % width of listings + morekeywords={% % VPython/Web VPython specific keywords + __future__,abs,acos,align,ambient,angle,append,append_to_caption,% + append_to_title,arange,arrow,asin,astuple,atan,atan2,attach_arrow,% + attach_trail,autoscale,axis,background,billboard,bind,black,blue,border,% + bounding_box,box,bumpaxis,bumpmap,bumpmaps,camera,canvas,caption,capture,% + ceil,center,clear,clear_trail,click,clone,CoffeeScript,coils,color,combin,% + comp,compound,cone,convex,cos,cross,curve,cyan,cylinder,data,degrees,del,% + delete,depth,descender,diff_angle,digits,division,dot,draw_complete,% + ellipsoid,emissive,end_face_color,equals,explog,extrusion,faces,factorial,% + False,floor,follow,font,format,forward,fov,frame,gcurve,gdisplay,gdots,% + get_library,get_selected,ghbars,global,GlowScript,graph,graphs,green,gvbars,% + hat,headlength,headwidth,height,helix,hsv_to_rgb,index,interval,keydown,% + keyup,label,length,lights,line,linecolor,linewidth,logx,logy,lower_left,% + lower_right,mag,mag2,magenta,make_trail,marker_color,markers,material,% + max,min,mouse,mousedown,mousemove,mouseup,newball,norm,normal,objects,% + offset,one,opacity,orange,origin,path,pause,pi,pixel_to_world,pixels,plot,% + points,pos,pow,pps,print,print_function,print_options,proj,purple,pyramid,% + quad,radians,radius,random,rate,ray,read_local_file,readonly,red,redraw,% + retain,rgb_to_hsv,ring,rotate,round,scene,scroll,shaftwidth,shape,shapes,% + shininess,show_end_face,show_start_face,sign,sin,size,size_units,sleep,% + smooth,space,sphere,sqrt,start,start_face_color,stop,tan,text,textpos,% + texture,textures,thickness,title,trail_color,trail_object,trail_radius,% + trail_type,triangle,trigger,True,twist,unbind,up,upper_left,upper_right,% + userpan,userspin,userzoom,vec,vector,vertex,vertical_spacing,visible,% + visual,vpython,VPython,waitfor,WebVPython,white,width,world,xtitle,% + yellow,yoffset,ytitle% + },% + morekeywords={print,None,TypeError},% % additional keywords + morestring=[b]{"""},% % treat triple quotes as strings + numbers=left,% % where to put line numbers + numbersep=10pt,% % how far line numbers are from code + numberstyle=\bfseries\tiny,% % set to 'none' for no line numbers + showstringspaces=false,% % show spaces in strings + showtabs=false,% % show tabs within strings + stringstyle=\gsfontfamily\color{gsgreen},% % color for strings + upquote=true,% % how to typeset quotes + }% +\AtBeginEnvironment{webvpythonblock}{\catcode`\#=12} +\AtEndEnvironment{webvpythonblock}{\catcode`\#=6} +\NewTCBListing[auto counter,list inside=gsprogs]{webvpythonblock}{ O{} D(){webvpython.org} m }% + {% + breakable,% + center,% + code = \newpage,% + %derivpeach,% + enhanced,% + hyperurl interior = https://#2,% + label = {gs:\thetcbcounter},% + left = 8mm,% + list entry = \thetcbcounter~~~~~#3,% + listing only,% + listing style = vpython,% + nameref = {#3},% + title = \begin{minipage}{1.5cm}% + \protect\qrcode*{https://#2}% + \end{minipage}\hspace{5mm}% + \begin{minipage}{0.7\textwidth}% + \texttt{Web VPython} Program \thetcbcounter: #3% + \end{minipage},% + width = 0.9\textwidth,% + {#1}, + }% +\AtBeginEnvironment{webvpythonblock*}{\catcode`\#=12} +\AtEndEnvironment{webvpythonblock*}{\catcode`\#=6} +\NewTCBListing[use counter from=webvpythonblock,list inside=gsprogs] + {webvpythonblock*}{ O{} D(){webvpython.org} m }% + {% + breakable,% + center,% + code = \newpage,% + %derivpeach,% + enhanced,% + hyperurl interior = https://#2,% + label = {gs:\thetcbcounter},% + left = 8mm,% + list entry = \thetcbcounter~~~~~#3,% + listing only,% + listing style = vpython,% + nameref = {#3},% + title = \texttt{Web VPython} Program \thetcbcounter: #3,% + width = 0.9\textwidth,% + {#1}, + }% +\NewDocumentCommand{\listofwebvpythonprograms}{}% + {% + \tcblistof[\section*]{gsprogs}{List of \texttt{Web VPython} Programs}% + }% +\newcommand*{\vpythonfile}{\catcode`\#=12 \vpythonfile@auxA} +\NewDocumentCommand{\vpythonfile@auxA}{ O{} D(){vpython.org} m m }% + {% + \vpythonfile@auxB[#1](#2){#3}{#4}% + \catcode`\#=6 + }% +\NewTCBInputListing[auto counter,list inside=vpprogs] + {\vpythonfile@auxB}{ O{} D(){vpython.org} m m }% + {% + breakable,% + center,% + code = \newpage,% + %derivgray,% + enhanced,% + hyperurl interior = https://#2,% + label = {vp:\thetcbcounter},% + left = 8mm,% + list entry = \thetcbcounter~~~~~#4,% + listing file = {#3},% + listing only,% + listing style = vpython,% + nameref = {#4},% + title = \texttt{VPython} Program \thetcbcounter: #4,% + width = 0.9\textwidth,% + {#1},% + }% +\NewDocumentCommand{\listofvpythonprograms}{}% + {% + \tcblistof[\section*]{vpprogs}{List of \texttt{VPython} Programs}% + }% +\DeclareTotalTCBox{\webvpythoninline}{ m }% + {% + bottom = 0pt,% + bottomrule = 0.0mm,% + boxsep = 1.0mm,% + colback = gsbggray,% + colframe = gsbggray,% + left = 0pt,% + leftrule = 0.0mm,% + nobeforeafter,% + right = 0pt,% + rightrule = 0.0mm,% + sharp corners,% + tcbox raise base,% + top = 0pt,% + toprule = 0.0mm,% + }% + {\lstinline[style = vpython]{#1}}% +\NewDocumentCommand{\vpythoninline}{}{\webvpythoninline}% \endinput %% %% End of file `mandistudent.sty'. -- cgit v1.2.3