summaryrefslogtreecommitdiff
path: root/macros/latex/contrib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-07-05 03:00:50 +0000
committerNorbert Preining <norbert@preining.info>2021-07-05 03:00:50 +0000
commit500adb5fa10a924ea571a0d9d7754ed17dab5dbf (patch)
tree2949e54f3539d61c239be23aaf037d10264da5ba /macros/latex/contrib
parent7994f86ec5e18f9d0d9f90161a2f26dd26d26af7 (diff)
CTAN sync 202107050300
Diffstat (limited to 'macros/latex/contrib')
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx42
-rw-r--r--macros/latex/contrib/easybook/easybook.pdfbin559175 -> 558968 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix-french.pdfbin463607 -> 463618 bytes
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.dtx31
-rw-r--r--macros/latex/contrib/nicematrix/nicematrix.pdfbin1330962 -> 1331253 bytes
-rw-r--r--macros/latex/contrib/semantex/README.md78
-rw-r--r--macros/latex/contrib/semantex/semantex.pdfbin384087 -> 384087 bytes
-rw-r--r--macros/latex/contrib/semantex/semantex.sty4
-rw-r--r--macros/latex/contrib/semantex/semantex.tex2
-rw-r--r--macros/latex/contrib/semantex/stripsemantex.lua620
-rw-r--r--macros/latex/contrib/semantex/stripsemantex.sty2
-rw-r--r--macros/latex/contrib/siunitx/CHANGELOG.md9
-rw-r--r--macros/latex/contrib/siunitx/siunitx-code.pdfbin1493737 -> 1493556 bytes
-rw-r--r--macros/latex/contrib/siunitx/siunitx-quantity.dtx23
-rw-r--r--macros/latex/contrib/siunitx/siunitx.dtx2
-rw-r--r--macros/latex/contrib/siunitx/siunitx.pdfbin635011 -> 635018 bytes
16 files changed, 421 insertions, 392 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index 17f6663350..f519420c42 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -28,7 +28,7 @@
%
% \title{\sffamily easybook 文档类手册}
% \author{瞿毅}
-% \date{2021/07/03\hskip\ccwd\relax v1.26q\thanks{\url{https://gitee.com/texl3/easybook}}}
+% \date{2021/07/04\hskip\ccwd\relax v1.26r\thanks{\url{https://gitee.com/texl3/easybook}}}
%
% \maketitle
% \begin{abstract}
@@ -158,7 +158,7 @@
% floatpage = <true|(false)>
% \end{syntax}
% 开启这个选项后浮动环境 \env{table} 和 \env{figure} 的比例参数会使用默认值,关闭它则尽可能避免出现浮动页,使图表环境与正文段落更加紧凑,减少多余的空白版面。
-% \changes{v1.26q}{2021/06/15}{增加浮动环境比例参数选项 \opt{floatpage}。}
+% \changes{v1.26r}{2021/06/15}{增加浮动环境比例参数选项 \opt{floatpage}。}
% \end{function}
%
% \subsection{article 模式}
@@ -240,7 +240,7 @@
% \tn{EBeforeAddBitoc*}\marg{加入目录英文标题前的代码}
% \end{syntax}
% \tn{appendix} 命令后的章节标题变为附录形式。英文目录中附录标题的格式用可选参数修改,英文附录目录前名字默认为 Appendix\tn{space},后名字默认为空,名字之间用一个半角逗号分开,也可以只有一部分,表示英文附录目录前名字。英文附录目录数字输出命令默认为 \tn{Alph}\{chapter\}。
-% \changes{v1.26q}{2021/06/13}{增加调整英文目录格式的钩子 \tn{EBeforeAddBitoc}。}
+% \changes{v1.26r}{2021/06/13}{增加调整英文目录格式的钩子 \tn{EBeforeAddBitoc}。}
% \end{function}
%
% \tn{EBeforeAddBitoc} 是一个作用于局部范围的英文目录钩子,可以插入标题或目录设置的命令改变英文目录中标题的显示格式,也可以覆盖上述的目录前后名字和编号等设置,带有星号的命令会重置之前的代码,放置在导言区或 \tn{bichapter} 等命令前生效。
@@ -255,7 +255,7 @@
% \ \oarg{水平偏移}\parg{下标代码}
% \end{syntax}
% 上标和下标的功能来自 \pkg{spbmark} 宏包,\tn{super}、\tn{sub} 和 \tn{supersub} 三个命令可以用于输出上标和下标。它们根据当前处于文本模式还是数学模式来匹配相应的模式,或者可以使用它们的星号变体命令来强制使用数学模式。也可以使用键值列表对偏移量进行全局设置,详情见小节 \ref{subsubsec:super-sub-script}。
-% \changes{v1.26q}{2021/06/28}{增加可以调整相对位置和格式的上标和下标命令 \tn{super}、\tn{sub} 和 \tn{supersub}。}
+% \changes{v1.26r}{2021/06/28}{增加可以调整相对位置和格式的上标和下标命令 \tn{super}、\tn{sub} 和 \tn{supersub}。}
% \end{function}
%
% 垂直和水平偏移默认值都是 0 pt,\meta{对齐方式} 的参数与 \opt{supersubalign} 相同。\meta{格式代码} 用于格式化上标和下标,可以插入字体或颜色等命令。代码中的最后一个命令可以接受一个为上标或下标的参数。\tn{textsuperscript} 和 \tn{textsubscript} 命令已被重新定义并且分别等价于 \tn{super} 和 \tn{sub},如果您需要使用它们的原始定义创建新命令,则可以使用 \tn{spb@textsuperscript@save} 和 \tn{spb@textsubscript@save} 命令。
@@ -306,7 +306,7 @@
% \tn{DeclareThemeColor}\{<风格名称>,<ctex@frame>,<ctex@emph>,<ctex@verb>\}
% \end{syntax}
% 可以使用 \tn{DeclareThemeColor} 命令声明新的主题颜色,它的参数以英文逗号分隔,第一部分为颜色风格名称,后面三部分为 HTML 颜色代码,构成主题颜色。类似地更改超链接颜色见小节 \ref{subsec:hyperlinks}。
-% \changes{v1.26q}{2021/07/03}{使用 \tn{DeclareThemeColor} 命令声明新的颜色风格。}
+% \changes{v1.26r}{2021/07/03}{使用 \tn{DeclareThemeColor} 命令声明新的颜色风格。}
% \end{function}
% \item[color-all] 统一设置主题的各部分颜色,参数是 6 个十六进制数字组成的 HTML 颜色代码,任意颜色的代码可以在常见的图片处理工具拾色器中查看。
% \item[multoc] 开启多栏目录,与节 \ref{sec:document command} 中目录命令的同名选项有相同效果。
@@ -371,7 +371,7 @@
% \tn{DeclareLinkColor}\{<风格名称>,<ctex@link>,<ctex@url>,<ctex@cite>\}
% \end{syntax}
% 可以使用 \tn{DeclareLinkColor} 命令声明新的超链接颜色样式,它的参数以英文逗号分隔,第一部分为颜色风格名称,后面三部分为 HTML 颜色代码,构成超链接颜色。
-% \changes{v1.26q}{2021/07/03}{使用 \tn{DeclareLinkColor} 命令声明新的超链接颜色。}
+% \changes{v1.26r}{2021/07/03}{使用 \tn{DeclareLinkColor} 命令声明新的超链接颜色。}
% \end{function}
% \item[linkcol-all] 统一设置超链接的各部分颜色,参数是 6 个十六进制数字组成的 HTML 颜色代码,任意颜色的代码可以在常见的图片处理工具拾色器中查看。
% \item[linktoc] 将目录中的超链接取消、置于标题上、置于页码上或置于标题和页码上。
@@ -492,7 +492,7 @@
% \end{syntax}
% \ding{229} 以上选项路径为 \opt{thmset/...}
% \changes{v1.21}{2021/01/12}{增加配置定理环境样式的选项。}
-% \changes{v1.26q}{2021/07/01}{增加配置公式标签括号选项 \opt{brackets}。}
+% \changes{v1.26r}{2021/07/01}{增加配置公式标签括号选项 \opt{brackets}。}
% \end{function}
%
% \begin{optdesc}
@@ -519,7 +519,7 @@
% 文档类已预置 8 个定理环境,环境名及对应的定理标题名见小节 \ref{subsec:theorem},如果需要新的定理标题名或定理样式可使用这两个命令,由 \pkg{thmtools} 提供支持,用法与它的同名命令一致。
% \changes{v1.23}{2021/03/12}{重新定义了新定理环境命令 \tn{newtheorem}。}
% \changes{v1.24}{2021/04/25}{增加定义定理环境命令 \tn{EBNewTheorem}。}
-% \changes{v1.26q}{2021/06/15}{定义新定理环境的命令调整为 \tn{declaretheorem}。}
+% \changes{v1.26r}{2021/06/15}{定义新定理环境的命令调整为 \tn{declaretheorem}。}
% \end{function}
%
% \begin{optdesc}
@@ -625,7 +625,7 @@
% \tn{markrule}\oarg{长度|(\tn{textwidth})}\parg{颜色名}\marg{线宽|(0.75pt)}[<上间距>+<下间距>]
% \end{syntax}
% 命令 \tn{easyhead} 和 \tn{easyfoot} 的使用方法与 \tn{fancyhead} 和 \tn{fancyfoot} 完全相同,它们需要在 \opt{head-foot} 选项中使用,设置的是一个名为 \opt{fancy} 的页面风格。\pkg{fancyhdr} 将页眉页脚分成了左中右和奇数页(odd)、偶数页(even)共12个部分,可选参数中E、O代表偶数、奇数,L、C、R代表左、中、右部分。单面打印时,含有偶数的选项无效。
-% \changes{v1.26q}{2021/06/14}{增加页眉页脚的横线绘制命令 \tn{markrule}。}
+% \changes{v1.26r}{2021/06/14}{增加页眉页脚的横线绘制命令 \tn{markrule}。}
% \end{function}
%
% 命令 \tn{markrule} 用于绘制页眉页脚横线,长度默认为页面文本区的宽度,上下间距为横线与上下方部件的间距,带有长度单位,间距长度之间用 + 号分开,若只有一部分则表示上间距,这个命令也可以在正文中绘制横线。下面举一个设置页眉内容的例子:
@@ -963,7 +963,7 @@
% \tn{EBUseCounter*}\oarg{父计数器}\parg{编号|(arabic)}\marg{计数器}\marg{内容}\oarg{分隔符|(.)}\parg{数值}
% \end{syntax}
% \tn{newcounter} 是 \LaTeX 自带的创建计数器命令,\tn{EBUseCounter} 将会以一定的格式使用由它创建的计数器,将会以 \tn{the}\meta{父计数器}\meta{分隔符}\tn{the}\meta{计数器}\meta{内容} 输出当前内容。
-% \changes{v1.26q}{2021/06/30}{增加计数器使用命令 \tn{EBUseCounter}。}
+% \changes{v1.26r}{2021/06/30}{增加计数器使用命令 \tn{EBUseCounter}。}
% \end{function}
%
% 需要注意的是 \tn{EBUseCounter} 仅具有 \textbf{输出功能},并不会改变计数器原有的绑定关系。默认每使用一次命令 \meta{计数器} 的值增加 1,带有星号的命令使 \meta{计数器} 保持当前值,\meta{编号} 为 arabic 和 alpha 等格式,\meta{数值} 可以手动将 \meta{计数器} 设为指定值。
@@ -1150,7 +1150,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/07/03}{1.26q}
+\ProvidesExplClass{easybook}{2021/07/04}{1.26r}
{Typeset Chinese books or notes}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -1398,7 +1398,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{etoolbox}
-\ProvidesExplPackage{easybase}{2021/07/03}{1.26q}
+\ProvidesExplPackage{easybase}{2021/07/04}{1.26r}
{Typeset Chinese books or notes}
\cs_generate_variant:Nn \eb_ctex_define:nn { nx }
@@ -3131,7 +3131,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2021/07/03}{1.26q}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2021/07/04}{1.26r}
{Customization of tcolorbox for easybook}
\cs_new_protected:Npn \eb_tcb_theorem_set:n #1
@@ -3178,7 +3178,13 @@
\newtcbox[auto~counter]{\eb@tc@exercise@box}[1]{tc-exercise,#1}
\tl_new:N \p@eb@exercise
\tl_new:N \eb@tc@list@prologue
-\tl_set:Nn \eb@tc@exercise@ifnametrue
+\cs_new:Npn \exerprologue #1 { \tl_gset:Nn \eb@tc@list@prologue {#1} }
+\cs_new:Npn \tcphanifname #1#2
+ {
+ \tl_gset:Nn \eb@tc@exercise@ifnametrue {#1}
+ \tl_gset:Nn \eb@tc@exercise@ifnamefalse {#2}
+ }
+\tcphanifname
{
\markright
{
@@ -3190,13 +3196,7 @@
\eb_tcb_toc_counter_numsep:n { section }
\eb@tc@exercise@title
}
- }
-\cs_new:Npn \exerprologue #1 { \tl_gset:Nn \eb@tc@list@prologue {#1} }
-\cs_new:Npn \tcphanifname #1#2
- {
- \tl_gset:Nn \eb@tc@exercise@ifnametrue {#1}
- \tl_gset:Nn \eb@tc@exercise@ifnamefalse {#2}
- }
+ }{}
\cs_set:Npn \eb_exercise_label_noempty_use:
{
\eb_current_label:n { eb@exercise }
diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf
index 94de411084..d43e951819 100644
--- a/macros/latex/contrib/easybook/easybook.pdf
+++ b/macros/latex/contrib/easybook/easybook.pdf
Binary files differ
diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
index 30ae5840fa..e630974f2f 100644
--- a/macros/latex/contrib/nicematrix/nicematrix-french.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix-french.pdf
Binary files differ
diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx
index 5e195b9103..f9ae880666 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.dtx
+++ b/macros/latex/contrib/nicematrix/nicematrix.dtx
@@ -15,8 +15,8 @@
%
% \fi
% \iffalse
-\def\myfileversion{5.17}
-\def\myfiledate{2021/07/01}
+\def\myfileversion{5.17a}
+\def\myfiledate{2021/07/04}
%
%
%<*batchfile>
@@ -9071,7 +9071,7 @@ version 2005/12/01 or later.
%
%
% \bigskip
-% \subsection{The redefinition of \textbackslash multicolumn}
+% \subsection*{The redefinition of \textbackslash multicolumn}
%
% \medskip
% The following command must \emph{not} be protected since it begins with
@@ -9079,8 +9079,15 @@ version 2005/12/01 or later.
% \begin{macrocode}
\cs_new:Npn \@@_multicolumn:nnn #1 #2 #3
{
+% \end{macrocode}
+% The following lines are from the definition of |\multicolumn| in \pkg{array}
+% (and \emph{not} in standard LaTeX). The first line aims to raise an error if
+% the user has put more that one column specifier in the preamble of
+% |\multicolumn|.
+% \begin{macrocode}
\multispan { #1 }
\begingroup
+ \cs_set:Npn \@addamp { \if@firstamp \@firstampfalse \else \@preamerr 5 \fi }
% \end{macrocode}
%
% \medskip
@@ -9100,10 +9107,12 @@ version 2005/12/01 or later.
% \end{macrocode}
%
% \medskip
-% The following line creates the preamble. This line is a adaptation of a line
-% of the initial definition of |\multicolumn|.
+% The following lines are an adaptation of the definition of |\multicolumn| in
+% \pkg{array}.
% \begin{macrocode}
\exp_args:NV \@mkpream \g_@@_preamble_tl
+ \@addtopreamble \@empty
+ \endgroup
% \end{macrocode}
%
% \medskip
@@ -9129,13 +9138,14 @@ version 2005/12/01 or later.
% The following lines were in the original definition of |\multicolumn|.
% \begin{macrocode}
\cs_set:Npn \@sharp { #3 }
- \set@typeset@protect
- \cs_set_eq:NN \@startpbox \@@startpbox
- \cs_set_eq:NN \@endpbox \@@endpbox
\@arstrut
\@preamble
- \hbox { }
- \endgroup
+ \null
+% \end{macrocode}
+%
+% \medskip
+% We add some lines.
+% \begin{macrocode}
\int_gadd:Nn \c@jCol { #1 - 1 }
\int_compare:nNnT \c@jCol > \g_@@_col_total_int
{ \int_gset_eq:NN \g_@@_col_total_int \c@jCol }
@@ -17831,6 +17841,7 @@ version 2005/12/01 or later.
%
% It's now possible to use a key |l|, |r| or |c| with the command
% |\pAutoNiceMatrix| (and the similar ones).
+%
%
% \PrintIndex
%
diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf
index 2f690d6409..ca40e46907 100644
--- a/macros/latex/contrib/nicematrix/nicematrix.pdf
+++ b/macros/latex/contrib/nicematrix/nicematrix.pdf
Binary files differ
diff --git a/macros/latex/contrib/semantex/README.md b/macros/latex/contrib/semantex/README.md
index 8c786f1d62..85732053e6 100644
--- a/macros/latex/contrib/semantex/README.md
+++ b/macros/latex/contrib/semantex/README.md
@@ -1,40 +1,40 @@
-SemanTeX -- semantic, keyval-based mathematics
---------------------------------------
-
-The SemanTeX package for LaTeX delivers a more semantic,
-systematized way of writing mathematics, compared to the
-classical math syntax in LaTeX. The system uses keyval
-syntax, and the user can define their own keys and
-customize the system down to the last detail. At the same
-time, care has been taken to make the syntax as simple,
-natural, practical, and lightweight as possible.
-
-Furthermore, the package has a companion package,
-called stripsemantex, which allows you to completely strip
-your documents of SemanTeX markup to prepare them e.g. for publication.
-
-The package is still in beta, but is considered feature-complete
-and more or less stable, so using it at this point should be safe.
-Still, suggestions, ideas, and bug reports are more than welcome!
-
-----------------------------------------------------------------
-SemanTeX -- semantic, keyval-based mathematics
-Maintained by Sebastian Ørsted
-E-mail: sorsted@gmail.com
-Released under the LaTeX Project Public License v1.3c or later
-See http://www.latex-project.org/lppl.txt
-----------------------------------------------------------------
-
-Copyright (C) 2021 by Sebastian Ørsted <sorsted@gmail.com>
-
-The package is loaded via \usepackage{semantex}
-
-This work may be distributed and/or modified under the
-conditions of the LaTeX Project Public License (LPPL), either
-version 1.3c of this license or (at your option) any later
-version. The latest version of this license is in the file:
-
-http://www.latex-project.org/lppl.txt
-
-This work is "maintained" (as per LPPL maintenance status) by
+SemanTeX -- semantic, keyval-based mathematics
+--------------------------------------
+
+The SemanTeX package for LaTeX delivers a more semantic,
+systematized way of writing mathematics, compared to the
+classical math syntax in LaTeX. The system uses keyval
+syntax, and the user can define their own keys and
+customize the system down to the last detail. At the same
+time, care has been taken to make the syntax as simple,
+natural, practical, and lightweight as possible.
+
+Furthermore, the package has a companion package,
+called stripsemantex, which allows you to completely strip
+your documents of SemanTeX markup to prepare them e.g. for publication.
+
+The package is still in beta, but is considered feature-complete
+and more or less stable, so using it at this point should be safe.
+Still, suggestions, ideas, and bug reports are more than welcome!
+
+----------------------------------------------------------------
+SemanTeX -- semantic, keyval-based mathematics
+Maintained by Sebastian Ørsted
+E-mail: sorsted@gmail.com
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
+
+Copyright (C) 2021 by Sebastian Ørsted <sorsted@gmail.com>
+
+The package is loaded via \usepackage{semantex}
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License (LPPL), either
+version 1.3c of this license or (at your option) any later
+version. The latest version of this license is in the file:
+
+http://www.latex-project.org/lppl.txt
+
+This work is "maintained" (as per LPPL maintenance status) by
Sebastian Ørsted. \ No newline at end of file
diff --git a/macros/latex/contrib/semantex/semantex.pdf b/macros/latex/contrib/semantex/semantex.pdf
index c05e9af057..71b9241a80 100644
--- a/macros/latex/contrib/semantex/semantex.pdf
+++ b/macros/latex/contrib/semantex/semantex.pdf
Binary files differ
diff --git a/macros/latex/contrib/semantex/semantex.sty b/macros/latex/contrib/semantex/semantex.sty
index a54891f132..b026a84023 100644
--- a/macros/latex/contrib/semantex/semantex.sty
+++ b/macros/latex/contrib/semantex/semantex.sty
@@ -1,5 +1,5 @@
\RequirePackage{xparse,l3keys2e,leftindex,semtex}
-\ProvidesExplPackage{semantex}{2021/07/03}{0.506}{}
+\ProvidesExplPackage{semantex}{2021/07/04}{0.507}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
@@ -8177,7 +8177,7 @@
set~lower~slot={ {-} },
% Upper left indices:
data~provide=upper~left,
- data~provide=next~upper~left~with~sep,
+ bool~provide=next~upper~left~with~sep,
int~provide=number~of~upper~left~indices,
data~provide=pre~upper~left,
data~provide=post~upper~left,
diff --git a/macros/latex/contrib/semantex/semantex.tex b/macros/latex/contrib/semantex/semantex.tex
index fd1e6a67e8..2d8e6457ae 100644
--- a/macros/latex/contrib/semantex/semantex.tex
+++ b/macros/latex/contrib/semantex/semantex.tex
@@ -42,7 +42,7 @@
\usepackage[nameinlink]{cleveref}
-\title{Seman\!\TeX: semantic, keyval-based mathematics (v0.506)}
+\title{Seman\!\TeX: semantic, keyval-based mathematics (v0.507)}
\date{\today}
\author{Sebastian Ørsted (\href{mailto:sorsted@gmail.com}{sorsted@gmail.com})}
diff --git a/macros/latex/contrib/semantex/stripsemantex.lua b/macros/latex/contrib/semantex/stripsemantex.lua
index 0d624cc72d..f50648dd23 100644
--- a/macros/latex/contrib/semantex/stripsemantex.lua
+++ b/macros/latex/contrib/semantex/stripsemantex.lua
@@ -1,311 +1,311 @@
--- aliases for protected environments
-local assert, io_open
- = assert, io.open
-
--- load the ltn12 module
-local ltn12 = require("ltn12")
-
--- No more global accesses after this point
-if _VERSION == "Lua 5.2" then _ENV = nil end
-
--- copy a file
-copy_file = function(path_src, path_dst)
- ltn12.pump.all(
- ltn12.source.file(assert(io_open(path_src, "rb"))),
- ltn12.sink.file(assert(io_open(path_dst, "wb")))
- )
-end
-
-openFile = function(file)
- f = io.open(file, "r")
- filecontent = f:read("*all")
- local beginDocPosition = filecontent:find('\\begin{document}')
- if not beginDocPosition then
- tex.sprint( [[\begingroup\ExplSyntaxOn
- \msg_fatal:nnn { stripsemantex } { begin_document_not_found } { ]] .. file .. [[ }
- \endgroup]] )
- return
- end
- precontent = filecontent:sub(1,beginDocPosition-1)
- content = filecontent:sub(beginDocPosition,-1)
- f:close()
-end
-
-closeFile = function(file)
- f = io.open(file, "w")
- f:write(precontent .. content)
- f:close()
-end
-
-removeStricttexFormatting = function(str)
- -- We do this in case the package "stricttex" was used
- str = str:gsub('numberZERO','0')
- str = str:gsub('numberONE','1')
- str = str:gsub('numberTWO','2')
- str = str:gsub('numberTHREE','3')
- str = str:gsub('numberFOUR','4')
- str = str:gsub('numberFIVE','5')
- str = str:gsub('numberSIX','6')
- str = str:gsub('numberSEVEN','7')
- str = str:gsub('numberEIGHT','8')
- str = str:gsub('numberNINE','9')
- str = str:gsub('symbolPRIME','\'')
- return str
-end
-
-addIDsToRegisters = function(str)
- str = removeStricttexFormatting(str)
- content = content:gsub('\\' .. str .. '([^%a])' ,'\\SemantexIDcommand{}\\' .. str .. '%1')
- -- '%f[^%a]' does not work here, as it will not react if the last character of str is a number,
- -- which stricttex allows.
- -- Because of this choice, there will be an issue if you use stricttex and let
- -- \<command> by a SemanTeX command and \<command>' be a non-SemanTeX command.
- -- So simply *don't do that*.
-end
-
-removeSuperfluousIDs = function()
- local p = content:find('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)')
- while p do
- content = content:gsub('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)','%1%2')
- p = content:find('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)')
- end
- content = content:gsub('parent(%s*)=(%s*)\\SemantexIDcommand{}','parent%1=%2')
- content = content:gsub('class(%s*)=(%s*)\\SemantexIDcommand{}','class%1=%2')
- content = content:gsub('clone(%s*)=(%s*)\\SemantexIDcommand{}','clone%1=%2')
- content = content:gsub('copy(%s*)=(%s*)\\SemantexIDcommand{}','copy%1=%2')
- content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexIDcommand{}','\\New%1Class%2')
- content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexIDcommand{}(\\%w+%s*}?%s*{?%s*)\\SemantexIDcommand{}', '\\NewObject%1%2')
- content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexIDcommand{}', '\\SetupClass%1')
- content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexIDcommand{}', '\\SetupObject%1')
-end
-
-addNumbersToIDs = function()
- local n = 0
- local p,q = string.find(content,'\\SemantexIDcommand{}')
- while q do
- n = n + 1
- content = content:sub(1,q-1) .. n .. content:sub(q,-1)
- p, q = string.find(content,'\\SemantexIDcommand{}')
- end
-end
-
-semantexIDluacommand = function(id, source, output)
- local p, q = string.find(content, '\\SemantexIDcommand{' .. id .. '}')
-
- while p do
- content = content:sub(1,p-1) .. content:sub(q+1,-1)
-
- source = source:gsub('%s+', '')
-
- -- We do this in case the package "stricttex" was used
- source = removeStricttexFormatting(source)
-
- -- This is because #1's in the code becomes ##1
- -- in the .semtex file.
- source = source:gsub('#(%d)', '%1')
-
- local length = source:len()
-
- local i = 1
-
- local s
-
- while i <= length do
- s = content:sub(p,p)
- if s == source:sub(i,i) then
- content = content:sub(1 , p-1) .. content:sub(p+1, -1)
- i = i + 1
- elseif s:match('%s') then
- content = content:sub(1, p-1) .. content:sub(p+1, -1)
- elseif s == '%' then
- content = content:sub(1 , p-1) .. content:sub(p,-1):gsub('%%.-\n','',1)
- elseif s == '{' then
- -- In this case, we remove the corresponding right brace,
- -- once we find it
- local netto = 1 -- The current brace group level
- local q = 0 -- The position we have moved forward so far
- while netto > 0 do
- q = q + 1
- local e = content:sub(p+q,p+q)
- if e == '}' then
- netto = netto - 1
- elseif e == '{' then
- netto = netto + 1
- elseif e == '\\' then
- q = q + 1
- elseif e == '%' then
- content = content:sub(1, p+q-1) .. content:sub(p+q,-1):gsub('%%.-\n','',1)
- q = q - 1
- end
- end
- content = content:sub(1,p-1) .. content:sub(p+1,p+q-1) .. content:sub(p+q+1,-1)
- elseif s == '<' and content:sub(p+1,p+2) == '[>' then
- content = content:sub(1,p-1) .. content:sub(p+3,-1)
- i = i + 1
- elseif s == '<' and content:sub(p+1,p+2) == ']>' then
- content = content:sub(1,p-1) .. content:sub(p+3,-1)
- i = i + 1
- elseif source:sub(i,i) == '{' then
- -- In this case, we remove the corresponding right brace,
- -- once we find it
- local netto = 1 -- The current brace group level
- local q = 0 -- The position we have moved forward so far
- while netto > 0 do
- q = q + 1
- local e = source:sub(i+q,i+q)
- if e == '}' then
- netto = netto - 1
- elseif e == '{' then
- netto = netto + 1
- elseif e == '\\' then
- q = q + 1
- -- there is no chance that the source contains an unescaped %, so we do not
- -- check for this
- end
- end
- source = source:sub(1,i-1) .. source:sub(i+1,i+q-1) .. source:sub(i+q+1,-1)
- length = source:len()
- else
- tex.sprint( [[\begingroup\ExplSyntaxOn
- \msg_fatal:nnnn { stripsemantex } { source_not_expected } { ]] .. source:sub(i,i) .. [[ } { ]] .. s .. [[ }
- \endgroup]] )
- break
- end
- end
-
-
- output = output:gsub('%s*\\sp {', '^{')
- output = output:gsub('%s*\\sb {', '_{')
- output = output:gsub('\\mathopen \\big ', '\\bigl')
- output = output:gsub('\\mathclose \\big ', '\\bigr')
- output = output:gsub('\\mathopen \\Big ', '\\Bigl')
- output = output:gsub('\\mathclose \\Big ', '\\Bigr')
- output = output:gsub('\\mathopen \\bigg ', '\\biggl')
- output = output:gsub('\\mathclose \\bigg ', '\\biggr')
- output = output:gsub('\\mathopen \\Bigg ', '\\Biggl')
- output = output:gsub('\\mathclose \\Bigg ', '\\Biggr')
- output = output:gsub('\\mathopen %(', '(')
- output = output:gsub('\\mathclose %)', ')')
- output = output:gsub('\\mathopen %[', '[')
- output = output:gsub('\\mathclose %]', ']')
- output = output:gsub('\\mathopen \\{', '\\{')
- output = output:gsub('\\mathclose \\}', '\\}')
- output = output:gsub('\\mathopen \\lbrace', '\\lbrace')
- output = output:gsub('\\mathclose \\rbrace', '\\rbrace')
- output = output:gsub('\\mathopen \\lbrack', '\\lbrack')
- output = output:gsub('\\mathclose \\rbrack', '\\rbrack')
- output = output:gsub('\\mathopen \\langle', '\\langle')
- output = output:gsub('\\mathclose \\rangle', '\\rangle')
- output = output:gsub('\\mathopen \\lvert', '\\lvert')
- output = output:gsub('\\mathclose \\rvert', '\\rvert')
- output = output:gsub('\\mathopen \\vert', '\\lvert')
- output = output:gsub('\\mathclose \\vert', '\\rvert')
- output = output:gsub('\\mathopen \\lVert', '\\lVert')
- output = output:gsub('\\mathclose \\rVert', '\\rVert')
- output = output:gsub('\\mathopen \\Vert', '\\lVert')
- output = output:gsub('\\mathclose \\Vert', '\\rVert')
- output = output:gsub('%^{\\prime }', '\'')
- output = output:gsub('%^{\\prime \\prime }', '\'\'')
- output = output:gsub('%^{\\prime \\prime \\prime }', '\'\'\'')
- output = output:gsub('%^{\\prime \\prime \\prime \\prime }', '\'\'\'\'')
- output = output:gsub('%^{\\prime \\prime \\prime \\prime \\prime }', '\'\'\'\'\'')
-
- output = output:gsub('%s+%f[{}%[%]%(%)%$,]','')
- output = output:gsub('([}%]%)])%f[\\%w%+%-%(%[=]', '%1 ')
- output = output:gsub(',',', ')
- output = output:gsub('%s+$', '')
-
-
- -- We now check whether the string we add will follow right
- -- after a control sequence, causing it to be interpreted
- -- as part of that control sequence.
- -- Because we want to allow the user to use stricttex, we
- -- check for alphanumerical control sequences rather than
- -- just alphabetic ones. This could add spaces that
- -- the user might not have intended, but it's a minor issue.
- if output:sub(1,1):match('%w') and content:sub(1, p-1):match('\\%w+$') then
- content = content:sub(1,p-1) .. ' ' .. output .. content:sub(p,-1)
- else
- content = content:sub(1,p-1) .. output .. content:sub(p,-1)
- end
- p, q = string.find(content, '\\SemantexIDcommand{' .. id .. '}')
- end
-end
-
-stripRemainingSemantexIDs = function()
- content = content:gsub('\\SemantexIDcommand{%d+}', '')
-end
-
-removeParenthesisCommands = function()
- content = content:gsub('\\SemantexMathOpen \\bigg%s?', '\\biggl')
- content = content:gsub('\\SemantexMathClose \\bigg%s?', '\\biggr')
- content = content:gsub('\\SemantexMathOpen \\Bigg%s?', '\\Biggl')
- content = content:gsub('\\SemantexMathClose \\Bigg%s?', '\\Biggr')
- content = content:gsub('\\SemantexMathOpen \\big%s?', '\\bigl')
- content = content:gsub('\\SemantexMathClose \\big%s?', '\\bigr')
- content = content:gsub('\\SemantexMathOpen \\Big%s?', '\\Bigl')
- content = content:gsub('\\SemantexMathClose \\Big%s?', '\\Bigr')
- content = content:gsub('\\SemantexMathOpen{} %(', '(')
- content = content:gsub('%s*\\SemantexMathClose{}%)', ')')
- content = content:gsub('\\SemantexMathOpen{} %[', '[')
- content = content:gsub('%s*\\SemantexMathClose{}%]', ']')
- content = content:gsub('\\SemantexMathOpen{} \\{', '\\{')
- content = content:gsub('%s*\\SemantexMathClose{} \\}', '\\}')
- content = content:gsub('\\SemantexMathOpen{} \\lbrace', '\\lbrace')
- content = content:gsub('\\SemantexMathClose{} \\rbrace', '\\rbrace')
- content = content:gsub('\\SemantexMathOpen{} \\lbrack', '\\rbrack')
- content = content:gsub('\\SemantexMathClose{} \\rbrack', '\\rbrack')
- content = content:gsub('\\SemantexMathOpen{} \\langle', '\\langle')
- content = content:gsub('\\SemantexMathClose{} \\rangle', '\\rangle')
- content = content:gsub('\\SemantexMathOpen{} \\lvert', '\\lvert')
- content = content:gsub('\\SemantexMathClose{} \\rvert', '\\rvert')
- content = content:gsub('\\SemantexMathOpen{} \\vert', '\\lvert')
- content = content:gsub('\\SemantexMathClose{} \\vert', '\\rvert')
- content = content:gsub('\\SemantexMathOpen{} \\lVert', '\\lVert')
- content = content:gsub('\\SemantexMathClose{} \\rVert', '\\rVert')
- content = content:gsub('\\SemantexMathOpen{} \\Vert', '\\lVert')
- content = content:gsub('\\SemantexMathClose{} \\Vert', '\\rVert')
- content = content:gsub('\\SemantexMathOpen{} .%s?', '')
- content = content:gsub('\\SemantexMathClose{} .%s?', '')
- content = content:gsub('\\SemantexMathOpen{}', '\\mathopen ')
- content = content:gsub('\\SemantexMathClose{}', '\\mathclose ')
- content = content:gsub('\\SemantexMathOpenAuto%s?', '\\SemantexLeft')
- content = content:gsub('\\SemantexMathCloseAuto%s?', '\\SemantexRight')
- content = content:gsub('\\SemantexMathOpenNoPar%s?', '')
- content = content:gsub('\\SemantexMathCloseNoPar%s?', '')
- content = content:gsub('\\SemantexMathOpen%s?', '\\mathopen')
- content = content:gsub('\\SemantexMathClose%s?', '\\mathclose')
-end
-
-stripComments = function()
- content = content:gsub('\\%%', '\\StripSemantexEscapedPercent')
- content = content:gsub('(\\%w+)%%.-\n%s*', '%1 ')
- content = content:gsub('%%.-\n%s*', '')
- content = content:gsub('\\StripSemantexEscapedPercent', '\\%%')
-end
-
-addSemtexPackageToFile = function()
- content = [[% The following was added by "stripsemantex":
-
-\usepackage{semtex,leftindex,graphicx}
-
-\providecommand\SemantexLeft{%
- \mathopen{}\mathclose\bgroup\left
-}
-
-\providecommand\SemantexRight{%
- \aftergroup\egroup\right
-}
-
-\makeatletter
-\DeclareRobustCommand\SemantexBullet{%
- \mathord{\mathpalette\SemantexBullet@{0.5}}%
-}
-\newcommand\SemantexBullet@[2]{%
- \vcenter{\hbox{\scalebox{#2}{$\m@th#1\bullet$}}}%
-}
-\DeclareRobustCommand\SemantexDoubleBullet{\SemantexBullet \SemantexBullet}
-\makeatother
-
-]] .. content
+-- aliases for protected environments
+local assert, io_open
+ = assert, io.open
+
+-- load the ltn12 module
+local ltn12 = require("ltn12")
+
+-- No more global accesses after this point
+if _VERSION == "Lua 5.2" then _ENV = nil end
+
+-- copy a file
+copy_file = function(path_src, path_dst)
+ ltn12.pump.all(
+ ltn12.source.file(assert(io_open(path_src, "rb"))),
+ ltn12.sink.file(assert(io_open(path_dst, "wb")))
+ )
+end
+
+openFile = function(file)
+ f = io.open(file, "r")
+ filecontent = f:read("*all")
+ local beginDocPosition = filecontent:find('\\begin{document}')
+ if not beginDocPosition then
+ tex.sprint( [[\begingroup\ExplSyntaxOn
+ \msg_fatal:nnn { stripsemantex } { begin_document_not_found } { ]] .. file .. [[ }
+ \endgroup]] )
+ return
+ end
+ precontent = filecontent:sub(1,beginDocPosition-1)
+ content = filecontent:sub(beginDocPosition,-1)
+ f:close()
+end
+
+closeFile = function(file)
+ f = io.open(file, "w")
+ f:write(precontent .. content)
+ f:close()
+end
+
+removeStricttexFormatting = function(str)
+ -- We do this in case the package "stricttex" was used
+ str = str:gsub('numberZERO','0')
+ str = str:gsub('numberONE','1')
+ str = str:gsub('numberTWO','2')
+ str = str:gsub('numberTHREE','3')
+ str = str:gsub('numberFOUR','4')
+ str = str:gsub('numberFIVE','5')
+ str = str:gsub('numberSIX','6')
+ str = str:gsub('numberSEVEN','7')
+ str = str:gsub('numberEIGHT','8')
+ str = str:gsub('numberNINE','9')
+ str = str:gsub('symbolPRIME','\'')
+ return str
+end
+
+addIDsToRegisters = function(str)
+ str = removeStricttexFormatting(str)
+ content = content:gsub('\\' .. str .. '([^%a])' ,'\\SemantexIDcommand{}\\' .. str .. '%1')
+ -- '%f[^%a]' does not work here, as it will not react if the last character of str is a number,
+ -- which stricttex allows.
+ -- Because of this choice, there will be an issue if you use stricttex and let
+ -- \<command> by a SemanTeX command and \<command>' be a non-SemanTeX command.
+ -- So simply *don't do that*.
+end
+
+removeSuperfluousIDs = function()
+ local p = content:find('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)')
+ while p do
+ content = content:gsub('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)','%1%2')
+ p = content:find('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)')
+ end
+ content = content:gsub('parent(%s*)=(%s*)\\SemantexIDcommand{}','parent%1=%2')
+ content = content:gsub('class(%s*)=(%s*)\\SemantexIDcommand{}','class%1=%2')
+ content = content:gsub('clone(%s*)=(%s*)\\SemantexIDcommand{}','clone%1=%2')
+ content = content:gsub('copy(%s*)=(%s*)\\SemantexIDcommand{}','copy%1=%2')
+ content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexIDcommand{}','\\New%1Class%2')
+ content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexIDcommand{}(\\%w+%s*}?%s*{?%s*)\\SemantexIDcommand{}', '\\NewObject%1%2')
+ content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexIDcommand{}', '\\SetupClass%1')
+ content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexIDcommand{}', '\\SetupObject%1')
+end
+
+addNumbersToIDs = function()
+ local n = 0
+ local p,q = string.find(content,'\\SemantexIDcommand{}')
+ while q do
+ n = n + 1
+ content = content:sub(1,q-1) .. n .. content:sub(q,-1)
+ p, q = string.find(content,'\\SemantexIDcommand{}')
+ end
+end
+
+semantexIDluacommand = function(id, source, output)
+ local p, q = string.find(content, '\\SemantexIDcommand{' .. id .. '}')
+
+ while p do
+ content = content:sub(1,p-1) .. content:sub(q+1,-1)
+
+ source = source:gsub('%s+', '')
+
+ -- We do this in case the package "stricttex" was used
+ source = removeStricttexFormatting(source)
+
+ -- This is because #1's in the code becomes ##1
+ -- in the .semtex file.
+ source = source:gsub('#(%d)', '%1')
+
+ local length = source:len()
+
+ local i = 1
+
+ local s
+
+ while i <= length do
+ s = content:sub(p,p)
+ if s == source:sub(i,i) then
+ content = content:sub(1 , p-1) .. content:sub(p+1, -1)
+ i = i + 1
+ elseif s:match('%s') then
+ content = content:sub(1, p-1) .. content:sub(p+1, -1)
+ elseif s == '%' then
+ content = content:sub(1 , p-1) .. content:sub(p,-1):gsub('%%.-\n','',1)
+ elseif s == '{' then
+ -- In this case, we remove the corresponding right brace,
+ -- once we find it
+ local netto = 1 -- The current brace group level
+ local q = 0 -- The position we have moved forward so far
+ while netto > 0 do
+ q = q + 1
+ local e = content:sub(p+q,p+q)
+ if e == '}' then
+ netto = netto - 1
+ elseif e == '{' then
+ netto = netto + 1
+ elseif e == '\\' then
+ q = q + 1
+ elseif e == '%' then
+ content = content:sub(1, p+q-1) .. content:sub(p+q,-1):gsub('%%.-\n','',1)
+ q = q - 1
+ end
+ end
+ content = content:sub(1,p-1) .. content:sub(p+1,p+q-1) .. content:sub(p+q+1,-1)
+ elseif s == '<' and content:sub(p+1,p+2) == '[>' then
+ content = content:sub(1,p-1) .. content:sub(p+3,-1)
+ i = i + 1
+ elseif s == '<' and content:sub(p+1,p+2) == ']>' then
+ content = content:sub(1,p-1) .. content:sub(p+3,-1)
+ i = i + 1
+ elseif source:sub(i,i) == '{' then
+ -- In this case, we remove the corresponding right brace,
+ -- once we find it
+ local netto = 1 -- The current brace group level
+ local q = 0 -- The position we have moved forward so far
+ while netto > 0 do
+ q = q + 1
+ local e = source:sub(i+q,i+q)
+ if e == '}' then
+ netto = netto - 1
+ elseif e == '{' then
+ netto = netto + 1
+ elseif e == '\\' then
+ q = q + 1
+ -- there is no chance that the source contains an unescaped %, so we do not
+ -- check for this
+ end
+ end
+ source = source:sub(1,i-1) .. source:sub(i+1,i+q-1) .. source:sub(i+q+1,-1)
+ length = source:len()
+ else
+ tex.sprint( [[\begingroup\ExplSyntaxOn
+ \msg_fatal:nnnn { stripsemantex } { source_not_expected } { ]] .. source:sub(i,i) .. [[ } { ]] .. s .. [[ }
+ \endgroup]] )
+ break
+ end
+ end
+
+
+ output = output:gsub('%s*\\sp {', '^{')
+ output = output:gsub('%s*\\sb {', '_{')
+ output = output:gsub('\\mathopen \\big ', '\\bigl')
+ output = output:gsub('\\mathclose \\big ', '\\bigr')
+ output = output:gsub('\\mathopen \\Big ', '\\Bigl')
+ output = output:gsub('\\mathclose \\Big ', '\\Bigr')
+ output = output:gsub('\\mathopen \\bigg ', '\\biggl')
+ output = output:gsub('\\mathclose \\bigg ', '\\biggr')
+ output = output:gsub('\\mathopen \\Bigg ', '\\Biggl')
+ output = output:gsub('\\mathclose \\Bigg ', '\\Biggr')
+ output = output:gsub('\\mathopen %(', '(')
+ output = output:gsub('\\mathclose %)', ')')
+ output = output:gsub('\\mathopen %[', '[')
+ output = output:gsub('\\mathclose %]', ']')
+ output = output:gsub('\\mathopen \\{', '\\{')
+ output = output:gsub('\\mathclose \\}', '\\}')
+ output = output:gsub('\\mathopen \\lbrace', '\\lbrace')
+ output = output:gsub('\\mathclose \\rbrace', '\\rbrace')
+ output = output:gsub('\\mathopen \\lbrack', '\\lbrack')
+ output = output:gsub('\\mathclose \\rbrack', '\\rbrack')
+ output = output:gsub('\\mathopen \\langle', '\\langle')
+ output = output:gsub('\\mathclose \\rangle', '\\rangle')
+ output = output:gsub('\\mathopen \\lvert', '\\lvert')
+ output = output:gsub('\\mathclose \\rvert', '\\rvert')
+ output = output:gsub('\\mathopen \\vert', '\\lvert')
+ output = output:gsub('\\mathclose \\vert', '\\rvert')
+ output = output:gsub('\\mathopen \\lVert', '\\lVert')
+ output = output:gsub('\\mathclose \\rVert', '\\rVert')
+ output = output:gsub('\\mathopen \\Vert', '\\lVert')
+ output = output:gsub('\\mathclose \\Vert', '\\rVert')
+ output = output:gsub('%^{\\prime }', '\'')
+ output = output:gsub('%^{\\prime \\prime }', '\'\'')
+ output = output:gsub('%^{\\prime \\prime \\prime }', '\'\'\'')
+ output = output:gsub('%^{\\prime \\prime \\prime \\prime }', '\'\'\'\'')
+ output = output:gsub('%^{\\prime \\prime \\prime \\prime \\prime }', '\'\'\'\'\'')
+
+ output = output:gsub('%s+%f[{}%[%]%(%)%$,]','')
+ output = output:gsub('([}%]%)])%f[\\%w%+%-%(%[=]', '%1 ')
+ output = output:gsub(',',', ')
+ output = output:gsub('%s+$', '')
+
+
+ -- We now check whether the string we add will follow right
+ -- after a control sequence, causing it to be interpreted
+ -- as part of that control sequence.
+ -- Because we want to allow the user to use stricttex, we
+ -- check for alphanumerical control sequences rather than
+ -- just alphabetic ones. This could add spaces that
+ -- the user might not have intended, but it's a minor issue.
+ if output:sub(1,1):match('%w') and content:sub(1, p-1):match('\\%w+$') then
+ content = content:sub(1,p-1) .. ' ' .. output .. content:sub(p,-1)
+ else
+ content = content:sub(1,p-1) .. output .. content:sub(p,-1)
+ end
+ p, q = string.find(content, '\\SemantexIDcommand{' .. id .. '}')
+ end
+end
+
+stripRemainingSemantexIDs = function()
+ content = content:gsub('\\SemantexIDcommand{%d+}', '')
+end
+
+removeParenthesisCommands = function()
+ content = content:gsub('\\SemantexMathOpen \\bigg%s?', '\\biggl')
+ content = content:gsub('\\SemantexMathClose \\bigg%s?', '\\biggr')
+ content = content:gsub('\\SemantexMathOpen \\Bigg%s?', '\\Biggl')
+ content = content:gsub('\\SemantexMathClose \\Bigg%s?', '\\Biggr')
+ content = content:gsub('\\SemantexMathOpen \\big%s?', '\\bigl')
+ content = content:gsub('\\SemantexMathClose \\big%s?', '\\bigr')
+ content = content:gsub('\\SemantexMathOpen \\Big%s?', '\\Bigl')
+ content = content:gsub('\\SemantexMathClose \\Big%s?', '\\Bigr')
+ content = content:gsub('\\SemantexMathOpen{} %(', '(')
+ content = content:gsub('%s*\\SemantexMathClose{}%)', ')')
+ content = content:gsub('\\SemantexMathOpen{} %[', '[')
+ content = content:gsub('%s*\\SemantexMathClose{}%]', ']')
+ content = content:gsub('\\SemantexMathOpen{} \\{', '\\{')
+ content = content:gsub('%s*\\SemantexMathClose{} \\}', '\\}')
+ content = content:gsub('\\SemantexMathOpen{} \\lbrace', '\\lbrace')
+ content = content:gsub('\\SemantexMathClose{} \\rbrace', '\\rbrace')
+ content = content:gsub('\\SemantexMathOpen{} \\lbrack', '\\rbrack')
+ content = content:gsub('\\SemantexMathClose{} \\rbrack', '\\rbrack')
+ content = content:gsub('\\SemantexMathOpen{} \\langle', '\\langle')
+ content = content:gsub('\\SemantexMathClose{} \\rangle', '\\rangle')
+ content = content:gsub('\\SemantexMathOpen{} \\lvert', '\\lvert')
+ content = content:gsub('\\SemantexMathClose{} \\rvert', '\\rvert')
+ content = content:gsub('\\SemantexMathOpen{} \\vert', '\\lvert')
+ content = content:gsub('\\SemantexMathClose{} \\vert', '\\rvert')
+ content = content:gsub('\\SemantexMathOpen{} \\lVert', '\\lVert')
+ content = content:gsub('\\SemantexMathClose{} \\rVert', '\\rVert')
+ content = content:gsub('\\SemantexMathOpen{} \\Vert', '\\lVert')
+ content = content:gsub('\\SemantexMathClose{} \\Vert', '\\rVert')
+ content = content:gsub('\\SemantexMathOpen{} .%s?', '')
+ content = content:gsub('\\SemantexMathClose{} .%s?', '')
+ content = content:gsub('\\SemantexMathOpen{}', '\\mathopen ')
+ content = content:gsub('\\SemantexMathClose{}', '\\mathclose ')
+ content = content:gsub('\\SemantexMathOpenAuto%s?', '\\SemantexLeft')
+ content = content:gsub('\\SemantexMathCloseAuto%s?', '\\SemantexRight')
+ content = content:gsub('\\SemantexMathOpenNoPar%s?', '')
+ content = content:gsub('\\SemantexMathCloseNoPar%s?', '')
+ content = content:gsub('\\SemantexMathOpen%s?', '\\mathopen')
+ content = content:gsub('\\SemantexMathClose%s?', '\\mathclose')
+end
+
+stripComments = function()
+ content = content:gsub('\\%%', '\\StripSemantexEscapedPercent')
+ content = content:gsub('(\\%w+)%%.-\n%s*', '%1 ')
+ content = content:gsub('%%.-\n%s*', '')
+ content = content:gsub('\\StripSemantexEscapedPercent', '\\%%')
+end
+
+addSemtexPackageToFile = function()
+ content = [[% The following was added by "stripsemantex":
+
+\usepackage{semtex,leftindex,graphicx}
+
+\providecommand\SemantexLeft{%
+ \mathopen{}\mathclose\bgroup\left
+}
+
+\providecommand\SemantexRight{%
+ \aftergroup\egroup\right
+}
+
+\makeatletter
+\DeclareRobustCommand\SemantexBullet{%
+ \mathord{\mathpalette\SemantexBullet@{0.5}}%
+}
+\newcommand\SemantexBullet@[2]{%
+ \vcenter{\hbox{\scalebox{#2}{$\m@th#1\bullet$}}}%
+}
+\DeclareRobustCommand\SemantexDoubleBullet{\SemantexBullet \SemantexBullet}
+\makeatother
+
+]] .. content
end \ No newline at end of file
diff --git a/macros/latex/contrib/semantex/stripsemantex.sty b/macros/latex/contrib/semantex/stripsemantex.sty
index d50c14c6e3..1d66144b50 100644
--- a/macros/latex/contrib/semantex/stripsemantex.sty
+++ b/macros/latex/contrib/semantex/stripsemantex.sty
@@ -1,5 +1,5 @@
\RequirePackage{xparse}
-\ProvidesExplPackage{stripsemantex}{2021/07/03}{0.506}{}
+\ProvidesExplPackage{stripsemantex}{2021/07/04}{0.507}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
diff --git a/macros/latex/contrib/siunitx/CHANGELOG.md b/macros/latex/contrib/siunitx/CHANGELOG.md
index 8cd9f6dfee..829db2c92a 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.0.18]
+
+### Fixed
+- Printing of reciprocal units when `per-mode = symbol` is active
+ (issue #500)
+
## [v3.0.17]
### Fixed
@@ -1414,7 +1420,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.0.17...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.0.18...HEAD
+[v3.0.18]: https://github.com/josephwright/siunitx/compare/v3.0.17...v3.0.18
[v3.0.17]: https://github.com/josephwright/siunitx/compare/v3.0.16...v3.0.17
[v3.0.16]: https://github.com/josephwright/siunitx/compare/v3.0.15...v3.0.16
[v3.0.15]: https://github.com/josephwright/siunitx/compare/v3.0.14...v3.0.15
diff --git a/macros/latex/contrib/siunitx/siunitx-code.pdf b/macros/latex/contrib/siunitx/siunitx-code.pdf
index a3f4606a73..ed17e84c1c 100644
--- a/macros/latex/contrib/siunitx/siunitx-code.pdf
+++ b/macros/latex/contrib/siunitx/siunitx-code.pdf
Binary files differ
diff --git a/macros/latex/contrib/siunitx/siunitx-quantity.dtx b/macros/latex/contrib/siunitx/siunitx-quantity.dtx
index 353fe94e6e..e4dc93200e 100644
--- a/macros/latex/contrib/siunitx/siunitx-quantity.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-quantity.dtx
@@ -372,18 +372,29 @@
% }
% For printing a single part of a quantity. This is needed for compound
% quantities and so is public: that's also the reason for passing both
-% argument explicitly.
+% argument explicitly. The lazy test here is looking for the case where
+% a |1| has been inserted at the start of a format unit \emph{and} we
+% have some other number to print: the |1| is then removed and there is
+% no space inserted.
% \begin{macrocode}
\cs_new_protected:Npn \siunitx_quantity_print:nn #1#2
{
\siunitx_print_number:n {#1}
\tl_if_blank:nF {#2}
{
- \tl_use:N \l_@@_product_tl
- \bool_if:NTF \l_@@_break_bool
- { \penalty \binoppenalty }
- { \nobreak }
- \siunitx_print_unit:n {#2}
+ \bool_lazy_or:nnTF
+ { \tl_if_blank_p:n {#1} }
+ { ! \tl_if_head_eq_charcode_p:nN {#2} { 1 } }
+ {
+ \tl_use:N \l_@@_product_tl
+ \bool_if:NTF \l_@@_break_bool
+ { \penalty \binoppenalty }
+ { \nobreak }
+ \siunitx_print_unit:n {#2}
+ }
+ {
+ \exp_args:No \siunitx_print_unit:n { \use_none:n #2 }
+ }
}
}
\cs_generate_variant:Nn \siunitx_quantity_print:nn { nV , VV , xV }
diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx
index 30afff3ae2..52da6d7b36 100644
--- a/macros/latex/contrib/siunitx/siunitx.dtx
+++ b/macros/latex/contrib/siunitx/siunitx.dtx
@@ -121,7 +121,7 @@
%
% Identify the package and give the over all version information.
% \begin{macrocode}
-\ProvidesExplPackage {siunitx} {2021-06-29} {3.0.17}
+\ProvidesExplPackage {siunitx} {2021-07-04} {3.0.18}
{A comprehensive (SI) units package}
% \end{macrocode}
%
diff --git a/macros/latex/contrib/siunitx/siunitx.pdf b/macros/latex/contrib/siunitx/siunitx.pdf
index ed08b36163..57e3ffb45e 100644
--- a/macros/latex/contrib/siunitx/siunitx.pdf
+++ b/macros/latex/contrib/siunitx/siunitx.pdf
Binary files differ