summaryrefslogtreecommitdiff
path: root/macros/latex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-10-05 03:01:34 +0000
committerNorbert Preining <norbert@preining.info>2022-10-05 03:01:34 +0000
commit6925a15396a955498e1d1663204e7fa7da3d1728 (patch)
tree925ce3e30472ef82315230ec2772e2e104642541 /macros/latex
parent30b3429f0e138c93c5f1ba1d1a6d46728c0943e9 (diff)
CTAN sync 202210050301
Diffstat (limited to 'macros/latex')
-rw-r--r--macros/latex/contrib/semantex/semantex.pdfbin397503 -> 397454 bytes
-rw-r--r--macros/latex/contrib/semantex/semantex.sty72
-rw-r--r--macros/latex/contrib/semantex/semantex.tex64
-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.pdfbin617808 -> 617674 bytes
-rw-r--r--macros/latex/contrib/siunitx/siunitx-number.dtx40
-rw-r--r--macros/latex/contrib/siunitx/siunitx.dtx2
-rw-r--r--macros/latex/contrib/siunitx/siunitx.pdfbin665418 -> 665420 bytes
-rw-r--r--macros/latex/contrib/upmethodology/src/UPMVERSION.def2
-rw-r--r--macros/latex/contrib/upmethodology/src/upmethodology-document.cls2
-rw-r--r--macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty32
-rw-r--r--macros/latex/required/babel/base/README.md31
-rw-r--r--macros/latex/required/babel/base/babel.dtx201
-rw-r--r--macros/latex/required/babel/base/babel.ins2
-rw-r--r--macros/latex/required/babel/base/babel.pdfbin885746 -> 885961 bytes
-rw-r--r--macros/latex/required/babel/base/bbcompat.dtx2
18 files changed, 564 insertions, 517 deletions
diff --git a/macros/latex/contrib/semantex/semantex.pdf b/macros/latex/contrib/semantex/semantex.pdf
index 4e50ebe1d4..64e0bae6cf 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 ed347ffb6a..1937f4e5c4 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}{2022/09/24}{0.521}{}
+\ProvidesExplPackage{semantex}{2022/10/04}{0.522}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
@@ -10,7 +10,7 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\tl_set:Nn\SemantexVersion{0.521}
+\tl_set:Nn\SemantexVersion{0.522}
\cs_set_eq:NN \semantex_keyval_parse:NNn \keyval_parse:NNn
\cs_set:Npn \semantex_singlekey_parse:Nn#1#2 { \clist_map_function:nN { #2 } #1 }
@@ -887,7 +887,7 @@
{
\semantex_inner_pre_return:n { #1 }
\tl_set:Nx \l__semantex_render_output_class_temp_tl { \semantex_data_tl_get:nn { #1 } { output } } % The output class
- \tl_set:Nx \l__semantex_render_object_associated_to_output_class_tempt_tl {
+ \tl_set:Nx \l__semantex_render_object_associated_to_output_class_temp_tl {
object_associated_to_\l__semantex_render_output_class_temp_tl
}
\exp_args:NNx\cs_set:Nn\l__semantex_render_output_options_temp_cs:n
@@ -899,7 +899,7 @@
}
\tl_put_right:Nx \l__semantex_render_output_options_temp_tl
{
- { \l__semantex_render_output_class_temp_tl }
+ { \l__semantex_render_object_associated_to_output_class_temp_tl }
}
\exp_args:NNo\tl_set:No \l__semantex_render_output_options_temp_tl
{
@@ -922,21 +922,21 @@
% makes a one-time object of class ??? and allows us to
% immediately pass options to it
{
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ upper~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { upper } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ lower~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { lower } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ pre~upper~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { pre~upper } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ post~upper~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { post~upper } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ pre~lower~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { pre~lower } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ post~lower~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { post~lower } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ slanting~phantom } { } % reset slanting phantom
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ math~class } { \semantex_data_tl_get_exp_not:nn { #1 } { math~class } }
\exp_not:V \l__semantex_render_output_options_temp_tl
% These are the options we pass to the output class so that it
@@ -959,23 +959,23 @@
% makes a one-time object of class ??? and allows us to
% immediately pass options to it
{
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ upper~left~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { upper~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ lower~left~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { lower~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ pre~upper~left~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { pre~upper~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ post~upper~left~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { post~upper~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ pre~lower~left~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { pre~lower~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ post~lower~left~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { post~lower~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ height~phantom } { \semantex_data_tl_get_exp_not:nn { #1 } { height~phantom } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ slanting~phantom } { \semantex_data_tl_get_exp_not:nn { #1 } { slanting~phantom } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ math~class } { \semantex_data_tl_get_exp_not:nn { #1 } { math~class } }
\exp_not:V \l__semantex_render_output_options_temp_tl
% These are the options we pass to the output class so that it
@@ -997,35 +997,35 @@
% makes a one-time object of class ??? and allows us to
% immediately pass options to it
{
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ upper~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { upper } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ lower~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { lower } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ upper~left~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { upper~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ lower~left~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { lower~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ pre~upper~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { pre~upper } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ post~upper~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { post~upper } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ pre~lower~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { pre~lower } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ post~lower~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { post~lower } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ pre~upper~left~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { pre~upper~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ post~upper~left~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { post~upper~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ pre~lower~left~put~left } { \semantex_data_tl_get_exp_not:nn { #1 } { pre~lower~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ post~lower~left~put~right } { \semantex_data_tl_get_exp_not:nn { #1 } { post~lower~left } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ height~phantom } { \semantex_data_tl_get_exp_not:nn { #1 } { height~phantom } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ slanting~phantom } { \semantex_data_tl_get_exp_not:nn { #1 } { slanting~phantom } }
- \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_tempt_tl }
+ \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_object_associated_to_output_class_temp_tl }
{ math~class } { \semantex_data_tl_get_exp_not:nn { #1 } { math~class } }
\exp_not:V \l__semantex_render_output_options_temp_tl
% These are the options we pass to the output class so that it
diff --git a/macros/latex/contrib/semantex/semantex.tex b/macros/latex/contrib/semantex/semantex.tex
index bd932ca3be..08587d1ad8 100644
--- a/macros/latex/contrib/semantex/semantex.tex
+++ b/macros/latex/contrib/semantex/semantex.tex
@@ -2135,9 +2135,9 @@ $\int \vf \wedgeD{\vx[1],
\chapter{Using \texorpdfstring{Seman\!\TeX{}}{SemanTeX} in other commands using \texorpdfstring{\texttt{\textbackslash UseClassInCommand}}{\string\UseClassInCommand}}\label{sec:UseClassInCommand}
\SemantexRecordObject{\Frac}
-\newcommand\Frac[2]{
- \SemantexRecordSource{\Frac{#1}{#2}}
- \UseClassInCommand\MyVar{ \frac{#1}{#2} }
+\newcommand\Frac[2]{%
+ \SemantexRecordSource{\Frac{#1}{#2}}%
+ \UseClassInCommand\MyVar{\frac{#1}{#2}}%
}
Sometimes, it is useful to create other commands based on \semantex
@@ -2148,7 +2148,9 @@ a command~\lstinline!\Frac! which automatically wraps
the fraction in~\lstinline!\MyVar!. The first guess how to
do that would be something like
\begin{lstlisting}
-\newcommand\Frac[2]{ \MyVar{ \frac{#1}{#2} } }
+\newcommand\Frac[2]{%
+ \MyVar{\frac{#1}{#2}}%
+}
\end{lstlisting}
\begin{LTXexample}
\[
@@ -2162,9 +2164,9 @@ your document of \semantex{} markup. But in order to prepare yourself for this p
in a slightly more cumbersome way:
\begin{lstlisting}
\SemantexRecordObject{\Frac}
-\newcommand\Frac[2]{
- \SemantexRecordSource{\Frac{#1}{#2}}
- \UseClassInCommand\MyVar{ \frac{#1}{#2} }
+\newcommand\Frac[2]{%
+ \SemantexRecordSource{\Frac{#1}{#2}}%
+ \UseClassInCommand\MyVar{\frac{#1}{#2}}%
}
\end{lstlisting}
\begin{LTXexample}
@@ -2240,27 +2242,27 @@ Therefore, we do three things:
\NewObject\MyVar\catvect{\categoryformat{Vect}}
\SemantexRecordObject{\catxmod}
-\newcommand\catxmod[1]{
- \SemantexRecordSource{\catxmod{#1}}
- \UseClassInCommand\MyVar{#1\categoryformat{-mod}}
+\newcommand\catxmod[1]{%
+ \SemantexRecordSource{\catxmod{#1}}%
+ \UseClassInCommand\MyVar{#1\categoryformat{-mod}}%
}
\SemantexRecordObject{\catmodx}
-\newcommand\catmodx[1]{
- \SemantexRecordSource{\catmodx{#1}}
- \UseClassInCommand\MyVar{\categoryformat{mod-}#1}
+\newcommand\catmodx[1]{%
+ \SemantexRecordSource{\catmodx{#1}}%
+ \UseClassInCommand\MyVar{\categoryformat{mod-}#1}%
}
\SemantexRecordObject{\catxmody}
-\newcommand\catxmody[2]{
- \SemantexRecordSource{\catxmody{#1}{#2}}
- \UseClassInCommand\MyVar{#1\categoryformat{-mod-}#2}
+\newcommand\catxmody[2]{%
+ \SemantexRecordSource{\catxmody{#1}{#2}}%
+ \UseClassInCommand\MyVar{#1\categoryformat{-mod-}#2}%
}
\SemantexRecordObject{\catxmodx}
-\newcommand\catxmodx[1]{
- \SemantexRecordSource{\catxmodx{#1}}
- \UseClassInCommand\MyVar{#1\categoryformat{-mod-}#1}
+\newcommand\catxmodx[1]{%
+ \SemantexRecordSource{\catxmodx{#1}}%
+ \UseClassInCommand\MyVar{#1\categoryformat{-mod-}#1}%
}
The above method can be used to create commands
@@ -2293,9 +2295,9 @@ For this, we use the constructions we learned at the introduction
to this chapter:
\begin{lstlisting}
\SemantexRecordObject{\catxmod}
-\newcommand\catxmod[1]{
- \SemantexRecordSource{\catxmod{#1}}
- \UseClassInCommand\MyVar{#1\categoryformat{-mod}}
+\newcommand\catxmod[1]{%
+ \SemantexRecordSource{\catxmod{#1}}%
+ \UseClassInCommand\MyVar{#1\categoryformat{-mod}}%
}
\end{lstlisting}
\begin{LTXexample}
@@ -2310,21 +2312,21 @@ of other situations, like
\( \catmodx{\vR} \) or~\( \catxmody{\vR}{\vS} \):
\begin{lstlisting}
\SemantexRecordObject{\catmodx}
-\newcommand\catmodx[1]{
- \SemantexRecordSource{\catmodx{#1}}
- \UseClassInCommand\MyVar{\categoryformat{mod-}#1}
+\newcommand\catmodx[1]{%
+ \SemantexRecordSource{\catmodx{#1}}%
+ \UseClassInCommand\MyVar{\categoryformat{mod-}#1}%
}
\SemantexRecordObject{\catxmody}
-\newcommand\catxmody[2]{
- \SemantexRecordSource{\catxmody{#1}{#2}}
- \UseClassInCommand\MyVar{#1\categoryformat{-mod-}#2}
+\newcommand\catxmody[2]{%
+ \SemantexRecordSource{\catxmody{#1}{#2}}%
+ \UseClassInCommand\MyVar{#1\categoryformat{-mod-}#2}%
}
\SemantexRecordObject{\catxmodx}
-\newcommand\catxmodx[1]{
- \SemantexRecordSource{\catxmodx{#1}}
- \UseClassInCommand\MyVar{#1\categoryformat{-mod-}#1}
+\newcommand\catxmodx[1]{%
+ \SemantexRecordSource{\catxmodx{#1}}%
+ \UseClassInCommand\MyVar{#1\categoryformat{-mod-}#1}%
}
\end{lstlisting}
diff --git a/macros/latex/contrib/semantex/stripsemantex.lua b/macros/latex/contrib/semantex/stripsemantex.lua
index 30d4c58be6..d0eb5d1963 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])' ,'\\SemantexID{}\\' .. 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]-)\\SemantexID{}([^\n]-\n)')
- while p do
- content = content:gsub('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)','%1%2')
- p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)')
- end
- content = content:gsub('parent(%s*)=(%s*)\\SemantexID{}','parent%1=%2')
- content = content:gsub('class(%s*)=(%s*)\\SemantexID{}','class%1=%2')
- content = content:gsub('clone(%s*)=(%s*)\\SemantexID{}','clone%1=%2')
- content = content:gsub('copy(%s*)=(%s*)\\SemantexID{}','copy%1=%2')
- content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexID{}','\\New%1Class%2')
- content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexID{}(\\%w+%s*}?%s*{?%s*)\\SemantexID{}', '\\NewObject%1%2')
- content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexID{}', '\\SetupClass%1')
- content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexID{}', '\\SetupObject%1')
-end
-
-addNumbersToIDs = function()
- local n = 0
- local p,q = string.find(content,'\\SemantexID{}')
- while q do
- n = n + 1
- content = content:sub(1,q-1) .. n .. content:sub(q,-1)
- p, q = string.find(content,'\\SemantexID{}')
- end
-end
-
-semantexIDluacommand = function(id, source, output)
- local p, q = string.find(content, '\\SemantexID{' .. 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, '\\SemantexID{' .. id .. '}')
- end
-end
-
-stripRemainingSemantexIDs = function()
- content = content:gsub('\\SemantexID{%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])' ,'\\SemantexID{}\\' .. 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]-)\\SemantexID{}([^\n]-\n)')
+ while p do
+ content = content:gsub('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)','%1%2')
+ p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)')
+ end
+ content = content:gsub('parent(%s*)=(%s*)\\SemantexID{}','parent%1=%2')
+ content = content:gsub('class(%s*)=(%s*)\\SemantexID{}','class%1=%2')
+ content = content:gsub('clone(%s*)=(%s*)\\SemantexID{}','clone%1=%2')
+ content = content:gsub('copy(%s*)=(%s*)\\SemantexID{}','copy%1=%2')
+ content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexID{}','\\New%1Class%2')
+ content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexID{}(\\%w+%s*}?%s*{?%s*)\\SemantexID{}', '\\NewObject%1%2')
+ content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexID{}', '\\SetupClass%1')
+ content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexID{}', '\\SetupObject%1')
+end
+
+addNumbersToIDs = function()
+ local n = 0
+ local p,q = string.find(content,'\\SemantexID{}')
+ while q do
+ n = n + 1
+ content = content:sub(1,q-1) .. n .. content:sub(q,-1)
+ p, q = string.find(content,'\\SemantexID{}')
+ end
+end
+
+semantexIDluacommand = function(id, source, output)
+ local p, q = string.find(content, '\\SemantexID{' .. 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, '\\SemantexID{' .. id .. '}')
+ end
+end
+
+stripRemainingSemantexIDs = function()
+ content = content:gsub('\\SemantexID{%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 cdd6947469..5a98435644 100644
--- a/macros/latex/contrib/semantex/stripsemantex.sty
+++ b/macros/latex/contrib/semantex/stripsemantex.sty
@@ -1,5 +1,5 @@
\RequirePackage{xparse}
-\ProvidesExplPackage{stripsemantex}{2022/09/24}{0.521}{}
+\ProvidesExplPackage{stripsemantex}{2022/10/04}{0.522}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
diff --git a/macros/latex/contrib/siunitx/CHANGELOG.md b/macros/latex/contrib/siunitx/CHANGELOG.md
index c4aec21e34..7cdde2cf78 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.1.8] - 2022-10-04
+
+### Fixed
+- Rounding to order of magnitude (see issue
+ [\#622](https://github.com/josephwright/siunitx/issues/622))
+
## [v3.1.7] - 2022-09-07
### Changed
@@ -1811,7 +1817,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.1.7...HEAD
+[Unreleased]: https://github.com/josephwright/siunitx/compare/v3.1.8...HEAD
+[v3.1.8]: https://github.com/josephwright/siunitx/compare/v3.1.7...v3.1.8
[v3.1.7]: https://github.com/josephwright/siunitx/compare/v3.1.6...v3.1.7
[v3.1.6]: https://github.com/josephwright/siunitx/compare/v3.1.5...v3.1.6
[v3.1.5]: https://github.com/josephwright/siunitx/compare/v3.1.4...v3.1.5
diff --git a/macros/latex/contrib/siunitx/siunitx-code.pdf b/macros/latex/contrib/siunitx/siunitx-code.pdf
index c9dcdaecda..cf6bc8c78c 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-number.dtx b/macros/latex/contrib/siunitx/siunitx-number.dtx
index f80684ee9c..1d11f909f0 100644
--- a/macros/latex/contrib/siunitx/siunitx-number.dtx
+++ b/macros/latex/contrib/siunitx/siunitx-number.dtx
@@ -2757,7 +2757,9 @@
% \begin{macrocode}
\cs_new:Npn \@@_round_final_shift:nn #1#2
{
- \str_if_eq:VnTF \l_@@_round_mode_tl { places }
+ \bool_lazy_or:nnTF
+ { \str_if_eq_p:Vn \l_@@_round_mode_tl { figures } }
+ { \str_if_eq_p:Vn \l_@@_round_mode_tl { places } }
{
\use:c
{ @@_round_ \l_@@_exponent_mode_tl :nn }
@@ -2770,7 +2772,11 @@
{
\int_compare:nNnTF { \tl_count:n {#1} } = 4
{
- \@@_round_engineering:NNNNn #1 {#2}
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn \l_@@_round_precision_int = 1 }
+ { \str_if_eq_p:Vn \l_@@_round_mode_tl { figures } }
+ { { 1 } { } }
+ { \@@_round_engineering:NNNNn #1 {#2} }
\@@_round_final_shift:Nw 3
}
{ {#1} {#2} }
@@ -2779,7 +2785,7 @@
{
{#1}
\exp_args:NV \@@_round_engineering:nnN
- { \l_@@_round_precision_int } { }
+ \l_@@_round_precision_int { }
#2#3#4#5 \q_recursion_tail \q_recursion_stop
}
\cs_new:Npn \@@_round_engineering:nnN #1#2#3
@@ -2793,11 +2799,17 @@
\cs_new:Npn \@@_round_input:nn #1#2 { {#1} {#2} }
\cs_new:Npn \@@_round_scientific:nn #1#2
{
- \@@_exponent_shift:nnf
- { 1 } {#1} { \@@_round_truncate_direct:n {#2} }
+ \bool_lazy_and:nnTF
+ { \int_compare_p:nNn \l_@@_round_precision_int = 1 }
+ { \str_if_eq_p:Vn \l_@@_round_mode_tl { figures } }
+ { { 1 } { } }
+ {
+ \@@_exponent_shift:nnf
+ { 1 } {#1} { \@@_round_truncate_direct:n {#2} }
+ }
\@@_round_final_shift:Nw 1
}
-\cs_new:Npn \@@_round_final_shift:Nw #1#2 \@@_round_places_end:nnn #3#4#5
+\cs_new:Npn \@@_round_final_shift:Nw #1#2 \@@_round_end:nnn #3#4#5
{
\exp_not:n { {#3} }
\@@_exponent_finalise:n { #4#5 + #1 }
@@ -2885,6 +2897,13 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[EXP]{\@@_round_end:nnn}
+% Used as a marker to allow adjustment when we pass a power of ten.
+% \begin{macrocode}
+\cs_new:Npn \@@_round_end:nnn #1#2#3 { \exp_not:n { {#1} {#2} {#3} } }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}[EXP]{\@@_round_figures:nnnnnnn, \@@_round_figures_aux:nnnnnnn}
% \begin{macro}[EXP]{\@@_round_figures_count:nnN}
% \begin{macro}[EXP]{\@@_round_figures_count:nnnN}
@@ -2913,7 +2932,7 @@
\exp_not:n { {#1} {#2} }
\@@_round_figures_count:nnN {#3} {#4} #3#4
\q_recursion_tail \q_recursion_stop
- \exp_not:n { { } {#6} {#7} }
+ \@@_round_end:nnn { } {#6} {#7}
}
{ { } { } { 0 } { } { } { } { 0 } }
}
@@ -2955,7 +2974,6 @@
% \end{macro}
%
% \begin{macro}[EXP]{\@@_round_places:nnnnnnn}
-% \begin{macro}[EXP]{\@@_round_places_end:nnn}
% \begin{macro}[EXP]{\@@_round_places_decimal:nn, \@@_round_places_integer:nn}
% \begin{macro}[EXP]{\@@_round_places_finalise:n}
% \begin{macro}[EXP]{\@@_round_places_finalise:nnnnnnn}
@@ -2977,12 +2995,11 @@
{ \@@_round_places_decimal:nn }
{ \@@_round_places_integer:nn }
{#3} {#4}
- \@@_round_places_end:nnn { } {#6} {#7}
+ \@@_round_end:nnn { } {#6} {#7}
}
}
{ \exp_not:n { {#1} {#2} {#3} {#4} {#5} {#6} {#7} } }
}
-\cs_new:Npn \@@_round_places_end:nnn #1#2#3 { \exp_not:n { {#1} {#2} {#3} } }
\cs_new:Npn \@@_round_places_decimal:nn #1#2
{
\int_compare:nNnTF
@@ -3056,7 +3073,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}[EXP]{\@@_round_uncertainty:nnnnnnn}
% \begin{macro}[EXP]{\@@_round_uncertainty_end:nn}
@@ -3249,7 +3265,7 @@
\use:c
{ @@_round_ \l_@@_exponent_mode_tl :nn }
{#2} {#3}
- \@@_round_places_end:nnn { { S } { 1 #1 } } {#4} {#5}
+ \@@_round_end:nnn { { S } { 1 #1 } } {#4} {#5}
}
% \end{macrocode}
% With the data available, adjust the output such that the uncertainty
diff --git a/macros/latex/contrib/siunitx/siunitx.dtx b/macros/latex/contrib/siunitx/siunitx.dtx
index 13a76da695..3e61bbb85c 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} {2022-09-07} {3.1.7}
+\ProvidesExplPackage {siunitx} {2022-10-04} {3.1.8}
{A comprehensive (SI) units package}
% \end{macrocode}
%
diff --git a/macros/latex/contrib/siunitx/siunitx.pdf b/macros/latex/contrib/siunitx/siunitx.pdf
index 4954530a97..15032f9957 100644
--- a/macros/latex/contrib/siunitx/siunitx.pdf
+++ b/macros/latex/contrib/siunitx/siunitx.pdf
Binary files differ
diff --git a/macros/latex/contrib/upmethodology/src/UPMVERSION.def b/macros/latex/contrib/upmethodology/src/UPMVERSION.def
index c944b0c40f..f67a49f440 100644
--- a/macros/latex/contrib/upmethodology/src/UPMVERSION.def
+++ b/macros/latex/contrib/upmethodology/src/UPMVERSION.def
@@ -1 +1 @@
-\def\UPMVERSION{20220210}
+\def\UPMVERSION{20221004}
diff --git a/macros/latex/contrib/upmethodology/src/upmethodology-document.cls b/macros/latex/contrib/upmethodology/src/upmethodology-document.cls
index 0bca5c1b2b..f62d987462 100644
--- a/macros/latex/contrib/upmethodology/src/upmethodology-document.cls
+++ b/macros/latex/contrib/upmethodology/src/upmethodology-document.cls
@@ -17,7 +17,7 @@
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite
% 330, Boston, MA 02111-1307, USA.
-\global\edef\upm@package@docclazz@ver{2022/02/10}
+\global\edef\upm@package@docclazz@ver{2022/10/04}
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{upmethodology-document}[\upm@package@docclazz@ver]
diff --git a/macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty b/macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty
index 5952c2b916..52b2adbb5b 100644
--- a/macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty
+++ b/macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty
@@ -17,7 +17,7 @@
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite
% 330, Boston, MA 02111-1307, USA.
-\global\edef\upm@package@fmt@ver{2022/02/10}
+\global\edef\upm@package@fmt@ver{2022/10/04}
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{upmethodology-fmt}[\upm@package@fmt@ver]
@@ -1270,18 +1270,44 @@
\let\upm@item@param\upm@fmt@olditem
\let\upm@item@noparam\upm@fmt@olditem
\def\item{\@ifnextchar[\upm@item@param\upm@item@noparam}
- \AtBeginDocument{
+ \newcommand{\overridedescriptionenvironment}{%
\message{*** Overriding the 'description' environment. Pass option 'standardlists' for avoiding this override.}
+ % Override the description environment
\global\let\description\@undefined
\global\let\enddescription\@undefined
\global\NewEnviron{description}[1][\upm@fmt@itemizeddescription@separator]{
\begin{itemize}%
- \renewcommand{\upm@item@param}[1][]{\upm@fmt@olditem \upm@fmt@itemizeddescription@desc{##1}{#1}}%
+ \renewcommand{\upm@item@param}[1][]{\upm@fmt@olditem \upm@fmt@itemizeddescription@desc{####1}{##1}}%
\renewcommand{\upm@item@noparam}{\upm@fmt@olditem }%
\BODY%
\end{itemize}%
}
}
+ \newcommand{\restoredescriptionenvironment}{%
+ \message{*** Restoring the 'description' environment.}
+ \global\let\description\@upm@fmt@overriden@description%
+ \global\let\enddescription\@upm@fmt@overriden@enddescrption%
+ }
+ \AtBeginDocument{
+ % Save the original definition for later restore
+ \global\let\@upm@fmt@overriden@description\description%
+ \global\let\@upm@fmt@overriden@enddescrption\enddescription%
+ \overridedescriptionenvironment%
+ \@ifundefined{printglossary}{}{%
+ \message{*** Overriding the 'printglossary' macro.}
+ \global\let\upm@fmt@printglossary@original\printglossary%
+ \global\newcommand{\upm@fmt@printglossary}[1][]{%
+ \message{*** Evaluating 'printglossary' macro.}%
+ \restoredescriptionenvironment%
+ \upm@fmt@printglossary@original[#1]%
+ \overridedescriptionenvironment%
+ }%
+ \global\let\printglossary\upm@fmt@printglossary%
+ }%
+ }
+\else
+ \newcommand{\overridedescriptionenvironment}{}
+ \newcommand{\restoredescriptionenvironment}{}
\fi
%----------------------------------------
diff --git a/macros/latex/required/babel/base/README.md b/macros/latex/required/babel/base/README.md
index ac068b909e..173be3799d 100644
--- a/macros/latex/required/babel/base/README.md
+++ b/macros/latex/required/babel/base/README.md
@@ -1,4 +1,6 @@
-## Babel 3.80
+## Babel 3.81
+
+**Development**
This package manages culturally-determined typographical (and other)
rules, and hyphenation patterns for a wide range of languages. Many
@@ -8,9 +10,9 @@ is a set of ini files for about 250 languages.
The latest stable version is available on <https://ctan.org/pkg/babel>.
-Changes in version 3.80 are described in:
+Changes in version 3.81 are described in:
-https://latex3.github.io/babel/news/whats-new-in-babel-3.80.html
+https://latex3.github.io/babel/news/whats-new-in-babel-3.81.html
Apart from the manual, you can find information on some aspects of babel at:
@@ -46,21 +48,14 @@ respective authors.
### Summary of latest changes
```
-3.80 2022-09-16
- * Ethiopic calendar.
- * Hungarian date in the superessive case.
- * Captions for Hausa by Abubakar Yusuf (@fatherofcamels)
- * Fixes in dates:
- - Latin: In `pdftex`, numerals were printed in arabic form.
- - Thai: Buddhist and Gregorian were reversed.
- - Persian: The Persian calendar was not loaded.
- * More updates to the CLDR 41: Galician, Swiss German, Gujarati,
- Hausa, Hebrew, Hindi, Croatian, Upper Sorbian, Hungarian,
- Armenian, Interlingua, Indonesian, Igbo, Sichuan Yi, Icelandic,
- Italian, Japanese, Ngomba, Georgian, Kabyle, Kabuverdianu,
- Kazakh, Kako, Kalaallisut, Khmer, Kannada, Korean, Konkani,
- Kashmiri, Colognian, Cornish, Kyrgyz, Lakota, Lao, Northern
- Luri, Lithuanian, Macedonian, Malayalam, Mongolian.
+3.81 2022-10-04
+ * Tibetan line breaking and justification (lines padded with
+ trailing tshegs).
+ * New option 'letters' for 'onchar'.
+ * Conceal 'fontspec' warnings about unknown languages and
+ scripts with \babelfont.
+ * More updates to the CLDR 41: Burmese, Dutch, Kwasio, Malay,
+ Marathi, Mazanderani, Nepali, Norwegian, Norwegian Nynorsk.
```
### Previous changes
diff --git a/macros/latex/required/babel/base/babel.dtx b/macros/latex/required/babel/base/babel.dtx
index c633f24b9e..3d8eddc505 100644
--- a/macros/latex/required/babel/base/babel.dtx
+++ b/macros/latex/required/babel/base/babel.dtx
@@ -32,7 +32,7 @@
%
% \iffalse
%<*filedriver>
-\ProvidesFile{babel.dtx}[2022/09/17 v3.80 The Babel package]
+\ProvidesFile{babel.dtx}[2022/10/04 v3.81 The Babel package]
\documentclass{ltxdoc}
\GetFileInfo{babel.dtx}
\usepackage{fontspec}
@@ -943,11 +943,9 @@ list of characters as their arguments.
The command |\shorthandoff| sets the |\catcode| for each of the
characters in its argument to other (12); the command |\shorthandon|
sets the |\catcode| to active (13). Both commands only work on `known'
-shorthand characters.
-
-% TODO - Is the following true ????
-% If a character is not known to be a shorthand character its category
-% code will be left unchanged.
+shorthand characters, and an error will be raised otherwise. You can
+check if a character is a shorthand with |\ifbabelshorthand| (see
+below).
\New{3.9a} However, |\shorthandoff| does not behave as
you would expect with characters like |~| or |^|, because they
@@ -2311,19 +2309,6 @@ to select fonts in addition to the three basic families.
\end{warning}
\begin{troubleshooting}
- \trouble{Package fontspec Warning: 'Language 'LANG' not available for
- font 'FONT' with script 'SCRIPT' 'Default' language used instead'}
- \textit{Package fontspec Warning: 'Language 'LANG' not available for
- font 'FONT' with script 'SCRIPT' 'Default' language used instead'}.
-
- \textbf{This is \textit{not} an error.} This warning is shown by
- \textsf{fontspec}, not by \babel. It can be irrelevant for English,
- but not for many other languages, including Urdu and Turkish. This is
- a useful and harmless warning, and if everything is fine with your
- document the best thing you can do is just to ignore it altogether.
-\end{troubleshooting}
-
-\begin{troubleshooting}
\trouble{Package babel Info: The following fonts are not babel
standard families} \textit{Package babel Info: The following fonts
are not babel standard families}.
@@ -2623,7 +2608,8 @@ the script, no matter which language is active. Although somewhat
inconsistent, this makes setting a language up easier in most typical
cases.
-\Describe{onchar=}{\texttt{ids} $\string|$ \texttt{fonts}}
+\Describe{onchar=}{\texttt{ids} $\string|$ \texttt{fonts}
+ $\string|$ \texttt{letters}}
\New{3.38} This option is much like an ‘event’ called when a character
belonging to the script of this locale is found (as its name implies,
it acts on characters, not on spaces). There are currently two
@@ -2634,6 +2620,10 @@ locale (as set with |\babelfont|). This option is not compatible with
|mapfont|. Characters can be added or modified with
|\babelcharproperty|.
+\New{3.81} Option |letters| restricts the ‘actions’ to letters, in the
+\TeX{} sense (i.~e., with catcode 11). Digits and punctuation are then
+considered part of current locale (as set by a selector).
+
\begin{note}
An alternative approach with \luatex{} and Harfbuzz is the font
option |RawFeature={multiscript=auto}|. It does not switch the
@@ -2657,7 +2647,8 @@ Currently used only in Southeast Asian scrips, like Thai. Ignored if 0
See section~\ref{transforms}.
\Describe{justification=}{\texttt{kashida} $\string|$
-\texttt{elongated} $\string|$ \texttt{unhyphenated}}
+\texttt{elongated} $\string|$ \texttt{unhyphenated}
+$\string|$ \texttt{padding}}
\New{3.59} There are currently three options, mainly for the Arabic
script. It sets the linebreaking and justification method, which can be
based on the the \textsc{arabic tatweel} character or in the
@@ -2666,6 +2657,11 @@ explanation see the
\href{https://latex3.github.io/babel/news/whats-new-in-babel-3.59.html}%
{\babel\ site}.
+\New{3.81} The option |padding| has been devised primarily for Tibetan.
+It’s still somewhat experimental. Again, there is an explanation in the
+\href{https://latex3.github.io/babel/news/whats-new-in-babel-3.81.html}%
+ {\babel\ site}.
+
\Describe{linebreaking=}{}
\New{3.59} Just a synonymous for \texttt{justification}.
@@ -4107,6 +4103,10 @@ For example:
\babelcharproperty{`)}{linebreak}{cl} % or id, op, cl, ns, ex, in, hy
\end{verbatim}
+Please, refer to the Unicode standard (Annex \#9 and Annex \#14) for
+the meaning of the available codes. For example, |en| is ‘European
+number’ and |id| is ‘ideographic’.
+
\New{3.39} Another property is |locale|, which adds characters to the
list used by |onchar| in |\babelprovide|, or, if the last argument is
empty, removes them. The last argument is the locale name:
@@ -5176,8 +5176,8 @@ help from Bernd Raichle, for which I am grateful.
% \section{Tools}
%
% \begin{macrocode}
-%<<version=3.80>>
-%<<date=2022/09/17>>
+%<<version=3.81>>
+%<<date=2022/10/04>>
% \end{macrocode}
%
% \textbf{Do not use the following macros in \texttt{ldf} files. They
@@ -5304,7 +5304,8 @@ help from Bernd Raichle, for which I am grateful.
% To check if a macro is defined, we create a new macro, which does
% the same as |\@ifundefined|. However, in an $\epsilon$-tex engine,
% it is based on |\ifcsname|, which is more efficient, and does not
-% waste memory.
+% waste memory. Defined inside a group, to avoid \cs{ifcsname} being
+% implicitly set to |\relax| by the |\csname| test.
%
% \begin{macrocode}
\begingroup
@@ -5314,7 +5315,7 @@ help from Bernd Raichle, for which I am grateful.
\else
\expandafter\@secondoftwo
\fi}
- \bbl@ifunset{ifcsname}% TODO. A better test?
+ \bbl@ifunset{ifcsname}%
{}%
{\gdef\bbl@ifunset#1{%
\ifcsname#1\endcsname
@@ -6135,7 +6136,6 @@ help from Bernd Raichle, for which I am grateful.
request the languages explicitly}%
{See the manual for further details.}%
\fi
-% TODO. Option to search if loaded, with \LocaleForEach
\let\bbl@auxname\languagename % Still necessary. TODO
\bbl@ifunset{bbl@bcp@map@\languagename}{}% Move uplevel??
{\edef\languagename{\@nameuse{bbl@bcp@map@\languagename}}}%
@@ -6427,19 +6427,8 @@ help from Bernd Raichle, for which I am grateful.
% TODO. name@map must be here?
\bbl@provide@locale
\bbl@iflanguage\languagename{%
- \expandafter\ifx\csname date\languagename\endcsname\relax
- \bbl@error
- {Unknown language '\languagename'. Either you have\\%
- misspelled its name, it has not been installed,\\%
- or you requested it in a previous run. Fix its name,\\%
- install it or just rerun the file, respectively. In\\%
- some cases, you may need to remove the aux file}%
- {You may proceed, but expect wrong results}%
- \else
- % set type
- \let\bbl@select@type\z@
- \expandafter\bbl@switch\expandafter{\languagename}%
- \fi}}
+ \let\bbl@select@type\z@
+ \expandafter\bbl@switch\expandafter{\languagename}}}
\def\babel@aux#1#2{%
\select@language{#1}%
\bbl@foreach\BabelContentsFiles{% \relax -> don't assume vertical mode
@@ -6493,7 +6482,7 @@ help from Bernd Raichle, for which I am grateful.
\bbl@id@assign
% switch captions, date
% No text is supposed to be added here, so we remove any
- % spurious spaces.
+ % spurious spaces.
\bbl@bsphack
\ifcase\bbl@select@type
\csname captions#1\endcsname\relax
@@ -6540,9 +6529,10 @@ help from Bernd Raichle, for which I am grateful.
\bbl@xin@{/u}{/\bbl@tempa}%
\ifin@\else\bbl@xin@{/e}{/\bbl@tempa}\fi % elongated forms
\ifin@\else\bbl@xin@{/k}{/\bbl@tempa}\fi % only kashida
+ \ifin@\else\bbl@xin@{/p}{/\bbl@tempa}\fi % padding (eg, Tibetan)
\ifin@\else\bbl@xin@{/v}{/\bbl@tempa}\fi % variable font
\ifin@
- % unhyphenated/kashida/elongated = allow stretching
+ % unhyphenated/kashida/elongated/padding = allow stretching
\language\l@unhyphenated
\babel@savevariable\emergencystretch
\emergencystretch\maxdimen
@@ -6709,17 +6699,6 @@ help from Bernd Raichle, for which I am grateful.
% TODO. name@map here?
\bbl@provide@locale
\bbl@iflanguage\languagename{%
- \expandafter\ifx\csname date\languagename\endcsname\relax
- \bbl@warning % TODO - why a warning, not an error?
- {Unknown language '#1'. Either you have\\%
- misspelled its name, it has not been installed,\\%
- or you requested it in a previous run. Fix its name,\\%
- install it or just rerun the file, respectively. In\\%
- some cases, you may need to remove the aux file.\\%
- I'll proceed, but expect wrong results.\\%
- Reported}%
- \fi
- % set type
\let\bbl@select@type\@ne
\expandafter\bbl@switch\expandafter{\languagename}}}
% \end{macrocode}
@@ -6944,7 +6923,7 @@ help from Bernd Raichle, for which I am grateful.
\@nameuse{#2}%
\edef\bbl@tempa{#1}%
\bbl@sreplace\bbl@tempa{name}{}%
- \bbl@warning{% TODO.
+ \bbl@warning{%
\@backslashchar#1 not set for '\languagename'. Please,\\%
define it after the language has been loaded\\%
(typically in the preamble) with:\\%
@@ -7039,8 +7018,7 @@ help from Bernd Raichle, for which I am grateful.
% The macro |\initiate@active@char| below takes all the necessary
% actions to make its argument a shorthand character. The real work
% is performed once for each character. But first we define a little
-% tool. TODO. Always used with additional expansions. Move them here?
-% Move the macro to basic?
+% tool.
%
% \begin{macrocode}
\def\bbl@withactive#1#2{%
@@ -7175,7 +7153,7 @@ help from Bernd Raichle, for which I am grateful.
%
% \begin{macrocode}
\bbl@trace{Defining babelensure}
-\newcommand\babelensure[2][]{% TODO - revise test files
+\newcommand\babelensure[2][]{%
\AddBabelHook{babel-ensure}{afterextras}{%
\ifcase\bbl@select@type
\bbl@cl{e}%
@@ -8695,21 +8673,12 @@ help from Bernd Raichle, for which I am grateful.
%
% \paragraph{Tools}
%
-% But first, a couple of tools. The first one makes global a local
-% variable. This is not the best solution, but it works.
+% But first, a tool. It makes global a local variable. This is not the
+% best solution, but it works.
%
% \begin{macrocode}
\bbl@trace{Multiencoding strings}
\def\bbl@toglobal#1{\global\let#1#1}
-\def\bbl@recatcode#1{% TODO. Used only once?
- \@tempcnta="7F
- \def\bbl@tempa{%
- \ifnum\@tempcnta>"FF\else
- \catcode\@tempcnta=#1\relax
- \advance\@tempcnta\@ne
- \expandafter\bbl@tempa
- \fi}%
- \bbl@tempa}
% \end{macrocode}
%
% The second one. We need to patch |\@uclclist|, but it is done once
@@ -8789,7 +8758,14 @@ help from Bernd Raichle, for which I am grateful.
\@onlypreamble\StartBabelCommands
\def\StartBabelCommands{%
\begingroup
- \bbl@recatcode{11}%
+ \@tempcnta="7F
+ \def\bbl@tempa{%
+ \ifnum\@tempcnta>"FF\else
+ \catcode\@tempcnta=11
+ \advance\@tempcnta\@ne
+ \expandafter\bbl@tempa
+ \fi}%
+ \bbl@tempa
<@Macros local to BabelCommands@>
\def\bbl@provstring##1##2{%
\providecommand##1{##2}%
@@ -9119,7 +9095,7 @@ help from Bernd Raichle, for which I am grateful.
% separates these two steps.
%
% \begin{macrocode}
-\newcommand\setlocalecaption{% TODO. Catch typos. What about ensure?
+\newcommand\setlocalecaption{% TODO. Catch typos.
\@ifstar\bbl@setcaption@s\bbl@setcaption@x}
\def\bbl@setcaption@x#1#2#3{% language caption-name string
\bbl@trim@def\bbl@tempa{#2}%
@@ -9855,7 +9831,15 @@ help from Bernd Raichle, for which I am grateful.
Babel.linebreaking.add_before(Babel.locale_map)
Babel.loc_to_scr = {}
Babel.chr_to_loc = Babel.chr_to_loc or {}
- end}%
+ end
+ Babel.locale_props[\the\localeid].letters = false
+ }%
+ \bbl@xin@{ letters }{ \bbl@KVP@onchar\space}%
+ \ifin@
+ \directlua{
+ Babel.locale_props[\the\localeid].letters = true
+ }%
+ \fi
\bbl@xin@{ ids }{ \bbl@KVP@onchar\space}%
\ifin@
\ifx\bbl@starthyphens\@undefined % Needed if no explicit selection
@@ -9958,7 +9942,8 @@ help from Bernd Raichle, for which I am grateful.
\let\bbl@KVP@linebreaking\bbl@KVP@justification
\fi
\ifx\bbl@KVP@linebreaking\@nnil\else
- \bbl@xin@{,\bbl@KVP@linebreaking,}{,elongated,kashida,cjk,unhyphenated,}%
+ \bbl@xin@{,\bbl@KVP@linebreaking,}%
+ {,elongated,kashida,cjk,padding,unhyphenated,}%
\ifin@
\bbl@csarg\xdef
{lnbrk@\languagename}{\expandafter\@car\bbl@KVP@linebreaking\@nil}%
@@ -9967,6 +9952,8 @@ help from Bernd Raichle, for which I am grateful.
\bbl@xin@{/e}{/\bbl@cl{lnbrk}}%
\ifin@\else\bbl@xin@{/k}{/\bbl@cl{lnbrk}}\fi
\ifin@\bbl@arabicjust\fi
+ \bbl@xin@{/p}{/\bbl@cl{lnbrk}}%
+ \ifin@\AtBeginDocument{\bbl@tibetanjust}\fi
% == Line breaking: hyphenate.other.(locale|script) ==
\ifx\bbl@lbkflag\@empty
\bbl@ifunset{bbl@hyotl@\languagename}{}%
@@ -12058,9 +12045,7 @@ help from Bernd Raichle, for which I am grateful.
\ifx\RTLfootnotetext\@undefined
\AtEndOfPackage{%
\EnableBabelHook{babel-bidi}%
- \ifx\fontspec\@undefined
- \bbl@loadfontspec % bidi needs fontspec
- \fi
+ \bbl@loadfontspec % bidi needs fontspec
\usepackage#1{bidi}}%
\fi}
\ifnum\bbl@bidimode>200
@@ -12940,24 +12925,17 @@ help from Bernd Raichle, for which I am grateful.
%<<*Font selection>>
\bbl@trace{Font handling with fontspec}
\ifx\ExplSyntaxOn\@undefined\else
- \ExplSyntaxOn
- \catcode`\ =10
+ \def\bbl@fs@warn@nx#1#2{% \bbl@tempfs is the original macro
+ \in@{,#1,}{,no-script,language-not-exist,}%
+ \ifin@\else\bbl@tempfs@nx{#1}{#2}\fi}
+ \def\bbl@fs@warn@nxx#1#2#3{%
+ \in@{,#1,}{,no-script,language-not-exist,}%
+ \ifin@\else\bbl@tempfs@nxx{#1}{#2}{#3}\fi}
\def\bbl@loadfontspec{%
- \usepackage{fontspec}% TODO. Apply patch always
- \expandafter
- \def\csname msg~text~>~fontspec/language-not-exist\endcsname##1##2##3##4{%
- Font '\l_fontspec_fontname_tl' is using the\\%
- default features for language '##1'.\\%
- That's usually fine, because many languages\\%
- require no specific features, but if the output is\\%
- not as expected, consider selecting another font.}
- \expandafter
- \def\csname msg~text~>~fontspec/no-script\endcsname##1##2##3##4{%
- Font '\l_fontspec_fontname_tl' is using the\\%
- default features for script '##2'.\\%
- That's not always wrong, but if the output is\\%
- not as expected, consider selecting another font.}}
- \ExplSyntaxOff
+ \let\bbl@loadfontspec\relax
+ \ifx\fontspec\@undefined
+ \usepackage{fontspec}%
+ \fi}%
\fi
\@onlypreamble\babelfont
\newcommand\babelfont[2][]{% 1=langs/scripts 2=fam
@@ -12969,9 +12947,7 @@ help from Bernd Raichle, for which I am grateful.
\fi}%
\edef\bbl@tempa{#1}%
\def\bbl@tempb{#2}% Used by \bbl@bblfont
- \ifx\fontspec\@undefined
- \bbl@loadfontspec
- \fi
+ \bbl@loadfontspec
\EnableBabelHook{babel-fontspec}% Just calls \bbl@switchfont
\bbl@bblfont}
\newcommand\bbl@bblfont[2][]{% 1=features 2=fontname, @font=rm|sf|tt
@@ -13126,8 +13102,15 @@ help from Bernd Raichle, for which I am grateful.
{\\\newfontscript{\bbl@cl{sname}}{\bbl@cl{sotf}}}%
\<keys_if_exist:nnF>{fontspec-opentype}{Language/\bbl@cl{lname}}%
{\\\newfontlanguage{\bbl@cl{lname}}{\bbl@cl{lotf}}}%
+ \let\\\bbl@tempfs@nx\<__fontspec_warning:nx>%
+ \let\<__fontspec_warning:nx>\\\bbl@fs@warn@nx
+ \let\\\bbl@tempfs@nxx\<__fontspec_warning:nxx>%
+ \let\<__fontspec_warning:nxx>\\\bbl@fs@warn@nxx
\\\renewfontfamily\\#4%
[\bbl@cl{lsys},#2]}{#3}% ie \bbl@exp{..}{#3}
+ \bbl@exp{%
+ \let\<__fontspec_warning:nx>\\\bbl@tempfs@nx
+ \let\<__fontspec_warning:nxx>\\\bbl@tempfs@nxx}%
\begingroup
#4%
\xdef#1{\f@family}% eg, \bbl@rmdflt@lang{FreeSerif(0)}
@@ -14378,6 +14361,11 @@ function Babel.locale_map(head)
(item.char >= 0x1DC0 and item.char <= 0x1DFF) then
toloc = toloc_save
end
+ if toloc and Babel.locale_props[toloc] and
+ Babel.locale_props[toloc].letters and
+ tex.getcatcode(item.char) \string~= 11 then
+ toloc = nil
+ end
if toloc and toloc > -1 then
if Babel.locale_props[toloc].lg then
item.lang = Babel.locale_props[toloc].lg
@@ -14388,7 +14376,7 @@ function Babel.locale_map(head)
end
toloc_save = toloc
end
- elseif not inmath and item.id == 7 then
+ elseif not inmath and item.id == 7 then % Apply recursively
item.replace = item.replace and Babel.locale_map(item.replace)
item.pre = item.pre and Babel.locale_map(item.pre)
item.post = item.post and Babel.locale_map(item.post)
@@ -14486,10 +14474,11 @@ end
\@ifnextchar[{\bbl@settransform{0}}{\bbl@settransform{0}[]}}
\gdef\babelposthyphenation{&%
\@ifnextchar[{\bbl@settransform{1}}{\bbl@settransform{1}[]}}
+\gdef\bbl@postlinebreak{\bbl@settransform{2}[]} &% WIP
\gdef\bbl@settransform#1[#2]#3#4#5{&%
\ifcase#1
\bbl@activateprehyphen
- \else
+ \or
\bbl@activateposthyphen
\fi
\begingroup
@@ -14505,7 +14494,7 @@ end
rep = rep:gsub('^%s*(remove)%s*$', 'remove = true')
rep = rep:gsub('^%s*(insert)%s*,', 'insert = true, ')
rep = rep:gsub('(string)%s*=%s*([^%s,]*)', Babel.capture_func)
- if #1 == 0 then
+ if #1 == 0 or #1 == 2 then
rep = rep:gsub('(space)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)',
'space = {' .. '%2, %3, %4' .. '}')
rep = rep:gsub('(spacefactor)%s*=%s*([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)',
@@ -14518,6 +14507,16 @@ end
end
tex.print([[\string\babeltempa{{]] .. rep .. [[}}]])
}}}&%
+ \bbl@foreach\babeltempb{&%
+ \bbl@forkv{{##1}}{&%
+ \in@{,####1,}{,nil,step,data,remove,insert,string,no,pre,&%
+ no,post,penalty,kashida,space,spacefactor,}&%
+ \ifin@\else
+ \bbl@error
+ {Bad option '####1' in a transform.\\&%
+ I’ll ignore it but expect more errors}&%
+ {See the manual for further info.}&%
+ \fi}}&%
\let\bbl@kv@attribute\relax
\let\bbl@kv@label\relax
\bbl@forkv{#2}{\bbl@csarg\edef{kv@##1}{##2}}&%
@@ -14528,7 +14527,7 @@ end
local lbkr = Babel.linebreaking.replacements[#1]
local u = unicode.utf8
local id, attr, label
- if #1 == 0 then
+ if #1 == 0 or #1 == 2 then
id = \the\csname bbl@id@@#3\endcsname\space
else
id = \the\csname l@#3\endcsname\space
@@ -14543,7 +14542,7 @@ end
\fi
&% Convert pattern:
local patt = string.gsub([==[#4]==], '%s', '')
- if #1 == 0 then
+ if #1 == 0 or #1 == 2 then
patt = string.gsub(patt, '|', ' ')
end
if not u.find(patt, '()', nil, true) then
@@ -15078,8 +15077,9 @@ end
% \begin{macrocode}
%<*transforms>
Babel.linebreaking.replacements = {}
-Babel.linebreaking.replacements[0] = {} -- pre
+Babel.linebreaking.replacements[0] = {} -- pre
Babel.linebreaking.replacements[1] = {} -- post
+Babel.linebreaking.replacements[2] = {} -- post-line WIP
-- Discretionaries contain strings as nodes
function Babel.str_to_nodes(fn, matches, base)
@@ -15231,6 +15231,7 @@ Babel.us_char = string.char(31)
function Babel.hyphenate_replace(head, mode)
local u = unicode.utf8
local lbkr = Babel.linebreaking.replacements[mode]
+ if mode == 2 then mode = 0 end -- WIP
local word_head = head
diff --git a/macros/latex/required/babel/base/babel.ins b/macros/latex/required/babel/base/babel.ins
index 767fe23eb1..a40cfd79f3 100644
--- a/macros/latex/required/babel/base/babel.ins
+++ b/macros/latex/required/babel/base/babel.ins
@@ -26,7 +26,7 @@
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%%
-\def\filedate{2022/09/17}
+\def\filedate{2022/10/04}
\def\batchfile{babel.ins}
\input docstrip.tex
diff --git a/macros/latex/required/babel/base/babel.pdf b/macros/latex/required/babel/base/babel.pdf
index 6741e73fcc..c667f527ac 100644
--- a/macros/latex/required/babel/base/babel.pdf
+++ b/macros/latex/required/babel/base/babel.pdf
Binary files differ
diff --git a/macros/latex/required/babel/base/bbcompat.dtx b/macros/latex/required/babel/base/bbcompat.dtx
index 53b5f46b8e..0bc850a585 100644
--- a/macros/latex/required/babel/base/bbcompat.dtx
+++ b/macros/latex/required/babel/base/bbcompat.dtx
@@ -30,7 +30,7 @@
%
% \iffalse
%<*dtx>
-\ProvidesFile{bbcompat.dtx}[2022/09/17 v3.80]
+\ProvidesFile{bbcompat.dtx}[2022/10/04 v3.81]
%</dtx>
%
%% File 'bbcompat.dtx'