summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
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 /Master/texmf-dist/tex/latex
parent3dc720cc4ed5d94ed2a9bbfbec06eeb9848e7cbf (diff)
eolang (10feb23)
git-svn-id: svn://tug.org/texlive/trunk@65778 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/eolang/eolang.sty46
1 files changed, 30 insertions, 16 deletions
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 . '}';