summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/eolang
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-12-16 03:01:21 +0000
committerNorbert Preining <norbert@preining.info>2022-12-16 03:01:21 +0000
commit14c4ab52b25f4384f6db7938c2666fdd0f75a723 (patch)
tree00da17c9471442a0486f7901e54e4db06e0a6174 /macros/latex/contrib/eolang
parent9e62b694b4955e33f16762e5c1f9f67bf736cf5b (diff)
CTAN sync 202212160301
Diffstat (limited to 'macros/latex/contrib/eolang')
-rw-r--r--macros/latex/contrib/eolang/README.md2
-rw-r--r--macros/latex/contrib/eolang/eolang.dtx94
-rw-r--r--macros/latex/contrib/eolang/eolang.pdfbin1869634 -> 2003793 bytes
3 files changed, 77 insertions, 19 deletions
diff --git a/macros/latex/contrib/eolang/README.md b/macros/latex/contrib/eolang/README.md
index 43774079bc..27d09c503e 100644
--- a/macros/latex/contrib/eolang/README.md
+++ b/macros/latex/contrib/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/macros/latex/contrib/eolang/eolang.dtx b/macros/latex/contrib/eolang/eolang.dtx
index 402bcd4b8f..e553bd8c9f 100644
--- a/macros/latex/contrib/eolang/eolang.dtx
+++ b/macros/latex/contrib/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/macros/latex/contrib/eolang/eolang.pdf b/macros/latex/contrib/eolang/eolang.pdf
index 87a430837e..4c9353b41c 100644
--- a/macros/latex/contrib/eolang/eolang.pdf
+++ b/macros/latex/contrib/eolang/eolang.pdf
Binary files differ