diff options
Diffstat (limited to 'macros/luatex')
19 files changed, 130 insertions, 152 deletions
diff --git a/macros/luatex/latex/lua-physical/README.md b/macros/luatex/latex/lua-physical/README.md index 8162d2de4d..830574a5da 100644 --- a/macros/luatex/latex/lua-physical/README.md +++ b/macros/luatex/latex/lua-physical/README.md @@ -2,9 +2,9 @@ Author: Thomas Jenni -Version: 1.0.2 +Version: 1.0.3 -Date: 2020-09-07 +Date: 2020-09-09 License: MIT diff --git a/macros/luatex/latex/lua-physical/lua-physical.bib b/macros/luatex/latex/lua-physical/lua-physical.bib deleted file mode 100644 index f675d92457..0000000000 --- a/macros/luatex/latex/lua-physical/lua-physical.bib +++ /dev/null @@ -1,57 +0,0 @@ -%% This BibTeX bibliography file was created using BibDesk. -%% https://bibdesk.sourceforge.io/ - -%% Created for Thomas Jenni at 2019-04-12 20:58:33 +0200 - - -%% Saved with string encoding Unicode (UTF-8) - - - -@electronic{bipm18, - Author = {Bureau International des Poids et Mesures}, - Date-Added = {2019-04-12 20:53:47 +0200}, - Date-Modified = {2019-04-12 20:58:26 +0200}, - Month = {November}, - Title = {Resolutions of the 26th CGPM}, - Url = {https://www.bipm.org/utils/common/pdf/CGPM-2018/26th-CGPM-Resolutions.pdf}, - Year = {2018}} - -@electronic{nist19, - Date-Added = {2019-04-12 17:05:08 +0200}, - Date-Modified = {2019-04-12 17:28:29 +0200}, - Lastchecked = {12.4.2019}, - Month = {August}, - Title = {Webpage https://physics.nist.gov/cuu/index.html}, - Url = {https://physics.nist.gov/cuu/index.html}, - Year = {2019}, - Bdsk-Url-1 = {https://physics.nist.gov/cuu/index.html}} - -@booklet{bipm06, - Author = {Bureau International des Poids et Mesures}, - Date-Added = {2019-03-19 13:45:11 +0000}, - Date-Modified = {2019-04-12 20:57:27 +0200}, - Title = {The International System of Units (SI)}, - Volume = {8th edition}, - Year = {2006}} - -@electronic{bipmunits18, - Date-Added = {2018-09-03 09:58:37 +0200}, - Date-Modified = {2019-04-12 17:28:42 +0200}, - Lastchecked = {3.9.2018}, - Month = {September}, - Title = {Webpage https://www.bipm.org/en/measurement-units/}, - Url = {https://www.bipm.org/en/measurement-units/}, - Year = {2018}, - Bdsk-Url-1 = {https://www.bipm.org/en/measurement-units/}} - -@article{iau16, - Author = {{Pr{\v{s}}a} et al.}, - Date-Modified = {2019-04-12 17:26:47 +0200}, - Journal = {The Astronomical Journal}, - Month = {August}, - Pages = {41}, - Title = {Nominal Values for Selected Solar and Planetary Quantities: IAU 2015 Resolution B3}, - Volume = {152}, - Year = {2016}, - Bdsk-Url-1 = {https://doi.org/10.3847/0004-6256/152/2/41}} diff --git a/macros/luatex/latex/lua-physical/lua-physical.pdf b/macros/luatex/latex/lua-physical/lua-physical.pdf Binary files differindex d7d4994674..577bf24f05 100644 --- a/macros/luatex/latex/lua-physical/lua-physical.pdf +++ b/macros/luatex/latex/lua-physical/lua-physical.pdf diff --git a/macros/luatex/latex/lua-physical/lua-physical.tex b/macros/luatex/latex/lua-physical/lua-physical.tex index 7ce00daa43..331a17d23e 100644 --- a/macros/luatex/latex/lua-physical/lua-physical.tex +++ b/macros/luatex/latex/lua-physical/lua-physical.tex @@ -85,7 +85,7 @@ Q = physical.Quantity } \lstset{ - numberstyle=\footnotesize\color{green!50!black}, + numberstyle=\footnotesize\color{black!50!white}, keywordstyle=\ttfamily\bfseries\color{black}, basicstyle=\ttfamily\footnotesize, commentstyle=\itshape\color{gray}, @@ -106,7 +106,7 @@ Q = physical.Quantity frameround=tttt, framexleftmargin=15pt, framexrightmargin=20pt, - rulecolor=\color{green!50!black}, + rulecolor=\color{black!50!white}, mathescape=false, captionpos=t, escapechar=`, @@ -127,7 +127,7 @@ Q = physical.Quantity % left bar \newenvironment{leftbar} {% -\begin{tcolorbox}[colframe=green!50!black, colback=white, arc=5pt, boxrule=0.5pt,]% +\begin{tcolorbox}[colframe=black!50!white, colback=white, arc=5pt, boxrule=0.5pt,]% } {% \end{tcolorbox}% @@ -152,7 +152,7 @@ Q = physical.Quantity \lstset{language=[LaTex]Tex} -\title{The \textsc{lua-physical} library \\\ \\\normalsize Version 1.0.2} +\title{The \textsc{lua-physical} library \\\ \\\normalsize Version 1.0.3} \author{Thomas Jenni} \date{\today} \maketitle @@ -170,10 +170,13 @@ Q = physical.Quantity \newpage \section{Introduction} -The author of this package is a physics teacher at the high school \emph{Kantonsschule Zug}, Switzerland. The main use of this package is to write physics problem sets. \LuaLaTeX{} does make it possible to integrate physical calculations directly. The package has been in use since 2016. Many bugs have been found and fixed. Nevertheless it still is possible, that some were not found yet. Therefore the author recommends not to use this package in industry or science. If one does so, it's the responsability of the user to check results for plausability. If the user finds some bugs, they can be reported at github.com or directly to the author (\texttt{thomas.jenni (at) ksz.ch}). +The author of this package is a physics teacher at the high school \emph{Kantonsschule Zug}, Switzerland. The main use of this package is to write physics problem sets. \LuaLaTeX{} does make it possible to integrate physical calculations directly. The package has been in use since 2016. Many bugs have been found and fixed. Nevertheless it still is possible, that some were not found yet. Therefore the author recommends not to use this package in industry or science. If one does so, it's the responsability of the user to check results for plausability. If the user finds some bugs, they can be reported at github.com. +\subsection{Dependencies} + +In principle this library is standalone, but it is compatible with the |siunitx| package. Calculation results can be written to \LuaLaTeX{} directly by calling the |tosiunitx()| method. If the preamble in the next section is used, the printing is done by the |\q{}| macro. @@ -184,40 +187,45 @@ This package is a pure Lua library. Therefore one has to require it explicitly b The following \LaTeX{} preamble loads the |lua-physical| package and creates a macro |\q| for printing physical quantities. \nopagebreak \begin{lstlisting}[language=Tex, caption=basic preamble, label=lst:basic preamble] - \usepackage{siunitx} - - % configure siunitx - \sisetup{ - output-decimal-marker = {.}, - per-mode = symbol, - separate-uncertainty = true, - add-decimal-zero = true, - exponent-product = \cdot, - round-mode = off - } +\usepackage{luacode} +\usepackage{siunitx} - % load the lua-physical package - \begin{luacode*} - physical = require("physical") - N = physical.Number - \end{luacode*} +% configure siunitx +\sisetup{ + output-decimal-marker = {.}, + per-mode = symbol, + separate-uncertainty = true, + add-decimal-zero = true, + exponent-product = \cdot, + round-mode = off +} - % print a physical quantity - \newcommand{\q}[1]{% - \directlua{tex.print(physical.Quantity.tosiunitx(#1,"scientific-notation=fixed,exponent-to-prefix=false"))}% - } -\end{lstlisting} +% load the lua-physical package +\begin{luacode*} + physical = require("physical") + N = physical.Number +\end{luacode*} -\subsection{Dependencies} -In principle this library is standalone, but it is compatible with the |siunitx| package. Calculation results can be written to \LuaLaTeX{} directly by calling the |tosiunitx()| method. If the preamble above is used, the printing is done by the |\q{}| macro. +% print a physical quantity +\newcommand{\q}[1]{% + \directlua{ + tex.print( + physical.Quantity.tosiunitx( + #1, + "scientific-notation=fixed,exponent-to-prefix=false" + ) + ) + }% +} +\end{lstlisting} \subsection{License} This code is freely distributable under the terms of the MIT license.\\ -Copyright (c) 2019 Thomas Jenni\\ +Copyright (c) 2020 Thomas Jenni\\ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\\ @@ -243,9 +251,10 @@ Given the basic preamble, units can be used in lua code directly. By convention, \end{luacode} A car travels $\q{s}$ in $\q{t}$. calculate its velocity. -\begin{align} - v=\frac{s}{t} = \frac{\q{s}}{\q{t}} = \uuline{\q{v}} -\end{align} +% +\begin{equation*} + v=\frac{s}{t} = \frac{\q{s}}{\q{t}} = \underline{\q{v}} +\end{equation*} \end{lstlisting} \begin{luacode} @@ -257,9 +266,10 @@ A car travels $\q{s}$ in $\q{t}$. calculate its velocity. \leftbar A car travels $\q{s}$ in $\q{t}$. Calculate its velocity. -\begin{align} - v=\frac{s}{t} = \frac{\q{s}}{\q{t}} = \uuline{\q{v}} -\end{align} +% +\begin{equation*} + v=\frac{s}{t} = \frac{\q{s}}{\q{t}} = \underline{\q{v}} +\end{equation*} \endleftbar In the above listing~\ref{lst:Car Velocity}, the variable |s| stands for displacement and has the unit meter |_m|, the variable |t| stands for time and is given in seconds |_s|. If mathematical operations are done on them, new physical quantities are created. In the problem above, the velocity |v| is calculated by dividing |s| by |t|. The instance |v| has the derived unit \si{\m\per\s}. By using the macro |\q{}| all quantities can be printed to the \LuaLaTeX{} code directly. @@ -272,6 +282,8 @@ In the above listing~\ref{lst:Car Velocity}, the variable |s| stands for displac Very often, the result of a calculation has to be converted to another unit. In listing~\ref{lst:Volume of Cuboid} the task is to calculate the volume of a cuboid. The length of the edges are given in different units. The volume is calculated by multipling all three lengths, the unit of the result is \si{\cm\mm\m}. If the unit \si{\cm\cubed} is preferred, it has to be converted explicitly. The conversion function is called |to()| and is available on all physical quantitiy instances. At first this looks a bit cumbersome. The reason of this behaviour is, that the software is not able to guess the unit of the result. In many cases, like in the example here, it's not clear what unit the result sould have. Therefore the user has always to give the target unit explicitly. +\pagebreak + \begin{lstlisting}[caption=Volume of a cuboid.,label=lst:Volume of Cuboid] \begin{luacode} a = 12 * _cm @@ -283,12 +295,13 @@ Very often, the result of a calculation has to be converted to another unit. In Find the volume of a rectangular cuboid with lengths $\q{a}$, $\q{b}$ and $\q{c}$. -\begin{align} +% +\begin{equation*} V= a \cdot b \cdot c = \q{a} \cdot \q{b} \cdot \q{c} = \q{V} - = \uuline{\q{V:to(_dm^3)}} -\end{align} + = \underline{\q{V:to(_dm^3)}} +\end{equation*} \end{lstlisting} \begin{luacode} @@ -301,12 +314,13 @@ $\q{b}$ and $\q{c}$. \leftbar Find the volume of a rectangular cuboid with lengths $\q{a}$, $\q{b}$ and $\q{c}$. -\begin{align} +% +\begin{equation*} V= a \cdot b \cdot c = \q{a} \cdot \q{b} \cdot \q{c} = \q{V} - = \uuline{\q{V:to(_dm^3)}} -\end{align} + = \underline{\q{V:to(_dm^3)}} +\end{equation*} \endleftbar @@ -394,9 +408,9 @@ In the following problem, listing~\ref{lst:temperature conversion}, the task is The package supports uncertainty propagation. To create a number with an uncertainty, an instance of |physical.Number| has to be created, see listing~\ref{lst:rectangular area}. It has to be remembered, that |N| is a alias for |physical.Number|. The first argument of the constructor |N(mean, uncertainty)| is the mean value and the second one the uncertainty of the measurement. If the proposed preamble \ref{lst:basic preamble} is used, the uncertainty is by default seperated from the mean value by a plus-minus sign. For the uncertainty propagation the gaussian formula -\begin{align} +\begin{equation*} \Delta f = \sqrt{ \left(\frac{\partial f}{x_1} \cdot \Delta x_1\right)^2 + \dots + \left(\frac{\partial f}{x_n} \cdot \Delta x_2 \right)^2 } -\end{align} +\end{equation*} is used. This formula is a good estimation for the uncertainty $\Delta f$, if the quantities $x_1, \dots, x_n$ the function $f$ depends on, have no correlation. Further, the function $f$ has to change linear, if quantities $x_i$ are changed in the range of their uncertainties. @@ -410,11 +424,12 @@ is used. This formula is a good estimation for the uncertainty $\Delta f$, if th \end{luacode} Calculate the area of a rectangle with lengths $\q{a}$ and $\q{b}$. -\begin{align} +% +\begin{equation*} A = a \cdot b = \q{a} \cdot \q{b} - = \uuline{\q{A}} -\end{align} + = \underline{\q{A}} +\end{equation*} \end{lstlisting} \begin{luacode} @@ -426,11 +441,12 @@ Calculate the area of a rectangle with lengths $\q{a}$ and $\q{b}$. \leftbar Calculate the area of a rectangle with lengths $\q{a}$ and $\q{b}$. -\begin{align} +% +\begin{equation*} A = a \cdot b = \q{a} \cdot \q{b} - = \uuline{\q{A}} -\end{align} + = \underline{\q{A}} +\end{equation*} \endleftbar @@ -449,11 +465,12 @@ In the following problem, listing~\ref{lst:volume of ideal gas}, the task is to \end{luacode} An ideal gas ($\q{n}$) has a pressure of $\q{p}$ and a temperature of $\q{T}$. Calculate the volume of the gas. -\begin{align} +% +\begin{equation*} V=\frac{ \q{n} \cdot \q{_R} \cdot \q{(T + _degC_0):to(_K)} }{ \q{p} } = \q{V} - = \uuline{\q{V}} -\end{align} + = \underline{\q{V}} +\end{equation*} \end{lstlisting} @@ -468,11 +485,11 @@ An ideal gas ($\q{n}$) has a pressure of $\q{p}$ and a temperature of $\q{T}$. C \leftbar An ideal gas ($\q{n}$) has a pressure of $\q{p}$ and a temperature of $\q{T}$. Calculate the volume of the gas. - -\begin{align} +% +\begin{equation*} V=\frac{ \q{n} \cdot \q{(_R*N(1,0.001)):to(_J/(_mol*_K))} \cdot \q{(T + _degC_0):to(_K)} }{ \q{p} } - = \uuline{\q{V}} -\end{align} + = \underline{\q{V}} +\end{equation*} \endleftbar This example shows, that the result has only two digits. If more digits are needed, the uncertainties of the given quantities should be smaller. @@ -698,7 +715,7 @@ length & meter & |_m| & $\mathrm{L}$ & -The SI unit of length. It is defined by taking the fixed numercial value of the speed of light in vacuum $c$ to be $\num{299792458}$ when expressed in the unit of $\q{_m/_s}$. \\ +The SI unit of length. It is defined by taking the fixed numercial value of the speed of light in vacuum $c$ to be $\num{299792458}$ when expressed in the unit of $\qu{_m/_s}$. \\ \hline @@ -738,7 +755,7 @@ thermodynamic \newline temperature & kelvin & |_K| & $\mathrm{K}$ \protect\footnotemark & -The SI unit of the thermodynamic temperature. It is defineed by taking the fixed numerical value of the Boltzmann constant $k_B$ to be $\qs{(_k_B/(_J/_K)):to()}$ when expressed in $\q{_kg*_m^2*_s^-2*_K^-1}$\\ +The SI unit of the thermodynamic temperature. It is defineed by taking the fixed numerical value of the Boltzmann constant $k_B$ to be $\qs{(_k_B/(_J/_K)):to()}$ when expressed in $\qu{_kg*_m^2*_s^-2*_K^-1}$\\ amount of \newline substance & mole & @@ -1639,7 +1656,7 @@ tex.write(tostring(T:to()) ) \item |mode| : |number| \end{description} - If |mode| is equal |Q.siunitx_SI|, which is the default, the quantity is converted to an \textbackslash SI\{\}\{\} macro. If mode is |Q.siunitx_num|, the quantity is converted to \textbackslash num\{\} and if it is |Q.siunitx_si| the macro \textbackslash si\{\} is printed. + If |mode| is equal |Q.SIUNITX_SI|, which is the default, the quantity is converted to an \textbackslash SI\{\}\{\} macro. If mode is |Q.SIUNITX_num|, the quantity is converted to \textbackslash num\{\} and if it is |Q.SIUNITX_si| the macro \textbackslash si\{\} is printed. \begin{lstlisting} s = 1.9 * _km @@ -1652,17 +1669,17 @@ tex.write(tostring(s:tosiunitx()) ) \end{luacode} ` -print( s:tosiunitx(nil,Q.siunitx_num) ) +print( s:tosiunitx(nil,Q.SIUNITX_num) ) ` \begin{luacode} -tex.write(tostring(s:tosiunitx(nil,Q.siunitx_num)) ) +tex.write(tostring(s:tosiunitx(nil,Q.SIUNITX_num)) ) \end{luacode} ` -print( s:tosiunitx(nil,Q.siunitx_si) ) +print( s:tosiunitx(nil,Q.SIUNITX_si) ) ` \begin{luacode} -tex.write(tostring(s:tosiunitx(nil,Q.siunitx_si)) ) +tex.write(tostring(s:tosiunitx(nil,Q.SIUNITX_si)) ) \end{luacode} ` \end{lstlisting} @@ -2035,9 +2052,9 @@ tex.write(tostring(x:atan():to(_deg))) \method{Q}{sinh(q)} \begin{quote} Returns the value of the hyperbolic sine function of the given quantity. The quantity has to be dimensionless. Since Lua doesn't implement the hyperbolic functions, the following formula is used - \begin{align} + \begin{equation*} \sinh(x) = 0.5 \cdot e^x - 0.5 / e^x \quad. - \end{align} + \end{equation*} \begin{description} \item |q| : |Q|, |N|, |number|\\ @@ -2066,9 +2083,9 @@ tex.write(tostring(x:sinh())) \method{Q}{cosh(q)} \begin{quote} Returns the value of the hyperbolic cosine function of the given quantity. The quantity has to be dimensionless. Since Lua doesn't implement the hyperbolic functions, the following formula is used - \begin{align} + \begin{equation*} \cosh(x) = 0.5 \cdot e^x + 0.5 / e^x \quad. - \end{align} + \end{equation*} \begin{description} \item |q| : |Q|, |N|, |number|\\ @@ -2096,9 +2113,9 @@ tex.write(tostring(x:cosh())) \method{Q}{tanh(q)} \begin{quote} Returns the value of the hyperbolic tangent function of the given quantity. The quantity has to be dimensionless. Since Lua doesn't implement the hyperbolic functions, the following formula is used - \begin{align} + \begin{equation*} \tanh(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}} \quad. - \end{align} + \end{equation*} \begin{description} \item |q| : |Q|, |N|, |number|\\ @@ -2127,9 +2144,9 @@ tex.write(tostring(x:tanh())) \method{Q}{asinh(q)} \begin{quote} Returns the value of the inverse hyperbolic sine function of the given quantity. The quantity has to be dimensionless. Since Lua doesn't implement the hyperbolic functions, the following formula is used - \begin{align} + \begin{equation*} \text{asinh}(x) = \ln\left( x + \sqrt{x^2 + 1} \right) \quad. - \end{align} + \end{equation*} \begin{description} \item |q| : |Q|, |N|, |number|\\ @@ -2158,9 +2175,9 @@ tex.write(tostring(x:asinh())) \method{Q}{acosh(q)} \begin{quote} Returns the value of the inverse hyperbolic cosine function of the given quantity. The quantity has to be dimensionless. Since Lua doesn't implement the hyperbolic functions, the following formula is used - \begin{align} + \begin{equation*} \text{acosh}(x) = \ln\left( x + \sqrt{x^2 - 1} \right) \quad, x > 1 \quad. - \end{align} + \end{equation*} \begin{description} \item |q| : |Q|, |N|, |number|\\ @@ -2189,9 +2206,9 @@ tex.write(tostring(x:acosh())) \method{Q}{atanh(q)} \begin{quote} Returns the value of the inverse hyperbolic tangent function of the given quantity. The quantity has to be dimensionless. Since Lua doesn't implement the hyperbolic functions, the following formula is used - \begin{align} + \begin{equation*} \text{atanh}(x) = \ln\left( \frac{1 + x}{1 - x} \right) \quad, -1 < x < 1 \quad. - \end{align} + \end{equation*} \begin{description} \item |q| : |Q|, |N|, |number|\\ @@ -3052,12 +3069,30 @@ tex.write(tostring(n:atanh())) \newpage \section{Change History} -V1.0.2 \quad (2020/09/07) Minor release. Path issues resolved. Docs corrected. -V1.0.1 \quad (2020/09/05) Minor release. Files renamed. +\newcommand{\vhist}[4]{ +#1 \quad (#2) \qquad \textbf{#3} \\ +\hangindent2em +#4 +\vspace{1em} +} -V1.0 \quad (2020/09/03) First official release. +\vhist{V1.0.3}{2020/09/09}{Minor release}{ + Changed foldername |physical| to |src|. Changed Classvariables |Q.siunitx\_SI|, |Q.siunitx\_num| and |Q.siunitx\_si| to uppercase |Q.SIUNITX\_SI|, |Q.SIUNITX\_num| and |Q.SIUNITX\_si|. +} + +\vhist{V1.0.2}{2020/09/07}{Minor release}{ + Path issues resolved. Docs corrected. +} + +\vhist{V1.0.1}{2020/09/05}{Minor release}{ + Files renamed. +} + +\vhist{V1.0.1}{2020/09/03}{First official release.}{ + +} diff --git a/macros/luatex/latex/lua-physical/physical/physical-astronomical.lua b/macros/luatex/latex/lua-physical/src/physical-astronomical.lua index 48ca5646b8..48ca5646b8 100644 --- a/macros/luatex/latex/lua-physical/physical/physical-astronomical.lua +++ b/macros/luatex/latex/lua-physical/src/physical-astronomical.lua diff --git a/macros/luatex/latex/lua-physical/physical/physical-data.lua b/macros/luatex/latex/lua-physical/src/physical-data.lua index efc1a30ffa..efc1a30ffa 100644 --- a/macros/luatex/latex/lua-physical/physical/physical-data.lua +++ b/macros/luatex/latex/lua-physical/src/physical-data.lua diff --git a/macros/luatex/latex/lua-physical/physical/physical-definition.lua b/macros/luatex/latex/lua-physical/src/physical-definition.lua index cf1576b4c5..cf1576b4c5 100644 --- a/macros/luatex/latex/lua-physical/physical/physical-definition.lua +++ b/macros/luatex/latex/lua-physical/src/physical-definition.lua diff --git a/macros/luatex/latex/lua-physical/physical/physical-dimension.lua b/macros/luatex/latex/lua-physical/src/physical-dimension.lua index edd9e65997..edd9e65997 100644 --- a/macros/luatex/latex/lua-physical/physical/physical-dimension.lua +++ b/macros/luatex/latex/lua-physical/src/physical-dimension.lua diff --git a/macros/luatex/latex/lua-physical/physical/physical-isotope.lua b/macros/luatex/latex/lua-physical/src/physical-isotope.lua index 0ec85f1a5e..0ec85f1a5e 100644 --- a/macros/luatex/latex/lua-physical/physical/physical-isotope.lua +++ b/macros/luatex/latex/lua-physical/src/physical-isotope.lua diff --git a/macros/luatex/latex/lua-physical/physical/physical-number.lua b/macros/luatex/latex/lua-physical/src/physical-number.lua index 8c278aacfe..8c278aacfe 100644 --- a/macros/luatex/latex/lua-physical/physical/physical-number.lua +++ b/macros/luatex/latex/lua-physical/src/physical-number.lua diff --git a/macros/luatex/latex/lua-physical/physical/physical-quantity.lua b/macros/luatex/latex/lua-physical/src/physical-quantity.lua index 47a02063c5..d89fdd2836 100644 --- a/macros/luatex/latex/lua-physical/physical/physical-quantity.lua +++ b/macros/luatex/latex/lua-physical/src/physical-quantity.lua @@ -46,9 +46,9 @@ Quantity._base = {} Quantity._prefixes = {} -- modes for the function tosiunitx() -Quantity.siunitx_SI = 0 -Quantity.siunitx_num = 1 -Quantity.siunitx_si = 2 +Quantity.SIUNITX_SI = 0 +Quantity.SIUNITX_num = 1 +Quantity.SIUNITX_si = 2 -- constructor @@ -416,20 +416,20 @@ end -- convert quantity to an siunitx expression function Quantity:tosiunitx(param,mode) - mode = mode or self.siunitx_SI + mode = mode or self.SIUNITX_SI param = param or "" if param ~= "" then param = "["..param.."]" end - if mode == Quantity.siunitx_SI then + if mode == Quantity.SIUNITX_SI then return "\\SI"..param.."{"..tostring(self.value).."}".."{"..self.unit:tosiunitx().."}" - elseif mode == Quantity.siunitx_num then + elseif mode == Quantity.SIUNITX_num then return "\\num"..param.."{"..tostring(self.value).."}" - elseif mode == Quantity.siunitx_si then + elseif mode == Quantity.SIUNITX_si then return "\\si"..param.."{"..self.unit:tosiunitx().."}" else diff --git a/macros/luatex/latex/lua-physical/physical/physical-unit.lua b/macros/luatex/latex/lua-physical/src/physical-unit.lua index 65c016449b..65c016449b 100644 --- a/macros/luatex/latex/lua-physical/physical/physical-unit.lua +++ b/macros/luatex/latex/lua-physical/src/physical-unit.lua diff --git a/macros/luatex/latex/lua-physical/physical.lua b/macros/luatex/latex/lua-physical/src/physical.lua index 2af9d7677a..8c8d30171b 100755..100644 --- a/macros/luatex/latex/lua-physical/physical.lua +++ b/macros/luatex/latex/lua-physical/src/physical.lua @@ -3,8 +3,8 @@ lua-physical Author: Thomas Jenni -Version: 1.0.2 -Date: 2020-09-07 +Version: 1.0.3 +Date: 2020-09-09 License: MIT diff --git a/macros/luatex/latex/lua-physical/test/testData.lua b/macros/luatex/latex/lua-physical/test/testData.lua index 6af56c24f3..44db28afc3 100644 --- a/macros/luatex/latex/lua-physical/test/testData.lua +++ b/macros/luatex/latex/lua-physical/test/testData.lua @@ -24,7 +24,7 @@ SOFTWARE. local lu = require("luaunit") -package.path = "../physical/?.lua;" .. package.path +package.path = "../src/?.lua;" .. package.path local physical = require("physical") diff --git a/macros/luatex/latex/lua-physical/test/testDefinition.lua b/macros/luatex/latex/lua-physical/test/testDefinition.lua index a36d460086..b8ffe3eb56 100644 --- a/macros/luatex/latex/lua-physical/test/testDefinition.lua +++ b/macros/luatex/latex/lua-physical/test/testDefinition.lua @@ -24,7 +24,7 @@ SOFTWARE. local lu = require("luaunit") -package.path = "../physical/?.lua;" .. package.path +package.path = "../src/?.lua;" .. package.path local physical = require("physical") local N = physical.Number diff --git a/macros/luatex/latex/lua-physical/test/testDimension.lua b/macros/luatex/latex/lua-physical/test/testDimension.lua index 8578196995..872e399544 100644 --- a/macros/luatex/latex/lua-physical/test/testDimension.lua +++ b/macros/luatex/latex/lua-physical/test/testDimension.lua @@ -24,7 +24,7 @@ SOFTWARE. local lu = require("luaunit") -package.path = "../physical/?.lua;" .. package.path +package.path = "../src/?.lua;" .. package.path local physical = require("physical") local D = physical.Dimension diff --git a/macros/luatex/latex/lua-physical/test/testNumber.lua b/macros/luatex/latex/lua-physical/test/testNumber.lua index e41ff355e5..68c543604f 100644 --- a/macros/luatex/latex/lua-physical/test/testNumber.lua +++ b/macros/luatex/latex/lua-physical/test/testNumber.lua @@ -24,7 +24,7 @@ SOFTWARE. local lu = require("luaunit") -package.path = "../physical/?.lua;" .. package.path +package.path = "../src/?.lua;" .. package.path local physical = require("physical") local N = physical.Number diff --git a/macros/luatex/latex/lua-physical/test/testQuantity.lua b/macros/luatex/latex/lua-physical/test/testQuantity.lua index e7e1223ab6..dd98d89572 100644 --- a/macros/luatex/latex/lua-physical/test/testQuantity.lua +++ b/macros/luatex/latex/lua-physical/test/testQuantity.lua @@ -24,7 +24,7 @@ SOFTWARE. local lu = require("luaunit") -package.path = "../physical/?.lua;" .. package.path +package.path = "../src/?.lua;" .. package.path local physical = require("physical") local N = physical.Number diff --git a/macros/luatex/latex/lua-physical/test/testUnit.lua b/macros/luatex/latex/lua-physical/test/testUnit.lua index 1e3107ae07..34e13e2926 100644 --- a/macros/luatex/latex/lua-physical/test/testUnit.lua +++ b/macros/luatex/latex/lua-physical/test/testUnit.lua @@ -24,7 +24,7 @@ SOFTWARE. local lu = require("luaunit") -package.path = "../physical/?.lua;" .. package.path +package.path = "../src/?.lua;" .. package.path local physical = require("physical") local D = physical.Dimension |