texlive[65778] Master/texmf-dist: eolang (10feb23)
commits+karl at tug.org
commits+karl at tug.org
Fri Feb 10 22:55:16 CET 2023
Revision: 65778
http://tug.org/svn/texlive?view=revision&revision=65778
Author: karl
Date: 2023-02-10 22:55:16 +0100 (Fri, 10 Feb 2023)
Log Message:
-----------
eolang (10feb23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/eolang/eolang.pdf
trunk/Master/texmf-dist/source/latex/eolang/eolang.dtx
trunk/Master/texmf-dist/tex/latex/eolang/eolang.sty
Modified: trunk/Master/texmf-dist/doc/latex/eolang/eolang.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/eolang/eolang.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/eolang/eolang.dtx 2023-02-10 21:54:31 UTC (rev 65777)
+++ trunk/Master/texmf-dist/source/latex/eolang/eolang.dtx 2023-02-10 21:55:16 UTC (rev 65778)
@@ -50,7 +50,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{eolang}
%<*package>
-[2023-02-07 0.11.1 Formulas and Graphs for EO Programming Language]
+[2023-02-09 0.12.0 Formulas and Graphs for EO Programming Language]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -585,6 +585,22 @@
% \end{document}
% \end{docshot}
+% It is possible to use ``manual splitting'' mode in the |phiquation| environment by starting the body with |\begin{split}|:
+% \docshotOptions{firstline=5,lastline=10}
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage{eolang}
+% \thispagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% \begin{split}
+% x(\pi) & -> 4 \\
+% x(a,b,c) & -> [[ \alpha_0 -> ? ]] \\
+% \end{split}
+% \end{phiquation*}
+% \end{document}
+% \end{docshot}
+
% You can make a copy of a vertex together with its kids:
% \docshotOptions{firstline=5,lastline=15}
% \begin{docshot}
@@ -767,7 +783,7 @@
$macro = $ARGV[0];
open(my $fh, '<', $ARGV[1]);
my $tex; { local $/; $tex = <$fh>; }
-print "% This file is auto-generated by 0.11.1\n";
+print "% This file is auto-generated by 0.12.0\n";
print '% There are ', length($tex),
' chars in the input: ', $ARGV[1], "\n";
print '% ---', "\n";
@@ -782,10 +798,19 @@
print '% ---', "\n";
$tex =~ s/%.*\n/\n/g;
$tex =~ s/^\s+|\s+$//g;
+my $splitting = $tex =~ /^\\begin\{split\}/;
+if ($splitting) {
+ print '% The manual splitting mode is ON since \begin{split} started the text' . "\n";
+}
my $indents = $tex =~ /\n +/g;
my $gathered = (0 == $indents);
if ($gathered) {
- print '% The "gathered" is used since all lines are left-aligned' . "\n";
+ if ($splitting) {
+ print '% The "gathered" is NOT used because of manual splitting' . "\n";
+ $gathered = 0;
+ } else {
+ print '% The "gathered" is used since all lines are left-aligned' . "\n";
+ }
} else {
print '% The "gathered" is NOT used because ' .
$indents . " lines are indented\n";
@@ -798,8 +823,10 @@
print '% The "align" is used because of && seen in the text' . "\n";
}
if ($macro ne 'phiq') {
- $tex =~ s/\\\\\n/\n\n/g;
- $tex =~ s/\\\n\s*//g;
+ if (not $splitting) {
+ $tex =~ s/\\\\\n/\n\n/g;
+ $tex =~ s/\\\n\s*//g;
+ }
$tex =~ s/\n*(\\label\{[^\}]+\})\n*/\1/g;
$tex =~ s/\n{3,}/\n\n/g;
}
@@ -824,7 +851,9 @@
return '{TEXT' . (0+ at texts - 1) . '}' . substr($s, $p + 1);
}
$tex =~ s/\\text\{(.+)/trep("$1")/ge;
-$tex =~ s/(?<![{&])&(?![&}])/\\sigma{}/g;
+if (not $splitting) {
+ $tex =~ s/(?<![{&])&(?![&}])/\\sigma{}/g;
+}
$tex =~ s/([^\\{a-z0-9]|^)Q(?![a-z0-9])/\1\\Phi{}/g;
$tex =~ s/([^\\{a-z0-9]|^)D>/\1\\Delta{}..>/g;
$tex =~ s/([^\\{a-z0-9]|^)L>/\1\\lambda{}..>/g;
@@ -835,15 +864,17 @@
$tex =~ s/([^^_]|^)([0-9]+|\*)
(->|\.\.>|~>|:=|!->)/\1\\alpha_{\2}\\space{}\3/xg;
if ($macro ne 'phiq') {
- $tex =~ s/\\begin\{split\}\n/\\begin{split}&/g;
- $tex =~ s/\n\s*\\end\{split\}/\\end{split}/g;
- $tex =~ s/\n\n/\\\\&/g;
- $tex =~ s/\n/\\phiEOL{}\n&/g;
- $tex =~ s/\\\\$//g;
- $tex =~ s/\\\\/\\\\\n/g;
- $tex =~ s/([^&\s])\s{2}([^\s])/\1 \2/g;
- $tex =~ s/\s{2}/ \\quad{}/g;
- $tex = '&' . $tex;
+ if (not $splitting) {
+ $tex =~ s/\\begin\{split\}\n/\\begin{split}&/g;
+ $tex =~ s/\n\s*\\end\{split\}/\\end{split}/g;
+ $tex =~ s/\n\n/\\\\&/g;
+ $tex =~ s/\n/\\phiEOL{}\n&/g;
+ $tex =~ s/\\\\$//g;
+ $tex =~ s/\\\\/\\\\\n/g;
+ $tex =~ s/([^&\s])\s{2}([^\s])/\1 \2/g;
+ $tex =~ s/\s{2}/ \\quad{}/g;
+ $tex = '&' . $tex;
+ }
my $lead = '[^\s]+\s(?:->|:=|=|==)\s';
my @leads = $tex =~ /&${lead}/g;
my @eols = $tex =~ /&/g;
@@ -892,11 +923,10 @@
print '\begin{', $macro, "}\n";
if (not($align)) {
if ($gathered) {
- print '\begin{gathered}';
- } else {
- print '\begin{split}';
+ print '\begin{gathered}' . "\n";
+ } elsif (not $splitting) {
+ print '\begin{split}' . "\n";
}
- print "\n";
}
}
if ($gathered and not($align)) {
@@ -908,11 +938,10 @@
print '$' if ($tex ne '');
} else {
if (not($align)) {
- print "\n";
if ($gathered) {
- print '\end{gathered}';
- } else {
- print '\end{split}';
+ print "\n" . '\end{gathered}';
+ } elsif (not $splitting) {
+ print "\n" . '\end{split}';
}
}
print "\n" . '\end{' . $macro . '}';
@@ -954,6 +983,7 @@
\setcounter{FancyVerbLine}{\value{eolang at lineno}}%
\def\eolang at phiSaveTo{\relax}%
}
+%
\newenvironment{phiquation*}%
{\catcode`\|=12 \VerbatimEnvironment%
\setcounter{eolang at lineno}{\value{FancyVerbLine}}%
@@ -960,6 +990,7 @@
\begin{VerbatimOut}
{\eolang at tmpdir/\jobname/phiquation.tex}}
{\end{VerbatimOut}\eolang at process{equation*}}
+%
\newenvironment{phiquation}%
{\catcode`\|=12 \VerbatimEnvironment%
\setcounter{eolang at lineno}{\value{FancyVerbLine}}%
Modified: trunk/Master/texmf-dist/tex/latex/eolang/eolang.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/eolang/eolang.sty 2023-02-10 21:54:31 UTC (rev 65777)
+++ trunk/Master/texmf-dist/tex/latex/eolang/eolang.sty 2023-02-10 21:55:16 UTC (rev 65778)
@@ -31,7 +31,7 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{eolang}
-[2023-02-07 0.11.1 Formulas and Graphs for EO Programming Language]
+[2023-02-09 0.12.0 Formulas and Graphs for EO Programming Language]
@@ -77,6 +77,7 @@
+
\RequirePackage{stmaryrd}
\RequirePackage{amsmath}
\let\Bbbk\relax\RequirePackage{amssymb}
@@ -110,7 +111,7 @@
$macro = $ARGV[0];
open(my $fh, '<', $ARGV[1]);
my $tex; { local $/; $tex = <$fh>; }
-print "% This file is auto-generated by 0.11.1\n";
+print "% This file is auto-generated by 0.12.0\n";
print '% There are ', length($tex),
' chars in the input: ', $ARGV[1], "\n";
print '% ---', "\n";
@@ -125,11 +126,20 @@
print '% ---', "\n";
$tex =~ s/%.*\n/\n/g;
$tex =~ s/^\s+|\s+$//g;
+my $splitting = $tex =~ /^\\begin\{split\}/;
+if ($splitting) {
+print '% The manual splitting mode is ON since \begin{split} started the text' . "\n";
+}
my $indents = $tex =~ /\n +/g;
my $gathered = (0 == $indents);
if ($gathered) {
-print '% The "gathered" is used since all lines are left-aligned' . "\n";
+ if ($splitting) {
+ print '% The "gathered" is NOT used because of manual splitting' . "\n";
+ $gathered = 0;
} else {
+ print '% The "gathered" is used since all lines are left-aligned' . "\n";
+}
+} else {
print '% The "gathered" is NOT used because ' .
$indents . " lines are indented\n";
}
@@ -141,8 +151,10 @@
print '% The "align" is used because of && seen in the text' . "\n";
}
if ($macro ne 'phiq') {
- $tex =~ s/\\\\\n/\n\n/g;
+if (not $splitting) {
+ $tex =~ s/\\\\\n/\n\n/g;
$tex =~ s/\\\n\s*//g;
+}
$tex =~ s/\n*(\\label\{[^\}]+\})\n*/\1/g;
$tex =~ s/\n{3,}/\n\n/g;
}
@@ -167,7 +179,9 @@
return '{TEXT' . (0+ at texts - 1) . '}' . substr($s, $p + 1);
}
$tex =~ s/\\text\{(.+)/trep("$1")/ge;
+if (not $splitting) {
$tex =~ s/(?<![{&])&(?![&}])/\\sigma{}/g;
+}
$tex =~ s/([^\\{a-z0-9]|^)Q(?![a-z0-9])/\1\\Phi{}/g;
$tex =~ s/([^\\{a-z0-9]|^)D>/\1\\Delta{}..>/g;
$tex =~ s/([^\\{a-z0-9]|^)L>/\1\\lambda{}..>/g;
@@ -178,15 +192,17 @@
$tex =~ s/([^^_]|^)([0-9]+|\*)
(->|\.\.>|~>|:=|!->)/\1\\alpha_{\2}\\space{}\3/xg;
if ($macro ne 'phiq') {
+ if (not $splitting) {
$tex =~ s/\\begin\{split\}\n/\\begin{split}&/g;
- $tex =~ s/\n\s*\\end\{split\}/\\end{split}/g;
- $tex =~ s/\n\n/\\\\&/g;
+ $tex =~ s/\n\s*\\end\{split\}/\\end{split}/g;
+ $tex =~ s/\n\n/\\\\&/g;
$tex =~ s/\n/\\phiEOL{}\n&/g;
$tex =~ s/\\\\$//g;
$tex =~ s/\\\\/\\\\\n/g;
- $tex =~ s/([^&\s])\s{2}([^\s])/\1 \2/g;
+ $tex =~ s/([^&\s])\s{2}([^\s])/\1 \2/g;
$tex =~ s/\s{2}/ \\quad{}/g;
- $tex = '&' . $tex;
+ $tex = '&' . $tex;
+ }
my $lead = '[^\s]+\s(?:->|:=|=|==)\s';
my @leads = $tex =~ /&${lead}/g;
my @eols = $tex =~ /&/g;
@@ -235,11 +251,10 @@
print '\begin{', $macro, "}\n";
if (not($align)) {
if ($gathered) {
- print '\begin{gathered}';
- } else {
- print '\begin{split}';
+ print '\begin{gathered}' . "\n";
+ } elsif (not $splitting) {
+ print '\begin{split}' . "\n";
}
- print "\n";
}
}
if ($gathered and not($align)) {
@@ -251,11 +266,10 @@
print '$' if ($tex ne '');
} else {
if (not($align)) {
- print "\n";
if ($gathered) {
- print '\end{gathered}';
- } else {
- print '\end{split}';
+ print "\n" . '\end{gathered}';
+ } elsif (not $splitting) {
+ print "\n" . '\end{split}';
}
}
print "\n" . '\end{' . $macro . '}';
More information about the tex-live-commits
mailing list.