texlive[56304] Master/texmf-dist: semantex (9sep20)

commits+karl at tug.org commits+karl at tug.org
Wed Sep 9 22:57:08 CEST 2020


Revision: 56304
          http://tug.org/svn/texlive?view=revision&revision=56304
Author:   karl
Date:     2020-09-09 22:57:07 +0200 (Wed, 09 Sep 2020)
Log Message:
-----------
semantex (9sep20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/semantex/semantex.pdf
    trunk/Master/texmf-dist/doc/latex/semantex/semantex.tex
    trunk/Master/texmf-dist/tex/latex/semantex/semantex.sty
    trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.lua
    trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/latex/semantex/semtex.sty

Modified: trunk/Master/texmf-dist/doc/latex/semantex/semantex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/semantex/semantex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/semantex/semantex.tex	2020-09-09 20:56:27 UTC (rev 56303)
+++ trunk/Master/texmf-dist/doc/latex/semantex/semantex.tex	2020-09-09 20:57:07 UTC (rev 56304)
@@ -38,7 +38,7 @@
 	
 \usepackage[nameinlink]{cleveref}
 
-\title{Seman\!\TeX: semantic, keyval-based mathematics (v$0.4\beta$)}
+\title{Seman\!\TeX: semantic, keyval-based mathematics (v$0.41\beta$)}
 \date{\today}
 \author{Sebastian Ørsted (\href{mailto:sorsted at gmail.com}{sorsted at gmail.com})}
 
@@ -3302,7 +3302,7 @@
 	\item
 	\mylst!intclear={$\<integer\>$}!
 	
-	Clears the \<integer\>.
+	Clears the \<integer\>, i.e.~sets it to~\( 0 \).
 	
 	\item
 	\mylst!ifblankTF={$\<tokens\>$}{$\<if true\>$}{$\<if false\>$}!,\\
@@ -5228,7 +5228,7 @@
 
 \section{The programming commands}\label{sec:programming_commands}
 
-The following commands are available for programming inside \lstinline!execute={...}!:
+The following commands are available for programming inside keys, including \lstinline!execute={...}!:
 
 \begin{itemize}
 	\item
@@ -5435,7 +5435,7 @@
 	\item
 	\mylst!\SemantexIntClear{$\<integer\>$}!
 		
-	Clears the \<integer\>.
+	Clears the \<integer\>, i.e.~sets it to~\( 0 \).
 
 	\item
 	\mylst!\SemantexIfBlankTF{$\<tokens\>$}{$\<if true\>$}{$\<if false\>$}!,\\

Modified: trunk/Master/texmf-dist/tex/latex/semantex/semantex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/semantex/semantex.sty	2020-09-09 20:56:27 UTC (rev 56303)
+++ trunk/Master/texmf-dist/tex/latex/semantex/semantex.sty	2020-09-09 20:57:07 UTC (rev 56304)
@@ -1,5 +1,5 @@
 \RequirePackage{xparse,l3keys2e,semtex,leftindex}
-\ProvidesExplPackage{semantex}{2020/09/07}{0.4beta}{}
+\ProvidesExplPackage{semantex}{2020/09/08}{0.41beta}{}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %															%

Added: trunk/Master/texmf-dist/tex/latex/semantex/semtex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/semantex/semtex.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/semantex/semtex.sty	2020-09-09 20:57:07 UTC (rev 56304)
@@ -0,0 +1,83 @@
+\RequirePackage{xparse}
+\ProvidesExplPackage{semtex}{2020/07/29}{0.1beta}{}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%																%
+%		semtex -- for documents stripped of SemanTeX markup		%
+%		https://ctan.org/pkg/semantex							%
+%		(C) 2020 Sebastian Ørsted								%
+%       sorsted at gmail.com										%
+%																%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Bullets:
+
+\box_new:N \g__semantex_bullet_box
+\hbox_set:Nn \g__semantex_bullet_box { $\cdot$ }
+\box_scale:Nnn \g__semantex_bullet_box {1.2} {1.2}
+\tl_set:Nn\g_semantex_bullet
+{
+	\box_move_up:nn{-0.25ex}{\box_use:N \g__semantex_bullet_box}
+}
+
+\tl_set:Nn\g_semantex_double_bullet{\g_semantex_bullet \g_semantex_bullet}
+
+\tl_set_eq:NN\SemantexBullet \g_semantex_bullet
+
+\tl_set_eq:NN \SemantexDoubleBullet \g_semantex_double_bullet
+
+
+% Parentheses:
+
+\cs_new:Npn\SemantexLeft { \mathopen{}\mathclose\bgroup\left }
+
+\cs_new:Npn\SemantexRight { \aftergroup\egroup\right }
+
+\tl_new:N\SemantexDelimiterSize
+
+\DeclareDocumentCommand\SemantexParentheses { mmmm }
+{
+	\str_case:nnF { #1 } % This is where \big,\Big, etc. go.
+	{
+		{ normal } {
+			\group_begin:
+			\tl_clear:N \SemantexDelimiterSize
+			\str_if_eq:nnF { #2 } { . } { \mathopen #2 }
+			#4
+			\str_if_eq:nnF { #3 } { . } { \mathclose #3 }
+			\group_end:
+		}
+		{ auto } {
+			\group_begin:
+			\tl_set_eq:NN \SemantexDelimiterSize \middle
+			\SemantexLeft #2
+			#4
+			\SemantexRight #3
+			\group_end:
+		}
+		{ * } {
+			\group_begin:
+			\tl_set_eq:NN \SemantexDelimiterSize \middle
+			\SemantexLeft #2
+			#4
+			\SemantexRight #3
+			\group_end:
+		}
+	}
+	{
+		\group_begin:
+		\tl_set_eq:NN\SemantexDelimiterSize #1
+		\mathopen #1 #2
+		#4
+		\mathclose #1 #3
+		\group_end:
+	}
+}
+
+\DeclareDocumentCommand\SemantexNoParentheses { m }
+{
+	\group_begin:
+	\tl_clear:N\SemantexDelimiterSize
+	#1
+	\group_end:
+}
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/semantex/semtex.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.lua
===================================================================
--- trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.lua	2020-09-09 20:56:27 UTC (rev 56303)
+++ trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.lua	2020-09-09 20:57:07 UTC (rev 56304)
@@ -55,7 +55,12 @@
 
 addIDsToRegisters = function(str)
 	str = removeStricttexFormatting(str)
-	content = content:gsub('\\' .. str .. '%f[^%a]' ,'\\SemantexIDcommand{}\\' .. str)
+	content = content:gsub('\\' .. str .. '([^%a])' ,'\\SemantexIDcommand{}\\' .. str .. '%1')
+	-- '%f[^%a]' does not work here, as it will not react if the last character of str is a number,
+	-- which stricttex allows.
+	-- Because of this choice, there will be an issue if you use stricttex and let
+	-- \<command> by a SemanTeX command and \<command>' be a non-SemanTeX command.
+	-- So simply *don't do that*.
 end
 
 removeSuperfluousIDs = function()
@@ -106,7 +111,7 @@
 				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)
+				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
@@ -123,9 +128,38 @@
 						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 a %, 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  .. [[ }

Modified: trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty	2020-09-09 20:56:27 UTC (rev 56303)
+++ trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty	2020-09-09 20:57:07 UTC (rev 56304)
@@ -1,4 +1,5 @@
-\ProvidesExplPackage{stripsemantex}{2020/09/07}{0.1alpha}{}
+\RequirePackage{xparse}
+\ProvidesExplPackage{stripsemantex}{2020/09/05}{0.1alpha}{}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %																		%
@@ -66,8 +67,17 @@
 		openFile('\lua_escape:e{#1}_stripped.tex')
 	}
 	
-	\cs_set:Npn\SemantexID##1\BeginSource##2\EndSource\BeginOutput##3\EndOutput
+	\DeclareDocumentCommand\SemantexID{ m t{\BeginSource} }
 	{
+		\IfBooleanT{##2}
+		{
+			\strip_semantex_id_command:w ##1 \BeginSource
+		}
+	}
+	
+	
+	\cs_set:Npn\strip_semantex_id_command:w##1\BeginSource##2\EndSource\BeginOutput##3\EndOutput
+	{
 		\lua_now:e
 		{
 			semantexIDluacommand( '\lua_escape:e{\tl_trim_spaces:n{##1}}' , '\lua_escape:e{\exp_not:n{##2}}' , '\lua_escape:e{\exp_not:n{##3}}' )



More information about the tex-live-commits mailing list.