summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-12-15 20:44:04 +0000
committerKarl Berry <karl@freefriends.org>2022-12-15 20:44:04 +0000
commitc1ceb558d158d5b660f1eb80551f76c940e990e1 (patch)
tree0b24bc5a8202b4ee7d76ee50297f99668b49d949
parentdba18a2875d3fdeecf85f1f3b3b5e679267d36f6 (diff)
eolang (15dec22)
git-svn-id: svn://tug.org/texlive/trunk@65281 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/eolang/README.md2
-rw-r--r--Master/texmf-dist/doc/latex/eolang/eolang.pdfbin1869634 -> 2003793 bytes
-rw-r--r--Master/texmf-dist/source/latex/eolang/eolang.dtx94
-rw-r--r--Master/texmf-dist/tex/latex/eolang/eolang.sty47
4 files changed, 110 insertions, 33 deletions
diff --git a/Master/texmf-dist/doc/latex/eolang/README.md b/Master/texmf-dist/doc/latex/eolang/README.md
index 43774079bc0..27d09c503e9 100644
--- a/Master/texmf-dist/doc/latex/eolang/README.md
+++ b/Master/texmf-dist/doc/latex/eolang/README.md
@@ -3,7 +3,7 @@
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/objectionary/eolang.sty/blob/master/LICENSE.txt)
This LaTeX package helps you write 𝜑-calculus formulas and
-[SODG](https://github.com/objectionary/sodg) graphs
+draw [SODG](https://github.com/objectionary/sodg) graphs
for [EO](https://www.eolang.org) programming language.
First, [install it](https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages)
diff --git a/Master/texmf-dist/doc/latex/eolang/eolang.pdf b/Master/texmf-dist/doc/latex/eolang/eolang.pdf
index 87a430837ea..4c9353b41c1 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 402bcd4b8f8..e553bd8c9f0 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>
-[2022-11-29 0.8.0 Formulas and Graphs for EO Programming Language]
+[2022-12-15 0.9.0 Formulas and Graphs for EO Programming Language]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -148,6 +148,10 @@
% \end{itemize}
% Also, a few symbols are supported for $\varphi$PU architecture:
% \begin{itemize}\setlength\itemsep{0em}
+% \item ``|<<|'' maps to ``$\langle$''
+% (|\langle|),
+% \item ``|>>|'' maps to ``$\rangle$''
+% (|\rangle|),
% \item ``|-abc>|'' maps to ``$\phiSlot{abc}$''
% (|\phiSlot{abc}|),
% \item ``|:=|'' maps to ``$\vDash$''
@@ -365,6 +369,9 @@
% \end{document}
% \end{docshot}
+% \DescribeMacro{\eoAnon}
+% You may want to hide some of the content with the help of the |anonymous| package option. The command |\eoAnon| may help you with this. It has two parameters: one mandatory and one optional. The mandatory one is the content you want to show and the optional one is the substituion we will render if the |anonymous| package option is set.
+
% \section{Package Options}
% \DescribeMacro{tmpdir}
@@ -392,7 +399,7 @@
%\fi
% \DescribeMacro{anonymous}
-% You may anonymize |\eolang|, |\XMIR|, and |\phic| commands by using |anonymous| package option:
+% You may anonymize |\eolang|, |\XMIR|, and |\phic| commands by using |anonymous| package option (they all use the |\eoAnon| command mentioned earlier):
%\iffalse
%<*verb>
%\fi
@@ -447,6 +454,39 @@
% \end{document}
% \end{docshot}
+% You can use the |matrix| environment too, in order to group a few lines:
+% \docshotOptions{firstline=5,lastline=11}
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage{eolang}
+% \pagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% x -> \left\{\begin{matrix} \
+% ? \\
+% [[ L> ^ \times $.\alpha_0 ]] \\
+% [[ D> 42 ]] \
+% \end{matrix}\right\}
+% \end{phiquation*}
+% \end{document}
+% \end{docshot}
+
+% The |cases| environment works too:
+% \docshotOptions{firstline=5,lastline=11}
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage{eolang}
+% \pagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% \beta := \begin{cases} \
+% [ v_2, @ -dtzd> 42 ] \\
+% [ v_{33} ] \
+% \end{cases}
+% \end{phiquation*}
+% \end{document}
+% \end{docshot}
+
% The |phiquation| environment may be used together with the \href{https://ctan.org/pkg/acmart}{acmart} package:
% \begin{docshot}
% \documentclass{acmart}
@@ -538,7 +578,7 @@
% \begin{phiquation*}
% [[ b -> ? ]],
% [[ @ -> TRUE, \Delta ..> 42 ]], \\
-% \Delta = |43-09|.
+% \psi = << \pi, 42 >>.
% \end{phiquation*}
% \end{document}
% \end{docshot}
@@ -714,6 +754,8 @@
% \changes{0.7.0}{2022/11/17}{New syntax sugar constructs added: \texttt{D>} and \texttt{L>} for \texttt{\char`\\Delta} and \texttt{\char`\\lambda} with a dotted arrow respectively.}
% \changes{0.7.0}{2022/11/18}{New syntax sugar for $\Phi$, just using capital ``\texttt{Q}'' is enough.}
% \changes{0.8.0}{2022/11/21}{Inside \texttt{phiquation} any text inside the \texttt{\char`\\text} macro is not processed.}
+% \changes{0.9.0}{2022/12/15}{Proper handling of the \texttt{matrix} environment.}
+% \changes{0.9.0}{2022/12/15}{Parsing of \texttt{<<} and \texttt{>>} implemented.}
% Then, we create a Perl script for |phiquation| processing using |VerbatimOut| environment from
% \href{https://ctan.org/pkg/fancyvrb}{fancyvrb}:
% \begin{macrocode}
@@ -790,6 +832,7 @@ if ($macro ne 'phiq') {
$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;
@@ -804,6 +847,16 @@ if ($macro ne 'phiq') {
(0+@eols) . ' lines are ' . (0+@leads) . " leads\n";
}
}
+if ($macro ne 'phiq') {
+ sub strip_tabs {
+ my ($env, $tex) = @_;
+ $tex =~ s/&//g;
+ return "\\begin{$env}" . $tex . "\\end{$env}";
+ }
+ foreach my $e (('matrix', 'cases')) {
+ $tex =~ s/\\begin\{(\Q$e\E\*?)\}(.+)\\end\{\Q$e\E\*?\}/strip_tabs($1, $2)/sge;
+ }
+}
$tex =~ s/\$/\\xi{}/g;
$tex =~ s/(?<!\{)\^/\\rho{}/g;
$tex =~ s/\[\[/\\llbracket\\mathrel{}/g;
@@ -820,6 +873,8 @@ $tex =~ s/->/\\mathrel{\\mapsto}/g;
$tex =~ s/~>/\\mathrel{\\phiWave}/g;
$tex =~ s/:=/\\mathrel{\\vDash}/g;
$tex =~ s/\.\.>/\\mathrel{\\phiDotted}/g;
+$tex =~ s/<</\\langle/g;
+$tex =~ s/>>/\\rangle/g;
$tex =~ s/\|{2,}/|/g;
$tex =~ s/\|([^\|]+)\|/\\textnormal{\\texttt{\1}}{}/g;
$tex =~ s/\{TEXT(\d+)\}/'\\text{' . @texts[$1] . '}';/ge;
@@ -1168,7 +1223,7 @@ for (my $c = 0; $c < 0+@cmds; $c++) {
}
if (exists $opts{'data'}) {
print ',phi-data';
- if (not $opts{'data'} eq '') {
+ if ($opts{'data'} ne '') {
my $d = $opts{'data'};
if (index($d, '|') == -1) {
$d = '$\Delta\phiDotted\text{' .
@@ -1180,7 +1235,7 @@ for (my $c = 0; $c < 0+@cmds; $c++) {
}
} elsif (exists $opts{'atom'}) {
print ',phi-atom';
- if (not $opts{'atom'} eq '') {
+ if ($opts{'atom'} ne '') {
my $a = $opts{'atom'};
if (index($a, '$') == -1) {
$a = '$\lambda\phiDotted{}' . fmt($a) . '$';
@@ -1379,12 +1434,19 @@ print '\endinput';
% \end{macrocode}
% \end{macro}
-% \begin{macro}{\eolang@anon}
+% \begin{macro}{\eoAnon}
% Then, we define a supplementary command to help us anonymize some content.
-% \changes{0.9.0}{2022/11/29}{New command \texttt{\char`\\eolang@anon} added.}
+% \changes{0.9.0}{2022/11/29}{New command \texttt{\char`\\eoAnon} added.}
% \begin{macrocode}
+\RequirePackage{hyperref}
+\pdfstringdefDisableCommands{
+ \def\({}%
+ \def\){}%
+ \def\alpha{alpha}%
+ \def\varphi{phi}%
+}
\makeatletter
-\NewExpandableDocumentCommand{\eolang@anon}{O{ANONYMIZED}m}{%
+\NewExpandableDocumentCommand{\eoAnon}{O{ANONYMIZED}m}{%
\ifdefined\eolang@anonymous%
\textcolor{orange}{#1}%
\else%
@@ -1399,9 +1461,8 @@ print '\endinput';
% \changes{0.1.0}{2022/10/25}{New command \texttt{\char`\\eolang} added to print the name of the language in both
% normal and the anonymous mode of \texttt{acmart}.}
% \begin{macrocode}
-\makeatletter\newcommand\eolang{%
- \eolang@anon[XYZ]{{\sffamily EO}}}
-\makeatother
+\newcommand\eolang{%
+ \eoAnon[XYZ]{{\sffamily EO}}}
% \end{macrocode}
% \end{macro}
@@ -1410,10 +1471,8 @@ print '\endinput';
% \changes{0.1.0}{2022/10/25}{New command \texttt{\char`\\phic} prints the name of $\varphi$-calculus in both
% normal and the anonymous mode of \texttt{acmart}.}
% \begin{macrocode}
-\RequirePackage{hyperref}
-\makeatletter\newcommand\phic{%
- \eolang@anon[$\alpha$-cal\-cu\-lus]{$\varphi$-cal\-cu\-lus}}
-\makeatother
+\newcommand\phic{%
+ \eoAnon[\(\alpha\)-cal\-cu\-lus]{\(\varphi\)-cal\-cu\-lus}}
% \end{macrocode}
% \end{macro}
@@ -1421,9 +1480,8 @@ print '\endinput';
% Then, we define a simple supplementary command to help you print \xmir{}, the name of our XML-based format of program representation.
% \changes{0.2.0}{2022/10/28}{New command \texttt{\char`\\xmir} prints XMIR in both normal and the anonymous mode of \texttt{acmart}.}
% \begin{macrocode}
-\makeatletter\newcommand\xmir{%
- \eolang@anon[XML$^+$]{XMIR}}
-\makeatother
+\newcommand\xmir{%
+ \eoAnon[XML\(^+\)]{XMIR}}
% \end{macrocode}
% \end{macro}
diff --git a/Master/texmf-dist/tex/latex/eolang/eolang.sty b/Master/texmf-dist/tex/latex/eolang/eolang.sty
index 66a31bd43b2..b902261c140 100644
--- a/Master/texmf-dist/tex/latex/eolang/eolang.sty
+++ b/Master/texmf-dist/tex/latex/eolang/eolang.sty
@@ -31,7 +31,10 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{eolang}
-[2022-11-29 0.8.0 Formulas and Graphs for EO Programming Language]
+[2022-12-15 0.9.0 Formulas and Graphs for EO Programming Language]
+
+
+
@@ -175,6 +178,7 @@ if ($macro ne 'phiq') {
$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;
@@ -189,6 +193,16 @@ if ($macro ne 'phiq') {
(0+@eols) . ' lines are ' . (0+@leads) . " leads\n";
}
}
+if ($macro ne 'phiq') {
+sub strip_tabs {
+ my ($env, $tex) = @_;
+$tex =~ s/&//g;
+ return "\\begin{$env}" . $tex . "\\end{$env}";
+ }
+ foreach my $e (('matrix', 'cases')) {
+$tex =~ s/\\begin\{(\Q$e\E\*?)\}(.+)\\end\{\Q$e\E\*?\}/strip_tabs($1, $2)/sge;
+}
+}
$tex =~ s/\$/\\xi{}/g;
$tex =~ s/(?<!\{)\^/\\rho{}/g;
$tex =~ s/\[\[/\\llbracket\\mathrel{}/g;
@@ -205,6 +219,8 @@ $tex =~ s/->/\\mathrel{\\mapsto}/g;
$tex =~ s/~>/\\mathrel{\\phiWave}/g;
$tex =~ s/:=/\\mathrel{\\vDash}/g;
$tex =~ s/\.\.>/\\mathrel{\\phiDotted}/g;
+$tex =~ s/<</\\langle/g;
+$tex =~ s/>>/\\rangle/g;
$tex =~ s/\|{2,}/|/g;
$tex =~ s/\|([^\|]+)\|/\\textnormal{\\texttt{\1}}{}/g;
$tex =~ s/\{TEXT(\d+)\}/'\\text{' . @texts[$1] . '}';/ge;
@@ -511,7 +527,7 @@ for (my $c = 0; $c < 0+@cmds; $c++) {
}
if (exists $opts{'data'}) {
print ',phi-data';
- if (not $opts{'data'} eq '') {
+ if ($opts{'data'} ne '') {
my $d = $opts{'data'};
if (index($d, '|') == -1) {
$d = '$\Delta\phiDotted\text{' .
@@ -523,7 +539,7 @@ for (my $c = 0; $c < 0+@cmds; $c++) {
}
} elsif (exists $opts{'atom'}) {
print ',phi-atom';
- if (not $opts{'atom'} eq '') {
+ if ($opts{'atom'} ne '') {
my $a = $opts{'atom'};
if (index($a, '$') == -1) {
$a = '$\lambda\phiDotted{}' . fmt($a) . '$';
@@ -691,8 +707,15 @@ print '\endinput';
\def\eolang@sodgSaveTo{\relax}%
}\makeatother
+\RequirePackage{hyperref}
+\pdfstringdefDisableCommands{
+ \def\({}%
+ \def\){}%
+ \def\alpha{alpha}%
+ \def\varphi{phi}%
+}
\makeatletter
-\NewExpandableDocumentCommand{\eolang@anon}{O{ANONYMIZED}m}{%
+\NewExpandableDocumentCommand{\eoAnon}{O{ANONYMIZED}m}{%
\ifdefined\eolang@anonymous%
\textcolor{orange}{#1}%
\else%
@@ -700,18 +723,14 @@ print '\endinput';
\fi%
}\makeatother
-\makeatletter\newcommand\eolang{%
- \eolang@anon[XYZ]{{\sffamily EO}}}
-\makeatother
+\newcommand\eolang{%
+ \eoAnon[XYZ]{{\sffamily EO}}}
-\RequirePackage{hyperref}
-\makeatletter\newcommand\phic{%
- \eolang@anon[$\alpha$-cal\-cu\-lus]{$\varphi$-cal\-cu\-lus}}
-\makeatother
+\newcommand\phic{%
+ \eoAnon[\(\alpha\)-cal\-cu\-lus]{\(\varphi\)-cal\-cu\-lus}}
-\makeatletter\newcommand\xmir{%
- \eolang@anon[XML$^+$]{XMIR}}
-\makeatother
+\newcommand\xmir{%
+ \eoAnon[XML\(^+\)]{XMIR}}
\newcommand\phiConst{%
\mathrel{\hspace{.15em}}%