summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/eolang/eolang.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/eolang/eolang.dtx')
-rw-r--r--macros/latex/contrib/eolang/eolang.dtx474
1 files changed, 370 insertions, 104 deletions
diff --git a/macros/latex/contrib/eolang/eolang.dtx b/macros/latex/contrib/eolang/eolang.dtx
index 1fabdd6282..c277d02c14 100644
--- a/macros/latex/contrib/eolang/eolang.dtx
+++ b/macros/latex/contrib/eolang/eolang.dtx
@@ -50,15 +50,17 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{eolang}
%<*package>
-[2022-10-25 0.0.2 Formulas and Graphs for EO Programming Language]
+[2022-10-27 0.1.0 Formulas and Graphs for EO Programming Language]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[maxnames=1,minnames=1,maxbibnames=1,natbib=true,citestyle=authoryear,bibstyle=authoryear,doi=false,url=false,isbn=false,isbn=false]{biblatex}
-\addbibresource{main.bib}
+\addbibresource{eolang.bib}
\usepackage[tt=false, type1=true]{libertine}
\usepackage{microtype}
+\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}}
\usepackage{graphicx}
+\usepackage{xcolor}
\usepackage[runs=1,dtx]{docshots}
\usepackage{eolang}
\usepackage{href-ul}
@@ -80,9 +82,10 @@
%
% \maketitle
%
-% \textbf{NB!}
+% \textbf{\color{red}NB!}
% You must run \TeX{} processor with |--shell-escape| option
% and you must have \href{https://www.perl.org}{Perl} installed.
+% This package doesn't work on Windows.
% \section{Introduction}
%
@@ -101,9 +104,8 @@
% ^ !-> $.b,
% b -> [[ c -> |fn|(56),
% @ -> |hello|($),
-% \Delta ~> |01-FE-C3| ]]]],
-
-% x -> [[ \alpha_0 -> ? ]]
+% \Delta ..> |01-FE-C3| ]]]],\\
+% x -> [[ \alpha_0 -> ? ]].
% \end{phiquation*}
% \end{document}
% \end{docshot}
@@ -124,10 +126,10 @@
% (|\varnothing|),
% \item ``|->|'' maps to ``$\mapsto$''
% (|\mapsto|),
-% \item ``|!->|'' maps to ``$\mapstochar\relbar\mathrel{\mkern-12mu}\mapsto$''
-% (|\mapstochar\relbar\mathrel{\mkern-12mu}\mapsto|),
-% \item ``|~>|'' maps to ``$\mapstochar\dashrightarrow$''
-% (|\mapstochar\dashrightarrow|),
+% \item ``|!->|'' maps to ``$\phiConst$''
+% (|\phiConst|),
+% \item ``|..>|'' maps to ``$\phiDotted$''
+% (|\phiDotted|),
% \item ``|[[|'' maps to ``$\llbracket$''
% (|\llbracket|),
% \item ``|]]|'' maps to ``$\rrbracket$''
@@ -148,15 +150,14 @@
% using the same simple plain-text notation:
% \begin{docshot}
% \documentclass{article}
-% \usepackage[paperwidth=2in]{geometry}
% \pagestyle{empty}
% \usepackage{eolang}
% \begin{document}
-% A simple object
-% \phiq{x -> [[@ -> y]]}
-% is a decorator of
-% the data object
-% \phiq{y -> [[\Delta ~> 42]]}.
+% A simple object \\
+% \phiq{x -> [[@ -> y]]} \\
+% is a decorator of \\
+% the data object \\
+% \phiq{y -> [[\Delta ..> 42]]}.
% \end{document}
% \end{docshot}
@@ -198,72 +199,259 @@
% \item ``|pi|'' makes it dotted, with $\pi$ label.
% \end{itemize}
+% \DescribeMacro{\eolang}
+% \DescribeMacro{\phic}
+% There is also a no-argument command |\eolang| to help you print the name of
+% \eolang{} language. It understands |anonymous| mode of \href{https://ctan.org/pkg/acmart}{acmart} and prints itself
+% differently, to double-blind your paper. There is also |\phic| command to print
+% the name of \phic{}, also sensitive to |anonymous| mode.
+% \begin{docshot}
+% \documentclass[anonymous]{acmart}
+% \thispagestyle{empty}
+% \usepackage{eolang}
+% \begin{document}
+% In our research we use \eolang{}, \\
+% an experimental object-oriented \\
+% dataflow language, and \phic{}, \\
+% its formal foundation.
+% \end{document}
+% \end{docshot}
+
+% \DescribeMacro{\phiConst}
+% A simple commands is defined to help you render an arrow for a constant attribute.
+% It is recommende not to use it directly, but use |!->| instead. However, if you
+% want to use |\phiConst|, wrap it in |\mathrel| for better display:
+% \begin{docshot}
+% \documentclass{article}
+% \pagestyle{empty}
+% \usepackage{eolang}
+% \begin{document}
+% \phiq{[[ x \mathrel{\phiConst} y ]]}
+% \end{document}
+% \end{docshot}
+
+% \section{Package Options}
+
+% \DescribeMacro{tmpdir}
+% The default location of temp files is |_eolang|. You can change this using |tmpdir| option:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\usepackage[tmpdir=/tmp/foo]{eolang}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+
+% \section{More Examples}
+
+% The |phiquation| environment treats ends of line as signals to start
+% new lines in the formula. If you don't want this to happen and want to parse
+% the next line as the a continuation of the current line, you can use a single
+% backslash as it's done here:
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage{amsmath}
+% \usepackage{eolang}
+% \pagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% \dfrac \
+% {x->[[@->y]] \quad y->[[z->|42|]]} \
+% {x.z -> |42|} \
+% \text{\sffamily R1}
+% \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}
+% \usepackage{eolang}
+% \thispagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% x -> [[
+% y -> [[
+% z !-> $, f ..> ? ]]]],\\
+% \beta_1 := [ \psi -wait> ? ].
+% \end{phiquation*}
+% \end{document}
+% \end{docshot}
+
+% The |phiquation| environment will automatically align formulas by the first
+% arrow, if there are only left-aligned formulas:
+% \begin{docshot}
+% \documentclass{acmart}
+% \usepackage{eolang}
+% \thispagestyle{empty}
+% \begin{document}
+% \begin{phiquation*}
+% x(\pi) -> [[\lambda ..> f_1]], \\
+% x(a,b,c) -> [[ \alpha_0 -> ?, \
+% @ -> |hello|($) ]], \\
+% \Delta = |43-09|.
+% \end{phiquation*}
+% \end{document}
+% \end{docshot}
+
% \StopEventually{}
% \section{Implementation}
+% \changes{0.0.1}{2022/10/15}{First draft.}
-% First, we include a few packages:
+% First, we include a few packages.
+% We need \href{https://ctan.org/pkg/stmaryrd}{stmaryrd} for |\llbracket| and |\rrbracket| commands:
% \begin{macrocode}
\RequirePackage{stmaryrd}
+% \end{macrocode}
+% We need \href{https://ctan.org/pkg/amsmath}{amsmath} for |equation*| environment:
+% \begin{macrocode}
\RequirePackage{amsmath}
-\RequirePackage{amssymb}
-\RequirePackage{amsfonts}
-\RequirePackage{iexec}
+% \end{macrocode}
+% We need \href{https://ctan.org/pkg/amssymb}{amssymb} for |\varnothing| command. We disable |\Bbbk|
+% because it may conflict with some packages from \href{https://ctan.org/pkg/acmart}{acmart}:
+% \begin{macrocode}
+\let\Bbbk\relax\RequirePackage{amssymb}
+% \end{macrocode}
+% We need \href{https://ctan.org/pkg/fancyvrb}{fancyvrb} for |\VerbatimEnvironment| command:
+% \begin{macrocode}
\RequirePackage{fancyvrb}
% \end{macrocode}
+% We need \href{https://ctan.org/pkg/iexec}{iexec} for executing Perl scripts:
+% \begin{macrocode}
+\RequirePackage{iexec}
+% \end{macrocode}
-% \begin{macro}{\eolang@env}
+% Then, we process package options:
+% \changes{0.1.0}{2022/10/26}{Parsing of package options introduced.}
+% \begin{macrocode}
+\RequirePackage{pgfopts}
+\RequirePackage{ifluatex}
+\RequirePackage{ifxetex}
+\pgfkeys{
+ /eolang/.cd,
+ tmpdir/.store in=\eolang@tmpdir,
+ tmpdir/.default=_eolang\ifxetex-xe\else\ifluatex-lua\fi\fi,
+ tmpdir
+}
+\ProcessPgfOptions{/eolang}
+% \end{macrocode}
+
+% Then, we make a directory where all temporary files will be kept:
+% \begin{macrocode}
+\iexec[null]{mkdir -p "\eolang@tmpdir/\jobname"}%
+% \end{macrocode}
+
+% \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
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{eolang-phi.pl}
% \changes{0.0.2}{2022/10/21}{The symbols ``['' and ``]'' replaced with ``[['' and ``]]'' for abstract object brackets, because they conflicted with normal square brackets}
% \changes{0.0.2}{2022/10/21}{New symbol added for basket slots}
% \changes{0.0.2}{2022/10/21}{Parsing of symbols ``@,'' ``\^{},'' and ``\&'' enabled (varphi, rho, and sigma)}
-% Then, we define |\eolang@env| supplementary command.
-% It is implemented with the help of |\iexec| from
-% \href{https://github.com/yegor256/iexec}{iexec} package:
+% \changes{0.1.0}{2022/10/26}{A new Perl script "eolang-phi.pl" added for parsing of phi expressions.}
+% Then, we create a Perl script for |phiquation| processing:
% \begin{macrocode}
-\makeatletter\newcommand\eolang@env[2]{
- \iexec[trace]{
- /bin/echo -n '\\begin{#1}\\begin{split} &'
- &&
- /bin/echo -n '\detokenize{#2}'
- | perl -pe 's/^\\r\\+//g'
- | perl -pe 's/\\r\\+$//g'
- | perl -pe 's/\\?/\\\\varnothing/g'
- | perl -pe 's/@/\\\\varphi/g'
- | perl -pe 's/&/\\\\sigma/g'
- | perl -pe 's/\\^/\\\\rho/g'
- | perl -pe 's/\\$/\\\\xi/g'
- | perl -pe 's/-([a-z]+)>/\\\\xrightarrow{\\\\text{\\\\sffamily\\\\scshape \\1}}/g'
- | perl -pe 's/!->/\\\\mapstochar\\\\relbar\\\\mathrel{\\\\mkern-12mu}\\\\mapsto/g'
- | perl -pe 's/->/\\\\mapsto/g'
- | perl -pe 's/:=/\\\\vDash/g'
- | perl -pe 's/\unexpanded{~}>/\\\\mapstochar\\\\dashrightarrow/g'
- | perl -pe 's/\\|([^\\|]+)\\|/\\\\texttt{\\1}/g'
- | perl -pe 's/\\[\\[/\\\\llbracket/g'
- | perl -pe 's/\\]\\]/\\\\rrbracket/g'
- | perl -pe 's/\\r\\r/\\\\\\\\ \&/g'
- | perl -pe 's/\\r/\\\\\\\\[-4pt] \&/g'
- | perl -pe 's/([^& ]) {2}([^ ])/\\1 \\2/g'
- | perl -pe 's/ {2}/\\\\quad{}/g'
- &&
- /bin/echo -n '\\end{split}\\end{#1}\\endinput'
- }%
-}\makeatother
+\makeatletter
+\begin{VerbatimOut}{\eolang@tmpdir/eolang-phi.pl}
+$env = $ARGV[0];
+open(my $fh, '<', $ARGV[1]);
+my $tex; { local $/; $tex = <$fh>; }
+print '% This file is auto-generated', "\n";
+print '% There are ', length($tex),
+ ' chars in the input: ', $ARGV[1], "\n";
+print '% ---', "\n";
+if (index($tex, "\t") > 0) {
+ print "TABS are prohibited!";
+ exit 1;
+}
+my @lines = split (/\n/g, $tex);
+foreach my $t (@lines) {
+ print '% ', $t, "\n";
+}
+print '% ---', "\n";
+if ($env eq 'phiq') {
+ print '$';
+} else {
+ print '\begin{', $env, '}\begin{split}';
+}
+$tex =~ s/^\s+|\s+$//g;
+if ($env ne 'phiq') {
+ $tex =~ s/\s+\\\n\s*//g;
+ $tex =~ s/\\\\\n/\n\n/g;
+}
+$tex =~ s/\?/\\varnothing{}/g;
+$tex =~ s/@/\\varphi{}/g;
+$tex =~ s/&/\\sigma{}/g;
+$tex =~ s/\^/\\rho{}/g;
+$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{\\vDash}/g;
+$tex =~ s/..>/\\mathrel{\\phiDotted}/g;
+$tex =~ s/\|([^\|]+)\|/\\texttt{\1}{}/g;
+$tex =~ s/\[\[/\\llbracket\\mathrel{}/g;
+$tex =~ s/\]\]/\\mathrel{}\\rrbracket{}/g;
+if ($env ne 'phiq') {
+ $tex =~ s/\n\n/\\\\&/g;
+ $tex =~ s/\n/\\\\[-4pt]&/g;
+ $tex =~ s/([^&\s])\s{2}([^\s])/\1 \2/g;
+ $tex =~ s/\s{2}/ \\quad{}/g;
+ my @leads = $tex =~ /&[^\s]+\s/g;
+ my @eols = $tex =~ /&/g;
+ $tex = '&' . $tex;
+ if (0+@leads == 0+@eols && 0+@eols > 0) {
+ $tex =~ s/&([^\s]+)\s/\1&/g;
+ }
+}
+print $tex;
+if ($env eq 'phiq') {
+ print '$';
+} else {
+ print '\end{split}\end{', $env, '}';
+}
+print '\endinput', "\n";
+\end{VerbatimOut}
+\message{eolang: File with Perl script
+ '\eolang@tmpdir/eolang-phi.pl' saved^^J}%
+\iexec[trace,null]{perl -pi -e 's/(\\\\[a-zA-Z])\\s+/\\1/g'
+ "\eolang@tmpdir/eolang-phi.pl"}
+\makeatother
% \end{macrocode}
% \end{macro}
% \begin{macro}{phiquation}
-% Then, we define |phiquation| and |phiquation*| environments:
+% Then, we define |phiquation| and |phiquation*| environments through a supplementary
+% |\eolang@process| command:
% \begin{macrocode}
-\makeatletter
-\NewDocumentEnvironment{phiquation*}{b}{%
- \eolang@env{equation*}{#1}
-}{}
-\NewDocumentEnvironment{phiquation}{b}{%
- \eolang@env{equation}{#1}
-}{}
+\makeatletter\newcommand\eolang@process[1]{
+ \def\hash{\eolang@mdfive
+ {\eolang@tmpdir/\jobname/phiquation.tex}}%
+ \iexec[null]{cp "\eolang@tmpdir/\jobname/phiquation.tex"
+ "\eolang@tmpdir/\jobname/\hash.tex"}%
+ \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{
+ perl "\eolang@tmpdir/eolang-phi.pl"
+ '#1'
+ "\eolang@tmpdir/\jobname/\hash.tex"}%
+}
+\newenvironment{phiquation*}%
+{\VerbatimEnvironment\begin{VerbatimOut}
+ {\eolang@tmpdir/\jobname/phiquation.tex}}
+{\end{VerbatimOut}\eolang@process{equation*}}
+\newenvironment{phiquation}%
+{\VerbatimEnvironment\begin{VerbatimOut}
+ {\eolang@tmpdir/\jobname/phiquation.tex}}
+{\end{VerbatimOut}\eolang@process{equation}}
\makeatother
-\AddToHook{env/phiquation*/begin}{\obeylines\obeyspaces}
-\AddToHook{env/phiquation/begin}{\obeylines\obeyspaces}
% \end{macrocode}
% \end{macro}
@@ -271,42 +459,47 @@
% \changes{0.0.2}{2022/10/21}{Parsing of additional symbols enabled}
% Then, we define |\phiq| command:
% \begin{macrocode}
-\newcommand\phiq[1]{
- \iexec[trace]{
- /bin/echo -n '$'
- &&
- /bin/echo -n '\detokenize{#1}'
- | perl -pe 's/\\^/\\\\rho/g'
- | perl -pe 's/\\$/\\\\xi/g'
- | perl -pe 's/&/\\\\sigma/g'
- | perl -pe 's/\\?/\\\\varnothing/g'
- | perl -pe 's/@/\\\\varphi/g'
- | perl -pe 's/!->/\\\\mapstochar\\\\relbar\\\\mathrel{\\\\mkern-12mu}\\\\mapsto/g'
- | perl -pe 's/->/\\\\mapsto/g'
- | perl -pe 's/-([a-z]+)>/\\\\xrightarrow{\\\\text{\\\\sffamily\\\\scshape \\1}}/g'
- | perl -pe 's/\unexpanded{~}>/\\\\mapstochar\\\\dashrightarrow/g'
- | perl -pe 's/:=/\\\\vDash/g'
- | perl -pe 's/\\[\\[/\\\\llbracket/g'
- | perl -pe 's/\\]\\]/\\\\rrbracket/g'
- &&
- /bin/echo -n '$\\endinput'
- }%
-}
+\makeatletter\newcommand\phiq[1]{
+ \iexec[trace,quiet,stdout=\eolang@tmpdir/\jobname/phiq.tex]{
+ /bin/echo '\detokenize{#1}'}
+ \def\hash{\eolang@mdfive
+ {\eolang@tmpdir/\jobname/phiq.tex}}%
+ \iexec[null]{cp "\eolang@tmpdir/\jobname/phiq.tex"
+ "\eolang@tmpdir/\jobname/\hash.tex"}%
+ \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{
+ perl \eolang@tmpdir/eolang-phi.pl 'phiq'
+ "\eolang@tmpdir/\jobname/\hash.tex"}%
+}\makeatother
% \end{macrocode}
% \end{macro}
-% \begin{macro}{Perl}
+% \begin{macro}{eolang-sodg.pl}
% \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.}
-% Then, create a Perl script:
+% \changes{0.1.0}{2022/10/26}{There are two Perl scripts now: one for phiquation, another one for sodg.}
+% Then, we create a Perl script for |sodg| graphs processing:
% \begin{macrocode}
-\begin{VerbatimOut}{eolang.pl}
-$tex = $ARGV[0];
+\makeatletter
+\begin{VerbatimOut}{\eolang@tmpdir/eolang-sodg.pl}
+open(my $fh, '<', $ARGV[0]);
+my $tex; { local $/; $tex = <$fh>; }
+print '% This file is auto-generated', "\n";
+print '% There are ', length($tex),
+ ' chars in the input: ', $ARGV[0], "\n";
+print '% ---', "\n";
+if (index($tex, "\t") > 0) {
+ print "TABS are prohibited!";
+ exit 1;
+}
$tex =~ s/^\s+|\s+$//g;
$tex =~ s/(\\[a-zA-Z]+)\s+/\1/g;
-$tex =~ s/\r\s+/\r/g;
+$tex =~ s/\n\s+/\n/g;
$tex =~ s/\|([^\|]+)\|/\\texttt{\1}/g;
-my @cmds = split (/\r/g, $tex);
-print '\begin{phig}', "\n";
+my @cmds = split (/\n/g, $tex);
+foreach my $t (@cmds) {
+ print '% ', $t, "\n";
+}
+print '% ---', "\n";
+print '\begin{phicture}', "\n";
foreach my $c (@cmds) {
my ($head, $tail) = split (/ /, $c, 2);
my %opts = {};
@@ -380,10 +573,13 @@ foreach my $c (@cmds) {
}
print ";\n";
}
-print '\end{phig}', "\n", '\endinput';
+print '\end{phicture}', "\n", '\endinput';
\end{VerbatimOut}
-\message{^^Jeolang: File with Perl script (eolang.pl) saved^^J}%
-\iexec[trace,null]{perl -pi -e 's/(\\\\[a-zA-Z])\\s+/\\1/g' eolang.pl}
+\message{eolang: File with Perl script
+ '\eolang@tmpdir/eolang-sodg.pl' saved^^J}%
+\iexec[trace,null]{perl -pi -e 's/(\\\\[a-zA-Z])\\s+/\\1/g'
+ "\eolang@tmpdir/eolang-sodg.pl"}
+\makeatother
% \end{macrocode}
% \end{macro}
@@ -402,10 +598,10 @@ print '\end{phig}', "\n", '\endinput';
% \end{macrocode}
% \end{macro}
-% \begin{macro}{phig}
-% Then, we define internal environment |phig|:
+% \begin{macro}{phicture}
+% Then, we define internal environment |phicture|:
% \begin{macrocode}
-\newenvironment{phig}%
+\newenvironment{phicture}%
{\noindent\begin{tikzpicture}[
->,>=stealth',node distance=0,thick,
pics/parallel arrow/.style={
@@ -438,14 +634,84 @@ print '\end{phig}', "\n", '\endinput';
% Then, create a new environment |sodg|, as suggested
% \href{https://tex.stackexchange.com/questions/661056}{here}:
% \begin{macrocode}
-\NewDocumentEnvironment{sodg}{b}{%
- \catcode`\ =10 %
- \catcode`\^^M=5 %
- \iexec[trace,stdout=\jobname.tex.eolang]{
- perl eolang.pl '\detokenize{#1}'}%
-}{}
-\AddToHook{env/sodg/before}{\bgroup\obeylines\obeyspaces}
-\AddToHook{env/sodg/after}{\egroup}
+\makeatletter\newenvironment{sodg}%
+{\VerbatimEnvironment\begin{VerbatimOut}
+ {\eolang@tmpdir/\jobname/sodg.tex}}
+{\end{VerbatimOut}%
+ \def\hash{\eolang@mdfive
+ {\eolang@tmpdir/\jobname/sodg.tex}}%
+ \iexec[null]{cp "\eolang@tmpdir/\jobname/sodg.tex"
+ "\eolang@tmpdir/\jobname/\hash.tex"}%
+ \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{
+ perl "\eolang@tmpdir/eolang-sodg.pl"
+ "\eolang@tmpdir/\jobname/\hash.tex"}%
+}\makeatother
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\eolang}
+% \changes{0.1.0}{2022/10/25}{New command "eolang" added to print the name of the language in both
+% normal and anonymous mode of "acmart"}
+% \begin{macrocode}
+\makeatletter\newcommand\eolang{%
+ \ifdefined\anon%
+ \anon[XYZ]{{\sffamily EO}}%
+ \else%
+ {\sffamily EO}%
+ \fi%
+}\makeatother
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\phic}
+% \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}
+\makeatletter\newcommand\phic{%
+ \ifdefined\anon%
+ \anon[$\alpha$-calculus]{$\varphi$-calculus}%
+ \else%
+ $\varphi$-calculus%
+ \fi%
+}\makeatother
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\phiConst}
+% \changes{0.1.0}{2022/10/26}{New command "phiConst" added to denote a link to a constant attribute.}
+% Then, we define a command to render an arrow for a constant attribute,
+% as suggested \href{https://tex.stackexchange.com/questions/663121}{here}:
+% \begin{macrocode}
+\newcommand\phiConst{%
+ \mathrel{\hspace{.15em}}\mapstochar\mathrel{\hspace{-.15em}}\mapsto}
+% \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,
+% as suggested \href{https://tex.stackexchange.com/questions/663176}{here}:
+% \begin{macrocode}
+\RequirePackage{trimclip}
+\RequirePackage{amsfonts}
+\makeatletter
+\newcommand{\phiDotted}{\mapstochar\mathrel{\mathpalette\phiDotted@\relax}}
+\newcommand{\phiDotted@}[2]{%
+ \begingroup
+ \settowidth{\dimen\z@}{$\m@th#1\rightarrow$}%
+ \settoheight{\dimen\tw@}{$\m@th#1\rightarrow$}%
+ \sbox\z@{%
+ \makebox[\dimen\z@][s]{%
+ \clipbox{0 0 {0.4\width} 0}%
+ {\resizebox{\dimen\z@}{\height}%
+ {$\m@th#1\dashrightarrow$}}%
+ \hss%
+ \clipbox{{0.69\width} {-0.1\height} 0 {-\height}}{$\m@th#1\rightarrow$}%
+ }%
+ }%
+ \ht\z@=\dimen\tw@ \dp\z@=\z@%
+ \box\z@%
+ \endgroup}\makeatother
% \end{macrocode}
% \end{macro}