summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-02-10 21:55:16 +0000
committerKarl Berry <karl@freefriends.org>2023-02-10 21:55:16 +0000
commit035e9f17d3b9c02d58e74591d59c7539a7fbafc2 (patch)
tree80c3dcb906c498ccbeb80a0af2a556d6357e73e7
parent3dc720cc4ed5d94ed2a9bbfbec06eeb9848e7cbf (diff)
eolang (10feb23)
git-svn-id: svn://tug.org/texlive/trunk@65778 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/eolang/eolang.pdfbin2015121 -> 2063516 bytes
-rw-r--r--Master/texmf-dist/source/latex/eolang/eolang.dtx77
-rw-r--r--Master/texmf-dist/tex/latex/eolang/eolang.sty46
3 files changed, 84 insertions, 39 deletions
diff --git a/Master/texmf-dist/doc/latex/eolang/eolang.pdf b/Master/texmf-dist/doc/latex/eolang/eolang.pdf
index a09b3b17cda..28e6bdeb340 100644
--- a/Master/texmf-dist/doc/latex/eolang/eolang.pdf
+++ b/Master/texmf-dist/doc/latex/eolang/eolang.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/eolang/eolang.dtx b/Master/texmf-dist/source/latex/eolang/eolang.dtx
index daca8ee56f1..6ad8663b55e 100644
--- a/Master/texmf-dist/source/latex/eolang/eolang.dtx
+++ b/Master/texmf-dist/source/latex/eolang/eolang.dtx
@@ -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 @@ foreach my $t (@lines) {
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 @@ if (index($tex, '&&') >= 0) {
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 @@ sub trep {
return '{TEXT' . (0+@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]+|\*)\/(\\?[a-z]+|\|[a-z]+\|)
$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 @@ if ($macro eq 'phiq') {
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 @@ if ($macro eq 'phiq') {
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,12 +983,14 @@ print '\endinput';
\setcounter{FancyVerbLine}{\value{eolang@lineno}}%
\def\eolang@phiSaveTo{\relax}%
}
+%
\newenvironment{phiquation*}%
{\catcode`\|=12 \VerbatimEnvironment%
\setcounter{eolang@lineno}{\value{FancyVerbLine}}%
\begin{VerbatimOut}
{\eolang@tmpdir/\jobname/phiquation.tex}}
{\end{VerbatimOut}\eolang@process{equation*}}
+%
\newenvironment{phiquation}%
{\catcode`\|=12 \VerbatimEnvironment%
\setcounter{eolang@lineno}{\value{FancyVerbLine}}%
diff --git a/Master/texmf-dist/tex/latex/eolang/eolang.sty b/Master/texmf-dist/tex/latex/eolang/eolang.sty
index 2cb960e690a..dde0846d3fd 100644
--- a/Master/texmf-dist/tex/latex/eolang/eolang.sty
+++ b/Master/texmf-dist/tex/latex/eolang/eolang.sty
@@ -31,7 +31,8 @@
\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]
+
@@ -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,10 +126,19 @@ foreach my $t (@lines) {
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 @@ if (index($tex, '&&') >= 0) {
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 @@ sub trep {
return '{TEXT' . (0+@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]+|\*)\/(\\?[a-z]+|\|[a-z]+\|)
$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 @@ if ($macro eq 'phiq') {
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 @@ if ($macro eq 'phiq') {
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 . '}';