summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/eolang/eolang.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-10-30 20:43:08 +0000
committerKarl Berry <karl@freefriends.org>2022-10-30 20:43:08 +0000
commit73e6f2b82d706c6410ea452a77481507df27273a (patch)
treeae004ba496eb29bb2ad70cbe9948160fbbe39438 /Master/texmf-dist/source/latex/eolang/eolang.dtx
parent65f294f0eabddd4a09f422ce1501797e39143c25 (diff)
eolang (30oct22)
git-svn-id: svn://tug.org/texlive/trunk@64867 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/eolang/eolang.dtx')
-rw-r--r--Master/texmf-dist/source/latex/eolang/eolang.dtx100
1 files changed, 83 insertions, 17 deletions
diff --git a/Master/texmf-dist/source/latex/eolang/eolang.dtx b/Master/texmf-dist/source/latex/eolang/eolang.dtx
index 65e87c220ac..c7bad937399 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-10-29 0.2.0 Formulas and Graphs for EO Programming Language]
+[2022-10-30 0.3.0 Formulas and Graphs for EO Programming Language]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -126,6 +126,8 @@
% (|\varnothing|),
% \item ``|->|'' maps to ``$\mapsto$''
% (|\mapsto|),
+% \item ``|~>|'' maps to ``$\phiWave$''
+% (|\phiWave|),
% \item ``|!->|'' maps to ``$\phiConst$''
% (|\phiConst|),
% \item ``|..>|'' maps to ``$\phiDotted$''
@@ -153,9 +155,9 @@
% \pagestyle{empty}
% \usepackage{eolang}
% \begin{document}
-% A simple object \\
+% A simple object
% \phiq{x -> [[@ -> y]]} \\
-% is a decorator of \\
+% is a decorator of
% the data object \\
% \phiq{y -> [[\Delta ..> 42]]}.
% \end{document}
@@ -267,6 +269,27 @@
% \end{document}
% \end{docshot}
+% This is how you can use |\dfrac| from |amsmath| for large inference rules,
+% with the help of |\begin{split}| and |\end{split}|:
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage{amsmath}
+% \usepackage{eolang}
+% \pagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% \dfrac{\begin{split}
+% x->[[@->y, z->42,
+% \alpha_0->?, \alpha_1->42]]
+% \end{split}}{\begin{split}
+% x->[[@->y, z->?, f ~> |pi|(
+% \alpha_0->[[ \psi !-> |hello|(12) ]],
+% \alpha_1->42)]]
+% \end{split}}\text{R2}.
+% \end{phiquation*}
+% \end{document}
+% \end{docshot}
+
% The |phiquation| environment may be used together with \href{https://ctan.org/pkg/acmart}{acmart}:
% \begin{docshot}
% \documentclass{acmart}
@@ -346,12 +369,22 @@
\iexec[null]{mkdir -p "\eolang@tmpdir/\jobname"}%
% \end{macrocode}
+% \begin{macro}{\eolang@lineno}
+% \changes{0.3.0}{2022/10/30}{New counter for protecting lineno.}
+% Then, we define an internal counter to protect line number from changing:
+% \begin{macrocode}
+\makeatletter\newcounter{eolang@lineno}\makeatother
+% \end{macrocode}
+% \end{macro}
+
% \begin{macro}{\eolang@mdfive}
% \changes{0.1.0}{2022/10/26}{New supplementary command added to calculate MD5 sum of a file.}
% Then, we define a command for MD5 hash calculating of a file:
% \begin{macrocode}
\RequirePackage{pdftexcmds}
-\makeatletter\newcommand\eolang@mdfive[1]{\pdf@filemdfivesum{#1}}\makeatother
+\makeatletter
+\newcommand\eolang@mdfive[1]{\pdf@filemdfivesum{#1}}
+\makeatother
% \end{macrocode}
% \end{macro}
@@ -361,7 +394,9 @@
% \changes{0.0.2}{2022/10/21}{Parsing of symbols ``@,'' ``\^{},'' and ``\&'' enabled (varphi, rho, and sigma)}
% \changes{0.1.0}{2022/10/26}{A new Perl script "eolang-phi.pl" added for parsing of phi expressions.}
% \changes{0.2.0}{2022/10/29}{Numbers automatically render as "texttt". No need to use vertical bars around them anymore.}
-% Then, we create a Perl script for |phiquation| processing:
+% \changes{0.3.0}{2022/10/30}{New arrow added, that looks like "leadsto".}
+% Then, we create a Perl script for |phiquation| processing using |VerbatimOut| from
+% \href{https://ctan.org/pkg/fancyvrb}{fancyvrb}:
% \begin{macrocode}
\makeatletter
\begin{VerbatimOut}{\eolang@tmpdir/eolang-phi.pl}
@@ -400,12 +435,15 @@ $tex =~ s/\$/\\xi{}/g;
$tex =~ s/-([a-z]+)>/\\mathrel{\\xrightarrow{\\text{\\sffamily\\scshape \1}}}/g;
$tex =~ s/!->/\\mathrel{\\phiConst}/g;
$tex =~ s/->/\\mathrel{\\mapsto}/g;
+$tex =~ s/~>/\\mathrel{\\phiWave}/g;
$tex =~ s/:=/\\mathrel{\\vDash}/g;
$tex =~ s/..>/\\mathrel{\\phiDotted}/g;
-$tex =~ s/\|([^\|]+)\|/\\texttt{\1}{}/g;
+$tex =~ s/\|([^\|]+)\|/\\textnormal{\\texttt{\1}}{}/g;
$tex =~ s/\[\[/\\llbracket\\mathrel{}/g;
$tex =~ s/\]\]/\\mathrel{}\\rrbracket{}/g;
if ($env 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/\\\\[-4pt]&/g;
$tex =~ s/([^&\s])\s{2}([^\s])/\1 \2/g;
@@ -446,13 +484,18 @@ print '\endinput', "\n";
perl "\eolang@tmpdir/eolang-phi.pl"
'#1'
"\eolang@tmpdir/\jobname/\hash.tex"}%
+ \setcounter{FancyVerbLine}{\value{eolang@lineno}}%
}
\newenvironment{phiquation*}%
-{\VerbatimEnvironment\begin{VerbatimOut}
+{\VerbatimEnvironment%
+\setcounter{eolang@lineno}{\value{FancyVerbLine}}%
+\begin{VerbatimOut}
{\eolang@tmpdir/\jobname/phiquation.tex}}
{\end{VerbatimOut}\eolang@process{equation*}}
\newenvironment{phiquation}%
-{\VerbatimEnvironment\begin{VerbatimOut}
+{\VerbatimEnvironment%
+\setcounter{eolang@lineno}{\value{FancyVerbLine}}%
+\begin{VerbatimOut}
{\eolang@tmpdir/\jobname/phiquation.tex}}
{\end{VerbatimOut}\eolang@process{equation}}
\makeatother
@@ -460,12 +503,12 @@ print '\endinput', "\n";
% \end{macro}
% \begin{macro}{\phiq}
-% \changes{0.0.2}{2022/10/21}{Parsing of additional symbols enabled}
+% \changes{0.0.2}{2022/10/21}{Parsing of additional symbols enabled.}
% Then, we define |\phiq| command:
% \begin{macrocode}
-\makeatletter\newcommand\phiq[1]{
+\makeatletter\newcommand\phiq[1]{%
\iexec[trace,quiet,stdout=\eolang@tmpdir/\jobname/phiq.tex]{
- /bin/echo '\detokenize{#1}'}
+ /bin/echo '\detokenize{#1}'}%
\def\hash{\eolang@mdfive
{\eolang@tmpdir/\jobname/phiq.tex}}%
\iexec[null]{cp "\eolang@tmpdir/\jobname/phiq.tex"
@@ -481,7 +524,8 @@ print '\endinput', "\n";
% \changes{0.0.2}{2022/10/24}{The Perl file now has a fixed name, which doesn't depend on the name of the TeX job. This file may be shared among jobs, no need to make it uniquely named.}
% \changes{0.1.0}{2022/10/26}{There are two Perl scripts now: one for phiquation, another one for sodg.}
% \changes{0.2.0}{2022/10/28}{The content of "atom" and "data" boxes is parsed automatically as formulas and numbers, respectively.}
-% Then, we create a Perl script for |sodg| graphs processing:
+% Then, we create a Perl script for |sodg| graphs processing using |VerbatimOut| from
+% \href{https://ctan.org/pkg/fancyvrb}{fancyvrb}:
% \begin{macrocode}
\makeatletter
\begin{VerbatimOut}{\eolang@tmpdir/eolang-sodg.pl}
@@ -498,7 +542,7 @@ if (index($tex, "\t") > 0) {
$tex =~ s/^\s+|\s+$//g;
$tex =~ s/(\\[a-zA-Z]+)\s+/\1/g;
$tex =~ s/\n\s+/\n/g;
-$tex =~ s/\|([^\|]+)\|/\\texttt{\1}/g;
+$tex =~ s/\|([^\|]+)\|/\\textnormal{\\texttt{\1}}/g;
my @cmds = split (/\n/g, $tex);
foreach my $t (@cmds) {
print '% ', $t, "\n";
@@ -528,7 +572,7 @@ foreach my $c (@cmds) {
if (not $opts{'data'} eq '') {
my $d = $opts{'data'};
if (index($d, '|') == -1) {
- $d = '\texttt{' . $d . '}';
+ $d = '\textnormal{\texttt{' . $d . '}}';
}
$opts{'box'} = $d;
}
@@ -596,6 +640,14 @@ print '\end{phicture}', "\n", '\endinput';
% \end{macrocode}
% \end{macro}
+% \begin{macro}{FancyVerbLine}
+% Then, we reset the counter for \href{https://ctan.org/pkg/fancyvrb}{fancyvrb}, so that
+% it starts counting lines from zero when the document starts rendering:
+% \begin{macrocode}
+\setcounter{FancyVerbLine}{0}
+% \end{macrocode}
+% \end{macro}
+
% \begin{macro}{tikz}
% Then, we include |tikz| package and its libraries:
% \begin{macrocode}
@@ -648,7 +700,9 @@ print '\end{phicture}', "\n", '\endinput';
% \href{https://tex.stackexchange.com/questions/661056}{here}:
% \begin{macrocode}
\makeatletter\newenvironment{sodg}%
-{\VerbatimEnvironment\begin{VerbatimOut}
+{\VerbatimEnvironment%
+\setcounter{eolang@lineno}{\value{FancyVerbLine}}%
+\begin{VerbatimOut}
{\eolang@tmpdir/\jobname/sodg.tex}}
{\end{VerbatimOut}%
\def\hash{\eolang@mdfive
@@ -658,6 +712,7 @@ print '\end{phicture}', "\n", '\endinput';
\iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{
perl "\eolang@tmpdir/eolang-sodg.pl"
"\eolang@tmpdir/\jobname/\hash.tex"}%
+ \setcounter{FancyVerbLine}{\value{eolang@lineno}}%
}\makeatother
% \end{macrocode}
% \end{macro}
@@ -682,11 +737,12 @@ print '\end{phicture}', "\n", '\endinput';
% \changes{0.1.0}{2022/10/25}{New command "phic" prints the name of $\varphi$-calculus in both
% normal and anonymous mode of "acmart"}
% \begin{macrocode}
+\RequirePackage{hyperref}
\newcommand\phic{%
\ifdefined\anon%
- \anon[$\alpha$-calculus]{$\varphi$-calculus}%
+ \anon[\texorpdfstring{$\alpha$}{a}-calculus]{\texorpdfstring{$\varphi$}{phi}-calculus}%
\else%
- $\varphi$-calculus%
+ \texorpdfstring{$\varphi$}{phi}-calculus%
\fi%
}
% \end{macrocode}
@@ -716,6 +772,16 @@ print '\end{phicture}', "\n", '\endinput';
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\phiWave}
+% \changes{0.3.0}{2022/10/30}{New command "phiWave" added to denote a link to a multi-layer attribute.}
+% Then, we define a command to render an arrow for a multi-layer attribute,
+% as suggested \href{https://tex.stackexchange.com/questions/198755}{here}:
+% \begin{macrocode}
+\newcommand\phiWave{%
+ \mapstochar\mathrel{\mspace{0.45mu}}\leadsto}
+% \end{macrocode}
+% \end{macro}
+
% \begin{macro}{\phiDotted}
% \changes{0.1.0}{2022/10/27}{New command "phiDotted" added to denote a link to a special attribute.}
% Then, we define a command to render an arrow for a special attribute,