diff options
author | Norbert Preining <norbert@preining.info> | 2022-11-29 03:01:10 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-11-29 03:01:10 +0000 |
commit | d3420ed49446361fef055ad7f989ff41ce7362b6 (patch) | |
tree | b3812509ff2e55f916ddd82001b071a62f598e7b /macros | |
parent | d215ba492183a22167b7cdf9900899ab51f7dda6 (diff) |
CTAN sync 202211290301
Diffstat (limited to 'macros')
-rw-r--r-- | macros/latex/contrib/eolang/README.md | 4 | ||||
-rw-r--r-- | macros/latex/contrib/eolang/eolang.dtx | 309 | ||||
-rw-r--r-- | macros/latex/contrib/eolang/eolang.pdf | bin | 1552474 -> 1746109 bytes | |||
-rw-r--r-- | macros/latex/contrib/ffcode/ffcode.dtx | 48 | ||||
-rw-r--r-- | macros/latex/contrib/ffcode/ffcode.pdf | bin | 493615 -> 574021 bytes |
5 files changed, 289 insertions, 72 deletions
diff --git a/macros/latex/contrib/eolang/README.md b/macros/latex/contrib/eolang/README.md index 86809ceb26..43774079bc 100644 --- a/macros/latex/contrib/eolang/README.md +++ b/macros/latex/contrib/eolang/README.md @@ -16,8 +16,8 @@ and then use in the preamble: \begin{document} \begin{phiquation} x -> [ - @ -> |foo|(5), - y -> [ \lambda -> M_1 ]]. + @ -> foo(5), + y -> [ L> M_1 ]]. \end{phiquation} \end{document} ``` diff --git a/macros/latex/contrib/eolang/eolang.dtx b/macros/latex/contrib/eolang/eolang.dtx index ee68942161..8a9469e0d7 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-18 0.7.0 Formulas and Graphs for EO Programming Language] +[2022-11-28 0.7.1 Formulas and Graphs for EO Programming Language] %</package> %<*driver> \documentclass{ltxdoc} @@ -196,8 +196,8 @@ % \begin{document} % \begin{sodg} % v0 \\ v0===> \\ v0!!A -% v1 xy:v0,-.8,2.8 data:42 \\ =>v1 -% v0->v1 a:x rho +% v1 xy:v0,-.8,2.8 data:42 tag:d_1 +% v0->v1 a:x rho \\ =>v1 % v2 xy:v0,+1,+1 atom:\xi.x+1 % v1->v2 a:|hi| bend:-15 % v2->v0 pi bend:10 % a comment @@ -212,6 +212,7 @@ % The following markers are supported for a vertex: % \begin{itemize}\setlength\itemsep{0em} +% \item ``|tag:<math>|'' puts a custom label |<math>| into the circle, % \item ``|data:[<box>]|'' makes it a data vertex with an optional attached ``|<box>|'' % (the content of the box may only be numeric data), % \item ``|atom:[<box>]|'' makes it an atom with an optional attached ``|<box>|'' @@ -250,7 +251,7 @@ % \DescribeMacro{\phic} % \DescribeMacro{\xmir} % 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 +% \eolang{} language. It understands the |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. The macro |\xmir| prints "XMIR". % \docshotOptions{firstline=4,lastline=10} @@ -271,7 +272,7 @@ % \DescribeMacro{\phiWave} % \DescribeMacro{\phiDotted} % A few simple commands are defined to help you render arrows. -% It is recommende not to use them directly, but use |!->| instead. However, if you +% It is recommended not to use them directly, but use |!->| instead. However, if you % want to use |\phiConst|, wrap it in |\mathrel| for better display: % \docshotOptions{firstline=6,lastline=12} % \begin{docshot} @@ -281,17 +282,36 @@ % \usepackage{eolang} % \begin{document}\noindent % If $x$ is an identifier and $y$ is -% an objects, then $x \phiConst y$ +% an object, then $x \phiConst y$ % makes $y$ a constant, % $x \phiWave y$ makes it a decoratee -% of arbitrary number of control-flow -% objects, while $x \phiDotted y$ -% makes it a special attribute. +% of an arbitrary number of objects, +% while $x \phiDotted y$ makes it +% a special attribute. +% \end{document} +% \end{docshot} + +% \DescribeMacro{\phiOset} +% \DescribeMacro{\phiUset} +% If you want to put a text over an arrow or under it, use |\phiOset| and |\phiUset| respectively: +% \docshotOptions{firstline=6,lastline=11} +% \begin{docshot} +% \documentclass{article} +% \pagestyle{empty} +% \usepackage[paperwidth=3in]{geometry} +% \usepackage{eolang} +% \begin{document}\noindent +% When the names of attributes and their +% values don't matter, we use an arrow +% with a star, for example: +% \begin{phiquation*} +% [[ \phiOset{*}{->} ]]. +% \end{phiquation*} % \end{document} % \end{docshot} % \DescribeMacro{\phiMany} -% Sometimes you may need to simplify the way you describe an object: +% Sometimes you may need to simplify the way you describe an object (the typesetting is a bit off, but this is not because of us, but because of \href{https://tex.stackexchange.com/questions/664772}{this}): % \docshotOptions{firstline=6,lastline=14} % \begin{docshot} % \documentclass{article} @@ -311,10 +331,30 @@ % \end{document} % \end{docshot} +% \DescribeMacro{\phiSaveTo} +% \DescribeMacro{\sodgSaveTo} +% If you want to use |phiquation| or |sodg| environments inside |tabular| or any other environment or command, you won't be able to do this, because |phiquation| and |sodg| are ``verbatim'' environments. |\phiSaveTo| and |\sodgSaveTo| commands will help you in this situation. You use them right before |\begin{phiquation}| or |\begin{sodg}| respectively --- the content of the equation or the graph won't be rendered, but instead saved to the file. Later, inside |tabular|, you can use it through the |\input| macro (don't forget the |\parbox|): +% \docshotOptions{firstline=5,lastline=12} +% \begin{docshot} +% \documentclass{article} +% \usepackage{eolang} +% \pagestyle{empty} +% \begin{document} +% \phiSaveTo{a} +% \begin{phiquation*} +% [[ x -> [[D>42]] ]] +% \end{phiquation*} +% \begin{tabular}{p{.5in}l} +% Free: & $[[x -> ?]]$ \\ +% Bound: & \parbox{1in}{\input{a}} \\ +% \end{tabular} +% \end{document} +% \end{docshot} + % \section{Package Options} % \DescribeMacro{tmpdir} -% The default location of temp files is |_eolang|. You can change this using |tmpdir| option: +% The default location of temp files is |_eolang|. You can change this with the help of the |tmpdir| package option: %\iffalse %<*verb> %\fi @@ -326,7 +366,7 @@ %\fi % \DescribeMacro{nodollar} -% You may disable special treatment of the dollar sign: +% You may disable the special treatment of the dollar sign by using the |nodollar| package option: %\iffalse %<*verb> %\fi @@ -359,7 +399,7 @@ % \end{document} % \end{docshot} -% This is how you can use |\dfrac| from |amsmath| for large inference rules, +% This is how you can use |\dfrac| from \href{https://ctan.org/pkg/amsmath}{amsmath} for large inference rules, % with the help of |\begin{split}| and |\end{split}|: % \docshotOptions{firstline=6,lastline=15} % \begin{docshot} @@ -381,7 +421,7 @@ % \end{document} % \end{docshot} -% The |phiquation| environment may be used together with \href{https://ctan.org/pkg/acmart}{acmart}: +% The |phiquation| environment may be used together with the \href{https://ctan.org/pkg/acmart}{acmart} package: % \begin{docshot} % \documentclass{acmart} % \usepackage{eolang} @@ -396,7 +436,7 @@ % \end{document} % \end{docshot} -% It's possible to use |\label| inside |phiquation| environment: +% It's possible to use |\label| inside the |phiquation| environment (pay attention to how you can disable our custom parsing of math formulas by means of curled brackets around the ``|4|'' number): % \docshotOptions{firstline=6,lastline=13} % \begin{docshot} % \documentclass{article} @@ -407,7 +447,7 @@ % Discriminant can be calculated using % the following simple formula: % \begin{phiquation} -% D = b{^2} - 4ac. +% D = b{^2} - {4}ac. % \label{d} % \end{phiquation} % Eq.~\ref{d} is also widely used in @@ -415,6 +455,36 @@ % \end{document} % \end{docshot} +% You can add comments to your equations, using the |&&| command (pay attention, the text inside |\text{}| is not processed and treated like a plain text): +% \docshotOptions{firstline=6,lastline=10} +% \begin{docshot} +% \documentclass{article} +% \usepackage[paperwidth=4in]{geometry} +% \usepackage{eolang} +% \pagestyle{empty} +% \begin{document} +% \begin{phiquation*} +% [[ 0->x ]] && \text{This is formation} +% [[ 0->? ]] && \text{Abstraction} +% x(D>42) && \text{Application} +% \end{phiquation*} +% \end{document} +% \end{docshot} + +% If you don't use |nodollar| package option, you can still use normal parsing of the dollar sign, by means of |\(...\)| syntax: +% \docshotOptions{firstline=6,lastline=8} +% \begin{docshot} +% \documentclass{article} +% \usepackage[paperwidth=3in]{geometry} +% \usepackage{eolang} +% \pagestyle{empty} +% \begin{document}\noindent +% The object formation $[[0->x]]$ +% may be replaced with a formula +% \( Q \times a^2 \). +% \end{document} +% \end{docshot} + % The |phiquation| environment will automatically align formulas by the first % arrow, if there are only left-aligned formulas: % \docshotOptions{firstline=5,lastline=10} @@ -440,7 +510,7 @@ % \thispagestyle{empty} % \begin{document} % \begin{phiquation*} -% [[ b -> ? ]], \\ +% [[ b -> ? ]], % [[ @ -> TRUE, \Delta ..> 42 ]], \\ % \Delta = |43-09|. % \end{phiquation*} @@ -604,23 +674,24 @@ % \begin{macro}{eolang-phi.pl} % \changes{0.0.2}{2022/10/21}{The symbols ``\texttt{[}'' and ``\texttt{]}'' replaced with ``\texttt{[[}'' and ``\texttt{]]}'' 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 ``\texttt{@},'' ``\texttt{\^{}},'' and ``\texttt{\&}'' enabled (\texttt{\char`\\varphi}, \texttt{\char`\\rho}, and \texttt{\char`\\sigma})} +% \changes{0.0.2}{2022/10/21}{Parsing of the symbols ``\texttt{@},'' ``\texttt{\^{}},'' and ``\texttt{\&}'' enabled (\texttt{\char`\\varphi}, \texttt{\char`\\rho}, and \texttt{\char`\\sigma})} % \changes{0.1.0}{2022/10/26}{A new Perl script "\texttt{eolang-phi.pl}" added for parsing of phi expressions.} % \changes{0.2.0}{2022/10/29}{Numbers automatically render as \texttt{\char`\\texttt}. No need to use vertical bars around them anymore.} % \changes{0.3.0}{2022/10/30}{New arrow added, that looks like \texttt{\char`\\leadsto}.} % \changes{0.5.0}{2022/11/11}{Automated formatting of \texttt{TRUE} and \texttt{FALSE} added.} -% \changes{0.5.0}{2022/11/13}{A new syntax introduced for \texttt{\char`\\alpha}-attributes: \texttt{0->}.} +% \changes{0.5.0}{2022/11/13}{A new syntax introduced for the \texttt{\char`\\alpha} attributes: \texttt{0->}.} % \changes{0.5.0}{2022/11/14}{It's possible to use double names for attributes, such as \texttt{0/g->}.} % \changes{0.7.0}{2022/11/17}{Object names are automatically converted to \texttt{\char`\\texttt}, provided their names include two or more symbols.} % \changes{0.7.0}{2022/11/17}{Text in quotes is automatically converted to \texttt{\char`\\texttt}.} % \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.} % Then, we create a Perl script for |phiquation| processing using |VerbatimOut| environment from % \href{https://ctan.org/pkg/fancyvrb}{fancyvrb}: % \begin{macrocode} \makeatletter \begin{VerbatimOut}{\eolang@tmpdir/eolang-phi.pl} -$env = $ARGV[0]; +$macro = $ARGV[0]; open(my $fh, '<', $ARGV[1]); my $tex; { local $/; $tex = <$fh>; } print '% This file is auto-generated', "\n"; @@ -639,42 +710,78 @@ print '% ---', "\n"; $tex =~ s/%.*\n/\n/g; $tex =~ s/^\s+|\s+$//g; my $gathered = (0 == $tex =~ /\n\s+/g); -if ($env ne 'phiq') { - $tex =~ s/\s+\\\n\s*//g; +if ($gathered) { + print '% The "gathered" is used since all lines are left-aligned' . "\n"; +} +my $align = 0; +print '% The "align" is NOT used by default' . "\n"; +if (index($tex, '&&') >= 0) { + $macro =~ s/equation/align/g; + $align = 1; + print '% The "align" is used because of && seen in the text' . "\n"; +} +if ($macro ne 'phiq') { $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; } -$tex =~ s/&/\\sigma{}/g; +my @texts = (); +sub trep { + my ($s) = @_; + my $open = 0; + my $p = 0; + for (; $p < length($s); $p++) { + $c = substr($s, $p, 1); + if ($c eq '}') { + if ($open eq 0) { + last; + } + $open--; + } + if ($c eq '{') { + $open++; + } + } + push(@texts, substr($s, 0, $p)); + return '{TEXT' . (0+@texts - 1) . '}' . substr($s, $p + 1); +} +$tex =~ s/\\text\{(.+)/trep("$1")/ge; +$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; $tex =~ s/"([^"]+)"/|"\1"|/g; -$tex =~ s/([ )(.>\/]|^)([a-z0-9]{2,})(?=[ )(.-])/\1|\2|/g; +$tex =~ s/(^|(?<=[\s)(\]\[,.>\/]))([a-z][a-z0-9]+)(?=[\s)(\]\[,.-]|$)/|\2|/g; $tex =~ s/([^^_]|^)([0-9]+|\*)\/(\\?[a-z]+|\|[a-z]+\|) (->|\.\.>|~>|:=|!->)/\1\\alpha_{\2}\\vert{}\3\\space{}\4/xg; $tex =~ s/([^^_]|^)([0-9]+|\*) (->|\.\.>|~>|:=|!->)/\1\\alpha_{\2}\\space{}\3/xg; -if ($env ne 'phiq') { +if ($macro 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/\n/\\phiEOL{}\n&/g; + $tex =~ s/\\\\/\\\\\n/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; + my $lead = '[^\s]+\s(->|:=|=)'; + my @leads = $tex =~ /&${lead}/g; + my @eols = $tex =~ /&/g; if (0+@leads == 0+@eols && 0+@eols > 0) { - $tex =~ s/&([^\s\}]+)\s/\1&/g; + $tex =~ s/&${lead}/\1&/g; $gathered = 0; + print '% The "gathered" is NOT used because all ' . + (0+@eols) . ' lines are ' . (0+@leads) . " leads\n"; } } $tex =~ s/\$/\\xi{}/g; $tex =~ s/(?<!\{)\^/\\rho{}/g; $tex =~ s/\[\[/\\llbracket\\mathrel{}/g; $tex =~ s/\]\]/\\mathrel{}\\rrbracket{}/g; -$tex =~ s/([\s,>\(])([0-9A-F]{2}(?:-[0-9A-F]{2})+| - [0-9]+(?:\.[0-9]+)?)/\1|\2|/xg; +$tex =~ s/([\s,>(])([0-9A-F]{2}(?:-[0-9A-F]{2})+| + [0-9]+(?:\.[0-9]+)?)(?!\{)/\1|\2|/xg; $tex =~ s/TRUE/|TRUE|/g; $tex =~ s/FALSE/|FALSE|/g; $tex =~ s/\?/\\varnothing{}/g; @@ -687,30 +794,37 @@ $tex =~ s/:=/\\mathrel{\\vDash}/g; $tex =~ s/\.\.>/\\mathrel{\\phiDotted}/g; $tex =~ s/\|{2,}/|/g; $tex =~ s/\|([^\|]+)\|/\\textnormal{\\texttt{\1}}{}/g; -if ($env eq 'phiq') { +$tex =~ s/\{TEXT(\d+)\}/'\\text{' . @texts[$1] . '}';/ge; +if ($macro eq 'phiq') { print '$' if ($tex ne ''); } else { - print '\begin{', $env, '}'; - if ($gathered) { - print '\begin{gathered}'; - } else { - print '\begin{split}'; + print '\begin{', $macro, "}\n"; + if (not($align)) { + if ($gathered) { + print '\begin{gathered}'; + } else { + print '\begin{split}'; + } + print "\n"; } } -if ($gathered) { - $tex =~ s/(\\\\(?:\[[^\]]+\])?)&/\1/g; +if ($gathered and not($align)) { $tex =~ s/^&//g; + $tex =~ s/\n&/\n/g; } print $tex; -if ($env eq 'phiq') { +if ($macro eq 'phiq') { print '$' if ($tex ne ''); } else { - if ($gathered) { - print '\end{gathered}'; - } else { - print '\end{split}'; + if (not($align)) { + print "\n"; + if ($gathered) { + print '\end{gathered}'; + } else { + print '\end{split}'; + } } - print '\end{', $env, '}'; + print "\n" . '\end{' . $macro . '}'; } print '\endinput'; \end{VerbatimOut} @@ -720,8 +834,18 @@ print '\endinput'; % \end{macrocode} % \end{macro} +% \begin{macro}{\phiSaveTo} +% \changes{0.8.0}{2022/11/20}{The output of the \texttt{phiquation} environment can be redirected to a file.} +% Then, we define the |\phiSaveTo| command to instruct the |phiquation| environment that the output should not be sent to the document but saved to the file instead: +% \begin{macrocode} +\makeatletter +\newcommand\phiSaveTo[1]{\def\eolang@phiSaveTo{#1}} +\makeatother +% \end{macrocode} +% \end{macro} + % \begin{macro}{phiquation} -% Then, we define |phiquation| and |phiquation*| environments through a supplementary +% Then, we define the |phiquation| and the |phiquation*| environments through a supplementary % |\eolang@process| command: % \begin{macrocode} \makeatletter\newcommand\eolang@process[1]{ @@ -733,8 +857,10 @@ print '\endinput'; perl "\eolang@tmpdir/eolang-phi.pl" '#1' "\eolang@tmpdir/\jobname/\hash.tex" - \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi}% + \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi + \ifdefined\eolang@phiSaveTo > \eolang@phiSaveTo\fi}% \setcounter{FancyVerbLine}{\value{eolang@lineno}}% + \def\eolang@phiSaveTo{\relax}% } \newenvironment{phiquation*}% {\catcode`\|=12 \VerbatimEnvironment% @@ -774,7 +900,7 @@ print '\endinput'; % \end{macro} % \begin{macro}{nodollar} -% \changes{0.7.0}{2022/11/18}{Now it is possible to use dollar sign instead of \texttt{\char`\\phiq}.} +% \changes{0.7.0}{2022/11/18}{Now it is possible to use dollar sign instead of the \texttt{\char`\\phiq} command.} % Then, we redefine dollar sign: % \begin{macrocode} \ifdefined\eolang@nodollar\else @@ -790,15 +916,16 @@ print '\endinput'; % \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.} % \changes{0.1.0}{2022/10/26}{There are two Perl scripts now: one for \texttt{phiquation}, another one for \texttt{sodg}.} -% \changes{0.2.0}{2022/10/28}{The content of \texttt{atom} and \texttt{data} boxes is parsed automatically as formulas and numbers, respectively.} -% \changes{0.4.0}{2022/10/31}{Labels on the edges are automatically printed as math formulas. Also, boxes are prefixed with \texttt{\char`\\Delta} and \texttt{\char`\\lambda} commands.} +% \changes{0.2.0}{2022/10/28}{The content of the \texttt{atom} and the \texttt{data} boxes is parsed automatically as formulas and numbers, respectively.} +% \changes{0.4.0}{2022/10/31}{Labels on the edges are automatically printed as math formulas. Also, boxes are prefixed with the \texttt{\char`\\Delta} and the \texttt{\char`\\lambda} commands.} % \changes{0.4.0}{2022/10/31}{Relative positioning of vertices fixed.} -% \changes{0.4.0}{2022/10/31}{Transforming arrows added with \texttt{=>} syntax, also markers with exclamation mark syntax.} +% \changes{0.4.0}{2022/10/31}{Transforming arrows added with the \texttt{=>} syntax, also markers with exclamation mark syntax.} % \changes{0.5.0}{2022/11/09}{New syntax introduced that allows to make clones of vertices and all their dependants.} -% \changes{0.5.0}{2022/11/09}{Now edges may have \texttt{break} attribute, to make them shorter.} -% \changes{0.5.0}{2022/11/10}{It is possible to use multiple ``equaltion sign'' symbols for transition arrows \texttt{=>}.} -% \changes{0.5.0}{2022/11/12}{It is possible to use tikz commands inside \texttt{sodg} environment.} -% \changes{0.6.0}{2022/11/13}{The attribute \texttt{rrho} is retired, now \texttt{rho} works just fine in all situations.} +% \changes{0.5.0}{2022/11/09}{Now edges may have the \texttt{break} attribute, to make them shorter.} +% \changes{0.5.0}{2022/11/10}{It is possible to use multiple the ``equaltion sign'' symbols for transition arrows \texttt{=>}.} +% \changes{0.5.0}{2022/11/12}{It is possible to use TikZ commands inside the \texttt{sodg} environment.} +% \changes{0.6.0}{2022/11/13}{The \texttt{rrho} attribute is retired, now \texttt{rho} works just fine in all situations.} +% \changes{0.8.0}{2022/11/20}{The \texttt{tag} attribute is introduced for changing labels inside a vertex circle.} % Then, we create a Perl script for |sodg| graphs processing using |VerbatimOut| from % \href{https://ctan.org/pkg/fancyvrb}{fancyvrb}: % \begin{macrocode} @@ -1037,8 +1164,20 @@ for (my $c = 0; $c < 0+@cmds; $c++) { print ',phi-object'; } print ']'; - print ' (', $head, ')'; - print ' {$' . vertex($head) . '$}'; + print ' (' . $head . ')'; + print ' {'; + if (exists $opts{'tag'}) { + my $t = $opts{'tag'}; + if (index($t, '$') == -1) { + $t = '$' . $t . '$'; + } else { + $t = fmt($t); + } + print $t; + } else { + print '$' . vertex($head) . '$'; + } + print '}'; if (exists $opts{'box'}) { print ' node[phi-box] at ('; print $head, '.south east) {'; @@ -1077,7 +1216,6 @@ print '\endinput'; \RequirePackage{tikz} \usetikzlibrary{arrows} \usetikzlibrary{shapes} - \usetikzlibrary{snakes} \usetikzlibrary{decorations} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{decorations.pathreplacing} @@ -1173,6 +1311,16 @@ print '\endinput'; % \end{macrocode} % \end{macro} +% \begin{macro}{\sodgSaveTo} +% \changes{0.8.0}{2022/11/20}{The output of the \texttt{sodg} environment can be redirected to a file.} +% Then, we define the |\sodgSaveTo| command to instruct the |sodg| environment that the output should not be sent to the document but saved to the file instead: +% \begin{macrocode} +\makeatletter +\newcommand\sodgSaveTo[1]{\def\eolang@sodgSaveTo{#1}} +\makeatother +% \end{macrocode} +% \end{macro} + % \begin{macro}{sodg} % \changes{0.0.2}{2022/10/20}{The environment \texttt{phigure} renamed to \texttt{sodg} for the sake of better semantic. The graph in the picture is solely a SODG graph, that's why the name \texttt{sodg} is better.} % Then, we create a new environment |sodg|, as suggested @@ -1192,9 +1340,11 @@ print '\endinput'; \iexec[trace,stdout=\eolang@tmpdir/\jobname/\hash-post.tex]{ perl "\eolang@tmpdir/eolang-sodg.pl" "\eolang@tmpdir/\jobname/\hash.tex" - \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi}% + \ifdefined\eolang@nocomments | perl -pe 's/\%.*(\\n|$)//g'\fi + \ifdefined\eolang@sodgSaveTo > \eolang@sodgSaveTo\fi}% \catcode`\$\active% \setcounter{FancyVerbLine}{\value{eolang@lineno}}% + \def\eolang@sodgSaveTo{\relax}% }\makeatother % \end{macrocode} % \end{macro} @@ -1202,7 +1352,7 @@ print '\endinput'; % \begin{macro}{\eolang} % Then, we define a simple supplementary command to help you print \eolang{}, the name of our language. % \changes{0.1.0}{2022/10/25}{New command \texttt{\char`\\eolang} added to print the name of the language in both -% normal and anonymous mode of \texttt{acmart}.} +% normal and the anonymous mode of \texttt{acmart}.} % \begin{macrocode} \newcommand\eolang{% \ifdefined\anon% @@ -1217,15 +1367,15 @@ print '\endinput'; % \begin{macro}{\phic} % Then, we define a simple supplementary command to help you print \phic{}, the name of our formal apparatus. % \changes{0.1.0}{2022/10/25}{New command \texttt{\char`\\phic} prints the name of $\varphi$-calculus in both -% normal and anonymous mode of \texttt{acmart}.} +% normal and the anonymous mode of \texttt{acmart}.} % \begin{macrocode} \RequirePackage{hyperref} \newcommand\phic{% \ifdefined\anon% - \anon[\texorpdfstring{$\alpha$}{a}-calculus] - {\texorpdfstring{$\varphi$}{phi}-calculus}% + \anon[\texorpdfstring{$\alpha$}{a}-cal\-cu\-lus] + {\texorpdfstring{$\varphi$}{phi}-cal\-cu\-lus}% \else% - \texorpdfstring{$\varphi$}{phi}-calculus% + \texorpdfstring{$\varphi$}{phi}-cal\-cu\-lus% \fi% } % \end{macrocode} @@ -1233,7 +1383,7 @@ print '\endinput'; % \begin{macro}{\xmir} % 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 anonymous mode of \texttt{acmart}.} +% \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} \newcommand\xmir{% \ifdefined\anon% @@ -1275,12 +1425,37 @@ print '\endinput'; % \end{macrocode} % \end{macro} +% \begin{macro}{\phiOset} +% \changes{0.8.0}{2022/11/20}{New commands \texttt{\char`\\phiOset} and \texttt{\char`\\phiUset} help position text over and under an arrow.} +% Then, we define two commands to position a text over and under an arrow, as suggested \href{https://tex.stackexchange.com/a/194805/1449}{here}: +% \begin{macrocode} +\makeatletter +\newcommand{\phiOset}[2]{% + \mathrel{\mathop{#2}\limits^{ + \vbox to 0ex{\kern-2\ex@ + \hbox{$\scriptscriptstyle#1$}\vss}}}} +\newcommand{\phiUset}[2]{% + \mathrel{\mathop{#2}\limits_{ + \vbox to 0ex{\kern-6.3\ex@ + \hbox{$\scriptscriptstyle#1$}\vss}}}} +\makeatother +% \end{macrocode} +% \end{macro} + % \begin{macro}{\phiMany} % \changes{0.5.0}{2022/11/10}{New command \texttt{\char`\\phiMany} enables iterating over an arrow.} -% Then, we define a command to an arrow with iterating indecies: +% Then, we define a command for an arrow with iterating indecies: % \begin{macrocode} \newcommand\phiMany[3]{% - \overunderset{\scriptscriptstyle #3}{\scriptscriptstyle #2}{#1}} + \phiOset{#3}{\phiUset{#2}{#1}}} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\phiEOL} +% \changes{0.9.0}{2022/11/24}{New command \texttt{\char`\\phiEOL} added, instead of \texttt{\char`\\\char`\\[-4pt]}.} +% Then, we define a command for line breaks in formulas: +% \begin{macrocode} +\newcommand\phiEOL{\\[-4pt]} % \end{macrocode} % \end{macro} diff --git a/macros/latex/contrib/eolang/eolang.pdf b/macros/latex/contrib/eolang/eolang.pdf Binary files differindex 0743e93e95..f22ea00e44 100644 --- a/macros/latex/contrib/eolang/eolang.pdf +++ b/macros/latex/contrib/eolang/eolang.pdf diff --git a/macros/latex/contrib/ffcode/ffcode.dtx b/macros/latex/contrib/ffcode/ffcode.dtx index e50bb899eb..2107516f3e 100644 --- a/macros/latex/contrib/ffcode/ffcode.dtx +++ b/macros/latex/contrib/ffcode/ffcode.dtx @@ -50,7 +50,7 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{ffcode} %<*package> -[2022-11-16 0.6.0 Fixed Font Code] +[2022-11-28 0.7.0 Fixed Font Code] %</package> %<*driver> \documentclass{ltxdoc} @@ -97,7 +97,7 @@ % \begin{ffcode} % int fibo(int n) { % if (n < 2) { -% return n; |$\label{ln:ret}$| +% return n; |\label{ln:ret}| % } % return fibo(n-1)+fibo(n-2); % } @@ -133,6 +133,38 @@ % (stands for ``no continuous numbering'') % option of the package. +% \DescribeMacro{bold} +% You can make your |\ff| pieces look bolder than usual, which may be pretty convenient for some document classes +% (pay attention to the usage of the \href{https://ctan.org/pkg/lmodern}{lmodern} package, without it the bold won't work, as explained \href{https://tex.stackexchange.com/a/215489/1449}{here}): +% \docshotOptions{firstline=4,lastline=10} +% \begin{docshot} +% \documentclass{article} +% \usepackage[paperwidth=3in]{geometry} +% \pagestyle{empty} +% \usepackage{lmodern} +% \usepackage[bold,noframes]{ffcode} +% \begin{document} +% Sometimes it's necessary to make +% code pieces look bolder, like +% the |fibo()| function in this text. +% \end{document} +% \end{docshot} + +% \DescribeMacro{sf} +% You can change the font family of |\ff| pieces to |\sffamily|: +% \docshotOptions{firstline=4,lastline=9} +% \begin{docshot} +% \documentclass{article} +% \usepackage[paperwidth=3in]{geometry} +% \pagestyle{empty} +% \usepackage[sf,bold,noframes]{ffcode} +% \begin{document} +% Sometimes you may want them to look +% not strictly fixed-width, but more +% elegant, like the |fibo()| here. +% \end{document} +% \end{docshot} + % \section{Typesetting} % By the way, the package correctly formats low-height texts, for example, just @@ -196,10 +228,14 @@ % \changes{v0.4.0}{2022/01/09}{Package option \texttt{nobars} added.} % \changes{v0.6.0}{2021/11/14}{We use \texttt{pgfopts} instead of \texttt{xkeyval}.} % \changes{v0.6.0}{2021/11/14}{Package option \texttt{novert} added, to disable redefinition of vertical bar.} +% \changes{v0.7.0}{2021/11/28}{Package option \texttt{bold} added, to make all \texttt{\char`\\ff} pieces look bolder than usual.} +% \changes{v0.7.0}{2021/11/28}{Package option \texttt{sf} added, to make all \texttt{\char`\\ff} pieces be printed as \texttt{\char`\\sffamily}.} % \begin{macrocode} \RequirePackage{pgfopts} \pgfkeys{ /ff/.cd, + bold/.store in=\ff@bold, + sf/.store in=\ff@sf, nopygments/.store in=\ff@nopygments, noframes/.store in=\ff@noframes, nonumbers/.store in=\ff@nonumbers, @@ -271,7 +307,13 @@ % \changes{v0.5.1}{2022/10/30}{Now, the command \texttt{ff} ignores italic and bold and always prints \texttt{\char`\\texttt} as it should be.} % \begin{macrocode} \makeatletter -\newcommand\ff@print[1]{\textnormal{\texttt{#1}}} +\newcommand\ff@print[1]{% + \textnormal{% + \ifdefined\ff@sf\sffamily\else\ttfamily\fi% + \ifdefined\ff@bold\fontseries{b}\selectfont\fi% + #1% + }% +} \makeatother % \end{macrocode} % \end{macro} diff --git a/macros/latex/contrib/ffcode/ffcode.pdf b/macros/latex/contrib/ffcode/ffcode.pdf Binary files differindex f87101ad3f..b2a318eb0d 100644 --- a/macros/latex/contrib/ffcode/ffcode.pdf +++ b/macros/latex/contrib/ffcode/ffcode.pdf |