diff options
author | Norbert Preining <norbert@preining.info> | 2023-08-04 03:01:07 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-08-04 03:01:07 +0000 |
commit | 319c90e45fc96ba6f15edcf00b24e484d9d92f2b (patch) | |
tree | 7011e82643aff6842597d83574783a350142063c /macros | |
parent | 63c1aaa794cb47fe36ebe8010257ec8ad322efbb (diff) |
CTAN sync 202308040301
Diffstat (limited to 'macros')
112 files changed, 1827 insertions, 668 deletions
diff --git a/macros/latex/contrib/huawei/DEPENDS.txt b/macros/latex/contrib/huawei/DEPENDS.txt index c2b072d36c..32d6fff18a 100644 --- a/macros/latex/contrib/huawei/DEPENDS.txt +++ b/macros/latex/contrib/huawei/DEPENDS.txt @@ -1,5 +1,6 @@ hard anyfontsize hard biblatex +hard caption hard catchfile hard changepage hard currfile @@ -16,18 +17,32 @@ hard geometry hard hyperref hard lastpage hard libertine +hard listings +hard listingsutf8 hard makecell hard microtype hard pagecolor hard paralist +hard pdfcol hard pgf hard pgfopts hard ragged2e hard setspace hard svg +hard tcolorbox hard textpos +hard tikzfill hard titling hard transparent hard trimspaces hard wrapfig -hard xcolor
\ No newline at end of file +hard xcolor +soft docshots +soft href-ul +soft hypdoc +soft iexec +soft l3build +soft libertine +soft scheme-basic +soft tools +soft xetex
\ No newline at end of file diff --git a/macros/latex/contrib/huawei/huawei.dtx b/macros/latex/contrib/huawei/huawei.dtx index 8c502d0f38..7546b37e56 100644 --- a/macros/latex/contrib/huawei/huawei.dtx +++ b/macros/latex/contrib/huawei/huawei.dtx @@ -50,7 +50,7 @@ %<class>\NeedsTeXFormat{LaTeX2e} %<class>\ProvidesClass{huawei} %<*class> -[2023-05-20 0.16.0 Template for Huawei Documents] +[2023-08-03 0.17.0 Template for Huawei Documents] %</class> %<*driver> \documentclass{ltxdoc} @@ -58,9 +58,9 @@ \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{microtype} -\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}} + \AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}} \usepackage[dtx,margin=0,log,nocrop]{docshots} -\docshotPrerequisite{huawei-cover-picture.pdf} + \docshotPrerequisite{huawei-cover-picture.pdf} \usepackage{href-ul} \PageIndex \EnableCrossrefs @@ -402,39 +402,75 @@ $pdflatex = 'pdflatex %O --shell-escape %S'; \fi\makeatother % \end{macrocode} -% Then, we include a important packages: +% Then, we configure the encodings: % \begin{macrocode} \RequirePackage[T1]{fontenc} \RequirePackage[utf8]{inputenc} +% \end{macrocode} + +% Then, we include a few important packages: +% \begin{macrocode} \RequirePackage{tabularx} \RequirePackage{anyfontsize} \RequirePackage{multicol} \RequirePackage{ragged2e} \RequirePackage{multicol} -\RequirePackage[mmddyyyy,iso]{datetime} - \newtimeformat{daytime}{\twodigit{\THEHOUR}:\twodigit{\THEMINUTE}} -\RequirePackage[tt=false,type1=true]{libertine} \RequirePackage{paralist} \RequirePackage{makecell} -\RequirePackage[para]{footmisc} - \setlength{\footnotemargin}{2pt} - \setlength{\footnotesep}{2pt} \RequirePackage{graphicx} \RequirePackage{array} -\RequirePackage[hidelinks]{hyperref} % to enable \pageref* command \RequirePackage[abspath]{currfile} -\RequirePackage{enumitem} - \setlist{nosep} -\RequirePackage{microtype} -\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}} \RequirePackage{wrapfig} \RequirePackage{lastpage} \RequirePackage{tikz} \RequirePackage{tabularx} \RequirePackage{titling} \RequirePackage{svg} +% \end{macrocode} + +% Then, we configure |libertine| font: +% \begin{macrocode} +\PassOptionsToPackage{tt=false,type1=true}{libertine} +\RequirePackage{libertine} +% \end{macrocode} + +% Then, we configure |microtype|: +% \begin{macrocode} +\RequirePackage{microtype} +\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}} +% \end{macrocode} + +% Then, we configure |footmisc|: +% \begin{macrocode} +\PassOptionsToPackage{para}{footmisc} +\RequirePackage{footmisc} +\setlength{\footnotemargin}{2pt} +\setlength{\footnotesep}{2pt} +% \end{macrocode} + +% Then, we configure |enumitem|: +% \begin{macrocode} +\RequirePackage{enumitem} +\setlist{nosep} +% \end{macrocode} + +% Then, we configure |textpos|: +% \begin{macrocode} \RequirePackage[absolute]{textpos} - \TPGrid{16}{16} +\TPGrid{16}{16} +% \end{macrocode} + +% Then, we configure |datetime|: +% \begin{macrocode} +\PassOptionsToPackage{mmddyyyy,iso}{datetime} +\RequirePackage{datetime} +\newtimeformat{daytime}{\twodigit{\THEHOUR}:\twodigit{\THEMINUTE}} +% \end{macrocode} + +% Then, to enable |\pageref*| command, we configure |hyperref|: +% \begin{macrocode} +\PassOptionsToPackage{hidelinks}{hyperref} +\RequirePackage{hyperref} % \end{macrocode} % Then, we configure |biblatex|: @@ -445,6 +481,31 @@ $pdflatex = 'pdflatex %O --shell-escape %S'; url=false,isbn=false,isbn=false]{biblatex} % \end{macrocode} +% Then, we make figure captions smaller and in |sf| font: +% \changes{v0.17.0}{2023/08/08}{Smaller and sans-serif font for captions of figures.} +% \begin{macrocode} +\PassOptionsToPackage{font={small,sf}}{caption} +\RequirePackage{caption} +% \end{macrocode} + +% Then, we make all figures and tables bordered by default, with the help of the |float| package: +% \changes{v0.17.0}{2023/08/08}{All figures and tables are bordered by default.} +% \begin{macrocode} +\RequirePackage{float} +\floatstyle{boxed} +\restylefloat{table} +\restylefloat{figure} +% \end{macrocode} + +% Then, we make sure all figures and tables are centered by default, as recommended +% \href{https://tex.stackexchange.com/questions/2651/}{here}: +% \changes{v0.17.0}{2023/08/08}{All figures and tables are centered by default.} +% \begin{macrocode} +\makeatletter +\g@addto@macro\@floatboxreset\centering +\makeatother +% \end{macrocode} + % Then, we set spacing between lines: % \begin{macrocode} \RequirePackage{setspace} diff --git a/macros/latex/contrib/huawei/huawei.pdf b/macros/latex/contrib/huawei/huawei.pdf Binary files differindex a84233c475..8355c298f1 100644 --- a/macros/latex/contrib/huawei/huawei.pdf +++ b/macros/latex/contrib/huawei/huawei.pdf diff --git a/macros/latex/contrib/l3kernel/CHANGELOG.md b/macros/latex/contrib/l3kernel/CHANGELOG.md index 68e4090e09..38215a2cd2 100644 --- a/macros/latex/contrib/l3kernel/CHANGELOG.md +++ b/macros/latex/contrib/l3kernel/CHANGELOG.md @@ -7,6 +7,21 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2023-08-03] + +### Added +- `\tex_XeTeXhyphenatablelength:D`, `\tex_XeTeXinterwordspaceshaping:D`, + `\tex_XeTeXselectorcode:D` +- Several missing `\tex_<name>:D` primitives from LuaTeX and (up)TeX + +### Changed +- `\tex_protrudechars:D` now defined for XeTeX (to `\XeTeXprotrudechars`) +- Allow for optional `v` in version string argument to + `\ProvidesExpl...` + +### Fixed +- Allow for implicit chars when case changing + ## [2023-06-30] ### Added @@ -292,9 +307,13 @@ this project uses date-based 'snapshot' version identifiers. [\#1123](https://github.com/latex3/latex3/issues/1123)) - `\text_map_function:nN` and `\text_map_inline:nn` for mapping to graphemes in textual input -- Support for medevial Latin case changing +- Support for medieval Latin case changing - `\char_to_nfd:n` to extend NFD support to 8-bit engines +### Deprecated +- `\pdf_object_new:nn` and `\pdf_object_write:nn`, in favor of + `\pdf_object_new:n` and `\pdf_object_write:nnn`, respectively + ## [2022-08-23] ### Added @@ -1476,7 +1495,8 @@ this project uses date-based 'snapshot' version identifiers. - Step functions have been added for dim variables, e.g. `\dim_step_inline:nnnn` -[Unreleased]: https://github.com/latex3/latex3/compare/2023-06-30...HEAD +[Unreleased]: https://github.com/latex3/latex3/compare/2023-08-03...HEAD +[2023-08-03]: https://github.com/latex3/latex3/compare/2023-06-30...2023-08-03 [2023-06-30]: https://github.com/latex3/latex3/compare/2023-06-16...2023-06-30 [2023-06-16]: https://github.com/latex3/latex3/compare/2023-06-05...2023-06-16 [2023-06-05]: https://github.com/latex3/latex3/compare/2023-05-22...2023-06-05 diff --git a/macros/latex/contrib/l3kernel/README.md b/macros/latex/contrib/l3kernel/README.md index 9ac444ab9a..856c7364a1 100644 --- a/macros/latex/contrib/l3kernel/README.md +++ b/macros/latex/contrib/l3kernel/README.md @@ -1,7 +1,7 @@ LaTeX3 Programming Conventions ============================== -Release 2023-06-30 +Release 2023-08-03 Overview -------- diff --git a/macros/latex/contrib/l3kernel/expl3.dtx b/macros/latex/contrib/l3kernel/expl3.dtx index 31a8946103..b9856ecba3 100644 --- a/macros/latex/contrib/l3kernel/expl3.dtx +++ b/macros/latex/contrib/l3kernel/expl3.dtx @@ -24,7 +24,7 @@ % %<*driver|generic|package|2ekernel> %</driver|generic|package|2ekernel> -\def\ExplFileDate{2023-06-30}% +\def\ExplFileDate{2023-08-03}% %<*driver> \documentclass[full]{l3doc} \usepackage{graphicx} @@ -51,7 +51,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % @@ -323,7 +323,7 @@ % is private to the module, and should \emph{not} be used outside of that % module. % -% In the same way, private variables should use two "__" at the start of the +% Similarly, private variables should use |__| to separate scope and % module name, such that % \begin{verbatim} % \l_module_foo_tl @@ -1195,10 +1195,15 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@expl@provides@file@@Nnnnnn, \@expl@provides@generic@@wnnw} +% \begin{macro}{\@expl@provides@file@@Nnnnnn} +% \begin{macro}{\@expl@provides@file@@N} +% \begin{macro}{\@expl@provides@generic@@wnnw} % We need to check the existence of the % \cs[no-index]{Provides\meta{thing}}, since we need to load this very -% early in the \LaTeXe{} kernel. +% early in the \LaTeXe{} kernel. The gymnastics with the version identifier +% argument allow for the case where it starts with a \texttt{v} and the one +% where it does not: formally the \texttt{v} is not part of the version, +% but a lot of people include it. % \begin{macrocode} \protected\long\def\@expl@provides@file@@Nnnnnn#1#2#3#4#5#6% {% @@ -1210,15 +1215,18 @@ \else \@expl@provides@generic@@wnnw{#2}% \fi - {#3}[{#4 \ifx\relax#5\relax\else v#5\space\fi #6}]% + {#3}[{#4 \ifx\relax#5\relax\else\@expl@provides@file@@N#5\space\fi #6}]% \ExplSyntaxOn } +\long\def\@expl@provides@file@@N#1{v\if#1v\else#1\fi} \protected\long\def\@expl@provides@generic@@wnnw#1\fi#2[#3]% {% \immediate\write-1{#1: #2 #3}% } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % Load the business end: this leaves \cs{expl3} syntax on. % The test ensures we only load once without needing to know if diff --git a/macros/latex/contrib/l3kernel/expl3.pdf b/macros/latex/contrib/l3kernel/expl3.pdf Binary files differindex 67c571e2b8..f291da03e6 100644 --- a/macros/latex/contrib/l3kernel/expl3.pdf +++ b/macros/latex/contrib/l3kernel/expl3.pdf diff --git a/macros/latex/contrib/l3kernel/interface3.pdf b/macros/latex/contrib/l3kernel/interface3.pdf Binary files differindex a0daf6f920..86a42f9a42 100644 --- a/macros/latex/contrib/l3kernel/interface3.pdf +++ b/macros/latex/contrib/l3kernel/interface3.pdf diff --git a/macros/latex/contrib/l3kernel/interface3.tex b/macros/latex/contrib/l3kernel/interface3.tex index 786c5d7879..4896fa8f8f 100644 --- a/macros/latex/contrib/l3kernel/interface3.tex +++ b/macros/latex/contrib/l3kernel/interface3.tex @@ -62,7 +62,7 @@ for those people who are interested. {latex-team@latex-project.org}% }% } -\date{Released 2023-06-30} +\date{Released 2023-08-03} \pagenumbering{roman} \maketitle diff --git a/macros/latex/contrib/l3kernel/l3basics.dtx b/macros/latex/contrib/l3kernel/l3basics.dtx index e87c039363..7deb536728 100644 --- a/macros/latex/contrib/l3kernel/l3basics.dtx +++ b/macros/latex/contrib/l3kernel/l3basics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3bootstrap.dtx b/macros/latex/contrib/l3kernel/l3bootstrap.dtx index c82fccb0a9..4fb3c840ec 100644 --- a/macros/latex/contrib/l3kernel/l3bootstrap.dtx +++ b/macros/latex/contrib/l3kernel/l3bootstrap.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % @@ -77,7 +77,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[updated = 2017-03-19] +% \begin{function}[updated = 2017-03-19, updated = 2023-08-03] % {\ProvidesExplPackage, \ProvidesExplClass, \ProvidesExplFile} % \begin{syntax} % |\RequirePackage{expl3}| \\ @@ -93,8 +93,8 @@ % \tn{makeatletter} within package and class code.) The \meta{date} should % be given in the format \meta{year}/\meta{month}/\meta{day} or in the ISO % date format \meta{year}-\meta{month}-\meta{day}. If the -% \meta{version} is given then it will be prefixed with \texttt{v} in -% the package identifier line. +% \meta{version} is given then a leading \texttt{v} is optional: if given +% as a \enquote{pure} version string, a \texttt{v} will be appended. % \end{function} % % \begin{function}[updated = 2012-06-04]{\GetIdInfo} diff --git a/macros/latex/contrib/l3kernel/l3box.dtx b/macros/latex/contrib/l3kernel/l3box.dtx index c236ea8282..adcdbfb71e 100644 --- a/macros/latex/contrib/l3kernel/l3box.dtx +++ b/macros/latex/contrib/l3kernel/l3box.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3candidates.dtx b/macros/latex/contrib/l3kernel/l3candidates.dtx index 000779e5a1..d87f1614f5 100644 --- a/macros/latex/contrib/l3kernel/l3candidates.dtx +++ b/macros/latex/contrib/l3kernel/l3candidates.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3cctab.dtx b/macros/latex/contrib/l3kernel/l3cctab.dtx index dba24d5c7b..c8d0715a8d 100644 --- a/macros/latex/contrib/l3kernel/l3cctab.dtx +++ b/macros/latex/contrib/l3kernel/l3cctab.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3clist.dtx b/macros/latex/contrib/l3kernel/l3clist.dtx index d69256ef41..5373e5c642 100644 --- a/macros/latex/contrib/l3kernel/l3clist.dtx +++ b/macros/latex/contrib/l3kernel/l3clist.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3coffins.dtx b/macros/latex/contrib/l3kernel/l3coffins.dtx index 8f1856198c..4a5906d000 100644 --- a/macros/latex/contrib/l3kernel/l3coffins.dtx +++ b/macros/latex/contrib/l3kernel/l3coffins.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3color.dtx b/macros/latex/contrib/l3kernel/l3color.dtx index 0d4f1c6baa..caed570721 100644 --- a/macros/latex/contrib/l3kernel/l3color.dtx +++ b/macros/latex/contrib/l3kernel/l3color.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3debug.dtx b/macros/latex/contrib/l3kernel/l3debug.dtx index 31e7bf22ac..1d78e8a937 100644 --- a/macros/latex/contrib/l3kernel/l3debug.dtx +++ b/macros/latex/contrib/l3kernel/l3debug.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3deprecation.dtx b/macros/latex/contrib/l3kernel/l3deprecation.dtx index 66785fe4ae..1e39e014f9 100644 --- a/macros/latex/contrib/l3kernel/l3deprecation.dtx +++ b/macros/latex/contrib/l3kernel/l3deprecation.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3doc.dtx b/macros/latex/contrib/l3kernel/l3doc.dtx index 6a38db6634..0dc13578a3 100644 --- a/macros/latex/contrib/l3kernel/l3doc.dtx +++ b/macros/latex/contrib/l3kernel/l3doc.dtx @@ -85,7 +85,7 @@ and all files in that bundle must be distributed together. % require you to do updates, if the class changes.}} % % \author{\Team} -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % \maketitle % \tableofcontents % diff --git a/macros/latex/contrib/l3kernel/l3doc.pdf b/macros/latex/contrib/l3kernel/l3doc.pdf Binary files differindex eabd9d67fe..c11381e5ed 100644 --- a/macros/latex/contrib/l3kernel/l3doc.pdf +++ b/macros/latex/contrib/l3kernel/l3doc.pdf diff --git a/macros/latex/contrib/l3kernel/l3docstrip.dtx b/macros/latex/contrib/l3kernel/l3docstrip.dtx index 527c9dcab7..ea811769c0 100644 --- a/macros/latex/contrib/l3kernel/l3docstrip.dtx +++ b/macros/latex/contrib/l3kernel/l3docstrip.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3docstrip.pdf b/macros/latex/contrib/l3kernel/l3docstrip.pdf Binary files differindex 3e8f53870b..65acf03e3e 100644 --- a/macros/latex/contrib/l3kernel/l3docstrip.pdf +++ b/macros/latex/contrib/l3kernel/l3docstrip.pdf diff --git a/macros/latex/contrib/l3kernel/l3expan.dtx b/macros/latex/contrib/l3kernel/l3expan.dtx index 6629ac4c99..373099042e 100644 --- a/macros/latex/contrib/l3kernel/l3expan.dtx +++ b/macros/latex/contrib/l3kernel/l3expan.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3file.dtx b/macros/latex/contrib/l3kernel/l3file.dtx index 03487c7103..a08a0b220a 100644 --- a/macros/latex/contrib/l3kernel/l3file.dtx +++ b/macros/latex/contrib/l3kernel/l3file.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % @@ -450,7 +450,7 @@ % \begin{syntax} % \cs{iow_now:Nn} \meta{stream} \Arg{tokens} % \end{syntax} -% This functions writes \meta{tokens} to the specified +% This function writes \meta{tokens} to the specified % \meta{stream} immediately (\emph{i.e.}~the write operation is called % on expansion of \cs{iow_now:Nn}). % \end{function} @@ -479,7 +479,7 @@ % \begin{syntax} % \cs{iow_shipout:Nn} \meta{stream} \Arg{tokens} % \end{syntax} -% This functions writes \meta{tokens} to the specified +% This function writes \meta{tokens} to the specified % \meta{stream} when the current page is finalised (\emph{i.e.}~at % shipout). The \texttt{x}-type variants expand the \meta{tokens} % at the point where the function is used but \emph{not} when the @@ -502,7 +502,7 @@ % \begin{syntax} % \cs{iow_shipout_x:Nn} \meta{stream} \Arg{tokens} % \end{syntax} -% This functions writes \meta{tokens} to the specified +% This function writes \meta{tokens} to the specified % \meta{stream} when the current page is finalised (\emph{i.e.}~at % shipout). The \meta{tokens} are expanded at the time of writing % in addition to any expansion when the function is used. This makes diff --git a/macros/latex/contrib/l3kernel/l3flag.dtx b/macros/latex/contrib/l3kernel/l3flag.dtx index 43c6d4156e..d615c09543 100644 --- a/macros/latex/contrib/l3kernel/l3flag.dtx +++ b/macros/latex/contrib/l3kernel/l3flag.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-assign.dtx b/macros/latex/contrib/l3kernel/l3fp-assign.dtx index 1ad1248cf2..3286287b0a 100644 --- a/macros/latex/contrib/l3kernel/l3fp-assign.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-assign.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % \maketitle % % \begin{documentation} diff --git a/macros/latex/contrib/l3kernel/l3fp-aux.dtx b/macros/latex/contrib/l3kernel/l3fp-aux.dtx index 5c6e063078..2d1a010cd9 100644 --- a/macros/latex/contrib/l3kernel/l3fp-aux.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-aux.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-basics.dtx b/macros/latex/contrib/l3kernel/l3fp-basics.dtx index 3b370f678e..a51ddccdd6 100644 --- a/macros/latex/contrib/l3kernel/l3fp-basics.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-basics.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-convert.dtx b/macros/latex/contrib/l3kernel/l3fp-convert.dtx index 9168af101d..6e85c09cd8 100644 --- a/macros/latex/contrib/l3kernel/l3fp-convert.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-convert.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-expo.dtx b/macros/latex/contrib/l3kernel/l3fp-expo.dtx index 0882cba89a..75d37919bb 100644 --- a/macros/latex/contrib/l3kernel/l3fp-expo.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-expo.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-extended.dtx b/macros/latex/contrib/l3kernel/l3fp-extended.dtx index 5cfa2b73a0..5daaf4faa9 100644 --- a/macros/latex/contrib/l3kernel/l3fp-extended.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-extended.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-logic.dtx b/macros/latex/contrib/l3kernel/l3fp-logic.dtx index 4a549bdba9..bdc30332ff 100644 --- a/macros/latex/contrib/l3kernel/l3fp-logic.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-logic.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-parse.dtx b/macros/latex/contrib/l3kernel/l3fp-parse.dtx index 0306a25add..3cf349f50e 100644 --- a/macros/latex/contrib/l3kernel/l3fp-parse.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-parse.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-random.dtx b/macros/latex/contrib/l3kernel/l3fp-random.dtx index 348b582dab..25e64b88e1 100644 --- a/macros/latex/contrib/l3kernel/l3fp-random.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-random.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-round.dtx b/macros/latex/contrib/l3kernel/l3fp-round.dtx index 4e72114d26..9d81df31ce 100644 --- a/macros/latex/contrib/l3kernel/l3fp-round.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-round.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-traps.dtx b/macros/latex/contrib/l3kernel/l3fp-traps.dtx index 97243134c0..a413bec127 100644 --- a/macros/latex/contrib/l3kernel/l3fp-traps.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-traps.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % \maketitle % % \begin{documentation} diff --git a/macros/latex/contrib/l3kernel/l3fp-trig.dtx b/macros/latex/contrib/l3kernel/l3fp-trig.dtx index b1638acc75..19701831a0 100644 --- a/macros/latex/contrib/l3kernel/l3fp-trig.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-trig.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp.dtx b/macros/latex/contrib/l3kernel/l3fp.dtx index 0e587e842c..8ea5679f44 100644 --- a/macros/latex/contrib/l3kernel/l3fp.dtx +++ b/macros/latex/contrib/l3kernel/l3fp.dtx @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fparray.dtx b/macros/latex/contrib/l3kernel/l3fparray.dtx index fc94eca3af..149319bde5 100644 --- a/macros/latex/contrib/l3kernel/l3fparray.dtx +++ b/macros/latex/contrib/l3kernel/l3fparray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3int.dtx b/macros/latex/contrib/l3kernel/l3int.dtx index e6d430c192..a4031b8d44 100644 --- a/macros/latex/contrib/l3kernel/l3int.dtx +++ b/macros/latex/contrib/l3kernel/l3int.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3intarray.dtx b/macros/latex/contrib/l3kernel/l3intarray.dtx index 111e889fc9..697d51d7f0 100644 --- a/macros/latex/contrib/l3kernel/l3intarray.dtx +++ b/macros/latex/contrib/l3kernel/l3intarray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3kernel-functions.dtx b/macros/latex/contrib/l3kernel/l3kernel-functions.dtx index a1121dd0ce..d81cd34561 100644 --- a/macros/latex/contrib/l3kernel/l3kernel-functions.dtx +++ b/macros/latex/contrib/l3kernel/l3kernel-functions.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3keys.dtx b/macros/latex/contrib/l3kernel/l3keys.dtx index e89ebb176d..4a11b0fe75 100644 --- a/macros/latex/contrib/l3kernel/l3keys.dtx +++ b/macros/latex/contrib/l3kernel/l3keys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % @@ -176,8 +176,9 @@ % keyname .code:n = Some~code~using~#1 % } % \end{verbatim} -% Note that with the exception of the special |.undefine:| property, all -% key properties define the key within the current \TeX{} scope. +% Note that all key properties define the key within the current \TeX{} group, +% with an exception that the special |.undefine:| property \emph{undefines} the +% key within the current \TeX{} group. % % \begin{function}[updated = 2013-07-08] % {.bool_set:N, .bool_set:c, .bool_gset:N, .bool_gset:c} @@ -513,7 +514,7 @@ % \begin{syntax} % \meta{key} .undefine: % \end{syntax} -% Removes the definition of the \meta{key} within the current scope. +% Removes the definition of the \meta{key} within the current \TeX{} group. % \end{function} % % \begin{function}[added = 2015-07-14]{.value_forbidden:n} @@ -2969,7 +2970,7 @@ % } % \begin{macro}{\@@_set_selective:} % A shared system once again. First, set the current path and add a -% default if needed. There are then checks to see if the a value is +% default if needed. There are then checks to see if a value is % required or forbidden. If everything passes, move on to execute the % code. % \begin{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3legacy.dtx b/macros/latex/contrib/l3kernel/l3legacy.dtx index 6838bf11c6..511ddf655f 100644 --- a/macros/latex/contrib/l3kernel/l3legacy.dtx +++ b/macros/latex/contrib/l3kernel/l3legacy.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3luatex.dtx b/macros/latex/contrib/l3kernel/l3luatex.dtx index afc0605a61..1ec2d5aa98 100644 --- a/macros/latex/contrib/l3kernel/l3luatex.dtx +++ b/macros/latex/contrib/l3kernel/l3luatex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3msg.dtx b/macros/latex/contrib/l3kernel/l3msg.dtx index 0898334f51..e44e11c547 100644 --- a/macros/latex/contrib/l3kernel/l3msg.dtx +++ b/macros/latex/contrib/l3kernel/l3msg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3names.dtx b/macros/latex/contrib/l3kernel/l3names.dtx index 2235524d7b..d928f60aec 100644 --- a/macros/latex/contrib/l3kernel/l3names.dtx +++ b/macros/latex/contrib/l3kernel/l3names.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % @@ -783,6 +783,11 @@ \@@_primitive:NN \XeTeXvariationmin \tex_XeTeXvariationmin:D \@@_primitive:NN \XeTeXvariationname \tex_XeTeXvariationname:D \@@_primitive:NN \XeTeXversion \tex_XeTeXversion:D + \@@_primitive:NN \XeTeXselectorcode \tex_XeTeXselectorcode:D + \@@_primitive:NN \XeTeXinterwordspaceshaping + \tex_XeTeXinterwordspaceshaping:D + \@@_primitive:NN \XeTeXhyphenatablelength + \tex_XeTeXhyphenatablelength:D % \end{macrocode} % Primitives from \pdfTeX{} that \XeTeX{} renames: also helps with % \LuaTeX{}. @@ -797,6 +802,7 @@ \@@_primitive:NN \primitive \tex_primitive:D \@@_primitive:NN \resettimer \tex_resettimer:D \@@_primitive:NN \shellescape \tex_shellescape:D + \@@_primitive:NN \XeTeXprotrudechars \tex_protrudechars:D % \end{macrocode} % Primitives from \LuaTeX{}, some of which have been ported back to % \XeTeX{}. @@ -813,17 +819,21 @@ \@@_primitive:NN \begincsname \tex_begincsname:D \@@_primitive:NN \bodydir \tex_bodydir:D \@@_primitive:NN \bodydirection \tex_bodydirection:D + \@@_primitive:NN \boundary \tex_boundary:D \@@_primitive:NN \boxdir \tex_boxdir:D \@@_primitive:NN \boxdirection \tex_boxdirection:D \@@_primitive:NN \breakafterdirmode \tex_breakafterdirmode:D \@@_primitive:NN \catcodetable \tex_catcodetable:D \@@_primitive:NN \clearmarks \tex_clearmarks:D +% \@@_primitive:NN \compoundhyphenmode +% \tex_compoundhyphenmode:D % not documented in manual \@@_primitive:NN \crampeddisplaystyle \tex_crampeddisplaystyle:D \@@_primitive:NN \crampedscriptscriptstyle \tex_crampedscriptscriptstyle:D \@@_primitive:NN \crampedscriptstyle \tex_crampedscriptstyle:D \@@_primitive:NN \crampedtextstyle \tex_crampedtextstyle:D \@@_primitive:NN \csstring \tex_csstring:D + \@@_primitive:NN \deferred \tex_deferred:D \@@_primitive:NN \discretionaryligaturemode \tex_discretionaryligaturemode:D \@@_primitive:NN \directlua \tex_directlua:D @@ -836,10 +846,13 @@ \@@_primitive:NN \etoksapp \tex_etoksapp:D \@@_primitive:NN \etokspre \tex_etokspre:D \@@_primitive:NN \exceptionpenalty \tex_exceptionpenalty:D + \@@_primitive:NN \exhyphenchar \tex_exhyphenchar:D \@@_primitive:NN \explicithyphenpenalty \tex_explicithyphenpenalty:D \@@_primitive:NN \expanded \tex_expanded:D \@@_primitive:NN \explicitdiscretionary \tex_explicitdiscretionary:D \@@_primitive:NN \firstvalidlanguage \tex_firstvalidlanguage:D +% \@@_primitive:NN \fixupboxesmode +% \tex_fixupboxesmode:D % not documented in manual \@@_primitive:NN \fontid \tex_fontid:D \@@_primitive:NN \formatname \tex_formatname:D \@@_primitive:NN \hjcode \tex_hjcode:D @@ -848,6 +861,10 @@ \@@_primitive:NN \hyphenationmin \tex_hyphenationmin:D \@@_primitive:NN \hyphenpenaltymode \tex_hyphenpenaltymode:D \@@_primitive:NN \gleaders \tex_gleaders:D + \@@_primitive:NN \glet \tex_glet:D + \@@_primitive:NN \glyphdimensionsmode \tex_glyphdimensionsmode:D + \@@_primitive:NN \gtoksapp \tex_gtoksapp:D + \@@_primitive:NN \gtokspre \tex_gtokspre:D \@@_primitive:NN \ifcondition \tex_ifcondition:D \@@_primitive:NN \immediateassigned \tex_immediateassigned:D \@@_primitive:NN \immediateassignment \tex_immediateassignment:D @@ -880,10 +897,16 @@ \@@_primitive:NN \mathdisplayskipmode \tex_mathdisplayskipmode:D \@@_primitive:NN \matheqdirmode \tex_matheqdirmode:D \@@_primitive:NN \matheqnogapstep \tex_matheqnogapstep:D + \@@_primitive:NN \mathflattenmode \tex_mathflattenmode:D + \@@_primitive:NN \mathitalicsmode \tex_mathitalicsmode:D \@@_primitive:NN \mathnolimitsmode \tex_mathnolimitsmode:D \@@_primitive:NN \mathoption \tex_mathoption:D \@@_primitive:NN \mathpenaltiesmode \tex_mathpenaltiesmode:D \@@_primitive:NN \mathrulesfam \tex_mathrulesfam:D +% \@@_primitive:NN \mathrulesmode +% \tex_mathrulesmode:D % not documented in manual +% \@@_primitive:NN \mathrulethicknessmode +% \tex_mathrulethicknessmode:D % not documented in manual \@@_primitive:NN \mathscriptsmode \tex_mathscriptsmode:D \@@_primitive:NN \mathscriptboxmode \tex_mathscriptboxmode:D \@@_primitive:NN \mathscriptcharmode \tex_mathscriptcharmode:D @@ -914,6 +937,7 @@ \@@_primitive:NN \preexhyphenchar \tex_preexhyphenchar:D \@@_primitive:NN \prehyphenchar \tex_prehyphenchar:D \@@_primitive:NN \prerelpenalty \tex_prerelpenalty:D + \@@_primitive:NN \protrusionboundary \tex_protrusionboundary:D \@@_primitive:NN \rightghost \tex_rightghost:D \@@_primitive:NN \savecatcodetable \tex_savecatcodetable:D \@@_primitive:NN \scantextokens \tex_scantextokens:D @@ -930,7 +954,11 @@ \@@_primitive:NN \toksapp \tex_toksapp:D \@@_primitive:NN \tokspre \tex_tokspre:D \@@_primitive:NN \tpack \tex_tpack:D + \@@_primitive:NN \variablefam \tex_variablefam:D \@@_primitive:NN \vpack \tex_vpack:D + \@@_primitive:NN \wordboundary \tex_wordboundary:D + \@@_primitive:NN \xtoksapp \tex_xtoksapp:D + \@@_primitive:NN \xtokspre \tex_xtokspre:D % \end{macrocode} % Primitives from \pdfTeX{} that \LuaTeX{} renames. % \begin{macrocode} @@ -979,6 +1007,7 @@ \@@_primitive:NN \Udelimiterover \tex_Udelimiterover:D \@@_primitive:NN \Udelimiterunder \tex_Udelimiterunder:D \@@_primitive:NN \Uhextensible \tex_Uhextensible:D + \@@_primitive:NN \Uleft \tex_Uleft:D \@@_primitive:NN \Umathaccent \tex_Umathaccent:D \@@_primitive:NN \Umathaxis \tex_Umathaxis:D \@@_primitive:NN \Umathbinbinspacing \tex_Umathbinbinspacing:D @@ -1123,10 +1152,12 @@ \tex_Umathunderdelimiterbgap:D \@@_primitive:NN \Umathunderdelimitervgap \tex_Umathunderdelimitervgap:D + \@@_primitive:NN \Umiddle \tex_Umiddle:D \@@_primitive:NN \Unosubscript \tex_Unosubscript:D \@@_primitive:NN \Unosuperscript \tex_Unosuperscript:D \@@_primitive:NN \Uoverdelimiter \tex_Uoverdelimiter:D \@@_primitive:NN \Uradical \tex_Uradical:D + \@@_primitive:NN \Uright \tex_Uright:D \@@_primitive:NN \Uroot \tex_Uroot:D \@@_primitive:NN \Uskewed \tex_Uskewed:D \@@_primitive:NN \Uskewedwithdelims \tex_Uskewedwithdelims:D @@ -1182,9 +1213,11 @@ \@@_primitive:NN \pagefistretch \tex_pagefistretch:D \@@_primitive:NN \postbreakpenalty \tex_postbreakpenalty:D \@@_primitive:NN \prebreakpenalty \tex_prebreakpenalty:D + \@@_primitive:NN \ptexfontname \tex_ptexfontname:D \@@_primitive:NN \ptexlineendmode \tex_lineendmode:D \@@_primitive:NN \ptexminorversion \tex_ptexminorversion:D \@@_primitive:NN \ptexrevision \tex_ptexrevision:D + \@@_primitive:NN \ptextracingfonts \tex_ptextracingfonts:D \@@_primitive:NN \ptexversion \tex_ptexversion:D \@@_primitive:NN \readpapersizespecial \tex_readpapersizespecial:D \@@_primitive:NN \scriptbaselineshiftfactor @@ -1198,6 +1231,7 @@ \@@_primitive:NN \textbaselineshiftfactor \tex_textbaselineshiftfactor:D \@@_primitive:NN \tfont \tex_tfont:D + \@@_primitive:NN \tojis \tex_tojis:D \@@_primitive:NN \toucs \tex_toucs:D \@@_primitive:NN \ucs \tex_ucs:D \@@_primitive:NN \xkanjiskip \tex_xkanjiskip:D diff --git a/macros/latex/contrib/l3kernel/l3news.pdf b/macros/latex/contrib/l3kernel/l3news.pdf Binary files differindex d17bc2dd22..301c458e10 100644 --- a/macros/latex/contrib/l3kernel/l3news.pdf +++ b/macros/latex/contrib/l3kernel/l3news.pdf diff --git a/macros/latex/contrib/l3kernel/l3news01.pdf b/macros/latex/contrib/l3kernel/l3news01.pdf Binary files differindex 534d533da0..78f571bcf0 100644 --- a/macros/latex/contrib/l3kernel/l3news01.pdf +++ b/macros/latex/contrib/l3kernel/l3news01.pdf diff --git a/macros/latex/contrib/l3kernel/l3news02.pdf b/macros/latex/contrib/l3kernel/l3news02.pdf Binary files differindex e39c1962b2..76d58342fc 100644 --- a/macros/latex/contrib/l3kernel/l3news02.pdf +++ b/macros/latex/contrib/l3kernel/l3news02.pdf diff --git a/macros/latex/contrib/l3kernel/l3news03.pdf b/macros/latex/contrib/l3kernel/l3news03.pdf Binary files differindex 20bad7ae57..e2d10b7c65 100644 --- a/macros/latex/contrib/l3kernel/l3news03.pdf +++ b/macros/latex/contrib/l3kernel/l3news03.pdf diff --git a/macros/latex/contrib/l3kernel/l3news04.pdf b/macros/latex/contrib/l3kernel/l3news04.pdf Binary files differindex ae829790f9..adcefb4c66 100644 --- a/macros/latex/contrib/l3kernel/l3news04.pdf +++ b/macros/latex/contrib/l3kernel/l3news04.pdf diff --git a/macros/latex/contrib/l3kernel/l3news05.pdf b/macros/latex/contrib/l3kernel/l3news05.pdf Binary files differindex baf24d5bc6..51ab9c8dd0 100644 --- a/macros/latex/contrib/l3kernel/l3news05.pdf +++ b/macros/latex/contrib/l3kernel/l3news05.pdf diff --git a/macros/latex/contrib/l3kernel/l3news06.pdf b/macros/latex/contrib/l3kernel/l3news06.pdf Binary files differindex 906fbf5601..7420362ff3 100644 --- a/macros/latex/contrib/l3kernel/l3news06.pdf +++ b/macros/latex/contrib/l3kernel/l3news06.pdf diff --git a/macros/latex/contrib/l3kernel/l3news07.pdf b/macros/latex/contrib/l3kernel/l3news07.pdf Binary files differindex 828a005655..0ac7ba5514 100644 --- a/macros/latex/contrib/l3kernel/l3news07.pdf +++ b/macros/latex/contrib/l3kernel/l3news07.pdf diff --git a/macros/latex/contrib/l3kernel/l3news08.pdf b/macros/latex/contrib/l3kernel/l3news08.pdf Binary files differindex 3757fb902d..92d705f5d8 100644 --- a/macros/latex/contrib/l3kernel/l3news08.pdf +++ b/macros/latex/contrib/l3kernel/l3news08.pdf diff --git a/macros/latex/contrib/l3kernel/l3news09.pdf b/macros/latex/contrib/l3kernel/l3news09.pdf Binary files differindex 936939db81..b079a34137 100644 --- a/macros/latex/contrib/l3kernel/l3news09.pdf +++ b/macros/latex/contrib/l3kernel/l3news09.pdf diff --git a/macros/latex/contrib/l3kernel/l3news10.pdf b/macros/latex/contrib/l3kernel/l3news10.pdf Binary files differindex 9eaf2116a2..569e3d143b 100644 --- a/macros/latex/contrib/l3kernel/l3news10.pdf +++ b/macros/latex/contrib/l3kernel/l3news10.pdf diff --git a/macros/latex/contrib/l3kernel/l3news11.pdf b/macros/latex/contrib/l3kernel/l3news11.pdf Binary files differindex aaff774ace..c1ceab5a68 100644 --- a/macros/latex/contrib/l3kernel/l3news11.pdf +++ b/macros/latex/contrib/l3kernel/l3news11.pdf diff --git a/macros/latex/contrib/l3kernel/l3news12.pdf b/macros/latex/contrib/l3kernel/l3news12.pdf Binary files differindex cdf7bce3fa..5c7a17e5f5 100644 --- a/macros/latex/contrib/l3kernel/l3news12.pdf +++ b/macros/latex/contrib/l3kernel/l3news12.pdf diff --git a/macros/latex/contrib/l3kernel/l3pdf.dtx b/macros/latex/contrib/l3kernel/l3pdf.dtx index a8f7ed8a01..b14decdfd1 100644 --- a/macros/latex/contrib/l3kernel/l3pdf.dtx +++ b/macros/latex/contrib/l3kernel/l3pdf.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % @@ -255,46 +255,6 @@ % \end{function} % \end{documentation} % -% \section{Deprecated functions} -% -% \begin{function}[added = 2021-02-10]{\pdf_object_new:nn} -% \begin{syntax} -% \cs{pdf_object_new:nn} \Arg{object} \Arg{type} -% \end{syntax} -% Declares \meta{object} as a PDF object of \meta{type}, which should be -% one of -% \begin{itemize} -% \item \texttt{array} -% \item \texttt{dict} -% \item \texttt{fstream} -% \item \texttt{stream} -% \end{itemize} -% The object may be referenced from this point on, and written later -% using \cs{pdf_object_write:nn}. -% -% Deprecated in favor of \cs{pdf_object_new:n}. -% \end{function} -% -% \begin{function}[added = 2021-02-10]{\pdf_object_write:nn, \pdf_object_write:nx} -% \begin{syntax} -% \cs{pdf_object_write:nn} \Arg{object} \Arg{content} -% \end{syntax} -% Writes the \meta{content} as content of the \meta{object}. Depending on the -% \meta{type} declared for the object, the format required for the -% \meta{data} will vary -% \begin{itemize} -% \item[\texttt{array}] A space-separated list of values -% \item[\texttt{dict}] Key--value pairs in the form -% \texttt{/\meta{key} \meta{value}} -% \item[\texttt{fstream}] Two brace groups: \meta{file name} and -% \meta{file content} -% \item[\texttt{stream}] Two brace groups: \meta{attributes (dictionary)} -% and \meta{stream contents} -% \end{itemize} -% -% Deprecated in favor of \cs{pdf_object_write:nnn}. -% \end{function} -% % \begin{implementation} % % \section{\pkg{l3pdf} implementation} diff --git a/macros/latex/contrib/l3kernel/l3prefixes.csv b/macros/latex/contrib/l3kernel/l3prefixes.csv index 410b927d89..2de6430a12 100644 --- a/macros/latex/contrib/l3kernel/l3prefixes.csv +++ b/macros/latex/contrib/l3kernel/l3prefixes.csv @@ -118,6 +118,7 @@ insert,l3kernel,The LaTeX Project,https://www.latex-project.org/latex3.html,http int,l3kernel,The LaTeX Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2012-09-27,2012-09-27, intarray,l3kernel,The LaTeX Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2018-04-06,2018-04-06, ior,l3kernel,The LaTeX Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2012-09-27,2012-09-27, +iot,iot,Island of TeX,https://islandoftex.gitlab.io,https://gitlab.com/islandoftex/texmf,https://gitlab.com/groups/islandoftex/texmf/-/issues,2023-07-18,2023-07-18, iow,l3kernel,The LaTeX Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2012-09-27,2012-09-27, jiazhu,jiazhu,Qing Lee,https://github.com/CTeX-org/ctex-kit,https://github.com/CTeX-org/ctex-kit.git,https://github.com/CTeX-org/ctex-kit/issues,2020-05-17,2020-05-17, job,l3kernel,The LaTeX Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2021-04-23,2021-04-23, @@ -201,6 +202,7 @@ ptex,l3kernel,The LaTeX Project,https://www.latex-project.org/latex3.html,https: ptxcd,ptxcd, Marei Peischl,,,,2020-07-27,2020-07-27,Used for specific corporate design templates qrbill,qrbill,Marei Peischl,https://github.com/peiTeX/qrbill,https://github.com/peiTeX/qrbill.git,https://github.com/peiTeX/qrbill/issues,2020-06-27,2020-06-27, quark,l3kernel,The LaTeX Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2012-09-27,2012-09-27, +rainbow,beamertheme-rainbow,samcarter,https://github.com/samcarter/beamertheme-rainbow,https://github.com/samcarter/beamertheme-rainbow,https://github.com/samcarter/beamertheme-rainbow/issues,2023-07-04,2023-07-04, randomwalk,randomwalk,Bruno Le Floch,https://github.com/blefloch/latex-randomwalk,https://github.com/blefloch/latex-randomwalk.git,https://github.com/blefloch/latex-randomwalk/issues,2013-03-16,2015-09-22, rawobjects,rawobjects,Paolo De Donato,https://github.com/Loara/lt3rawobjects,https://github.com/Loara/lt3rawobjects/lt3rawobjects.git,https://github.com/Loara/lt3rawobjects/issues,2022-07-19,2022-07-19, recursion,l3kernel,The LaTeX Project,https://www.latex-project.org/latex3.html,https://github.com/latex3/latex3.git,https://github.com/latex3/latex3/issues,2018-05-12,2018-05-12, diff --git a/macros/latex/contrib/l3kernel/l3prefixes.pdf b/macros/latex/contrib/l3kernel/l3prefixes.pdf Binary files differindex 3dd67ab49b..3bb96153dd 100644 --- a/macros/latex/contrib/l3kernel/l3prefixes.pdf +++ b/macros/latex/contrib/l3kernel/l3prefixes.pdf diff --git a/macros/latex/contrib/l3kernel/l3prg.dtx b/macros/latex/contrib/l3kernel/l3prg.dtx index 1c96879388..ec1198fbd4 100644 --- a/macros/latex/contrib/l3kernel/l3prg.dtx +++ b/macros/latex/contrib/l3kernel/l3prg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3prop.dtx b/macros/latex/contrib/l3kernel/l3prop.dtx index 10167f4baf..c3e0aacd07 100644 --- a/macros/latex/contrib/l3kernel/l3prop.dtx +++ b/macros/latex/contrib/l3kernel/l3prop.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % @@ -212,7 +212,7 @@ % \cs{prop_concat:NNN} \meta{property list_1} \meta{property list_2} \meta{property list3} % \end{syntax} % Combines the key--value pairs of \meta{property list_2} and -% \meta{property list_3}, and saves the result in \meta{pproperty list_1}. If a +% \meta{property list_3}, and saves the result in \meta{property list_1}. If a % key appears in both \meta{property list_2} and \meta{property list_3} then the % last value, namely the value in \meta{property list_3} is kept. % \end{function} diff --git a/macros/latex/contrib/l3kernel/l3quark.dtx b/macros/latex/contrib/l3kernel/l3quark.dtx index f8d94d4c0f..bf09f3f528 100644 --- a/macros/latex/contrib/l3kernel/l3quark.dtx +++ b/macros/latex/contrib/l3kernel/l3quark.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3regex.dtx b/macros/latex/contrib/l3kernel/l3regex.dtx index 6d9cc425c0..0e02c1f31d 100644 --- a/macros/latex/contrib/l3kernel/l3regex.dtx +++ b/macros/latex/contrib/l3kernel/l3regex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3seq.dtx b/macros/latex/contrib/l3kernel/l3seq.dtx index 4789fff3ce..b43e47db78 100644 --- a/macros/latex/contrib/l3kernel/l3seq.dtx +++ b/macros/latex/contrib/l3kernel/l3seq.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3skip.dtx b/macros/latex/contrib/l3kernel/l3skip.dtx index 1d92789b5b..c67207b8ed 100644 --- a/macros/latex/contrib/l3kernel/l3skip.dtx +++ b/macros/latex/contrib/l3kernel/l3skip.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3sort.dtx b/macros/latex/contrib/l3kernel/l3sort.dtx index d23f9e366c..0832a3a527 100644 --- a/macros/latex/contrib/l3kernel/l3sort.dtx +++ b/macros/latex/contrib/l3kernel/l3sort.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3str-convert.dtx b/macros/latex/contrib/l3kernel/l3str-convert.dtx index f82cd50ac9..80d8d7cbd9 100644 --- a/macros/latex/contrib/l3kernel/l3str-convert.dtx +++ b/macros/latex/contrib/l3kernel/l3str-convert.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3str.dtx b/macros/latex/contrib/l3kernel/l3str.dtx index c05afad054..10bebf2611 100644 --- a/macros/latex/contrib/l3kernel/l3str.dtx +++ b/macros/latex/contrib/l3kernel/l3str.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3styleguide.pdf b/macros/latex/contrib/l3kernel/l3styleguide.pdf Binary files differindex b9c752b392..c28d4b27e8 100644 --- a/macros/latex/contrib/l3kernel/l3styleguide.pdf +++ b/macros/latex/contrib/l3kernel/l3styleguide.pdf diff --git a/macros/latex/contrib/l3kernel/l3styleguide.tex b/macros/latex/contrib/l3kernel/l3styleguide.tex index 2f26c99c9d..b7d0934013 100644 --- a/macros/latex/contrib/l3kernel/l3styleguide.tex +++ b/macros/latex/contrib/l3kernel/l3styleguide.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2023-06-30} +\date{Released 2023-08-03} \begin{document} diff --git a/macros/latex/contrib/l3kernel/l3syntax-changes.pdf b/macros/latex/contrib/l3kernel/l3syntax-changes.pdf Binary files differindex 7c02d2fb8b..e1ec150b8a 100644 --- a/macros/latex/contrib/l3kernel/l3syntax-changes.pdf +++ b/macros/latex/contrib/l3kernel/l3syntax-changes.pdf diff --git a/macros/latex/contrib/l3kernel/l3syntax-changes.tex b/macros/latex/contrib/l3kernel/l3syntax-changes.tex index 66d24d8910..431b6516fa 100644 --- a/macros/latex/contrib/l3kernel/l3syntax-changes.tex +++ b/macros/latex/contrib/l3kernel/l3syntax-changes.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2023-06-30} +\date{Released 2023-08-03} \newcommand{\TF}{\textit{(TF)}} diff --git a/macros/latex/contrib/l3kernel/l3sys.dtx b/macros/latex/contrib/l3kernel/l3sys.dtx index 4d7bad1082..301211dca6 100644 --- a/macros/latex/contrib/l3kernel/l3sys.dtx +++ b/macros/latex/contrib/l3kernel/l3sys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3term-glossary.pdf b/macros/latex/contrib/l3kernel/l3term-glossary.pdf Binary files differindex 900d65805e..f780345651 100644 --- a/macros/latex/contrib/l3kernel/l3term-glossary.pdf +++ b/macros/latex/contrib/l3kernel/l3term-glossary.pdf diff --git a/macros/latex/contrib/l3kernel/l3term-glossary.tex b/macros/latex/contrib/l3kernel/l3term-glossary.tex index 6eaf8bda57..77039fa4b8 100644 --- a/macros/latex/contrib/l3kernel/l3term-glossary.tex +++ b/macros/latex/contrib/l3kernel/l3term-glossary.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2023-06-30} +\date{Released 2023-08-03} \newcommand{\TF}{\textit{(TF)}} diff --git a/macros/latex/contrib/l3kernel/l3text-case.dtx b/macros/latex/contrib/l3kernel/l3text-case.dtx index 8b55915aec..dd6e72f25e 100644 --- a/macros/latex/contrib/l3kernel/l3text-case.dtx +++ b/macros/latex/contrib/l3kernel/l3text-case.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % @@ -147,6 +147,7 @@ % \begin{macro}[EXP]{\@@_change_case_math_group:nnNn} % \begin{macro}[EXP]{\@@_change_case_math_space:nnNw} % \begin{macro}[EXP]{\@@_change_case_cs_check:nnN} +% \begin{macro}[EXP]{\@@_change_case_cs_check:nnn} % \begin{macro}[EXP]{\@@_change_case_exclude:nnN} % \begin{macro}[EXP]{\@@_change_case_exclude:nnnN} % \begin{macro}[EXP]{\@@_change_case_exclude:nnNN} @@ -443,13 +444,18 @@ % \begin{macrocode} \cs_new:Npn \@@_change_case_cs_check:nnN #1#2#3 { - \token_if_cs:NTF #3 - { \@@_change_case_exclude:nnN {#1} {#2} } + \exp_args:Ne \@@_change_case_cs_check:nnn + { \@@_token_to_explicit:N #3 } {#1} {#2} + } +\cs_new:Npn \@@_change_case_cs_check:nnn #1#2#3 + { + \token_if_cs:NTF #1 + { \@@_change_case_exclude:nnN {#2} {#3} } { \@@_codepoint_process:nN - { \use:c { @@_change_case_custom_ #1 :nnn } {#1} {#2} } + { \use:c { @@_change_case_custom_ #2 :nnn } {#2} {#3} } } - #3 + #1 } % \end{macrocode} % To deal with a control sequence there is first a need to test if it is @@ -853,6 +859,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\text_declare_case_equivalent:Nn} % Create equivalents to allow replacement. diff --git a/macros/latex/contrib/l3kernel/l3text-map.dtx b/macros/latex/contrib/l3kernel/l3text-map.dtx index a2d6d48c10..432bae2b93 100644 --- a/macros/latex/contrib/l3kernel/l3text-map.dtx +++ b/macros/latex/contrib/l3kernel/l3text-map.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3text-purify.dtx b/macros/latex/contrib/l3kernel/l3text-purify.dtx index a8b84eb10c..8a97b401fc 100644 --- a/macros/latex/contrib/l3kernel/l3text-purify.dtx +++ b/macros/latex/contrib/l3kernel/l3text-purify.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3text.dtx b/macros/latex/contrib/l3kernel/l3text.dtx index eb97fca1fd..40a4dc4a5d 100644 --- a/macros/latex/contrib/l3kernel/l3text.dtx +++ b/macros/latex/contrib/l3kernel/l3text.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % @@ -929,7 +929,6 @@ % \begin{macro}[EXP]{\@@_expand_math_space:Nw} % \begin{macro}[EXP] % { -% \@@_expand_implicit:N , % \@@_expand_explicit:N , % \@@_expand_exclude:N % } diff --git a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx index 9c80c0fb9a..411951c303 100644 --- a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx +++ b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3tl.dtx b/macros/latex/contrib/l3kernel/l3tl.dtx index af9ed91866..117c50faa7 100644 --- a/macros/latex/contrib/l3kernel/l3tl.dtx +++ b/macros/latex/contrib/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3token.dtx b/macros/latex/contrib/l3kernel/l3token.dtx index 8af32dff06..5d9d04b9bc 100644 --- a/macros/latex/contrib/l3kernel/l3token.dtx +++ b/macros/latex/contrib/l3kernel/l3token.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3unicode.dtx b/macros/latex/contrib/l3kernel/l3unicode.dtx index e4dba1753f..d5715792e2 100644 --- a/macros/latex/contrib/l3kernel/l3unicode.dtx +++ b/macros/latex/contrib/l3kernel/l3unicode.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-06-30} +% \date{Released 2023-08-03} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/source3.pdf b/macros/latex/contrib/l3kernel/source3.pdf Binary files differindex 041c358d4f..8d5e7dc74a 100644 --- a/macros/latex/contrib/l3kernel/source3.pdf +++ b/macros/latex/contrib/l3kernel/source3.pdf diff --git a/macros/latex/contrib/l3kernel/source3.tex b/macros/latex/contrib/l3kernel/source3.tex index 4cf2cca1c2..8ad3093ca7 100644 --- a/macros/latex/contrib/l3kernel/source3.tex +++ b/macros/latex/contrib/l3kernel/source3.tex @@ -53,7 +53,7 @@ for those people who are interested. {latex-team@latex-project.org}% }% } -\date{Released 2023-06-30} +\date{Released 2023-08-03} \pagenumbering{roman} \maketitle diff --git a/macros/latex/contrib/siunitx/CHANGELOG.md b/macros/latex/contrib/siunitx/CHANGELOG.md index d246599ef5..e055add8b6 100644 --- a/macros/latex/contrib/siunitx/CHANGELOG.md +++ b/macros/latex/contrib/siunitx/CHANGELOG.md @@ -7,6 +7,12 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ## [Unreleased] +## [v3.3.2] - 2023-08-03 + +### Fixed +- Move an `expl3` variant defintion (see issue + [\#680](https://github.com/josephwright/siunitx/issues/680)) + ## [v3.3.1] - 2023-08-01 ### Fixed @@ -1978,7 +1984,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to ### Added - First public testing release (as `si`) -[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.3.1...HEAD +[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.3.2...HEAD +[v3.3.2]: https://github.com/josephwright/siunitx/compare/v3.3.1...v3.3.2 [v3.3.1]: https://github.com/josephwright/siunitx/compare/v3.3.0...v3.3.1 [v3.3.0]: https://github.com/josephwright/siunitx/compare/v3.2.9...v3.3.0 [v3.2.9]: https://github.com/josephwright/siunitx/compare/v3.2.8...v3.2.9 diff --git a/macros/latex/contrib/siunitx/README.md b/macros/latex/contrib/siunitx/README.md index 0d065403cf..1288929a5d 100644 --- a/macros/latex/contrib/siunitx/README.md +++ b/macros/latex/contrib/siunitx/README.md @@ -1,5 +1,6 @@ -siunitx - A comprehensive (SI) units package -============================================ +# `siunitx` - A comprehensive (SI) units package + +## Description Physical quantities have both numbers and units, and each physical quantity should be expressed as the product of a number and a unit. Typesetting physical @@ -13,3 +14,11 @@ consistent way. The package has an extended set of configuration options which make it possible to follow varying typographic conventions with the same input syntax. The package includes automated processing of numbers and units, and the ability to control tabular alignment of numbers. + +## Author + +This package is maintained by Joseph Wright: joseph.wright@morningstar2.co.uk + +## License + +Released under the LaTeX Project Public License v1.3c or later. See http://www.latex-project.org/lppl.txt
\ No newline at end of file diff --git a/macros/latex/contrib/siunitx/siunitx-code.pdf b/macros/latex/contrib/siunitx/siunitx-code.pdf Binary files differindex 669eb11190..1f82d980c2 100644 --- a/macros/latex/contrib/siunitx/siunitx-code.pdf +++ b/macros/latex/contrib/siunitx/siunitx-code.pdf diff --git a/macros/latex/contrib/siunitx/siunitx-compound.dtx b/macros/latex/contrib/siunitx/siunitx-compound.dtx index b16aa63f30..46d2404136 100644 --- a/macros/latex/contrib/siunitx/siunitx-compound.dtx +++ b/macros/latex/contrib/siunitx/siunitx-compound.dtx @@ -365,7 +365,6 @@ % \section{\pkg{siunitx-compound} implementation} % % \begin{macrocode} -\cs_generate_variant:Nn \keys_set:nn { nx } \cs_generate_variant:Nn \seq_use:Nnnn { NVVV } % \end{macrocode} % diff --git a/macros/latex/contrib/siunitx/siunitx-number.dtx b/macros/latex/contrib/siunitx/siunitx-number.dtx index 7ee8fc1653..a46613e42e 100644 --- a/macros/latex/contrib/siunitx/siunitx-number.dtx +++ b/macros/latex/contrib/siunitx/siunitx-number.dtx @@ -710,6 +710,7 @@ % % Variants not provided by \pkg{expl3}. % \begin{macrocode} +\cs_generate_variant:Nn \keys_set:nn { nx } \cs_generate_variant:Nn \tl_if_blank:nTF { f } \cs_generate_variant:Nn \tl_if_blank_p:n { f } \cs_generate_variant:Nn \tl_if_in:NnTF { NV } diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx index 765062ae21..a6e8b05866 100644 --- a/macros/latex/contrib/siunitx/siunitx.dtx +++ b/macros/latex/contrib/siunitx/siunitx.dtx @@ -122,7 +122,7 @@ % % Identify the package and give the over all version information. % \begin{macrocode} -\ProvidesExplPackage {siunitx} {2023-08-01} {3.3.1} +\ProvidesExplPackage {siunitx} {2023-08-03} {3.3.2} {A comprehensive (SI) units package} % \end{macrocode} % diff --git a/macros/latex/contrib/siunitx/siunitx.pdf b/macros/latex/contrib/siunitx/siunitx.pdf Binary files differindex c92c1d87cf..8d6c1a9c4c 100644 --- a/macros/latex/contrib/siunitx/siunitx.pdf +++ b/macros/latex/contrib/siunitx/siunitx.pdf diff --git a/macros/luatex/latex/lualinalg/2dvec.jpg b/macros/luatex/latex/lualinalg/2dvec.jpg Binary files differdeleted file mode 100644 index 7b857ab6d0..0000000000 --- a/macros/luatex/latex/lualinalg/2dvec.jpg +++ /dev/null diff --git a/macros/luatex/latex/lualinalg/3dvec.jpg b/macros/luatex/latex/lualinalg/3dvec.jpg Binary files differdeleted file mode 100644 index 1f84c4044f..0000000000 --- a/macros/luatex/latex/lualinalg/3dvec.jpg +++ /dev/null diff --git a/macros/luatex/latex/lualinalg/README.txt b/macros/luatex/latex/lualinalg/README.txt index 6b347a9417..03a71035cb 100644 --- a/macros/luatex/latex/lualinalg/README.txt +++ b/macros/luatex/latex/lualinalg/README.txt @@ -1,3 +1,8 @@ +# The lualinalg package +# version 1.3 +# Authors: Chetan Shirore and Ajit Kumar +# Email: mathsbeauty@gmail.com + # Introduction The lualinalg package is developed to perform operations on vectors and matrices defined over the field of real or complex numbers inside LaTeX documents. It provides flexible ways for defining and displaying vectors and matrices. diff --git a/macros/luatex/latex/lualinalg/lualinalg-complex.lua b/macros/luatex/latex/lualinalg/lualinalg-complex.lua new file mode 100644 index 0000000000..68fd055b5e --- /dev/null +++ b/macros/luatex/latex/lualinalg/lualinalg-complex.lua @@ -0,0 +1,347 @@ +--Version=1.3, Date=30-July-2023 +-- provides module for complex numbers +--Contains a modified version of the file complex.lua. It is availalbe on the link https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua. This is licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions. +--Licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions. + +frac= require("luamaths-fractions") +complex = {} +complex_meta = {} + +local function parse_scalar(s, pos0) + local x, n, pos = s:match('^([+-]?[%d%.]+)(.?)()', pos0) + if not x then return end + if n == 'e' or n == 'E' then + local x2, n2, pos2 = s:match('^([+-]?%d+)(.?)()', pos) + if not x2 then error 'number format error' end + x = tonumber(x..n..x2) + if not x then error 'number format error' end + return x, n2, pos2 + else + x = tonumber(x) + if not x then error 'number format error' end + return x, n, pos + end +end +local function parse_component(s, pos0) + local x, n, pos = parse_scalar(s, pos0) + if not x then + local x2, n2, pos2 = s:match('^([+-]?)(i)()$', pos0) + if not x2 then error 'number format error' end + return (x2=='-' and -1 or 1), n2, pos2 + end + if n == '/' then + local x2, n2, pos2 = parse_scalar(s, pos) + x = x / x2 + return x, n2, pos2 + end + return x, n, pos +end +local function parse_complex(s) + local x, n, pos = parse_component(s, 1) + if n == '+' or n == '-' then + local x2, n2, pos2 = parse_component(s, pos) + if n2 ~= 'i' or pos2 ~= #s+1 then error 'number format error' end + if n == '-' then x2 = - x2 end + return x, x2 + elseif n == '' then + return x, 0 + elseif n == 'i' then + if pos ~= #s+1 then error 'number format error' end + return 0, x + else + error 'number format error' + end +end + +function complex.to( num ) + -- check for table type + if type( num ) == "table" then + -- check for a complex number + if getmetatable( num ) == complex_meta then + return num + end + + if getmetatable( num) == frac_mt then + return setmetatable( { num, 0 }, complex_meta ) + end + + local real,imag = tonumber( num[1] ),tonumber( num[2] ) + if real and imag then + return setmetatable( { real,imag }, complex_meta ) + end + return + end + local isnum = tonumber( num ) + if isnum then + return setmetatable( { isnum,0 }, complex_meta ) + end + if type( num ) == "string" then + local real, imag = parse_complex(num) + return setmetatable( { real, imag }, complex_meta ) + end +end + +setmetatable( complex, { __call = function( _,num ) return complex.to( num ) end } ) + +function complex.new( x,y) + return setmetatable( {x,y}, complex_meta ) +end + +lcomplex = complex.new +function complex.type( arg ) + if getmetatable( arg ) == complex_meta then + return "complex" + end +end + +function complex.convpolar( radius, phi ) + return setmetatable( { radius * math.cos( phi ), radius * math.sin( phi ) }, complex_meta ) +end + +function complex.convpolardeg( radius, phi ) + phi = phi/180 * math.pi + return setmetatable( { radius * math.cos( phi ), radius * math.sin( phi ) }, complex_meta ) +end + +function complex.tostring( cx,formatstr ) + imunit = "\\imUnit" + local real,imag = cx[1],cx[2] + if type(cx[1]) ~= "table" and type(cx[2]) ~= "table" then + if imag == 0 then + return real + elseif real == 0 then + return ((imag==1 and "") or (imag==-1 and "-") or imag)..imunit + elseif imag > 0 then + return real.."+"..(imag==1 and "" or imag)..imunit + end + return real..(imag==-1 and "-" or imag)..imunit + end + + if type(cx[1]) == "table" and type(cx[2]) ~= "table" then + if cx[2] == 0 then + return frac.tostring(cx[1]) + end + if cx[2] > 0 then + return frac.tostring(cx[1]).. "+"..(imag==1 and "" or imag)..imunit + end + if cx[2] < 0 then + return frac.tostring(cx[1])..(imag==-1 and "-" or imag)..imunit + end + + end + + if type(cx[1]) ~= "table" and type(cx[2]) == "table" then + if frac.toFnumber(cx[2])==0 then return cx[1] end + return cx[1].."+"..frac.tostring(cx[2])..imunit + end + + if type(cx[1]) == "table" and type(cx[2]) == "table" then + if frac.toFnumber(cx[1]) == 0 and frac.toFnumber(cx[2]) ~= 0 then + return frac.tostring(cx[2])..imunit + end + + if frac.toFnumber(cx[2]) == 0 then + return frac.tostring(cx[1] + 0) + end + + if cx[2].d == 1 then + if cx[2].n > 0 then + return frac.tostring(cx[1]).. "+"..(cx[2].n==1 and "" or math.floor(cx[2].n))..imunit + end + if cx[2].n < 0 then + return frac.tostring(cx[1])..(cx[2].n==-1 and "-" or math.floor(cx[2].n))..imunit + end + end + end + return frac.tostring(cx[1]).. "+"..frac.tostring(cx[2])..imunit +end + +function complex.print( ... ) + print( complex.tostring( ... ) ) +end + +function complex.polar( cx ) + return math.sqrt( cx[1]^2 + cx[2]^2 ), math.atan2( cx[2], cx[1] ) +end + +function complex.polardeg( cx ) + return math.sqrt( cx[1]^2 + cx[2]^2 ), math.atan2( cx[2], cx[1] ) / math.pi * 180 +end + +function complex.norm2( cx ) + return cx[1]^2 + cx[2]^2 +end + +function complex.abs( cx ) + return math.sqrt( cx[1]^2 + cx[2]^2 ) +end + +function complex.get( cx ) + return cx[1],cx[2] +end + +function complex.set( cx,real,imag ) + cx[1],cx[2] = real,imag +end + +function complex.is( cx,real,imag ) + if cx[1] == real and cx[2] == imag then + return true + end + return false +end + +function complex.copy( cx ) + return setmetatable( { cx[1],cx[2] }, complex_meta ) +end + +function complex.add( cx1,cx2 ) + return setmetatable( { cx1[1]+cx2[1], cx1[2]+cx2[2] }, complex_meta ) +end + +function complex.sub( cx1,cx2 ) + return setmetatable( { cx1[1]-cx2[1], cx1[2]-cx2[2] }, complex_meta ) +end + +function complex.mul( cx1,cx2 ) + return setmetatable( { cx1[1]*cx2[1] - cx1[2]*cx2[2],cx1[1]*cx2[2] + cx1[2]*cx2[1] }, complex_meta ) +end + +function complex.mulnum( cx,num ) + return setmetatable( { cx[1]*num,cx[2]*num }, complex_meta ) +end + +function complex.div( cx1,cx2 ) + local val = cx2[1]*cx2[1] + cx2[2]*cx2[2] + return setmetatable( { (cx1[1]*cx2[1]+cx1[2]*cx2[2])/val,(cx1[2]*cx2[1]-cx1[1]*cx2[2])/val }, complex_meta ) +end + +function complex.divnum( cx,num ) + return setmetatable( { cx[1]/num,cx[2]/num }, complex_meta ) +end + +function complex.pow( cx,num ) + if math.floor( num ) == num then + if num < 0 then + local val = cx[1]^2 + cx[2]^2 + cx = { cx[1]/val,-cx[2]/val } + num = -num + end + local real,imag = cx[1],cx[2] + for i = 2,num do + real,imag = real*cx[1] - imag*cx[2],real*cx[2] + imag*cx[1] + end + return setmetatable( { real,imag }, complex_meta ) + end + local length,phi = math.sqrt( cx[1]^2 + cx[2]^2 )^num, math.atan2( cx[2], cx[1] )*num + return setmetatable( { length * math.cos( phi ), length * math.sin( phi ) }, complex_meta ) +end + +function complex.sqrt( cx ) + local h + local k + + if type(cx[1]) ~= "table" then h = cx[1] end + if type(cx[2]) ~= "table" then k = cx[2] end + + if type(cx[1]) == "table" then h = frac.toFnumber(cx[1]) end + if type(cx[2]) == "table" then k = frac.toFnumber(cx[2]) end + local len = math.sqrt( h^2 + k^2 ) + local sign = ( h<0 and -1) or 1 + return setmetatable( { math.sqrt((h +len)/2), sign*math.sqrt((len-h)/2) }, complex_meta ) +end + +function complex.ln( cx ) + return setmetatable( { math.log(math.sqrt( cx[1]^2 + cx[2]^2 )), + math.atan2( cx[2], cx[1] ) }, complex_meta ) +end + +function complex.exp( cx ) + local expreal = math.exp(cx[1]) + return setmetatable( { expreal*math.cos(cx[2]), expreal*math.sin(cx[2]) }, complex_meta ) +end + +function complex.conjugate( cx ) + return setmetatable( { cx[1], -cx[2] }, complex_meta ) +end + +function Xround(num, numDecimalPlaces) + if type(num)=="number" then + if num==math.floor(num) then + return math.floor(num) + end + end + if type(num)=="number" then + local mult = 10^(numDecimalPlaces or 0) + return math.floor(num * mult + 0.5) / mult + end + return num +end + +function complex.round( cx,idp ) + local mult =10^( idp or 0 ) + if type(cx[1]) ~= "table" and type(cx[2]) ~= "table" then + return setmetatable( {Xround(cx[1],idp), Xround(cx[2],idp)}, complex_meta ) + end + if type(cx[1]) ~= "table" and type(cx[2]) == "table" then + return setmetatable( {Xround(cx[1],idp), cx[2]}, complex_meta ) + end + if type(cx[1]) == "table" and type(cx[2]) ~= "table" then + return setmetatable({cx[1],Xround(cx[2],idp)}, complex_meta ) + end + if type(cx[1]) == "table" and type(cx[2]) == "table" then + return setmetatable({cx[1],cx[2]}, complex_meta ) + end +end + +complex.zero = complex.new(0, 0) +complex.one = complex.new(1, 0) + +complex_meta.__add = function( cx1,cx2 ) +local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) +return complex.add( cx1,cx2 ) +end +complex_meta.__sub = function( cx1,cx2 ) +local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) +return complex.sub( cx1,cx2 ) +end +complex_meta.__mul = function( cx1,cx2 ) +local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) +return complex.mul( cx1,cx2 ) +end +complex_meta.__div = function( cx1,cx2 ) +local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) +return complex.div( cx1,cx2 ) +end +complex_meta.__pow = function( cx,num ) +if num == "*" then +return complex.conjugate( cx ) +end +return complex.pow( cx,num ) +end +complex_meta.__unm = function( cx ) +return setmetatable( { -cx[1], -cx[2] }, complex_meta ) +end +complex_meta.__eq = function( cx1,cx2 ) +if cx1[1] == cx2[1] and cx1[2] == cx2[2] then +return true +end +return false +end +complex_meta.__tostring = function( cx ) +return tostring( complex.tostring( cx ) ) +end +complex_meta.__concat = function( cx,cx2 ) +return tostring(cx)..tostring(cx2) +end +-- cx( cx, formatstr ) +complex_meta.__call = function( ... ) +print( complex.tostring( ... ) ) +end +complex_meta.__index = {} +for k,v in pairs( complex ) do +complex_meta.__index[k] = v +end + +return complex + diff --git a/macros/luatex/latex/lualinalg/lualinalg-fractions.lua b/macros/luatex/latex/lualinalg/lualinalg-fractions.lua new file mode 100644 index 0000000000..e4ab7a2329 --- /dev/null +++ b/macros/luatex/latex/lualinalg/lualinalg-fractions.lua @@ -0,0 +1,225 @@ +-- The luafractions module +-- Authors: Chetan Shirore and Ajit Kumar +-- version 1.0, Date=03-Aug-2023 +-- Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt. + +M = {} -- the module +frac_mt = {} -- the metatable +function M.new (n, d, mode) + mode = mode or 'fracs' + if mode == 'nofracs' then + return (n/d) + end + if mode == 'fracs' then + if n~=math.floor(n) or d~=math.floor(d) then + error('Only integers are expected.') + end + if d == 0 then + error('Invalid fraction') + end + local fr = {} + local g = M.lgcd(n,d) + fr = {n=n/g, d=d/g} + return setmetatable(fr,frac_mt) + end +end +lfrac = M.new + +function M.lgcd (a, b) + local r + while (b ~= 0) do + r = a % b + a = b + b = r + end + return a +end + +function M.simp (num) + local cf = gcd(num[1], num[2]) + return M.new(num[1] / cf, num2[2] / cf) +end + +function M.toFnumber(c) + return c.n / c.d +end + +function M.toFrac(x) + if type(x) == "number" then + if x==math.floor(x) then + return M.new(math.floor(x),1) + else + return x + end + end + return x +end + + +function addFracs (c1, c2) + return M.new(c1.n * c2.d + c1.d * c2.n, c1.d*c2.d) +end + +function subFracs (c1, c2) + return M.new(c1.n * c2.d - c1.d * c2.n, c1.d*c2.d) +end + +function mulFracs (c1, c2) + return M.new(c1.n * c2.n, c1.d*c2.d) +end + +function divFracs (c1, c2) + return M.new(c1.n * c2.d, c1.d*c2.n) +end + +function minusFracs (c1) + return M.new(-c1.n,c1.d) +end + +function powerFracs (c1,m) + return M.new((c1.n)^m,(c1.d)^m) +end + + +function M.add(a, b) + if type(a) == "number" then + if a==math.floor(a) then + return addFracs(M.new(a,1),b) + else + return a + M.toFnumber(b) + end + end + + if type(b) == "number" then + if b==math.floor(b) then + return addFracs(a,M.new(b,1)) + else + return M.toFnumber(a) + b + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then + return setmetatable( { a+b[1], b[2] }, complex_meta ) + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( b ) == frac_mt and getmetatable( a ) == complex_meta then + return setmetatable( { b+a[1], a[2] }, complex_meta ) + end + end + return addFracs(a, b) +end + + +function M.sub(a, b) + if type(a) == "number" then + if a==math.floor(a) then + return subFracs(M.new(a,1),b) + else + return a - M.toFnumber(b) + end + end + + if type(b) == "number" then + if b==math.floor(b) then + return subFracs(a,M.new(b,1)) + else + return M.toFnumber(a) - b + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then + return setmetatable( { a-b[1], b[2] }, complex_meta ) + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( b ) == frac_mt and getmetatable( a ) == complex_meta then + return setmetatable( { a[1]-b, a[2] }, complex_meta ) + end + end + return subFracs(a, b) +end + + +function M.mul(a, b) + if type(a) == "number" then + if a==math.floor(a) then + return mulFracs(M.new(a,1),b) + else + return a * M.toFnumber(b) + end + end + + if type(b) == "number" then + if b==math.floor(b) then + return mulFracs(a,M.new(b,1)) + else + return M.toFnumber(a) * b + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then + return setmetatable( { a*b[1], a*b[2] }, complex_meta ) + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( b ) == frac_mt and getmetatable( a ) == complex_meta then + return setmetatable( { b*a[1], b*a[2] }, complex_meta ) + end + end + return mulFracs(a, b) +end + + +function M.div(a, b) + if type(a) == "number" then + if a==math.floor(a) then + return divFracs(M.new(a,1),b) + else + return a / M.toFnumber(b) + end + end + + if type(b) == "number" then + if b==math.floor(b) then + return divFracs(a,M.new(b,1)) + else + return M.toFnumber(a) / b + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then + b= setmetatable( { M.toFrac(b[1]), M.toFrac(b[2]) }, complex_meta ) + return a*(1/b) + end + end + return divFracs(a, b) +end + +function M.tostring (c) + if c.d == 1 then + return string.format("%g",c.n) + end + if c.d == -1 then + return string.format("%g",-c.n) + end + return string.format("\\frac{%g}{%g}", c.n, c.d) +end + +--Setting Metatable operations. +frac_mt.__add = M.add +frac_mt.__sub = M.sub +frac_mt.__mul = M.mul +frac_mt.__div = M.div +frac_mt.__unm = minusFracs +frac_mt.__pow = powerFracs +frac_mt.__tostring = M.tostring + +return M
\ No newline at end of file diff --git a/macros/luatex/latex/lualinalg/lualinalg.pdf b/macros/luatex/latex/lualinalg/lualinalg.pdf Binary files differindex 8b277707bd..b164d33407 100644 --- a/macros/luatex/latex/lualinalg/lualinalg.pdf +++ b/macros/luatex/latex/lualinalg/lualinalg.pdf diff --git a/macros/luatex/latex/lualinalg/lualinalg.sty b/macros/luatex/latex/lualinalg/lualinalg.sty index 5588fba0a0..de120d131a 100644 --- a/macros/luatex/latex/lualinalg/lualinalg.sty +++ b/macros/luatex/latex/lualinalg/lualinalg.sty @@ -1,17 +1,18 @@ % The lualinalg package % Authors: Chetan Shirore and Ajit Kumar -% version 1.2, Date=14-Feb-2023 +% version 1.3, Date=03-Aug-2023 % Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt. -\ProvidesPackage{lualinalg}[1.2] +\ProvidesPackage{lualinalg}[1.3] \RequirePackage{xkeyval} \RequirePackage{amsmath} \RequirePackage{luamaths} \RequirePackage{luacode} \begin{luacode*} -local complex = require "lualinalg_complex" +local complex = require "lualinalg-complex" + local lfrac = require "lualinalg-fractions" -- matrices part matrices = {} @@ -431,7 +432,7 @@ end function matrix.process(m1) --m1=load("return "..m1)() - return matrix.mulnum(m1, 1.0) + return matrix.mulnum(m1, 1) end function matrix.det(m1) @@ -558,7 +559,7 @@ function matrix.rref(mtx) local m = mtx[i][lead] if (i ~= r) then for v = 1, columnCount do - mtx[i][v] = mtx[i][v] - m * mtx[r][v] + mtx[i][v] = mtx[i][v] + ((-m) * (mtx[r][v])) end end end @@ -623,9 +624,9 @@ function matrix.rref0E(mtx, fom, dignum) tostring(stepCnt) .. ": Divide row " .. tostring(r) .. - " by " .. + " by $" .. tostring(complex.round(complex(m), dignum)) .. - ".$$" .. tostring(matrix.show(mtx, fom, dignum)) .. "$$" + "$.$$" .. tostring(matrix.show(mtx, fom, dignum)) .. "$$" end end end @@ -633,7 +634,7 @@ function matrix.rref0E(mtx, fom, dignum) local m = mtx[i][lead] if (i ~= r) then for v = 1, columnCount do - mtx[i][v] = mtx[i][v] - m * mtx[r][v] + mtx[i][v] = mtx[i][v] + ((-m) * (mtx[r][v])) end if m ~= 0 then if m ~= complex("0.0") then @@ -644,9 +645,9 @@ function matrix.rref0E(mtx, fom, dignum) tostring(stepCnt) .. ": Multiply row " .. tostring(r) .. - " by " .. + " by $" .. tostring(complex.round(complex(m), dignum)) .. - " and subtract it from row " .. + "$ and subtract it from row " .. tostring(i) .. ".$$" .. tostring(matrix.show(mtx, fom, dignum)) .. "$$" end @@ -1089,7 +1090,7 @@ end function vector.process(v1) --v1=load("return "..v1)() - return vector.mulnum(v1, 1.0) + return vector.mulnum(v1, 1) end function vector.show(vec, dig) @@ -1137,7 +1138,7 @@ function vector.gs(inptTbl, brckt, dignum) if vector.euclidnorm(inptTbl[1]) ~= complex(0.0) then tbl[1] = vector.mulnum(inptTbl[1], 1 / vector.euclidnorm(inptTbl[1])) else - tbl[1] = vector.mulnum(inptTbl[1], 1.0) + tbl[1] = vector.mulnum(inptTbl[1], 1) end setmetatable(tbl[1], vector_meta) str = str .. "$\\left" .. brcktL .. vector.show(tbl[1], dignum) .. "\\right" .. brcktR @@ -1184,7 +1185,7 @@ function vector.gsX(inptTbl, brckt, dignum) if vector.euclidnorm(inptTbl[1]) ~= complex(0.0) then tbl[1] = vector.mulnum(inptTbl[1], 1 / vector.euclidnorm(inptTbl[1])) else - tbl[1] = vector.mulnum(inptTbl[1], 1.0) + tbl[1] = vector.mulnum(inptTbl[1], 1) end setmetatable(tbl[1], vector_meta) str = str .. "\\ \\newline Step " .. cnt .. ": $$ u_" .. cnt .. "=v_" .. cnt .. "=" @@ -1205,7 +1206,7 @@ function vector.gsX(inptTbl, brckt, dignum) if vector.euclidnorm(tbl[i]) ~= complex(0.0) then tbl[i] = vector.mulnum(tbl[i], 1 / vector.euclidnorm(tbl[i])) else - tbl[i] = vector.mulnum(tbl[i], 1.0) + tbl[i] = vector.mulnum(tbl[i], 1) end cnt = cnt + 1 @@ -1267,7 +1268,6 @@ end % ========= KEY DEFINITIONS ========= \define@key{matrixop}{type}{\def\mop@type{#1}} \define@key{matrixop}{truncate}{\def\mop@truncate{#1}} - % ========= KEY DEFAULTS ========= \setkeys{matrixop}{type=bmatrix,truncate=6}% @@ -1639,12 +1639,6 @@ end }% } -\newcommand\complexRound[2]{% - \directlua{% - tex.sprint(tostring(complex.round(complex('#1'),#2))) - }% -} - % ========= KEY DEFINITIONS ========= \define@key{vecrr}{brckt}{\def\voprr@brckt{#1}} \define@key{vecrr}{truncate}{\def\voprr@truncate{#1}} diff --git a/macros/luatex/latex/lualinalg/lualinalg.tex b/macros/luatex/latex/lualinalg/lualinalg.tex index 99c01d06af..10b2d55c34 100644 --- a/macros/luatex/latex/lualinalg/lualinalg.tex +++ b/macros/luatex/latex/lualinalg/lualinalg.tex @@ -1,7 +1,8 @@ \documentclass{article} \usepackage{listings,color,parskip,booktabs,longtable,array, -hyperref,multirow,multicol,url,amsmath,amssymb,framed,graphicx,mismath} -\usepackage[top=1.1in, bottom=1.1in, left=1in, right=1in]{geometry} +hyperref,multirow,multicol,url,amsmath,amssymb,framed,graphicx,lualinalg,tikz,tikz-3dplot,float} +\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry} +\usetikzlibrary{calc,3d,arrows} \hypersetup{colorlinks,urlcolor=blue} \lstset{frame=none, language=[LaTeX]{TeX}, @@ -20,26 +21,33 @@ hyperref,multirow,multicol,url,amsmath,amssymb,framed,graphicx,mismath} } \begin{document} \title{The lualinalg Package} -\author{Chetan Shirore and Ajit Kumar} +\author{Chetan Shirore\thanks{Email id: mathsbeauty@gmail.com} \space and Ajit Kumar} \maketitle \section{Introduction} The \verb|lualinalg| package is developed to perform operations on vectors and matrices defined over the field of real or complex numbers inside LaTeX documents. It provides flexible ways for defining and displaying vectors and matrices. No particular environment of LaTeX is required to use commands in the package. The package is written in Lua, and tex file is to be compiled with the LuaLaTeX engine. The time required for calculations is not an issue while compiling with LuaLaTeX. There is no need to install Lua on the user's system as TeX distributions (TeXLive or MikTeX) come bundled with LuaLaTeX. It may also save users' efforts to copy vectors and matrices from other software (which may not be in latex-compatible format) and to use them in a tex file. The vectors and matrices of reasonable size can be handled with ease. The package can be modified or extended by writing custom Lua programs (Section \ref{customuse}). +The package supports fractions; numerators and denominators must be integers. A fraction can be specified with the Lua function: \verb|lfrac|. This function has the syntax \verb|lfrac(n,d,mode)|: \(n\) is an integer and \(d\) is a non-zero integer. The mode is optional. It can be \verb|fracs| or \verb|nofracs|. The default mode is \verb|fracs|. If fractions are input, the package will display vectors and matrices in fraction mode wherever possible. The package does not attempt to convert floats into fractions. If fractions are expected, then the input should contain fractions. If fractions are input and answers are expected in numbers, the mode can be specified as \verb|nofracs|. + +The Lua function \verb|lcomplex| defines the complex numbers. It has the syntax \verb|lcomplex(x,y)|, where \(x\) is a real part, and \(y\) is an imaginary part. \(x\) and \(y\) can also be fractions (numerators and denominators should be integers). The package has a command \verb|\imUnit| which provides typesetting for the imaginary unit. Its default value is \verb|\mathrm{i}|. It can be redefined. For example, one can redefine it as \verb|\renewcommand{\imUnit}{j}}|. + + \section{Installation and License} The installation of the \verb|lualinalg| package is similar to the plain latex package, where the \verb|.sty| file is in the LaTeX directory of the texmf tree. The package can be included with \verb|\usepackage{lualinalg}| command in the preamble of the LaTeX document. The \verb|lualinalg| package is released under the LaTeX Project Public License v1.3c or later. The complete license text is available at \url{http://www.latex-project.org/lppl.txt}. It is developed in Lua. Lua is available as a certified open-source software. Its license is simple and liberal, which is compatible with GPL. The package makes use of \verb|complex.lua| file which is available on \url{https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua}. It is available under the same licensing as that of Lua. The package also loads the \href{https://ctan.org/pkg/luamaths}{luamaths} package, which is available under the LaTeX Project Public License v1.3c or later. This package is loaded to use the standard mathematical functions and for computations on real numbers while performing operations on vectors and matrices. + \section{Defining vectors and performing operations on vectors} \subsection{Defining Vectors} Vectors are defined with the \verb|\vectornew| command. -\begin{verbatim} +\begin{lstlisting} \vectorNew{vector name}{coordinates} -\end{verbatim} - This command has two compulsory arguments: \verb|vector name| and \verb|coordinates|. Coordinates of vectors are enclosed in curly braces. A comma separates coordinates. The complex numbers are to be enclosed in single or double quotes inside the \verb|complex()| function. The following are a few valid ways of defining vectors. +\end{lstlisting} + + This command has two compulsory arguments: \verb|vector name| and \verb|coordinates|. Coordinates of vectors are enclosed in curly braces. A comma separates coordinates. The following are a few valid ways of defining vectors. \begin{lstlisting} \vectorNew{v1}{{1,2,3,4,5,6}} -\vectorNew{v2}{{3,6,complex('6+6i')}} +\vectorNew{v2}{{3,6,lcomplex(6,6)}} \end{lstlisting} The standard vector of dimension \(n \) with \(i^{th}\) coordinate \(1\) can be produced by using the following command. \begin{lstlisting} @@ -50,10 +58,12 @@ For example, the following commands \vectorNew{e_1}{3,'e',1} \(e_1=\left(\vectorPrint{e}\right)\) \end{lstlisting} -output to \(e_1 = \left(1.0,0.0,0.0\right) \). +output to \vectorNew{e_1}{3,'e',1} +\(e_1=\left(\vectorPrint{e_1}\right)\). + \subsection{Commands for operations on vectors} Table \ref{tbl:luavector} lists commands for operations on vectors. -\begin{longtable}{m{7cm}m{7cm}} +\begin{longtable}{m{7cm}m{8.2cm}} \toprule \multicolumn{1}{c}{\textcolor{blue}{Command Format}} & \multicolumn{1}{c}{\textcolor{blue}{Description}} \\ \toprule @@ -117,7 +127,7 @@ Calculates the Euclidean norm of a vector \(v\). If \(v=\left(v_1, \ldots, v_n \begin{lstlisting} \vectorpNorm{v} \end{lstlisting}& -Calculates the \(p\) \((p > 1)\) norm of a vector \(v\). If \(v=\left(v_1, \ldots, v_n \right)\) then it is given by \(\sqrt[p]{|v_1|^2 + \cdots + |v_n|^2} \). \\ +Calculates the \(p\) \((p > 1)\) norm of a vector \(v\). If \(v=\left(v_1, \ldots, v_n \right)\) then it is given by \(\sqrt[\leftroot{-2}\uproot{2} p]{|v_1|^p + \cdots + |v_n|^p} \). \\ \midrule \begin{lstlisting} \vectorSupNorm{v} @@ -157,16 +167,21 @@ truncate]{list of vectors} \caption{Commands for operations on vectors} \label{tbl:luavector} \end{longtable} + \subsection{Illustrations of commands for operations on vectors} The following commands define vectors \(v,w,x,\) and \(y\). \begin{lstlisting} -\vectorNew{v}{{1,2,complex('3+3i')}} -\vectorNew{w}{{3,6,complex('6+6i')}} -\vectorNew{x}{{1.12345678,6,complex('6+6i')}} +\vectorNew{v}{{1,2,lcomplex(3,3)}} +\vectorNew{w}{{3,6,lcomplex(6,6)}} +\vectorNew{x}{{1.12345678,6,lcomplex(6,6)}} \vectorNew{y}{{1,2,3}} \end{lstlisting} Table \ref{tbl:illluavector} illustrates various operations on vectors \(v,w,x\) and \(y\). -\begin{longtable}{lc} +\vectorNew{v}{{1,2,lcomplex(3,3)}} +\vectorNew{w}{{3,6,lcomplex(6,6)}} +\vectorNew{x}{{1.12345678,6,lcomplex(6,6)}} +\vectorNew{y}{{1,2,3}} +\begin{longtable}{lp{6.5cm}} \toprule Commands & Output Produced\\ \toprule @@ -174,93 +189,100 @@ Commands & Output Produced\\ \(v=\left(\vectorPrint{v}\right)\) \(w=\left(\vectorPrint{w}\right)\) \end{lstlisting} & -\(v=\left(1.0,2.0,3.0+3.0i\right)\) \\ -& -\(w=\left(3.0,6.0,6.0+6.0i\right)\) +\(v=\left(\vectorPrint{v}\right)\) \newline +\(w=\left(\vectorPrint{w}\right)\) \\ \midrule \begin{lstlisting} \(x=\left(\vectorPrint [truncate=3]{x}\right)\) \end{lstlisting} & -\(x=\left(1.123,6.0,6.0+6.0i\right)\) +\(x=\left(\vectorPrint +[truncate=3]{x}\right)\) \\ \midrule \begin{lstlisting} third coordinate of vector \(v = \vectorGetCoordinate{v}{3}\) \end{lstlisting} & -third coordinate of vector \(v = 3 + 3i\) +third coordinate of vector +\(v = \vectorGetCoordinate{v}{3}\) \\ \midrule \begin{lstlisting} -\(y = \vectorCopy{y}{w}\) -\(\left(\vectorPrint{y}\right)\) +\(\vectorCopy{z}{w}\) +\(z = \left(\vectorPrint{z}\right)\) \end{lstlisting} & -\(y = \left( 3.0,6.0,6.0+6.0i\right)\) +\(\vectorCopy{z}{w}\) +\(z = \left(\vectorPrint{z}\right)\) \\ \midrule \begin{lstlisting} new third coordinate of vector -\(y = \vectorSetCoordinate{y}{3}{9.3}\) -\(y=\left(\vectorPrint{y}\right)\) +\(z = \vectorSetCoordinate{z}{3}{9.3}\) +\(z=\left(\vectorPrint{z}\right)\) \end{lstlisting} & -new third coordinate of vector \(y = 9.3\) \\ -& \(y = \left( 3.0,6.0,9.3\right)\) +new third coordinate of vector +\(z = \vectorSetCoordinate{z}{3}{9.3}\) \newline +\(z=\left(\vectorPrint{z}\right)\) \\ \midrule \begin{lstlisting} \vectorAdd{v1}{v}{w} \(v1 = v+w =\left(\vectorPrint{v1}\right)\) \end{lstlisting} & -\(v1 = v+w =\left(4.0, 8.0, 9.0 + 9.0i\right)\) +\vectorAdd{v1}{v}{w} +\(v1 = v+w =\left(\vectorPrint{v1}\right)\) \\ \midrule \begin{lstlisting} \vectorSub{v2}{v}{w} \(v2 = v-w =\left(\vectorPrint{v2}\right)\) \end{lstlisting} & -\(v2 = v-w =\left(-2.0, -4.0, -3.0 -3.0i\right)\) +\vectorSub{v2}{v}{w} +\(v2 = v-w =\left(\vectorPrint{v2}\right)\) \\ \midrule \begin{lstlisting} \vectorMulNum{v3}{v}{complex('3+i')} \(v3 = 3v =\left(\vectorPrint{v3}\right)\) \end{lstlisting} & -\(v3 = 3v =\left(3.0 + i, 6.0 + 2.0i, 6.0 + 12.0i\right)\) +\vectorMulNum{v3}{v}{complex('3+i')} +\(v3 = 3v =\left(\vectorPrint{v3}\right)\) \\ \midrule \begin{lstlisting} -\vectorDot{v}{w} \(v \cdot w =\vectorDot{v}{w}\) \end{lstlisting} & -\(v \cdot w = 51\) +\(v \cdot w =\vectorDot{v}{w}\) \\ \midrule \begin{lstlisting} \vectorCross{v4}{v}{w} \(v \times w =\left(\vectorPrint{v4}\right)\) \end{lstlisting} & -\(v \times w = \left(-6.0 - 6.0i, 3.0 + 3.0i, 0.0\right)\) +\vectorCross{v4}{v}{w} +\(v \times w =\left(\vectorPrint{v4}\right)\) \\ \midrule \begin{lstlisting} Sum norm of a vector \(v = \vectorSumNorm{v}\) \end{lstlisting} & - Sum norm of a vector \(v = 7.2426406871193\) + Sum norm of a vector \(v = \vectorSumNorm{v}\) \\ \midrule \begin{lstlisting} Euclidean norm of a vector \(v = \vectorEuclidNorm{v}\) \end{lstlisting} & -Euclidean norm of a vector \(v = 4.7958315233127\) +Euclidean norm of a vector + \(v = \vectorEuclidNorm{v}\) \\ \midrule \begin{lstlisting} p norm of a vector \(v = \vectorpNorm{v}{3}\) \end{lstlisting} & -p norm of a vector \(v = 4.4031577258332\) +p norm of a vector \(v = \vectorpNorm{v}{3}\) \\ \midrule \begin{lstlisting} @@ -273,28 +295,30 @@ Sup norm of a vector \(v = 4.2426406871193\) \vectorCreateRandom{v5}{3}{9}{90} \(v5 =\left(\vectorPrint{v5}\right)\) \end{lstlisting} & -\(v5 =\left(18.290405, 23.356018, 49.966278\right)\) +\vectorCreateRandom{v5}{3}{9}{90} +\(v5 =\left(\vectorPrint{v5}\right)\) \\ \midrule \begin{lstlisting} \vectorOp{v6}{v+w-2*v} -\(v6 =\left(\vectorPrint{v7}\right)\) +\(v6 =\left(\vectorPrint{v6}\right)\) \end{lstlisting} & -\(v6=\left(2.0, 4.0, 27.0 + 27.0i \right)\) +\vectorOp{v6}{v+w-2*v} +\(v6 =\left(\vectorPrint{v6}\right)\) \\ \midrule \begin{lstlisting} angle between vector \(v\) and \(w\) is \( \vectorGetAngle{v}{w}\). \end{lstlisting} & -angle between vector \(v\) and \(w\) is - \( 0.32823410158508\). + angle between vector \(v\) and \(w\) is + \( \vectorGetAngle{v}{w}\). \\ \midrule \begin{lstlisting} \vectorParse{y} \end{lstlisting} & -\(\left(1,2,3 \right)\) +\vectorParse{y} \\ \bottomrule \\ \caption{Illustration of commands for operations on vectors} @@ -315,12 +339,14 @@ Gram Schmidt on \(v1,v2,v3\): \vectorGramSchmidt[brckt=round,truncate=3]{{'v1', \end{framed} Listing \ref{code:luavecgs} outputs the following. \begin{framed} -\[v1=\left(1,2,3\right)\] -\[v2=\left(4,5,6\right)\] -\[v3=\left(7,8,90\right)\] -Gram Schmidt on \(v1,v2,v3\): $\left(0.267,0.535,0.802\right),\left(0.873,0.218,-0.436\right),\left(0.408,-0.816,0.408\right)$ - -Take given vectors as $v_1,\ldots, v_3$ in order.\ \newline Step 1: $$ u_1=v_1=\left(1.0,2.0,3.0\right)$$ $$ e_1=\frac{u_{1}}{||u_{1}||} =\left(0.267,0.535,0.802\right)$$ Step 2: $$ u_2=v_2-\sum_{j=1}^{1}{{proj_{u_j}(v_2)}}=\left(1.714,0.429,-0.857\right)$$ $$ e_2=\frac{u_{2}}{||u_{2}||} =\left(0.873,0.218,-0.436\right)$$ Step 3: $$ u_3=v_3-\sum_{j=1}^{2}{{proj_{u_j}(v_3)}}=\left(13.5,-27.0,13.5\right)$$ $$ e_3=\frac{u_{3}}{||u_{3}||} =\left(0.408,-0.816,0.408\right)$$ +\vectorNew{v1}{{1,2,3}} +\vectorNew{v2}{{4,5,6}} +\vectorNew{v3}{{7,8,90}} +\[v1=\left(\vectorPrint{v1}\right)\] +\[v2=\left(\vectorPrint{v2}\right)\] +\[v3=\left(\vectorPrint{v3}\right)\] +Gram Schmidt on \(v1,v2,v3\): \vectorGramSchmidt[brckt=round,truncate=3]{{'v1','v2','v3'}} +\vectorGramSchmidtSteps[brckt=round,truncate=3]{{'v1','v2','v3'}} \end{framed} In addition to \verb|\mathRound|, the command \verb|complexRound| is also available. It has the following syntax. @@ -329,12 +355,11 @@ In addition to \verb|\mathRound|, the command \verb|complexRound| is also availa \end{verbatim} This command has two compulsory arguments. The complex number and number of decimal places to which number should be rounded off. For example, - \verb| \complexRound{3.3333666+6.777666i}{3}| outputs to \(3.333+6.778i\). This command can be nested with other commands in the package. + \verb| \complexRound{lcomplex(3.3333666, 6.777666)}{3}| outputs to \(\complexRound{lcomplex(3.3333666, 6.777666)}{3}\). This command can be nested with other commands in the package. \subsection{Plotting vectors} The \verb|lualinalg| package can be used with other packages that have facility to plot vectors defined over the field of real numbers in 2 or 3 dimensions. Listing \ref{code:luavecplot} illustrates plotting of vectors in 2-D plane by using \verb|lualinalg| and \verb|tikz| package. \begin{lstlisting}[label={code:luavecplot}, caption={Plotting vectors in 2-dimensions with the lualinalg and tikz packages}] -\begin{document} \tdplotsetmaincoords{0}{0} \begin{tikzpicture}[scale=1, tdplot_main_coords, @@ -363,15 +388,43 @@ The \verb|lualinalg| package can be used with other packages that have facility \draw[vector guide, black] \vectorParse{h} -- (\vectorGetCoordinate{h}{1},0) node [below] {$x=\vectorGetCoordinate{h}{1}$}; \draw[vector guide, black] \vectorParse{h} -- (0,\vectorGetCoordinate{h}{2}) node [left] {$y=\vectorGetCoordinate{h}{2}$}; \end{tikzpicture} -\end{document} \end{lstlisting} Listing \ref{code:luavecplot} produces figure \ref{fig:2dvecplot}. -\begin{figure}[!ht] % or [H] to turn off float +\begin{figure}[H] \centering - \includegraphics[scale=0.9]{2dvec.jpg} - \caption{Plotting of 3-D Vectors with lualinalg and tikz packages} + \tdplotsetmaincoords{0}{0} +\begin{tikzpicture}[scale=1, + tdplot_main_coords, + axis/.style={->,blue,thick}, + vector/.style={-stealth,red,very thick}, + vector guide/.style={dashed,red,thick}] +\vectorNew{o}{{0,0}} +\vectorNew{e1}{{4,0}} +\vectorNew{e2}{{0,4}} +\vectorNew{f}{{2,1}} +\vectorNew{g}{{1,2}} +% Axes +\draw [axis] \vectorParse{o}-- \vectorParse{e1} node [below left] {$x$}; +\draw [axis] \vectorParse{o}-- \vectorParse{e2} node [right] {$y$}; +% Plotting Vectors +\draw [vector] \vectorParse{o} --\vectorParse{f}; +\draw [vector] \vectorParse{o} --\vectorParse{g}; +\vectorOp{h}{f+g} +\draw [vector] \vectorParse{o} --\vectorParse{h}; +\draw [vector,dashed,black] \vectorParse{f} --\vectorParse{h}; +\draw [vector,dashed,black] \vectorParse{g} --\vectorParse{h}; +% Labels + \node [below right] at \vectorParse{f} {$f$}; + \node [above left] at \vectorParse{g} {$g$}; +\node [above left] at \vectorParse{h} {$f+g$}; + \draw[vector guide, black] \vectorParse{h} -- (\vectorGetCoordinate{h}{1},0) node [below] {$x=\vectorGetCoordinate{h}{1}$}; + \draw[vector guide, black] \vectorParse{h} -- (0,\vectorGetCoordinate{h}{2}) node [left] {$y=\vectorGetCoordinate{h}{2}$}; +\end{tikzpicture} + \caption{Plotting 2-D Vectors with lualinalg and tikz packages} \label{fig:2dvecplot} \end{figure} + + Listing \ref{code:luavecplot2} illustrates plotting of vectors in 3-D plane by using \verb|lualinalg| and \verb|tikz| package. \begin{lstlisting}[label={code:luavecplot2}, caption={Plotting vectors in 3-dimensions with the lualinalg and tikz packages}] \documentclass{article} @@ -410,10 +463,38 @@ Listing \ref{code:luavecplot2} illustrates plotting of vectors in 3-D plane by u \end{lstlisting} Listing \ref{code:luavecplot2} produces figure \ref{fig:3dvecplot}. -\begin{figure}[!ht] % or [H] to turn off float +\begin{figure}[H] \centering - \includegraphics[scale=0.9]{3dvec.jpg} - \caption{Plotting of Vectors with lualinalg and tikz packages} + \tdplotsetmaincoords{60}{120} +\begin{tikzpicture}[scale=1, + tdplot_main_coords, + axis/.style={->,blue,thick}, + vector/.style={-stealth,red,very thick}, + vector guide/.style={dashed,red,thick}] +\vectorNew{o}{{0,0,0}} +\vectorNew{e1}{{3,0,0}} +\vectorNew{e2}{{0,5,0}} +\vectorNew{e3}{{0,0,4}} +\vectorNew{f}{{2,2,0}} +\vectorNew{g}{{-1,2,2}} +% Axes +\draw [axis] \vectorParse{o}-- \vectorParse{e1} node [below left] {$x$}; +\draw [axis] \vectorParse{o}-- \vectorParse{e2} node [right] {$y$}; +\draw [axis] \vectorParse{o}-- \vectorParse{e3} node [above] {$z$}; +% Plotting Vectors +\draw [vector] \vectorParse{o} --\vectorParse{f}; +\draw [vector] \vectorParse{o} --\vectorParse{g}; +\vectorOp{h}{f+g} +\draw [vector] \vectorParse{o} --\vectorParse{h}; +% Labels + \node [below right] at \vectorParse{f} {$f$}; + \node [above left] at \vectorParse{g} {$g$}; +\node [right] at \vectorParse{h} {$f+g$}; + \draw[vector guide, black] \vectorParse{h} -- (\vectorGetCoordinate{h}{1},0,0) node [left] {$x=\vectorGetCoordinate{h}{1}$}; + \draw[vector guide, black] \vectorParse{h} -- (0,\vectorGetCoordinate{h}{2},0) node [below] {$y=\vectorGetCoordinate{h}{2}$}; + \draw[vector guide, black] \vectorParse{h} -- (0,0,\vectorGetCoordinate{h}{3}) node [left] {$z=\vectorGetCoordinate{h}{3}$}; +\end{tikzpicture} + \caption{Plotting 3-D Vectors with lualinalg and tikz packages} \label{fig:3dvecplot} \end{figure} @@ -422,15 +503,15 @@ Matrices are defined with the \verb|\matrixNew| command. \begin{lstlisting} \matrixNew{matrix name}{row entries} \end{lstlisting} -This command has two compulsory arguments: \verb|matrix name| and \verb|row entries|. Each row of the matrix is enclosed in curly brackets. A comma separates numbers in rows. Rows are also separated by a comma. The whole matrix is then enclosed in curly brackets. The complex numbers are to be enclosed in single or double quotes inside the parenthesis of the \verb|complex()| function. The following are a few valid ways of defining matrices. +This command has two compulsory arguments: \verb|matrix name| and \verb|row entries|. Each row of the matrix is enclosed in curly brackets. A comma separates numbers in rows. Rows are also separated by a comma. The whole matrix is then enclosed in curly brackets. The following are a few valid ways of defining matrices. \begin{lstlisting} -\def\n{{{1,2,3},{4,5,6},{7,8,complex('9+3i')}}} +\def\n{{{1,2,3},{4,5,6},{7,8,lcomplex(9,3)}}} \def\s{{{1,2,3},{4,5,6},{7,8,10}}} \matrixNew{m}{\n} \matrixNew{n}{\s} % an alternative way -\matrixNew{m}{{{1,2,3},{4,5,6},{7,8,complex('9+3i')}}} +\matrixNew{m}{{{1,2,3},{4,5,6},{7,8,lcomplex(9,3)}}} \matrixNew{n}{{{1,2,3},{4,5,6},{7,8,10}}} \end{lstlisting} @@ -440,7 +521,8 @@ The identity matrix can be defined as well by using the \verb|\matrixNew| comm I = \(\matrixPrint{mtx}\) \end{lstlisting} output to -\[I = \begin{bmatrix} 1.0 & 0.0 & 0.0 \\ 0.0 & 1.0 & 0.0 \\ 0.0 & 0.0 & 1.0\\\end{bmatrix} \] +\matrixNew{mtx}{3,'I'} +I = \(\matrixPrint{mtx}\) \subsection{Commands for operations on matrices} Table \ref{tbl:luamtxcmd} lists all commands for operations on matrices in the \verb|lualinalg| package. @@ -662,19 +744,35 @@ Defines new matrix obtained by performing Gauss-Jordan elimination on augmented \caption{Commands for operations on matrices} \label{tbl:luamtxcmd} \end{longtable} + \subsection{Illustrations of matrix operations} The following commands define matrices \(m,n,\) and \(r\). \begin{lstlisting} -\def\r{{{1,2,3},{4,5,6},{7,8,complex('9+3i')}}} +\def\r{{{1,2,3},{4,5,6},{7,8,lcomplex(9,3)}}} \def\s{{{1,2,3},{4,5,6},{7,8,10}}} \def\t{{{1,2,3},{4,5,6},{7,8,9}}} \def\u{{{1},{2},{3}}} +\def\z{{{lfrac(1,2),lcomplex(2,3),3},{4,5,6},{7,8,9}}} \matrixNew{m}{\r} \matrixNew{n}{\s} \matrixNew{p}{\t} \matrixNew{q}{\u} +\matrixNew{r}{\z} + \end{lstlisting} + +\def\r{{{1,2,3},{4,5,6},{7,8,lcomplex(9,3)}}} +\def\s{{{1,2,3},{4,5,6},{7,8,10}}} +\def\t{{{1,2,3},{4,5,6},{7,8,9}}} +\def\u{{{1},{2},{3}}} +\def\z{{{lfrac(1,2),lcomplex(2,3),3},{4,5,6},{7,8,9}}} + +\matrixNew{m}{\r} +\matrixNew{n}{\s} +\matrixNew{p}{\t} +\matrixNew{q}{\u} +\matrixNew{r}{\z} Table \ref{tbl:illluamatrix} illustrates various operations on matrices \(m,n,p,\) and \(q\). \begin{center} \begin{longtable}{lc} @@ -684,36 +782,39 @@ Commands & Output Produced\\ \multicolumn{2}{c}{Printing matrices}\\ \midrule \begin{lstlisting} -\(m=\matrixPrint{\m}\) +\(m=\matrixPrint{m}\) \end{lstlisting} & -\(m=\begin{bmatrix} 1.0 & 2.0 & 3.0 \\ 4.0 & 5.0 & 6.0 \\ 7.0 & 8.0 & 9.0+3.0i\end{bmatrix}\) +\(m=\matrixPrint{m}\) \\ \midrule \begin{lstlisting} -\(m=\matrixPrint[type=pmatrix]{\m}\) +\(m=\matrixPrint[type=pmatrix]{m}\) \end{lstlisting} & -\(m=\begin{pmatrix} 1.0 & 2.0 & 3.0 \\ 4.0 & 5.0 & 6.0 \\ 7.0 & 8.0 & 9.0+3.0i\end{pmatrix}\) +\(m=\matrixPrint[type=pmatrix]{m}\) \\ \midrule \multicolumn{2}{c}{Some parameters of defined matrices}\\ \midrule \begin{lstlisting} -\(No. or rows in matrix m +No. or rows in matrix \(m = \matrixNumRows{m}\) \end{lstlisting} & -No. or rows in matrix \(m = 3\)\\ +No. or rows in matrix \(m += \matrixNumRows{m}\)\\ \midrule \begin{lstlisting} -\(No. or columns in matrix m +No. or columns in matrix \(m = \matrixNumCols{m}\) \end{lstlisting} & -No. or columns in matrix \(m = 3\)\\ +No. or columns in matrix \(m += \matrixNumCols{m}\)\\ \midrule \begin{lstlisting} -\(Element of matrix m at (3,3) = +Element of matrix \(m\) at \((3,3) = \matrixGetElement{m}{3}{3}\) \end{lstlisting} & -\(9+3i\)\\ +Element of matrix \(m\) at \((3,3) = + \matrixGetElement{m}{3}{3}\)\\ \midrule \multicolumn{2}{c}{Algebraic operations on matrices}\\ \midrule @@ -721,151 +822,152 @@ No. or columns in matrix \(m = 3\)\\ \matrixAdd{m1}{m}{p} \(m1 = \matrixPrint{m1}\) \end{lstlisting} & -\(m1 = \begin{bmatrix} 2.0 & 4.0 & 6.0 \\ 8.0 & 10.0 & 12.0 \\ 14.0 & 16.0 & 18.0+3.0i\end{bmatrix} -\)\\ +\matrixAdd{m1}{m}{p} +\matrixAdd{m1}{m}{p} +\(m1 = \matrixPrint{m1}\)\\ \midrule \begin{lstlisting} \matrixSub{m2}{m}{p} \(m2 = \matrixPrint{m2}\) \end{lstlisting} & -\(m2 = \begin{bmatrix} 0.0 & 0.0 & 0.0 \\ 0.0 & 0.0 & 0.0 \\ 0.0 & 0.0 & 3.0i \end{bmatrix} -\)\\ +\matrixSub{m2}{m}{p} +\(m2 = \matrixPrint{m2}\)\\ \midrule \begin{lstlisting} \matrixMulNum{m3}{3}{m} \(m3 = \matrixPrint{m3}\) \end{lstlisting} & -\(m3 = \begin{bmatrix} 3.0 & 6.0 & 9.0 \\ 12.0 & 15.0 & 18.0 \\ 21.0 & 24.0 & 27.0+9.0i\end{bmatrix} -\)\\ +\matrixMulNum{m3}{3}{m} +\(m3 = \matrixPrint{m3}\)\\ \midrule \begin{lstlisting} \matrixMul{m4}{m}{p} \(m4 = \matrixPrint{m4}\) \end{lstlisting} & -\(m4 = \begin{bmatrix} 30.0 & 36.0 & 42.0 \\ 66.0 & 81.0 & 96.0 \\ 102.0+21.0i & 126.0+24.0i & 150.0+27.0i\end{bmatrix} -\)\\ +\matrixMul{m4}{m}{p} +\(m4 = \matrixPrint{m4}\)\\ \midrule \begin{lstlisting} \matrixPow{m5}{m}{2} \(m5 = \matrixPrint{m5}\) \end{lstlisting} & -\(m5 = \begin{bmatrix} 30.0 & 36.0 & 42.0+9.0i \\ 66.0 & 81.0 & 96.0+18.0i \\ 102.0+21.0i & 126.0+24.0i & 141.0+54.0i\end{bmatrix} -\)\\ +\matrixPow{m5}{m}{2} +\(m5 = \matrixPrint{m5}\)\\ \midrule \begin{lstlisting} \matrixInvert{m6}{m} -\(m6 = \matrixPrint[truncate=4]{m6}\) +\(m6 = \matrixPrint[truncate=2]{m6}\) \end{lstlisting} & -\(m6 = \begin{bmatrix} -1.6667-0.3333i & 0.6667+0.6667i & -0.3333i \\ 1.3333+0.6667i & -0.3333-1.3333i & 0.6667i \\ -0.3333i & 0.6667i & -0.3333i\end{bmatrix} -\)\\ +\matrixInvert{m6}{m} +\(m6 = \matrixPrint[truncate=2]{m6}\)\\ \midrule \begin{lstlisting} Rank of matrix \(m =\matrixRank{m}\) \end{lstlisting} & -Rank of matrix \(m = 3\)\\ +Rank of matrix \(m =\matrixRank{m}\)\\ \midrule \begin{lstlisting} Determinant of matrix \(m =\matrixDet{m}\) \end{lstlisting} & -Determinant of matrix \(m = -9i\)\\ +Determinant of matrix \(m =\matrixDet{m}\)\\ \midrule \begin{lstlisting} \matrixTranspose{m7}{m} \(m7 = \matrixPrint{m7}\) \end{lstlisting} & -\(m7 = \begin{bmatrix}1.0 & 4.0 & 7.0 \\ 2.0 & 5.0 & 8.0 \\ 3.0 & 6.0 & 9.0+3.0i\end{bmatrix} -\)\\ +\matrixTranspose{m7}{m} +\(m7 = \matrixPrint{m7}\)\\ \midrule \begin{lstlisting} \matrixSetElement{n}{3}{3}{300} \(n= \matrixPrint{n}\) \end{lstlisting} & -\(n = \begin{bmatrix}1.0 & 2.0 & 3.0 \\ 4.0 & 5.0 & 6.0 \\ 7.0 & 8.0 & 300.0\end{bmatrix} -\)\\ +\matrixSetElement{n}{3}{3}{300} +\(n= \matrixPrint{n}\)\\ \midrule \begin{lstlisting} \matrixSubmatrix{m8}{m}{1}{2}{2}{3} \(m8 = \matrixPrint{m8}\) \end{lstlisting} & -\(m8 = \begin{bmatrix} 2.0 & 3.0 \\ 5.0 & 6.0\end{bmatrix} -\)\\ +\matrixSubmatrix{m8}{m}{1}{2}{2}{3} +\(m8 = \matrixPrint{m8}\)\\ \midrule \begin{lstlisting} \matrixConcatH{m9}{m}{q} \(m9= \matrixPrint{m9}\) \end{lstlisting} & -\(m9 = \begin{bmatrix}1.0 & 2.0 & 3.0 & 1.0 \\ 4.0 & 5.0 & 6.0 & 2.0 \\ 7.0 & 8.0 & 9.0+3.0i & 3.0\end{bmatrix} -\)\\ +\matrixConcatH{m9}{m}{q} +\(m9= \matrixPrint{m9}\)\\ \midrule \begin{lstlisting} \matrixConcatV{m10}{m}{n} \(m10= \matrixPrint{m10}\) \end{lstlisting} & -\(m10= \begin{bmatrix} 1.0 & 2.0 & 3.0 \\ 4.0 & 5.0 & 6.0 \\ 7.0 & 8.0 & 9.0+3.0i \\ 1.0 & 2.0 & 3.0 \\ 4.0 & 5.0 & 6.0 \\ 7.0 & 8.0 & 300.0\end{bmatrix} -\)\\ +\matrixConcatV{m10}{m}{n} +\(m10= \matrixPrint{m10}\)\\ \midrule \begin{lstlisting} \matrixOp{m11}{m*m+2*m} \(\matrixPrint[truncate=4]{m11}\) \end{lstlisting} & -\(m11 = \begin{bmatrix} 32.0 & 40.0 & 48.0+9.0i \\ 74.0 & 91.0 & 108.0+18.0i \\ 116.0+21.0i & 142.0+24.0i & 159.0+60.0i\end{bmatrix} -\)\\ +\matrixOp{m11}{m*m+2*m} +\(\matrixPrint[truncate=4]{m11}\)\\ \midrule \begin{lstlisting} \matrixCopy{m12}{m} \(m12 = \matrixPrint{m12}\) \end{lstlisting} & -\(m12 = \begin{bmatrix}1.0 & 2.0 & 3.0 \\ 4.0 & 5.0 & 6.0 \\ 7.0 & 8.0 & 9.0+3.0i\end{bmatrix} -\)\\ +\matrixCopy{m12}{m} +\(m12 = \matrixPrint{m12}\)\\ \midrule \begin{lstlisting} trace of matrix \( m = \matrixTrace{m}\) \end{lstlisting} & -trace of matrix \( m = 15+3i\) \\ +trace of matrix \( m = \matrixTrace{m}\) \\ \midrule \begin{lstlisting} \matrixConjugate{mc}{m} \(mc = \matrixPrint{mc}\) \end{lstlisting} & -\(mc = \begin{bmatrix} 1.0 & 2.0 & 3.0 \\ 4.0 & 5.0 & 6.0 \\ 7.0 & 8.0 & 9.0-3.0i\end{bmatrix} -\)\\ +\matrixConjugate{mc}{m} +\(mc = \matrixPrint{mc}\)\\ \midrule \begin{lstlisting} \matrixConjugateT{mct}{m} \(mct = \matrixPrint{mct}\) \end{lstlisting} & -\(mct = \begin{bmatrix} 1.0 & 4.0 & 7.0 \\ 2.0 & 5.0 & 8.0 \\ 3.0 & 6.0 & 9.0-3.0i\end{bmatrix} -\)\\ +\matrixConjugateT{mct}{m} +\(mct = \matrixPrint{mct}\)\\ \midrule \begin{lstlisting} \(\matrixNormOne{m}\) \end{lstlisting} & - \(18.486832980505\) \\ + \(\matrixNormOne{m}\) \\ \midrule \begin{lstlisting} \(\matrixNormInfty{m}\) \end{lstlisting} & - \(24.486832980505\) \\ + \(\matrixNormInfty{m}\) \\ \midrule \begin{lstlisting} \(\matrixNormMax{m}\) \end{lstlisting} & - \(9.4868329805051\) \\ +\(\matrixNormMax{m}\) \\ \midrule \begin{lstlisting} \(\matrixNormF{m}\) \end{lstlisting} & -\( 17.146428199482\) \\ + \(\matrixNormF{m}\) \\ \midrule \multicolumn{2}{c}{Elementary row operations on matrices}\\ @@ -874,22 +976,22 @@ trace of matrix \( m = 15+3i\) \\ \matrixSwapRows{m13}{m}{2}{3} \(m13 = \matrixPrint{m13}\) \end{lstlisting} & -\(m13 = \begin{bmatrix}1.0 & 2.0 & 3.0 \\ 7.0 & 8.0 & 9.0+3.0i \\ 4.0 & 5.0 & 6.0\end{bmatrix} -\)\\ +\matrixSwapRows{m13}{m}{2}{3} +\(m13 = \matrixPrint{m13}\)\\ \midrule \begin{lstlisting} \matrixMulRow{m14}{m}{3}{300} \(m14 = \matrixPrint{m14}\) \end{lstlisting} & -\(m14 = \begin{bmatrix}1.0 & 2.0 & 3.0 \\ 4.0 & 5.0 & 6.0 \\ 2100.0 & 2400.0 & 2700.0+900.0i \end{bmatrix} -\)\\ +\matrixMulRow{m14}{m}{3}{300} +\(m14 = \matrixPrint{m14}\)\\ \midrule \begin{lstlisting} \matrixMulAddRow{m15}{m}{2}{10}{3} \(m15 = \matrixPrint{m15}\) \end{lstlisting} & -\(m15 = \begin{bmatrix}1.0 & 2.0 & 3.0 \\ 4.0 & 5.0 & 6.0 \\ 47.0 & 58.0 & 69.0+3.0i\end{bmatrix} -\)\\ +\matrixMulAddRow{m15}{m}{2}{10}{3} +\(m15 = \matrixPrint{m15}\)\\ \midrule \multicolumn{2}{c}{Elementary column operations on matrices}\\ \midrule @@ -897,23 +999,23 @@ trace of matrix \( m = 15+3i\) \\ \matrixSwapCols{m16}{m}{2}{3} \(m16 = \matrixPrint{m16}\) \end{lstlisting} & -\(m16 = \begin{bmatrix}1.0 & 3.0 & 2.0 \\ 4.0 & 6.0 & 5.0 \\ 7.0 & 9.0+3.0i & 8.0\end{bmatrix} -\)\\ +\matrixSwapCols{m16}{m}{2}{3} +\(m16 = \matrixPrint{m16}\)\\ \midrule \begin{lstlisting} \matrixMulCol{m17}{m}{3}{300} \(m17 = \matrixPrint{m17}\) \end{lstlisting} & -\(m17 = \begin{bmatrix} 1.0 & 2.0 & 900.0 \\ 4.0 & 5.0 & 1800.0 \\ 7.0 & 8.0 & 2700.0+900.0i \end{bmatrix} -\)\\ +\matrixMulCol{m17}{m}{3}{300} +\(m17 = \matrixPrint{m17}\)\\ \midrule \begin{lstlisting} \matrixMulAddCol{m18}{m}{2}{10}{3} \(m18 = \matrixPrint{m18}\) \end{lstlisting} & -\(m18 = \begin{bmatrix}1.0 & 2.0 & 23.0 \\ 4.0 & 5.0 & 56.0 \\ 7.0 & 8.0 & 89.0+3.0i\end{bmatrix} -\)\\ +\matrixMulAddCol{m18}{m}{2}{10}{3} +\(m18 = \matrixPrint{m18}\)\\ \midrule \multicolumn{2}{c}{Reduced row echelon form of a matrix}\\ @@ -922,27 +1024,27 @@ trace of matrix \( m = 15+3i\) \\ \matrixRREF{m19}{p} \(m19 = \matrixPrint{m19}\) \end{lstlisting} & -\(m19 = \begin{bmatrix}1.0 & 0.0 & -1.0 \\ 0.0 & 1.0 & 2.0 \\ 0.0 & 0.0 & 0.0\end{bmatrix} -\)\\ +\matrixRREF{m19}{p} +\(m19 = \matrixPrint{m19}\)\\ \midrule \begin{lstlisting} \matrixRREF{m20}{m} \(m20 = \matrixPrint{m20}\) \end{lstlisting} & -\(m20 = \begin{bmatrix} 1.0 & 0.0 & 0.0 \\ 0.0 & 1.0 & 0.0 \\ 0.0 & 0.0 & 1.0\end{bmatrix} -\)\\ +\matrixRREF{m20}{m} +\(m20 = \matrixPrint{m20}\)\\ \bottomrule \\ \caption{Illustration of commands for operations on matrices} \label{tbl:illluamatrix} \end{longtable} \end{center} - -The package has command \verb|\matrixRREFSteps| to produce step-by-step computation of reduced row echelon form of a matrix. The command \verb|\matrixRREFSteps{p}| outputs the following. -\begin{framed}Step 1:Multiply row 1 by 4.0 and subtract it from row 2.$$\begin{bmatrix} 1.0 & 2.0 & 3.0 \\ 0.0 & -3.0 & -6.0 \\ 7.0 & 8.0 & 9.0 \\ \end{bmatrix} $$Step 2:Multiply row 1 by 7.0 and subtract it from row 3.$$\begin{bmatrix} 1.0 & 2.0 & 3.0 \\ 0.0 & -3.0 & -6.0 \\ 0.0 & -6.0 & -12.0 \\ \end{bmatrix} $$Step 3:Divide row 2 by -3.0.$$\begin{bmatrix} 1.0 & 2.0 & 3.0 \\ 0.0 & 1.0 & 2.0 \\ 0.0 & -6.0 & -12.0 \\ \end{bmatrix} $$Step 4:Multiply row 2 by 2.0 and subtract it from row 1.$$\begin{bmatrix} 1.0 & 0.0 & -1.0 \\ 0.0 & 1.0 & 2.0 \\ 0.0 & -6.0 & -12.0 \\ \end{bmatrix} $$Step 5:Multiply row 2 by -6.0 and subtract it from row 3.$$\begin{bmatrix} 1.0 & 0.0 & -1.0 \\ 0.0 & 1.0 & 2.0 \\ 0.0 & 0.0 & 0.0 \\ \end{bmatrix} $$ +The package has command \verb|\matrixRREFSteps| to produce step-by-step computation of reduced row echelon form of a matrix. The command \verb|\matrixRREFSteps{r}| outputs the following. +\renewcommand*{\arraystretch}{1.5} +\begin{framed} + \matrixRREFSteps{r} \end{framed} - +\renewcommand*{\arraystretch}{1.0} The command \verb|\matrixGaussJordan| is used to obtain Gauss-Jordan elimination of an augmented matrix. - \begin{lstlisting} \def\a{{{1,1,1},{2,-1,-1},{1,-1,1}}} \def\b{{{3},{3},{9}}} @@ -953,27 +1055,28 @@ $$W = \matrixPrint{W}$$ \matrixGaussJordan{U}{S}{T} $$U = \matrixPrint{U}$$ \end{lstlisting} - The above code produces the following output. +\def\a{{{1,1,1},{2,-1,-1},{1,-1,1}}} +\def\b{{{3},{3},{9}}} +\matrixNew{S}{\a} +\matrixNew{T}{\b} +\matrixConcatH{W}{S}{T} \begin{framed} -$$W =\begin{bmatrix} 1.0 & 1.0 & 1.0 & 3.0 \\ 2.0 & -1.0 & -1.0 & 3.0 \\ 1.0 & -1.0 & 1.0 & 9.0 \\ \end{bmatrix} $$ -$$U = \begin{bmatrix} 1.0 & 0.0 & 0.0 & 2.0 \\ 0.0 & 1.0 & 0.0 & -3.0 \\ 0.0 & 0.0 & 1.0 & 4.0 \\ \end{bmatrix}$$ +$$W = \matrixPrint{W}$$ +\matrixGaussJordan{U}{S}{T} +$$U = \matrixPrint{U}$$ \end{framed} - The package also has a command \verb|\matrixGaussJordanSteps| to produce step-by-step computation of Gauss-Jordan elimination of an augmented matrix. The command \verb|\matrixGaussJordanSteps{S}{T}| produces the following output. - \begin{framed} -$$W =\begin{bmatrix} 1.0 & 1.0 & 1.0 & 3.0 \\ 2.0 & -1.0 & -1.0 & 3.0 \\ 1.0 & -1.0 & 1.0 & 9.0 \\ \end{bmatrix} $$ -Step 1:Multiply row 1 by 2.0 and subtract it from row 2.$$\begin{bmatrix} 1.0 & 1.0 & 1.0 & 3.0 \\ 0.0 & -3.0 & -3.0 & -3.0 \\ 1.0 & -1.0 & 1.0 & 9.0 \\ \end{bmatrix} $$Step 2:Multiply row 1 by 1.0 and subtract it from row 3.$$\begin{bmatrix} 1.0 & 1.0 & 1.0 & 3.0 \\ 0.0 & -3.0 & -3.0 & -3.0 \\ 0.0 & -2.0 & 0.0 & 6.0 \\ \end{bmatrix} $$Step 3:Divide row 2 by -3.0.$$\begin{bmatrix} 1.0 & 1.0 & 1.0 & 3.0 \\ 0.0 & 1.0 & 1.0 & 1.0 \\ 0.0 & -2.0 & 0.0 & 6.0 \\ \end{bmatrix} $$Step 4:Multiply row 2 by 1.0 and subtract it from row 1.$$\begin{bmatrix} 1.0 & 0.0 & 0.0 & 2.0 \\ 0.0 & 1.0 & 1.0 & 1.0 \\ 0.0 & -2.0 & 0.0 & 6.0 \\ \end{bmatrix} $$Step 5:Multiply row 2 by -2.0 and subtract it from row 3.$$\begin{bmatrix} 1.0 & 0.0 & 0.0 & 2.0 \\ 0.0 & 1.0 & 1.0 & 1.0 \\ 0.0 & 0.0 & 2.0 & 8.0 \\ \end{bmatrix} $$Step 6:Divide row 3 by 2.0.$$\begin{bmatrix} 1.0 & 0.0 & 0.0 & 2.0 \\ 0.0 & 1.0 & 1.0 & 1.0 \\ 0.0 & 0.0 & 1.0 & 4.0 \\ \end{bmatrix} $$Step 7:Multiply row 3 by 1.0 and subtract it from row 2.$$\begin{bmatrix} 1.0 & 0.0 & 0.0 & 2.0 \\ 0.0 & 1.0 & 0.0 & -3.0 \\ 0.0 & 0.0 & 1.0 & 4.0 \\ \end{bmatrix} $$ +\matrixGaussJordanSteps{S}{T} \end{framed} - \section{Customized usage}\label{customuse} The commands available in the package can be used for performing further operations on vectors and matrices. The command \verb|\vectorAdd| can be extended to add more than two vectors. The latex document (listing \ref{code:custluavec}) provides some instances of such usage. \begin{lstlisting}[label={code:custluavec}, caption={Customized usage of the lualinalg package}] \documentclass{article} \usepackage{lualinalg} \begin{document} -\begin{luacode} +\begin{luacode*} function sumcoordinates(v1) local sum = 0 for i = 1,#v1 do @@ -990,32 +1093,28 @@ s=vector.add(s,vector(p[i])) end return s end -\end{luacode} -\vectorNew{v}{{1,2,complex('3+3i')}} +\end{luacode*} +\vectorNew{v}{{1,2,lcomplex(3,3)}} The sum of coordinates of vector - \(v = \directlua{tex.sprint(tostring( sumcoordinates(v)))}\). + \(v = \directlua{tex.sprint(tostring( sumcoordinates(vectors['v'])))}\). \newcommand\vectorAddmulti[2]{% \directlua{% vectors['#1'] = vector.addmulti(#2) }% } - -\vectorNew{w}{{3,6,complex('6+6i')}} -\vectorNew{x}{{9,12,complex('12+12i')}} -\vectorAddmulti{y}{v,w,x} +\vectorNew{w}{{3,6,lcomplex(6,6)}} +\vectorNew{x}{{9,12,lcomplex(12,12)}} +\vectorAddmulti{y}{vectors['v'],vectors['w'],vectors['x']} The sum of vectors \(v,w \text{ and } x =\left( \vectorPrint{y} \right)\). \end{document} \end{lstlisting} - The latex document (listing \ref{code:custluavec}) outputs the following on compilation. \begin{framed} -The sum of coordinates of vector \(v = 6 + 3i\). +The sum of coordinates of vector \(v = 6 + 3\mathrm{i}\). -The sum of vectors \(v,w \text{ and } x = \left(13.0, 20.0, 21.0 + 21.0i \right) \). +The sum of vectors \(v,w \text{ and } x = \left(13, 20, 21 + 21\mathrm{i} \right) \). \end{framed} - - The command \verb|\matrixAdd| can be extended to add more than two matrices. The latex document (listing \ref{code:custluamtx}) provides some instances of such usage. \begin{lstlisting}[label={code:custluamtx}, caption={Customized usage of the lualinalg package}] @@ -1031,7 +1130,7 @@ for i = 1,#m1 do if i == j then sum = sum + (m1[i][j])^2 end end end -return sum +return complex.round(sum) end function matrix.addmulti(...) @@ -1044,14 +1143,14 @@ end end \end{luacode} -\def\r{{{1,2,3},{4,5,6},{7,8,complex('9+3i')}}} +\def\r{{{1,2,3},{4,5,6},{7,8,lcomplex(9,3)}}} \matrixNew{m}{\r} The sum of squares of diagonal entries of matrix - \(m = \directlua{tex.sprint(tostring(squareDiagEntries(m)))}\). + \(m = \directlua{tex.sprint(tostring(squareDiagEntries(matrices['m'])))}\). -\def\s{{{1,2,3},{4,5,complex('6+6i')}}} -\def\t{{{10,20,30},{40,50,complex('60+60i')}}} -\def\u{{{100,200,300},{400,500,complex('600+600i')}}} +\def\s{{{1,2,3},{4,5,lcomplex(6,6)}}} +\def\t{{{10,20,30},{40,50,lcomplex(60,60)}}} +\def\u{{{100,200,300},{400,500,lcomplex(600,600)}}} \matrixNew{m1}{\s} \matrixNew{m2}{\t} \matrixNew{m3}{\u} @@ -1060,18 +1159,17 @@ The sum of squares of diagonal entries of matrix matrices['#1'] = matrix.addmulti(#2) }% } -\matrixAddmulti{m4}{m1,m2,m3} +\matrixAddmulti{m4}{matrices['m1'],matrices['m2'],matrices['m3']} The sum of matrices \(m1,m2 \text{ and } m3 = \matrixPrint{m4}\). \end{document} \end{lstlisting} The latex document (listing \ref{code:custluamtx}) outputs the following on compilation. \begin{framed} -The sum of squares of diagonal entries of matrix \(m = 98.0 + 54i\). +The sum of squares of diagonal entries of matrix \(m = 98 + 54\mathrm{i}\). -The sum of matrices \(m1,m2 \text{ and } m3 =\begin{bmatrix} 111.0 & 222.0 & 333.0 \\ 444.0 & 555.0 & 666.0+666.0i \end{bmatrix} \). +The sum of matrices \(m1,m2 \text{ and } m3 =\begin{bmatrix} 111 & 222 & 333 \\ 444 & 555 & 666+666\mathrm{i} \end{bmatrix} \). \end{framed} - \section{Known issues and limitations} \begin{itemize} \item The package supports small and big numbers. They can be input in the usual scientific notation. The math library in Lua defines constants with the maximum \verb|math.maxinteger| and the minimum \verb|math.mininteger| values for an integer. The result wraps around when there is a computational operation on integers that would result in a value smaller than the \verb|mininteger| or larger than the \verb|maxinteger|. It means that the computed result is the only number between the \verb|miniinteger| and \verb|maxinteger|. diff --git a/macros/luatex/latex/lualinalg/lualinalg_complex.lua b/macros/luatex/latex/lualinalg/lualinalg_complex.lua deleted file mode 100644 index 89f3fdf072..0000000000 --- a/macros/luatex/latex/lualinalg/lualinalg_complex.lua +++ /dev/null @@ -1,298 +0,0 @@ - ---Version=1.2, Date=14-Feb-2023 --- provides module for complex numbers - ---Contains a modified version of the file complex.lua. It is availalbe on the link https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua. This is licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions. - ---Licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions. - - - -complex = {} - -local complex_meta = {} - -local function parse_scalar(s, pos0) - local x, n, pos = s:match('^([+-]?[%d%.]+)(.?)()', pos0) - if not x then return end - if n == 'e' or n == 'E' then - local x2, n2, pos2 = s:match('^([+-]?%d+)(.?)()', pos) - if not x2 then error 'number format error' end - x = tonumber(x..n..x2) - if not x then error 'number format error' end - return x, n2, pos2 - else - x = tonumber(x) - if not x then error 'number format error' end - return x, n, pos - end -end -local function parse_component(s, pos0) - local x, n, pos = parse_scalar(s, pos0) - if not x then - local x2, n2, pos2 = s:match('^([+-]?)(i)()$', pos0) - if not x2 then error 'number format error' end - return (x2=='-' and -1 or 1), n2, pos2 - end - if n == '/' then - local x2, n2, pos2 = parse_scalar(s, pos) - x = x / x2 - return x, n2, pos2 - end - return x, n, pos -end -local function parse_complex(s) - local x, n, pos = parse_component(s, 1) - if n == '+' or n == '-' then - local x2, n2, pos2 = parse_component(s, pos) - if n2 ~= 'i' or pos2 ~= #s+1 then error 'number format error' end - if n == '-' then x2 = - x2 end - return x, x2 - elseif n == '' then - return x, 0 - elseif n == 'i' then - if pos ~= #s+1 then error 'number format error' end - return 0, x - else - error 'number format error' - end -end - -function complex.to( num ) - -- check for table type - if type( num ) == "table" then - -- check for a complex number - if getmetatable( num ) == complex_meta then - return num - end - local real,imag = tonumber( num[1] ),tonumber( num[2] ) - if real and imag then - return setmetatable( { real,imag }, complex_meta ) - end - return - end - local isnum = tonumber( num ) - if isnum then - return setmetatable( { isnum,0 }, complex_meta ) - end - if type( num ) == "string" then - local real, imag = parse_complex(num) - return setmetatable( { real, imag }, complex_meta ) - end -end - -setmetatable( complex, { __call = function( _,num ) return complex.to( num ) end } ) - - -function complex.new( ... ) - return setmetatable( { ... }, complex_meta ) -end - - -function complex.type( arg ) - if getmetatable( arg ) == complex_meta then - return "complex" - end -end - - -function complex.convpolar( radius, phi ) - return setmetatable( { radius * math.cos( phi ), radius * math.sin( phi ) }, complex_meta ) -end - -function complex.convpolardeg( radius, phi ) - phi = phi/180 * math.pi - return setmetatable( { radius * math.cos( phi ), radius * math.sin( phi ) }, complex_meta ) -end - -function complex.tostring( cx,formatstr ) - local real,imag = cx[1],cx[2] - if formatstr then - if imag == 0 then - return string.format( formatstr, real ) - elseif real == 0 then - return string.format( formatstr, imag ).."i" - elseif imag > 0 then - return string.format( formatstr, real ).."+"..string.format( formatstr, imag ).."i" - end - return string.format( formatstr, real )..string.format( formatstr, imag ).."i" - end - if imag == 0 then - return real - elseif real == 0 then - return ((imag==1 and "") or (imag==-1 and "-") or imag).."i" - elseif imag > 0 then - return real.."+"..(imag==1 and "" or imag).."i" - end - return real..(imag==-1 and "-" or imag).."i" -end - -function complex.print( ... ) - print( complex.tostring( ... ) ) -end - -function complex.polar( cx ) - return math.sqrt( cx[1]^2 + cx[2]^2 ), math.atan2( cx[2], cx[1] ) -end - -function complex.polardeg( cx ) - return math.sqrt( cx[1]^2 + cx[2]^2 ), math.atan2( cx[2], cx[1] ) / math.pi * 180 -end - -function complex.norm2( cx ) - return cx[1]^2 + cx[2]^2 -end - -function complex.abs( cx ) - return math.sqrt( cx[1]^2 + cx[2]^2 ) -end - -function complex.get( cx ) - return cx[1],cx[2] -end - - -function complex.set( cx,real,imag ) - cx[1],cx[2] = real,imag -end - -function complex.is( cx,real,imag ) - if cx[1] == real and cx[2] == imag then - return true - end - return false -end - - -function complex.copy( cx ) - return setmetatable( { cx[1],cx[2] }, complex_meta ) -end - - -function complex.add( cx1,cx2 ) - return setmetatable( { cx1[1]+cx2[1], cx1[2]+cx2[2] }, complex_meta ) -end - - -function complex.sub( cx1,cx2 ) - return setmetatable( { cx1[1]-cx2[1], cx1[2]-cx2[2] }, complex_meta ) -end - -function complex.mul( cx1,cx2 ) - return setmetatable( { cx1[1]*cx2[1] - cx1[2]*cx2[2],cx1[1]*cx2[2] + cx1[2]*cx2[1] }, complex_meta ) -end - - -function complex.mulnum( cx,num ) - return setmetatable( { cx[1]*num,cx[2]*num }, complex_meta ) -end - -function complex.div( cx1,cx2 ) - local val = cx2[1]^2 + cx2[2]^2 - return setmetatable( { (cx1[1]*cx2[1]+cx1[2]*cx2[2])/val,(cx1[2]*cx2[1]-cx1[1]*cx2[2])/val }, complex_meta ) -end - -function complex.divnum( cx,num ) - return setmetatable( { cx[1]/num,cx[2]/num }, complex_meta ) -end - - -function complex.pow( cx,num ) - if math.floor( num ) == num then - if num < 0 then - local val = cx[1]^2 + cx[2]^2 - cx = { cx[1]/val,-cx[2]/val } - num = -num - end - local real,imag = cx[1],cx[2] - for i = 2,num do - real,imag = real*cx[1] - imag*cx[2],real*cx[2] + imag*cx[1] - end - return setmetatable( { real,imag }, complex_meta ) - end - local length,phi = math.sqrt( cx[1]^2 + cx[2]^2 )^num, math.atan2( cx[2], cx[1] )*num - return setmetatable( { length * math.cos( phi ), length * math.sin( phi ) }, complex_meta ) -end - -function complex.sqrt( cx ) - local len = math.sqrt( cx[1]^2+cx[2]^2 ) - local sign = (cx[2]<0 and -1) or 1 - return setmetatable( { math.sqrt((cx[1]+len)/2), sign*math.sqrt((len-cx[1])/2) }, complex_meta ) -end - - -function complex.ln( cx ) - return setmetatable( { math.log(math.sqrt( cx[1]^2 + cx[2]^2 )), - math.atan2( cx[2], cx[1] ) }, complex_meta ) -end - -function complex.exp( cx ) - local expreal = math.exp(cx[1]) - return setmetatable( { expreal*math.cos(cx[2]), expreal*math.sin(cx[2]) }, complex_meta ) -end - - -function complex.conjugate( cx ) - return setmetatable( { cx[1], -cx[2] }, complex_meta ) -end - -function complex.round( cx,idp ) - local mult = 10^( idp or 0 ) - return setmetatable( { math.floor( cx[1] * mult + 0.5 ) / mult, - math.floor( cx[2] * mult + 0.5 ) / mult }, complex_meta ) -end - - -complex.zero = complex.new(0, 0) -complex.one = complex.new(1, 0) - - - -complex_meta.__add = function( cx1,cx2 ) - local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) - return complex.add( cx1,cx2 ) -end -complex_meta.__sub = function( cx1,cx2 ) - local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) - return complex.sub( cx1,cx2 ) -end -complex_meta.__mul = function( cx1,cx2 ) - local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) - return complex.mul( cx1,cx2 ) -end -complex_meta.__div = function( cx1,cx2 ) - local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) - return complex.div( cx1,cx2 ) -end -complex_meta.__pow = function( cx,num ) - if num == "*" then - return complex.conjugate( cx ) - end - return complex.pow( cx,num ) -end -complex_meta.__unm = function( cx ) - return setmetatable( { -cx[1], -cx[2] }, complex_meta ) -end -complex_meta.__eq = function( cx1,cx2 ) - if cx1[1] == cx2[1] and cx1[2] == cx2[2] then - return true - end - return false -end -complex_meta.__tostring = function( cx ) - return tostring( complex.tostring( cx ) ) -end -complex_meta.__concat = function( cx,cx2 ) - return tostring(cx)..tostring(cx2) -end --- cx( cx, formatstr ) -complex_meta.__call = function( ... ) - print( complex.tostring( ... ) ) -end -complex_meta.__index = {} -for k,v in pairs( complex ) do - complex_meta.__index[k] = v -end - -return complex - diff --git a/macros/luatex/latex/luamaths/README.txt b/macros/luatex/latex/luamaths/README.txt index 02466225a8..926a94962c 100644 --- a/macros/luatex/latex/luamaths/README.txt +++ b/macros/luatex/latex/luamaths/README.txt @@ -1,10 +1,13 @@ +# The luamaths package +# version 1.1 +# Authors: Chetan Shirore and Ajit Kumar +# Email: mathsbeauty@gmail.com + # Introduction The luamaths package is developed to perform standard mathematical operations inside LaTeX documents using Lua. It provides an easy way to perform standard mathematical operations. There is no particular environment in the package for performing mathematical operations. -The package commands can be used in any environment (including the mathematics environment). - - + # License The luamaths package is released under the LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt. diff --git a/macros/luatex/latex/luamaths/luamaths-complex.lua b/macros/luatex/latex/luamaths/luamaths-complex.lua new file mode 100644 index 0000000000..68fd055b5e --- /dev/null +++ b/macros/luatex/latex/luamaths/luamaths-complex.lua @@ -0,0 +1,347 @@ +--Version=1.3, Date=30-July-2023 +-- provides module for complex numbers +--Contains a modified version of the file complex.lua. It is availalbe on the link https://github.com/davidm/lua-matrix/blob/master/lua/complex.lua. This is licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions. +--Licensed under the same terms as Lua itself. This license allows to freely copy, modify and distribute the file for any purpose and without any restrictions. + +frac= require("luamaths-fractions") +complex = {} +complex_meta = {} + +local function parse_scalar(s, pos0) + local x, n, pos = s:match('^([+-]?[%d%.]+)(.?)()', pos0) + if not x then return end + if n == 'e' or n == 'E' then + local x2, n2, pos2 = s:match('^([+-]?%d+)(.?)()', pos) + if not x2 then error 'number format error' end + x = tonumber(x..n..x2) + if not x then error 'number format error' end + return x, n2, pos2 + else + x = tonumber(x) + if not x then error 'number format error' end + return x, n, pos + end +end +local function parse_component(s, pos0) + local x, n, pos = parse_scalar(s, pos0) + if not x then + local x2, n2, pos2 = s:match('^([+-]?)(i)()$', pos0) + if not x2 then error 'number format error' end + return (x2=='-' and -1 or 1), n2, pos2 + end + if n == '/' then + local x2, n2, pos2 = parse_scalar(s, pos) + x = x / x2 + return x, n2, pos2 + end + return x, n, pos +end +local function parse_complex(s) + local x, n, pos = parse_component(s, 1) + if n == '+' or n == '-' then + local x2, n2, pos2 = parse_component(s, pos) + if n2 ~= 'i' or pos2 ~= #s+1 then error 'number format error' end + if n == '-' then x2 = - x2 end + return x, x2 + elseif n == '' then + return x, 0 + elseif n == 'i' then + if pos ~= #s+1 then error 'number format error' end + return 0, x + else + error 'number format error' + end +end + +function complex.to( num ) + -- check for table type + if type( num ) == "table" then + -- check for a complex number + if getmetatable( num ) == complex_meta then + return num + end + + if getmetatable( num) == frac_mt then + return setmetatable( { num, 0 }, complex_meta ) + end + + local real,imag = tonumber( num[1] ),tonumber( num[2] ) + if real and imag then + return setmetatable( { real,imag }, complex_meta ) + end + return + end + local isnum = tonumber( num ) + if isnum then + return setmetatable( { isnum,0 }, complex_meta ) + end + if type( num ) == "string" then + local real, imag = parse_complex(num) + return setmetatable( { real, imag }, complex_meta ) + end +end + +setmetatable( complex, { __call = function( _,num ) return complex.to( num ) end } ) + +function complex.new( x,y) + return setmetatable( {x,y}, complex_meta ) +end + +lcomplex = complex.new +function complex.type( arg ) + if getmetatable( arg ) == complex_meta then + return "complex" + end +end + +function complex.convpolar( radius, phi ) + return setmetatable( { radius * math.cos( phi ), radius * math.sin( phi ) }, complex_meta ) +end + +function complex.convpolardeg( radius, phi ) + phi = phi/180 * math.pi + return setmetatable( { radius * math.cos( phi ), radius * math.sin( phi ) }, complex_meta ) +end + +function complex.tostring( cx,formatstr ) + imunit = "\\imUnit" + local real,imag = cx[1],cx[2] + if type(cx[1]) ~= "table" and type(cx[2]) ~= "table" then + if imag == 0 then + return real + elseif real == 0 then + return ((imag==1 and "") or (imag==-1 and "-") or imag)..imunit + elseif imag > 0 then + return real.."+"..(imag==1 and "" or imag)..imunit + end + return real..(imag==-1 and "-" or imag)..imunit + end + + if type(cx[1]) == "table" and type(cx[2]) ~= "table" then + if cx[2] == 0 then + return frac.tostring(cx[1]) + end + if cx[2] > 0 then + return frac.tostring(cx[1]).. "+"..(imag==1 and "" or imag)..imunit + end + if cx[2] < 0 then + return frac.tostring(cx[1])..(imag==-1 and "-" or imag)..imunit + end + + end + + if type(cx[1]) ~= "table" and type(cx[2]) == "table" then + if frac.toFnumber(cx[2])==0 then return cx[1] end + return cx[1].."+"..frac.tostring(cx[2])..imunit + end + + if type(cx[1]) == "table" and type(cx[2]) == "table" then + if frac.toFnumber(cx[1]) == 0 and frac.toFnumber(cx[2]) ~= 0 then + return frac.tostring(cx[2])..imunit + end + + if frac.toFnumber(cx[2]) == 0 then + return frac.tostring(cx[1] + 0) + end + + if cx[2].d == 1 then + if cx[2].n > 0 then + return frac.tostring(cx[1]).. "+"..(cx[2].n==1 and "" or math.floor(cx[2].n))..imunit + end + if cx[2].n < 0 then + return frac.tostring(cx[1])..(cx[2].n==-1 and "-" or math.floor(cx[2].n))..imunit + end + end + end + return frac.tostring(cx[1]).. "+"..frac.tostring(cx[2])..imunit +end + +function complex.print( ... ) + print( complex.tostring( ... ) ) +end + +function complex.polar( cx ) + return math.sqrt( cx[1]^2 + cx[2]^2 ), math.atan2( cx[2], cx[1] ) +end + +function complex.polardeg( cx ) + return math.sqrt( cx[1]^2 + cx[2]^2 ), math.atan2( cx[2], cx[1] ) / math.pi * 180 +end + +function complex.norm2( cx ) + return cx[1]^2 + cx[2]^2 +end + +function complex.abs( cx ) + return math.sqrt( cx[1]^2 + cx[2]^2 ) +end + +function complex.get( cx ) + return cx[1],cx[2] +end + +function complex.set( cx,real,imag ) + cx[1],cx[2] = real,imag +end + +function complex.is( cx,real,imag ) + if cx[1] == real and cx[2] == imag then + return true + end + return false +end + +function complex.copy( cx ) + return setmetatable( { cx[1],cx[2] }, complex_meta ) +end + +function complex.add( cx1,cx2 ) + return setmetatable( { cx1[1]+cx2[1], cx1[2]+cx2[2] }, complex_meta ) +end + +function complex.sub( cx1,cx2 ) + return setmetatable( { cx1[1]-cx2[1], cx1[2]-cx2[2] }, complex_meta ) +end + +function complex.mul( cx1,cx2 ) + return setmetatable( { cx1[1]*cx2[1] - cx1[2]*cx2[2],cx1[1]*cx2[2] + cx1[2]*cx2[1] }, complex_meta ) +end + +function complex.mulnum( cx,num ) + return setmetatable( { cx[1]*num,cx[2]*num }, complex_meta ) +end + +function complex.div( cx1,cx2 ) + local val = cx2[1]*cx2[1] + cx2[2]*cx2[2] + return setmetatable( { (cx1[1]*cx2[1]+cx1[2]*cx2[2])/val,(cx1[2]*cx2[1]-cx1[1]*cx2[2])/val }, complex_meta ) +end + +function complex.divnum( cx,num ) + return setmetatable( { cx[1]/num,cx[2]/num }, complex_meta ) +end + +function complex.pow( cx,num ) + if math.floor( num ) == num then + if num < 0 then + local val = cx[1]^2 + cx[2]^2 + cx = { cx[1]/val,-cx[2]/val } + num = -num + end + local real,imag = cx[1],cx[2] + for i = 2,num do + real,imag = real*cx[1] - imag*cx[2],real*cx[2] + imag*cx[1] + end + return setmetatable( { real,imag }, complex_meta ) + end + local length,phi = math.sqrt( cx[1]^2 + cx[2]^2 )^num, math.atan2( cx[2], cx[1] )*num + return setmetatable( { length * math.cos( phi ), length * math.sin( phi ) }, complex_meta ) +end + +function complex.sqrt( cx ) + local h + local k + + if type(cx[1]) ~= "table" then h = cx[1] end + if type(cx[2]) ~= "table" then k = cx[2] end + + if type(cx[1]) == "table" then h = frac.toFnumber(cx[1]) end + if type(cx[2]) == "table" then k = frac.toFnumber(cx[2]) end + local len = math.sqrt( h^2 + k^2 ) + local sign = ( h<0 and -1) or 1 + return setmetatable( { math.sqrt((h +len)/2), sign*math.sqrt((len-h)/2) }, complex_meta ) +end + +function complex.ln( cx ) + return setmetatable( { math.log(math.sqrt( cx[1]^2 + cx[2]^2 )), + math.atan2( cx[2], cx[1] ) }, complex_meta ) +end + +function complex.exp( cx ) + local expreal = math.exp(cx[1]) + return setmetatable( { expreal*math.cos(cx[2]), expreal*math.sin(cx[2]) }, complex_meta ) +end + +function complex.conjugate( cx ) + return setmetatable( { cx[1], -cx[2] }, complex_meta ) +end + +function Xround(num, numDecimalPlaces) + if type(num)=="number" then + if num==math.floor(num) then + return math.floor(num) + end + end + if type(num)=="number" then + local mult = 10^(numDecimalPlaces or 0) + return math.floor(num * mult + 0.5) / mult + end + return num +end + +function complex.round( cx,idp ) + local mult =10^( idp or 0 ) + if type(cx[1]) ~= "table" and type(cx[2]) ~= "table" then + return setmetatable( {Xround(cx[1],idp), Xround(cx[2],idp)}, complex_meta ) + end + if type(cx[1]) ~= "table" and type(cx[2]) == "table" then + return setmetatable( {Xround(cx[1],idp), cx[2]}, complex_meta ) + end + if type(cx[1]) == "table" and type(cx[2]) ~= "table" then + return setmetatable({cx[1],Xround(cx[2],idp)}, complex_meta ) + end + if type(cx[1]) == "table" and type(cx[2]) == "table" then + return setmetatable({cx[1],cx[2]}, complex_meta ) + end +end + +complex.zero = complex.new(0, 0) +complex.one = complex.new(1, 0) + +complex_meta.__add = function( cx1,cx2 ) +local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) +return complex.add( cx1,cx2 ) +end +complex_meta.__sub = function( cx1,cx2 ) +local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) +return complex.sub( cx1,cx2 ) +end +complex_meta.__mul = function( cx1,cx2 ) +local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) +return complex.mul( cx1,cx2 ) +end +complex_meta.__div = function( cx1,cx2 ) +local cx1,cx2 = complex.to( cx1 ),complex.to( cx2 ) +return complex.div( cx1,cx2 ) +end +complex_meta.__pow = function( cx,num ) +if num == "*" then +return complex.conjugate( cx ) +end +return complex.pow( cx,num ) +end +complex_meta.__unm = function( cx ) +return setmetatable( { -cx[1], -cx[2] }, complex_meta ) +end +complex_meta.__eq = function( cx1,cx2 ) +if cx1[1] == cx2[1] and cx1[2] == cx2[2] then +return true +end +return false +end +complex_meta.__tostring = function( cx ) +return tostring( complex.tostring( cx ) ) +end +complex_meta.__concat = function( cx,cx2 ) +return tostring(cx)..tostring(cx2) +end +-- cx( cx, formatstr ) +complex_meta.__call = function( ... ) +print( complex.tostring( ... ) ) +end +complex_meta.__index = {} +for k,v in pairs( complex ) do +complex_meta.__index[k] = v +end + +return complex + diff --git a/macros/luatex/latex/luamaths/luamaths-fractions.lua b/macros/luatex/latex/luamaths/luamaths-fractions.lua new file mode 100644 index 0000000000..e4ab7a2329 --- /dev/null +++ b/macros/luatex/latex/luamaths/luamaths-fractions.lua @@ -0,0 +1,225 @@ +-- The luafractions module +-- Authors: Chetan Shirore and Ajit Kumar +-- version 1.0, Date=03-Aug-2023 +-- Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt. + +M = {} -- the module +frac_mt = {} -- the metatable +function M.new (n, d, mode) + mode = mode or 'fracs' + if mode == 'nofracs' then + return (n/d) + end + if mode == 'fracs' then + if n~=math.floor(n) or d~=math.floor(d) then + error('Only integers are expected.') + end + if d == 0 then + error('Invalid fraction') + end + local fr = {} + local g = M.lgcd(n,d) + fr = {n=n/g, d=d/g} + return setmetatable(fr,frac_mt) + end +end +lfrac = M.new + +function M.lgcd (a, b) + local r + while (b ~= 0) do + r = a % b + a = b + b = r + end + return a +end + +function M.simp (num) + local cf = gcd(num[1], num[2]) + return M.new(num[1] / cf, num2[2] / cf) +end + +function M.toFnumber(c) + return c.n / c.d +end + +function M.toFrac(x) + if type(x) == "number" then + if x==math.floor(x) then + return M.new(math.floor(x),1) + else + return x + end + end + return x +end + + +function addFracs (c1, c2) + return M.new(c1.n * c2.d + c1.d * c2.n, c1.d*c2.d) +end + +function subFracs (c1, c2) + return M.new(c1.n * c2.d - c1.d * c2.n, c1.d*c2.d) +end + +function mulFracs (c1, c2) + return M.new(c1.n * c2.n, c1.d*c2.d) +end + +function divFracs (c1, c2) + return M.new(c1.n * c2.d, c1.d*c2.n) +end + +function minusFracs (c1) + return M.new(-c1.n,c1.d) +end + +function powerFracs (c1,m) + return M.new((c1.n)^m,(c1.d)^m) +end + + +function M.add(a, b) + if type(a) == "number" then + if a==math.floor(a) then + return addFracs(M.new(a,1),b) + else + return a + M.toFnumber(b) + end + end + + if type(b) == "number" then + if b==math.floor(b) then + return addFracs(a,M.new(b,1)) + else + return M.toFnumber(a) + b + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then + return setmetatable( { a+b[1], b[2] }, complex_meta ) + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( b ) == frac_mt and getmetatable( a ) == complex_meta then + return setmetatable( { b+a[1], a[2] }, complex_meta ) + end + end + return addFracs(a, b) +end + + +function M.sub(a, b) + if type(a) == "number" then + if a==math.floor(a) then + return subFracs(M.new(a,1),b) + else + return a - M.toFnumber(b) + end + end + + if type(b) == "number" then + if b==math.floor(b) then + return subFracs(a,M.new(b,1)) + else + return M.toFnumber(a) - b + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then + return setmetatable( { a-b[1], b[2] }, complex_meta ) + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( b ) == frac_mt and getmetatable( a ) == complex_meta then + return setmetatable( { a[1]-b, a[2] }, complex_meta ) + end + end + return subFracs(a, b) +end + + +function M.mul(a, b) + if type(a) == "number" then + if a==math.floor(a) then + return mulFracs(M.new(a,1),b) + else + return a * M.toFnumber(b) + end + end + + if type(b) == "number" then + if b==math.floor(b) then + return mulFracs(a,M.new(b,1)) + else + return M.toFnumber(a) * b + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then + return setmetatable( { a*b[1], a*b[2] }, complex_meta ) + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( b ) == frac_mt and getmetatable( a ) == complex_meta then + return setmetatable( { b*a[1], b*a[2] }, complex_meta ) + end + end + return mulFracs(a, b) +end + + +function M.div(a, b) + if type(a) == "number" then + if a==math.floor(a) then + return divFracs(M.new(a,1),b) + else + return a / M.toFnumber(b) + end + end + + if type(b) == "number" then + if b==math.floor(b) then + return divFracs(a,M.new(b,1)) + else + return M.toFnumber(a) / b + end + end + + if type( a ) == "table" and type(b) =="table" then + if getmetatable( a ) == frac_mt and getmetatable( b ) == complex_meta then + b= setmetatable( { M.toFrac(b[1]), M.toFrac(b[2]) }, complex_meta ) + return a*(1/b) + end + end + return divFracs(a, b) +end + +function M.tostring (c) + if c.d == 1 then + return string.format("%g",c.n) + end + if c.d == -1 then + return string.format("%g",-c.n) + end + return string.format("\\frac{%g}{%g}", c.n, c.d) +end + +--Setting Metatable operations. +frac_mt.__add = M.add +frac_mt.__sub = M.sub +frac_mt.__mul = M.mul +frac_mt.__div = M.div +frac_mt.__unm = minusFracs +frac_mt.__pow = powerFracs +frac_mt.__tostring = M.tostring + +return M
\ No newline at end of file diff --git a/macros/luatex/latex/luamaths/luamaths.pdf b/macros/luatex/latex/luamaths/luamaths.pdf Binary files differindex a9ffe78a82..0b5d310b1d 100644 --- a/macros/luatex/latex/luamaths/luamaths.pdf +++ b/macros/luatex/latex/luamaths/luamaths.pdf diff --git a/macros/luatex/latex/luamaths/luamaths.sty b/macros/luatex/latex/luamaths/luamaths.sty index c3bc4d51e0..524b36a210 100644 --- a/macros/luatex/latex/luamaths/luamaths.sty +++ b/macros/luatex/latex/luamaths/luamaths.sty @@ -1,19 +1,25 @@ -% luaset package -% version 1.0 -% Authors: Chetan Shirore and Ajit Kumar +% The luamaths package +% version 1.1 % Licensed under LaTeX Project Public License v1.3c or later. The complete license text is available at http://www.latex-project.org/lppl.txt. +%Authors: Chetan Shirore and Ajit Kumar -\ProvidesPackage{luaset}[1.0] +\ProvidesPackage{luamaths}[1.1] \RequirePackage{xkeyval} \RequirePackage{amsmath} \RequirePackage{luacode} \begin{luacode*} +local complex = require "luamaths-complex" +local lfrac = require "luamaths-fractions" + function mathop(...) inf = math.huge return ... end function mathround(num, numDecimalPlaces) + if num==math.floor(num) then + return math.floor(num) + end local mult = 10^(numDecimalPlaces or 0) return math.floor(num * mult + 0.5) / mult end @@ -27,7 +33,7 @@ end \newcommand\mathCos[1]{\directlua{tex.sprint(math.cos(#1))}} \newcommand\mathExp[1]{\directlua{tex.sprint(math.exp(#1))}} \newcommand\mathFloor[1]{\directlua{tex.sprint(math.floor(#1))}} -\newcommand\mathHuge{\directlua{tex.sprint(math.huge)}} +\newcommand\mathInf{\directlua{tex.sprint(math.huge)}} \newcommand\mathLog[1]{\directlua{tex.sprint(math.log(#1))}} \newcommand\mathMax[1]{\directlua{tex.sprint(math.max(#1))}} \newcommand\mathMin[1]{\directlua{tex.sprint(math.min(#1))}} @@ -38,4 +44,12 @@ end \newcommand\mathTan[1]{\directlua{tex.sprint(math.tan(#1))}} \newcommand\mathRad[1]{\directlua{tex.sprint(math.rad(#1))}} \newcommand\mathRound[2]{\directlua{tex.sprint(mathround(#1,#2))}} +\newcommand\complexRound[2]{% +\directlua{% +tex.sprint(complex.tostring(complex.round(#1,#2))) +}% +}% +\newcommand{\imUnit}{\mathrm{i}} + + \endinput diff --git a/macros/luatex/latex/luamaths/luamaths.tex b/macros/luatex/latex/luamaths/luamaths.tex index 0c5abbbe94..8e501abf14 100644 --- a/macros/luatex/latex/luamaths/luamaths.tex +++ b/macros/luatex/latex/luamaths/luamaths.tex @@ -1,11 +1,12 @@ \documentclass{article} -\usepackage{listings,color,booktabs,longtable,array,hyperref,multicol} -\usepackage[ left=1in, right=1in]{geometry} +\renewcommand{\baselinestretch}{1.2} +\usepackage{float,listings,color,booktabs,longtable,array,hyperref,luamaths,amsmath,amssymb} +\usepackage[top=1.1in, bottom=1.1in, left=1.1in, right=1.1in]{geometry} \hypersetup{colorlinks,urlcolor=blue} \lstset{frame=none, language=[LaTeX]{TeX}, aboveskip=3mm, - belowskip=3mm, + belowskip=2mm, showstringspaces=false, columns=flexible, basicstyle={\ttfamily}, @@ -16,11 +17,12 @@ breakatwhitespace=true, tabsize=1 } +\usepackage{microtype,graphicx,amsmath,amssymb,float} \usepackage[backend=bibtex]{biblatex} \addbibresource{luamaths} \begin{document} -\title{The luamaths Package in LaTeX} -\author{Chetan Shirore and Dr. Ajit Kumar} +\title{The luamaths package in LaTeX} +\author{Chetan Shirore\thanks{Email id: mathsbeauty@gmail.com} \space and Ajit Kumar} \maketitle \section{Introduction}\label{section:introduction} The \verb|luamaths| package is developed to perform standard mathematical operations inside LaTeX documents using Lua. It provides an easy way to perform standard mathematical operations. There is no particular environment in the package for performing mathematical operations. The package commands can be used in any environment (including the mathematics environment). It is written in Lua, and tex file is to be compiled with LuaLatex engine. The time required for operations is not an issue while compiling with LuaLaTeX. There is no need to install Lua on the users system as tex distributions (TeXLive or MikTeX) come bundled with LuaLaTeX. It is useful to perform standard operations (addition, subtraction, multiplication, division, powers, roots etc.) in tex file itself. The package supports the nesting of commands for multiple operations. It can be modified or extended by writing custom Lua programs. @@ -28,6 +30,8 @@ The \verb|luamaths| package is developed to perform standard mathematical operat The Lua \cite{online.luaorg} programming language is a scripting language that can be embedded across platforms. With\verb|LuaTeX| \cite{online.luatex} and\verb|luacode| \cite{online.luacode} packages, it is possible to use Lua in LaTeX. The TeX \cite{online.tex} or LaTeX has scope for programming \cite{online.texscript}. However, with the weird internals of TeX, there are several limitations, especially for performing calculations on numbers in LaTeX documents. There are packages like \emph{pgf} \cite{online.pgf} and \emph{xparse} \cite{online.xparse} in LaTeX which provides some programming capabilities inside LaTeX documents. However, such packages do not provide the complete programming structure that Lua programming languages provide. The \verb|luacode| \cite{online.luacode} package is used in its development apart from the \verb|luacode| package. There is no need to install Lua on users system as TeX distributions (TeXLive or MikTeX) come bundled with LuaLaTeX. The package can be modified or extended by writing custom Lua programs. + + \section{Installation and License} The installation of \verb|luamaths| package is similar to plain latex package, where the \texttt{.sty} file is in \LaTeX directory of texmf tree. The package can be included with \verb|\usepackage{luamaths}| command in the preamble of the LaTeX document. The TeX file is to be compiled using the LuaLaTeX engine. @@ -179,13 +183,13 @@ Table \ref{tbl:opluamaths} lists operations in the \verb|luamaths| package. \begin{lstlisting} \mathTan{number} \end{lstlisting} & Gives the tangent of a real number. Here the number is in radians.\\ -\bottomrule +\bottomrule \\ \caption{Operations in the luamaths package} \label{tbl:opluamaths} \end{longtable} \end{center} Numbers can also be entered in scientific notation. For example, the number \(1860000\) can be entered as \(1.86e6\), and the number \(0.000186\) can be entered as \(1.86e-4\). -\subsection{Illustrations of commands in the luamaths package} +\subsection*{Illustrations of commands in the luamaths package} Table \ref{tbl:illluamaths} illustrates operations in the \verb|luamaths| package with examples. \begin{center} \begin{longtable}{lc} @@ -194,132 +198,204 @@ Table \ref{tbl:illluamaths} illustrates operations in the \verb|luamaths| packag \toprule \begin{lstlisting} \mathOp{(3+3)^4-4} -\end{lstlisting} & \(1292.0\)\\ +\end{lstlisting} & \(\mathOp{(3+3)^4-4}\)\\ \midrule \begin{lstlisting} \mathAbs{-6.96} -\end{lstlisting} & \(6.96\)\\ +\end{lstlisting} & \(\mathAbs{-6.96}\)\\ \midrule \begin{lstlisting} \mathFloor{-6.9} -\end{lstlisting} & \(-7\) \\ +\end{lstlisting} & \(\mathFloor{-6.9}\) \\ \midrule \begin{lstlisting} \mathFloor{9.9} -\end{lstlisting} & \(9\)\\ +\end{lstlisting} & \(\mathFloor{9.9}\)\\ \midrule \begin{lstlisting} \mathCeil{-9.9} -\end{lstlisting} & \(-9\) \\ +\end{lstlisting} & \(\mathCeil{-9.9}\) \\ \midrule \begin{lstlisting} \mathCeil{6.3} -\end{lstlisting} &\(7\)\\ +\end{lstlisting} &\(\mathCeil{6.3}\)\\ \midrule \begin{lstlisting} \mathRound{9.678884}{3} -\end{lstlisting} & \(9.679\)\\ +\end{lstlisting} & \(\mathRound{9.678884}{3}\)\\ \midrule \begin{lstlisting} \mathMax{20,30,100} -\end{lstlisting} &\(100\) \\ +\end{lstlisting} &\(\mathMax{20,30,100}\) \\ \midrule \begin{lstlisting} \mathMin{20,30,100} -\end{lstlisting} &\(20\)\\ +\end{lstlisting} &\(\mathMin{20,30,100}\)\\ \midrule \begin{lstlisting} \mathPi -\end{lstlisting} & \(3.1415926535898\)\\ +\end{lstlisting} & \(\mathPi\)\\ \midrule \begin{lstlisting} \mathRound{\mathPi}{6} -\end{lstlisting} & \(3.141593\)\\ +\end{lstlisting} & \(\mathRound{\mathPi}{6}\)\\ \midrule \begin{lstlisting} \mathInf -\end{lstlisting} & \(Inf\)\\ +\end{lstlisting} & \(\mathInf\)\\ \midrule \begin{lstlisting} \mathOp{\mathInf/2} -\end{lstlisting} &\(Inf\) \\ +\end{lstlisting} &\(\mathOp{\mathInf/2}\) \\ \midrule \begin{lstlisting} \mathSqrt{9} -\end{lstlisting} & \(3.0\)\\ +\end{lstlisting} & \(\mathSqrt{9}\)\\ \midrule \begin{lstlisting} \mathLog{2} -\end{lstlisting} & \(0.69314718055995\)\\ +\end{lstlisting} & \(\mathLog{2}\)\\ \midrule \begin{lstlisting} \mathExp{3} -\end{lstlisting} & \(20.085536923188\) \\ +\end{lstlisting} & \(\mathExp{3}\) \\ \midrule \begin{lstlisting} \mathRad{1800} -\end{lstlisting} & \(31.415926535898\)\\ +\end{lstlisting} & \(\mathRad{1800}\)\\ \midrule \begin{lstlisting} \mathSin{0} -\end{lstlisting} &\(0.0\)\\ +\end{lstlisting} &\(\mathSin{0}\)\\ \midrule \begin{lstlisting} \mathCos{0} -\end{lstlisting} & \(1.0\)\\ +\end{lstlisting} & \(\mathCos{0}\)\\ \midrule \begin{lstlisting} \mathTan{0} -\end{lstlisting} & \(0.0\)\\ +\end{lstlisting} & \(\mathTan{0}\)\\ \midrule \begin{lstlisting} \mathAsin{0} -\end{lstlisting} & \(0.0\)\\ +\end{lstlisting} & \(\mathAsin{0}\)\\ \midrule \begin{lstlisting} \mathAcos{0} -\end{lstlisting} & \(1.5707963267949\)\\ +\end{lstlisting} & \(\mathAcos{0}\)\\ \midrule \begin{lstlisting} \mathAtan{0} -\end{lstlisting} & \(0.0\)\\ +\end{lstlisting} & \(\mathAtan{0}\)\\ \midrule \begin{lstlisting} \mathRound{\mathOp{9+\mathSin{4}}}{6} -\end{lstlisting} & \(8.243198\)\\ -\midrule +\end{lstlisting} & \(\mathRound{\mathOp{9+\mathSin{4}}}{6}\)\\ +\bottomrule \\ \caption{Illustrations of commands in the luamaths package} \label{tbl:illluamaths} \end{longtable} \end{center} +The package supports fractions; numerators and denominators must be integers. A fraction can be specified with the Lua function: \verb|lfrac|. This function has the syntax \verb|lfrac(n,d,mode)|: \(n\) is an integer and \(d\) is a non-zero integer. The mode is optional. It can be \verb|fracs| or \verb|nofracs|. The default mode is \verb|fracs|. If fractions are input, the package will display vectors and matrices in fraction mode wherever possible. The package does not attempt to convert floats into fractions. If fractions are expected, then the input should contain fractions. If fractions are input and answers are expected in numbers, the mode can be specified as \verb|nofracs|. + +The Lua function \verb|lcomplex| defines the complex numbers. It has the syntax \verb|lcomplex(x,y)|, where \(x\) is a real part, and \(y\) is an imaginary part. \(x\) and \(y\) can also be fractions (numerators and denominators should be integers). The package has a command \verb|\imUnit| which provides typesetting for the imaginary unit. Its default value is \verb|\mathrm{i}|. It can be redefined. For example, one can redefine it as \verb|\renewcommand{\imUnit}{j}}|. + +Table \ref{tbl:illluamaths2} illustrates calculations on fractions and complex numbers using the \verb|luamaths| package. The numbers \(x, y, c\) and \(d\) are defined using the following commands. +\begin{lstlisting} +\def\x{lfrac(1,2)} +\def\y{lfrac(-3,4)} +\def\c{lcomplex(lfrac(3,4),6)} +\def\d{lcomplex(3,-9)} +\end{lstlisting} + +\subsection*{Some Illustrations} +\def\x{lfrac(1,2)} +\def\y{lfrac(-3,4)} +\def\c{lcomplex(lfrac(3,4),6)} +\def\d{lcomplex(3,-9)} +\begin{center} +\begin{longtable}{lc} +\toprule +\multicolumn{1}{c}{\textcolor{blue}{LaTeX input}} &\multicolumn{1}{c}{\textcolor{blue}{Output}} \\ +\toprule +\begin{lstlisting} +\(x + y = \mathOp{\x + \y}\) +\end{lstlisting} +& \(x + y = \mathOp{\x + \y}\) \\ \hline + +\begin{lstlisting} +\(x - y = \mathOp{\x - \y}\) +\end{lstlisting} +& \(x - y = \mathOp{\x - \y}\) \\ \hline + +\begin{lstlisting} +\(xy = \mathOp{\x*\y}\) +\end{lstlisting} +& \(xy = \mathOp{\x*\y}\) \\ \hline + +\begin{lstlisting} +\(\frac{x}{y} = \mathOp{\x / \y}\) +\end{lstlisting} +& \(\frac{x}{y} = \mathOp{\x / \y}\) \\ \hline + +\begin{lstlisting} +\(c + d = \mathOp{\c + \d}\) +\end{lstlisting} +& \(c + d = \mathOp{\c + \d}\) \\ \hline + +\begin{lstlisting} +\(c - d = \mathOp{\c - \d}\) +\end{lstlisting} +& \(c - d = \mathOp{\c - \d}\) \\ \hline + +\begin{lstlisting} +\(cd = \mathOp{\c*\d}\) +\end{lstlisting} +& \(cd = \mathOp{\c*\d}\) \\ \hline + +\begin{lstlisting} +\(\frac{c}{d} = \mathOp{\c / \d}\) +\end{lstlisting} +& \(\frac{c}{d} = \mathOp{\c / \d}\) \\ \hline + +\begin{lstlisting} +\(x + c - y + d = \mathOp{\x + \c - \y + \d}\) +\end{lstlisting} +& \(x + c - y + d = \mathOp{\x + \c - \y + \d}\) \\ + + \bottomrule \\ +\caption{Calculations on fractions and complex numbers} +\label{tbl:illluamaths2} +\end{longtable} +\end{center} \printbibliography \end{document} |