diff options
author | Norbert Preining <norbert@preining.info> | 2022-10-05 03:01:34 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-10-05 03:01:34 +0000 |
commit | 6925a15396a955498e1d1663204e7fa7da3d1728 (patch) | |
tree | 925ce3e30472ef82315230ec2772e2e104642541 /macros/latex/contrib | |
parent | 30b3429f0e138c93c5f1ba1d1a6d46728c0943e9 (diff) |
CTAN sync 202210050301
Diffstat (limited to 'macros/latex/contrib')
-rw-r--r-- | macros/latex/contrib/semantex/semantex.pdf | bin | 397503 -> 397454 bytes | |||
-rw-r--r-- | macros/latex/contrib/semantex/semantex.sty | 72 | ||||
-rw-r--r-- | macros/latex/contrib/semantex/semantex.tex | 64 | ||||
-rw-r--r-- | macros/latex/contrib/semantex/stripsemantex.lua | 620 | ||||
-rw-r--r-- | macros/latex/contrib/semantex/stripsemantex.sty | 2 | ||||
-rw-r--r-- | macros/latex/contrib/siunitx/CHANGELOG.md | 9 | ||||
-rw-r--r-- | macros/latex/contrib/siunitx/siunitx-code.pdf | bin | 617808 -> 617674 bytes | |||
-rw-r--r-- | macros/latex/contrib/siunitx/siunitx-number.dtx | 40 | ||||
-rw-r--r-- | macros/latex/contrib/siunitx/siunitx.dtx | 2 | ||||
-rw-r--r-- | macros/latex/contrib/siunitx/siunitx.pdf | bin | 665418 -> 665420 bytes | |||
-rw-r--r-- | macros/latex/contrib/upmethodology/src/UPMVERSION.def | 2 | ||||
-rw-r--r-- | macros/latex/contrib/upmethodology/src/upmethodology-document.cls | 2 | ||||
-rw-r--r-- | macros/latex/contrib/upmethodology/src/upmethodology-fmt.sty | 32 |
13 files changed, 448 insertions, 397 deletions
diff --git a/macros/latex/contrib/semantex/semantex.pdf b/macros/latex/contrib/semantex/semantex.pdf Binary files differindex 4e50ebe1d4..64e0bae6cf 100644 --- a/macros/latex/contrib/semantex/semantex.pdf +++ b/macros/latex/contrib/semantex/semantex.pdf 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 Binary files differindex c9dcdaecda..cf6bc8c78c 100644 --- a/macros/latex/contrib/siunitx/siunitx-code.pdf +++ b/macros/latex/contrib/siunitx/siunitx-code.pdf diff --git a/macros/latex/contrib/siunitx/siunitx-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 Binary files differindex 4954530a97..15032f9957 100644 --- a/macros/latex/contrib/siunitx/siunitx.pdf +++ b/macros/latex/contrib/siunitx/siunitx.pdf 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 %---------------------------------------- |