summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-03-11 03:00:57 +0000
committerNorbert Preining <norbert@preining.info>2022-03-11 03:00:57 +0000
commitdc086771e418d7c66a541d2831b468375c5f7090 (patch)
tree182467c4304d5956a3caa8a691ce27b14faeacaf /macros
parent6367aa11ef0b99d86693b685ab67096514792a0f (diff)
CTAN sync 202203110300
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/asmeconf/README.md8
-rw-r--r--macros/latex/contrib/asmeconf/asmeconf-template.pdfbin599456 -> 585147 bytes
-rw-r--r--macros/latex/contrib/asmeconf/asmeconf-template.tex6
-rw-r--r--macros/latex/contrib/asmeconf/asmeconf.cls27
-rw-r--r--macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdfbin639103 -> 596306 bytes
-rw-r--r--macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdfbin370592 -> 369381 bytes
-rw-r--r--macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex2
-rw-r--r--macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdfbin280349 -> 254973 bytes
-rw-r--r--macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.tex2
-rw-r--r--macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.pdfbin2931161 -> 2930107 bytes
-rw-r--r--macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.tex17
-rw-r--r--macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/demo/trigon_demo.pdfbin419465 -> 416666 bytes
-rw-r--r--macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.dtx13
-rw-r--r--macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.pdfbin367313 -> 366853 bytes
-rw-r--r--macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamercolorthemetrigon.dtx2
-rw-r--r--macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerfontthemetrigon.dtx2
-rw-r--r--macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerinnerthemetrigon.dtx20
-rw-r--r--macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerouterthemetrigon.dtx16
-rw-r--r--macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerthemetrigon.dtx2
-rw-r--r--macros/latex/contrib/create-theorem/create-theorem-doc.pdfbin117102 -> 117097 bytes
-rw-r--r--macros/latex/contrib/create-theorem/create-theorem-doc.tex6
-rw-r--r--macros/latex/contrib/create-theorem/create-theorem.sty92
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx169
-rw-r--r--macros/latex/contrib/easybook/easybook.pdfbin592701 -> 592859 bytes
-rw-r--r--macros/latex/contrib/easybook/easybook.tex26
-rw-r--r--macros/latex/contrib/functional/README.txt5
-rw-r--r--macros/latex/contrib/functional/functional.pdfbin0 -> 189483 bytes
-rw-r--r--macros/latex/contrib/functional/functional.sty686
-rw-r--r--macros/latex/contrib/functional/functional.tex994
-rw-r--r--macros/latex/contrib/tiscreen/README2
-rw-r--r--macros/latex/contrib/tiscreen/doc/tiscreen-doc.pdfbin150094 -> 229778 bytes
-rw-r--r--macros/latex/contrib/tiscreen/doc/tiscreen-doc.tex263
-rw-r--r--macros/latex/contrib/tiscreen/tex/tiscreen.sty149
-rw-r--r--macros/latex/contrib/verifiche/verifiche-example.pdfbin175815 -> 190102 bytes
-rw-r--r--macros/latex/contrib/verifiche/verifiche.dtx120
-rw-r--r--macros/latex/contrib/verifiche/verifiche.pdfbin523647 -> 551397 bytes
-rw-r--r--macros/latex/contrib/xsavebox/ChangeLog6
-rw-r--r--macros/latex/contrib/xsavebox/xsavebox.pdfbin368610 -> 378552 bytes
-rw-r--r--macros/latex/contrib/xsavebox/xsavebox.sty73
-rw-r--r--macros/latex/contrib/xsavebox/xsavebox.tex15
-rw-r--r--macros/luatex/latex/pyluatex/example/beamer.tex122
-rw-r--r--macros/luatex/latex/pyluatex/example/data-visualization.tex137
-rw-r--r--macros/luatex/latex/pyluatex/example/matplotlib-external.tex53
-rw-r--r--macros/luatex/latex/pyluatex/example/matplotlib-pgf.tex61
-rw-r--r--macros/luatex/latex/pyluatex/example/population.csv454
-rw-r--r--macros/luatex/latex/pyluatex/example/readme-custom-env.tex25
-rw-r--r--macros/luatex/latex/pyluatex/example/readme-example.tex32
-rw-r--r--macros/luatex/latex/pyluatex/example/repl.tex84
-rw-r--r--macros/luatex/latex/pyluatex/example/sessions.tex54
-rw-r--r--macros/luatex/latex/pyluatex/example/typesetting-example.tex43
-rw-r--r--macros/luatex/latex/pyluatex/example/typesetting-listings.tex94
-rw-r--r--macros/luatex/latex/pyluatex/example/typesetting-minted.tex81
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex-interpreter.py9
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex.lua37
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex.pdfbin84169 -> 81863 bytes
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex.sty24
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex.tex35
57 files changed, 3666 insertions, 402 deletions
diff --git a/macros/latex/contrib/asmeconf/README.md b/macros/latex/contrib/asmeconf/README.md
index 66bbf88e30..c45516e710 100644
--- a/macros/latex/contrib/asmeconf/README.md
+++ b/macros/latex/contrib/asmeconf/README.md
@@ -1,7 +1,7 @@
#asmeconf: A latex template for ASME conference papers#
- Version 1.28 dated 2022/02/14.
+ Version 1.29 dated 2022/03/10.
####Overview####
This class provides a LaTeX template for ASME Conference papers formatted according to
@@ -79,6 +79,12 @@
---
####Change log####
+ v1.29 (2022/03/10)
+ - Include current date and venue for 2022 IMECE (subject to change)
+ - Edit example .tex file for asmewide.sty to remove description of unreleased development code
+ - Fix bug in nofoot option that stopped capitalization of captions
+ - Adjust scale factors on typewriter (raise to 1.05) and sans serif fonts (lower to 0.91)
+
v1.28 (2022/02/14)
- Introduce asmewide.sty, an experimental package for setting page-width equations in a two column format. A document with examples of use is included.
- Increase scale of sans serif font under fontspec from 0.9 to 0.94, to better match newtxtext under pdflatex
diff --git a/macros/latex/contrib/asmeconf/asmeconf-template.pdf b/macros/latex/contrib/asmeconf/asmeconf-template.pdf
index 81365c217c..1544f87ee3 100644
--- a/macros/latex/contrib/asmeconf/asmeconf-template.pdf
+++ b/macros/latex/contrib/asmeconf/asmeconf-template.pdf
Binary files differ
diff --git a/macros/latex/contrib/asmeconf/asmeconf-template.tex b/macros/latex/contrib/asmeconf/asmeconf-template.tex
index 1e3c938e79..8d3fbfb485 100644
--- a/macros/latex/contrib/asmeconf/asmeconf-template.tex
+++ b/macros/latex/contrib/asmeconf/asmeconf-template.tex
@@ -4,7 +4,7 @@
%% This file is asmeconf-template.tex, a LaTeX template to format ASME Conference papers according to
%% the requirements on ASME's conference web pages, and including hypertext support for the pdf.
%%
-%% This file is version 1.28 dated 2022/02/14
+%% This file is version 1.29 dated 2022/03/10
%%
%% As of version 1.11, this template defaults to ASME's newer conference guidelines first posted July 2019.
%% Those guidelines changed the requested author block formatting to be inline.
@@ -113,8 +113,8 @@
\ConfName{Proceedings of the ASME 2022\linebreak International Mechanical Engineering Congress and Exposition}
\ConfAcronym{IMECE2022}
-\ConfDate{November XX-YY, 2022} % update once this is known (expected March 2022)
-\ConfCity{Location, ST} % update once this is known (expected March 2022)
+\ConfDate{October 30--November 3, 2022} % update
+\ConfCity{Columbus, OH} % update
\PaperNo{IMECE2022-XXXX}
% Units of measure (e.g., cm) and other specialty lowercase terms in the title should be
diff --git a/macros/latex/contrib/asmeconf/asmeconf.cls b/macros/latex/contrib/asmeconf/asmeconf.cls
index 8a2a2c952f..e513eee7b8 100644
--- a/macros/latex/contrib/asmeconf/asmeconf.cls
+++ b/macros/latex/contrib/asmeconf/asmeconf.cls
@@ -5,8 +5,8 @@
%% ASME conference requirements as represented on ASME's conference web pages in 2022.
%%
%% This file's version and date:
- \def\versionno{1.28}
- \def\versiondate{2022/02/14\space}
+ \def\versionno{1.29}
+ \def\versiondate{2022/03/10\space}
%%
%% Author: John H. Lienhard, V
%% Department of Mechanical Engineering
@@ -349,9 +349,9 @@
\DeclareOption{lineno}{\ac@linenotrue}
%% option to omit ASME footer [nofoot]
-\DeclareOption{nofoot}{%
- \AtBeginDocument{\pagestyle{plain}}%
-}
+\newif\ifac@nofoot\ac@nofootfalse
+\DeclareOption{nofoot}{\ac@nofoottrue}
+
%%% option [contractor] to obtain government contractor copyright notice.
\newif\ifac@contractor\ac@contractorfalse
@@ -507,12 +507,12 @@
\RequirePackage[]{babel}
\ifpdftex
- \RequirePackage[]{newtxtext}
- \RequirePackage[varqu,varl]{inconsolata}% sans typewriter font
+ \RequirePackage[helvratio=.91]{newtxtext}% rescaled 22/03/10
+ \RequirePackage[varqu,varl,scale=1.05]{inconsolata}% sans typewriter font % rescaled 22/03/10
\RequirePackage[]{newtxmath}
\else
\ifac@fontspec
- \RequirePackage[varqu,varl]{inconsolata} % typewriter font for math
+ \RequirePackage[varqu,varl]{inconsolata} % typewriter font for math
\renewcommand\rmdefault{ntxtlf} % roman font for math
\RequirePackage[T1]{fontenc} % qhv is not TU encoded, 2021/12/24
\DeclareFontFamily{T1}{\sfdefault}{} % sf for math
@@ -538,11 +538,11 @@
BoldFont = *-bold,
BoldItalicFont = *-bolditalic,
Numbers = Lining,
- Scale=0.94,% same as for newtx; former value 0.9 too small 2022/01/15
+ Scale=0.91,% same as for newtx; former value 0.9 too small 2022/01/15
]
\setmonofont{Inconsolatazi4}[% This otf font ships with the LaTeX Inconsolata package (it's in TeX Live)
\MonoNotMono,% match newtxtext if we enable wordspacing
- Scale=1,
+ Scale=1.05,% rescaled from 1, 22/03/10
Extension = .otf,
UprightFont = *-Regular,
ItalicFont = *-Regular,% has no italic face
@@ -905,8 +905,8 @@
\babelprovide[import, captions/abstract = Muhtasari, language = Default]{swahili}
%
\else % use lualatex without font support for other languages (easier set-up and still enables luacode for numerics)
- \RequirePackage[nofontspec]{newtxtext}% will lose some accented characters this way ... better to use fontspec
- \RequirePackage[varqu,varl]{inconsolata}% sans typewriter font
+ \RequirePackage[nofontspec,helvratio=0.91]{newtxtext}% will lose some accented characters this way ... better to use fontspec
+ \RequirePackage[varqu,varl,scale=1.05]{inconsolata}% sans typewriter font
\RequirePackage[]{newtxmath}
\fi
\fi
@@ -999,6 +999,9 @@
\fancyfoot[CE,CO]{\@SetFont\thepage\\[1ex]\footnotesize The United States Government retains, and by accepting the article for publication, the publisher acknowledges that the United States Government retains, a non-exclusive, paid-up, irrevocable, worldwide license to publish or reproduce the published form of this work, or allow others to do so, for United States Government purposes.}
\fi
+\ifac@nofoot
+ \fancyfoot[RO,RE]{}
+\fi
%%%%%% footnotes %%%%%%%
\RequirePackage{fnpos}
diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf b/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf
index 600ff30201..d765aef5a3 100644
--- a/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf
+++ b/macros/latex/contrib/asmeconf/examples/asmeconf-authorgrid-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf b/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf
index c2fc29a440..05e276803f 100644
--- a/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf
+++ b/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.pdf
Binary files differ
diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex b/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex
index c4ae6c0497..242e35ce91 100644
--- a/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex
+++ b/macros/latex/contrib/asmeconf/examples/asmeconf-fontspec.tex
@@ -188,7 +188,7 @@ The needed fonts are listed in Table~\ref{tab:2}.
%%%%%%%%%%%%%%% two column table %%%%%%%%%%%%%%%%%%
\NewDocumentCommand\R{O{11pt}}{\rule{0pt}{#1}}
\begin{table*}[t!]
-\caption{System fonts used by \AC\ with \FS. For all fonts, load regular and bold face. For Latin, Cyrillic, and Greek, also load italic and bold italic. For Noto Sans Arabic, install semibold instead of bold.\label{tab:2}}%
+\caption{System fonts used by \NoCaseChange{\AC} with \NoCaseChange{\FS}. For all fonts, load regular and bold face. For Latin, Cyrillic, and Greek, also load italic and bold italic. For Noto Sans Arabic, install semibold instead of bold.\label{tab:2}}%
\centering{%
\begin{tabular*}{\textwidth}{@{\hspace*{0.5em}}@{\extracolsep{\fill}}>{\raggedright}p{6em}>{\raggedright}p{12em}>{\raggedright}p{10em}p{23em}@{\hspace*{0.5em}}}
\toprule
diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf b/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf
index 3443ed0425..08d31a1ec5 100644
--- a/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf
+++ b/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.tex b/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.tex
index 891c2207d7..7857276b96 100644
--- a/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.tex
+++ b/macros/latex/contrib/asmeconf/examples/asmeconf-lualatex-ode-example.tex
@@ -191,7 +191,7 @@ Here, $A$ is a constant. We may adopt a fourth-order Runge-Kutta algorithm for t
The algorithm is implemented directly in the preamble of this file, and the results are plotted in Fig.~\ref{fig:1} for $A = \{0.25, 0.5, 0.75, 1.0\}$. Plotting is done using the \texttt{PGFPLOTS} package~\cite{pgfplots}.
-Landscape figures, such as Fig.~\ref{fig:1}, may be produced at full-page size by putting \verb|\usepackage[figuresright]{rotating}| in your \texttt{.tex} file's preamble and using the \texttt{sidewaysfigure*} environment~\cite{fairbairns}.
+Landscape figures may be produced at full-page size by putting \verb|\usepackage[figuresright]{rotating}| (Fig.~\ref{fig:1}) into your \texttt{.tex} file's preamble and using the \texttt{sidewaysfigure*} environment~\cite{fairbairns}.
\begin{sidewaysfigure*}
\begin{tikzpicture}
diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.pdf b/macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.pdf
index 3b915adbcc..cf119cdbde 100644
--- a/macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.pdf
+++ b/macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.pdf
Binary files differ
diff --git a/macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.tex b/macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.tex
index 209cf294ca..2456b0266d 100644
--- a/macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.tex
+++ b/macros/latex/contrib/asmeconf/examples/asmeconf-wide-equation-example/asmeconf-template-widetext.tex
@@ -11,15 +11,14 @@
%%
%% NB: the strip environment from cuted is incompatible with the [lineno] option to asmeconf!
-\documentclass[nofoot,colorlinks,balance,pdf-a]{asmeconf}
+\documentclass[nofoot,colorlinks,balance,pdf-acolorlinks,balance,pdf-a]{asmeconf}
-\def\ACwidetextversion{1.0}
-\def\ACwidetextdate{January 10, 2022}
+\def\ACwidetextversion{1.1}
+\def\ACwidetextdate{February 15, 2022}
\usepackage{lipsum}% Latin filler text
\usepackage{asmewide}
-
\begin{filecontents}{asme-wide-equations.bib}
@online{lienhard2021,
author = {Lienhard, John H., V},
@@ -123,7 +122,6 @@ to be read---the rest is simply filler to aid in layout.}
\subsection{Subsection}
\lipsum[5-6]
-
%%%%%%%%%%%%%%%%%%%% Example WT1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Single Wide Equation on the Page}
@@ -226,15 +224,16 @@ Our competitor's data & 72.321 & 141.384 \\[1pt]
\end{table*}
%%%%%%%%%%%%%%%% end table %%%%%%%%%%%%%%%%%%%
-\lipsum[17-24]
+\lipsum[17-23]
+\lipsum[24]
%%%%%%%%%%%%%%%%%%%% Examples WT4 & WT5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Wide Equation Pair Split Across Page Break and Followed by Wide Equation}
-\textcolor{red}{Here, we turn off automatic top line so that it does not appear again at the top of the next page: \texttt{\textbackslash TopLineOff}. We instead issue a command to create the top line inside the \texttt{widetext} environment, \texttt{\textbackslash LineAbove}. We must remember to restore the automatic top line after we exit the \texttt{widetext} environment: \texttt{\textbackslash TopLineOn}.}
+\textcolor{red}{Note that the upper rule is cleared after the first use in a \texttt{widetext} environment. This means that it will not show up at the top of the next page.}
-\textcolor{red}{The \texttt{\textbackslash newpage} command may optionally be used between the equations to force the second one onto the following page, e.g., try removing the source code line \texttt{\textbackslash lipsum[27]} with and without \texttt{\textbackslash newpage}.}
+\textcolor{red}{The \texttt{\textbackslash newpage} command may optionally be used between the equations to force the second one onto the following page, e.g., try removing the source code line \texttt{\textbackslash lipsum[24]} with and without \texttt{\textbackslash newpage}.}
\begin{widetext}
\begin{equation}\mathbf{WT4:}
@@ -295,7 +294,7 @@ q_\textrm{gray} & q_\textrm{int, $T_1$} & q_\textrm{int, $T_m$} & q_\textrm{exa
\lipsum[50-60]
-\textcolor{red}{In this case, we drop the top line: \texttt{\textbackslash begin\{widetext\}[][b]}.}
+\textcolor{red}{In the following example, we leave out the top line: \texttt{\textbackslash begin\{widetext\}[][b]}.}
\vskip 80pt% <== an extra skip to push this widetext over the edge
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/demo/trigon_demo.pdf b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/demo/trigon_demo.pdf
index 45942368e5..157574bf15 100644
--- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/demo/trigon_demo.pdf
+++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/demo/trigon_demo.pdf
Binary files differ
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.dtx b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.dtx
index 7e1dce7af9..bc46840940 100644
--- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.dtx
+++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.dtx
@@ -426,6 +426,19 @@ An easy way to customize the theme is to redefine these colors using
\end{lstlisting}
in your preamble.
+\subsection{Logos}
+
+The package allows the inclusion of logos on the title page and on the content
+slides. For that, the following commands are defined:
+\begin{lstlisting}
+ \biglogo[<options>]{path/to/your/titlepage_logo}
+ \smalllogo[<options>]{path/to/your/titlepage_logo}
+\end{lstlisting}
+These two commands are just replacements for |\includegraphics| and they will
+pass the options as-is so you can perfectly size and position the images.
+
+
+
\section{Tips \& Tricks}
\subsection{Backup Slides}
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.pdf b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.pdf
index 99d6007081..f70379b53a 100644
--- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.pdf
+++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/docs/trigontheme.pdf
Binary files differ
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamercolorthemetrigon.dtx b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamercolorthemetrigon.dtx
index d5da8918f1..9e5780a7e7 100644
--- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamercolorthemetrigon.dtx
+++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamercolorthemetrigon.dtx
@@ -13,7 +13,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{beamercolorthemetrigon}[2021/11/10 v0.6.2 Trigon color theme]
+\ProvidesPackage{beamercolorthemetrigon}[2022/03/10 v0.6.3 Trigon color theme]
%</package>
% \fi
% \CheckSum{0}
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerfontthemetrigon.dtx b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerfontthemetrigon.dtx
index 790af1b4f9..0d2d1b15ba 100644
--- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerfontthemetrigon.dtx
+++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerfontthemetrigon.dtx
@@ -13,7 +13,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{beamerfontthemetrigon}[2021/11/10 v0.6.2 Trigon font theme]
+\ProvidesPackage{beamerfontthemetrigon}[2022/03/10 v0.6.3 Trigon font theme]
%</package>
% \fi
% \CheckSum{0}
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerinnerthemetrigon.dtx b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerinnerthemetrigon.dtx
index 614cfb3854..5726c1a543 100644
--- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerinnerthemetrigon.dtx
+++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerinnerthemetrigon.dtx
@@ -13,7 +13,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{beamerinnerthemetrigon}[2021/11/10 v0.6.2 Trigon inner theme]
+\ProvidesPackage{beamerinnerthemetrigon}[2022/03/10 v0.6.3 Trigon inner theme]
%</package>
% \fi
% \CheckSum{0}
@@ -46,12 +46,15 @@
%
% \subsubsection{Definitions}
%
-% We define the command |\logobig| to specify the logo that needs to be applied
-% displayed on the title frame.
+% We define the command |\biglogo| to specify the logo that needs to be
+% displayed on the title frame. This command is just a replacement for
+% |\includegraphics|, so it accepts the same options.
% \begin{macrocode}
\def\logbig{}
-\newcommand\biglogo[1]{
- \def\logbig{#1}
+\newcommand\biglogo[2][width=0.28\textwidth]{
+ \ifx#2\@empty\else
+ \def\logbig{\includegraphics[#1]{#2}}
+ \fi
}
% \end{macrocode}
%
@@ -290,7 +293,7 @@
\path[fill=tBg]\rightTriangle{0.45\paperwidth}{\the\paperheight};
\ifx\logbig\@empty \else
\node[anchor=north east,inner sep=0mm] at
- (.96*\the\paperwidth,.96*\the\paperheight) {\includegraphics[width=0.28\textwidth]{\logbig}};
+ (.96*\the\paperwidth,.96*\the\paperheight) {\logbig};
\fi
\end{tikzpicture}
}
@@ -305,7 +308,8 @@
\useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);
\leftColorTriangle{0.58\paperwidth}{0}{tGrey!30!tBg}
\ifx\logbig\@empty \else
- \node[anchor=north east,inner sep=0mm] at (.94*\the\paperwidth,.94*\the\paperheight) {\includegraphics[width=0.33\textwidth]{\logbig}};
+ \node[anchor=north east,inner sep=0mm] at
+ (.94*\the\paperwidth,.94*\the\paperheight) {\logbig};
\fi
\ifx\inserttitlegraphic\@empty
\leftColorTriangle{0.58\paperwidth}{\the\paperheight}{tTheme}
@@ -491,7 +495,7 @@
\begin{minipage}[t][][t]{\textwidth}
\centering%
\ifx\logbig\@empty \else
- \includegraphics[height=0.15\textheight]{\logbig}
+ \logbig
\fi
\end{minipage}
\vskip15pt
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerouterthemetrigon.dtx b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerouterthemetrigon.dtx
index d33c019bcc..de5dc23c16 100644
--- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerouterthemetrigon.dtx
+++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerouterthemetrigon.dtx
@@ -13,7 +13,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{beamerouterthemetrigon}[2021/11/10 v0.6.2 Trigon outer theme]
+\ProvidesPackage{beamerouterthemetrigon}[2022/03/10 v0.6.3 Trigon outer theme]
%</package>
% \fi
% \CheckSum{0}
@@ -35,12 +35,16 @@
% \end{macrocode}
%
% \subsubsection{Definitions}
-% We define the command |\logsmall| to specify the logo that needs to be applied
-% displayed on all normal frames.
+%
+% We define the command |\smalllogo| to specify the logo that needs to be applied
+% displayed on all normal frames. This command is just a replacement for
+% |\includegraphics|, so it accepts the same options.
% \begin{macrocode}
\def\logsmall{}
-\newcommand\smalllogo[1]{
- \def\logsmall{#1}
+\newcommand\smalllogo[2][width=20pt]{
+ \ifx#2\@empty\else
+ \def\logsmall{\includegraphics[#1]{#2}}
+ \fi
}
% \end{macrocode}
%
@@ -100,7 +104,7 @@
\defbeamertemplate{headline}{none}{}
\defbeamertemplate*{headline}{logo}{
\ifx\logsmall\@empty\else
- \hfill\includegraphics[width=20pt]{\logsmall}\hspace{20pt}\vspace{-40pt}
+ \hfill\logsmall\hspace{20pt}\vspace{-40pt}
\fi
}
% \end{macrocode}
diff --git a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerthemetrigon.dtx b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerthemetrigon.dtx
index 0f097e81ac..f2c56ad5ea 100644
--- a/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerthemetrigon.dtx
+++ b/macros/latex/contrib/beamer-contrib/themes/beamertheme-trigon/source/beamerthemetrigon.dtx
@@ -13,7 +13,7 @@
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{beamerthemetrigon}[2021/11/10 v0.6.2 Trigon Beamer theme]
+\ProvidesPackage{beamerthemetrigon}[2022/03/10 v0.6.3 Trigon Beamer theme]
%</package>
% \fi
% \CheckSum{0}
diff --git a/macros/latex/contrib/create-theorem/create-theorem-doc.pdf b/macros/latex/contrib/create-theorem/create-theorem-doc.pdf
index 0339c47d91..5ec3992fbe 100644
--- a/macros/latex/contrib/create-theorem/create-theorem-doc.pdf
+++ b/macros/latex/contrib/create-theorem/create-theorem-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/create-theorem/create-theorem-doc.tex b/macros/latex/contrib/create-theorem/create-theorem-doc.tex
index 8a3bf3f607..ef84ddfca5 100644
--- a/macros/latex/contrib/create-theorem/create-theorem-doc.tex
+++ b/macros/latex/contrib/create-theorem/create-theorem-doc.tex
@@ -85,10 +85,12 @@
\begin{document}
+\def\PackageVersion{2022/03/10}
+
\title{\createtheorempackage{}\\\smallskip\itshape Initializing theorem-like environments with multilingual support}
\author{Jinwen XU}
-\thanks{Corresponding to: \texttt{\createtheorempackage{} 2022/03/03}}
-\date{March 2022, in Paris}
+\thanks{Corresponding to: \texttt{\createtheorempackage{} \PackageVersion}}
+\date{\TheDate{\PackageVersion}[only-year-month], in Paris}
\maketitle
diff --git a/macros/latex/contrib/create-theorem/create-theorem.sty b/macros/latex/contrib/create-theorem/create-theorem.sty
index f9fa3d4e9f..b7439ea466 100644
--- a/macros/latex/contrib/create-theorem/create-theorem.sty
+++ b/macros/latex/contrib/create-theorem/create-theorem.sty
@@ -13,7 +13,7 @@
\RequirePackage{l3keys2e}
\ProvidesExplPackage
{create-theorem}
- {2022/03/03} {}
+ {2022/03/10} {}
{Initializing theorem-like environments with multilingual support}
\keys_define:nn { create-theorem }
@@ -90,27 +90,27 @@
, Crefname .value_required:n = true
, heading~style .code:n = { \crthm_set_name_style_heading:en { \l__crthm_current_env_tl } { #1 } }
, heading~style .value_required:n = true
- , heading-style .meta:n = { heading~style = #1 }
+ , heading-style .meta:n = { heading~style = { #1 } }
, heading-style .value_required:n = true
- , heading style .meta:n = { heading~style = #1 }
+ , heading style .meta:n = { heading~style = { #1 } }
, heading style .value_required:n = true
, crefname~style .code:n = { \crthm_set_name_style_crefname:en { \l__crthm_current_env_tl } { #1 } }
, crefname~style .value_required:n = true
- , crefname-style .meta:n = { crefname~style = #1 }
+ , crefname-style .meta:n = { crefname~style = { #1 } }
, crefname-style .value_required:n = true
- , crefname style .meta:n = { crefname~style = #1 }
+ , crefname style .meta:n = { crefname~style = { #1 } }
, crefname style .value_required:n = true
, Crefname~style .code:n = { \crthm_set_name_style_Crefname:en { \l__crthm_current_env_tl } { #1 } }
, Crefname~style .value_required:n = true
- , Crefname-style .meta:n = { Crefname~style = #1 }
+ , Crefname-style .meta:n = { Crefname~style = { #1 } }
, Crefname-style .value_required:n = true
- , Crefname style .meta:n = { Crefname~style = #1 }
+ , Crefname style .meta:n = { Crefname~style = { #1 } }
, Crefname style .value_required:n = true
, numbering~style .code:n = { \crthm_set_name_style_numbering:en { \l__crthm_current_env_tl } { #1 } }
, numbering~style .value_required:n = true
- , numbering-style .meta:n = { numbering~style = #1 }
+ , numbering-style .meta:n = { numbering~style = { #1 } }
, numbering-style .value_required:n = true
- , numbering style .meta:n = { numbering~style = #1 }
+ , numbering style .meta:n = { numbering~style = { #1 } }
, numbering style .value_required:n = true
, unknown .code:n = {}
}
@@ -317,17 +317,23 @@
\cs_set:cpn { #4 ref@ #1 @format@second } ##1##2##3
{
\crefpairconjunction
+ \group_begin:
\crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 }
+ \group_end:
}
\cs_set:cpn { #4 ref@ #1 @format@middle } ##1##2##3
{
\crefmiddleconjunction
+ \group_begin:
\crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 }
+ \group_end:
}
\cs_set:cpn { #4 ref@ #1 @format@last } ##1##2##3
{
\creflastconjunction
+ \group_begin:
\crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 }
+ \group_end:
}
\crthm_define_format_long_version:nnnn { #2 } { #4 refrange@ #1 @format }
@@ -355,26 +361,32 @@
\cs_set:cpn { #4 refrange@ #1 @format@second } ##1##2##3##4##5##6
{
\crefpairconjunction
+ \group_begin:
\crthm_format_long_generic:nnnnnn
{ \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } }
{ \tl_use:c { g_crthm_number_style_ #2 _tl } { ##2 } }
{ ##3 } { ##4 } { ##5 } { ##6 }
+ \group_end:
}
\cs_set:cpn { #4 refrange@ #1 @format@middle } ##1##2##3##4##5##6
{
\crefmiddleconjunction
+ \group_begin:
\crthm_format_long_generic:nnnnnn
{ \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } }
{ \tl_use:c { g_crthm_number_style_ #2 _tl } { ##2 } }
{ ##3 } { ##4 } { ##5 } { ##6 }
+ \group_end:
}
\cs_set:cpn { #4 refrange@ #1 @format@last } ##1##2##3##4##5##6
{
\creflastconjunction
+ \group_begin:
\crthm_format_long_generic:nnnnnn
{ \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } }
{ \tl_use:c { g_crthm_number_style_ #2 _tl } { ##2 } }
{ ##3 } { ##4 } { ##5 } { ##6 }
+ \group_end:
}
}
@@ -387,7 +399,7 @@
{
\cs_new:cn { crthm_format_ #2 :nnn }
{
- #3 ##2 #4 \nobreakspace { \tl_use:c { g_crthm_number_style_ #1 _tl } { ##1 } } ##3
+ { #3 } ##2 { #4 } \nobreakspace { \tl_use:c { g_crthm_number_style_ #1 _tl } { ##1 } } ##3
}
\cs_set_eq:cc { #2 } { crthm_format_ #2 :nnn }
}
@@ -401,7 +413,7 @@
{
\cs_new:cn { crthm_format_ #2 :nnnnnn }
{
- #3 ##3 #4
+ { #3 } ##3 { #4 }
\nobreakspace \crefrangepreconjunction
{ \tl_use:c { g_crthm_number_style_ #1 _tl } { ##1 } }
##4 \crefrangeconjunction
@@ -519,18 +531,18 @@
, name .value_required:n = true
, name~style .code:n = { \exp_args:Ne \NameTheorem { \l__crthm_current_env_tl } { #1 } }
, name~style .value_required:n = true
- , name-style .meta:n = { name~style = #1 }
+ , name-style .meta:n = { name~style = { #1 } }
, name-style .value_required:n = true
- , name style .meta:n = { name~style = #1 }
+ , name style .meta:n = { name~style = { #1 } }
, name style .value_required:n = true
, style .code:n = { \bool_set_true:N \l__crthm_creating_apply_style_bool
\tl_set:Nn \l__crthm_creating_apply_style_tl { #1 } }
, style .value_required:n = true
- , apply~style .meta:n = { style = #1 }
+ , apply~style .meta:n = { style = { #1 } }
, apply~style .value_required:n = true
- , apply-style .meta:n = { style = #1 }
+ , apply-style .meta:n = { style = { #1 } }
, apply-style .value_required:n = true
- , apply style .meta:n = { style = #1 }
+ , apply style .meta:n = { style = { #1 } }
, apply style .value_required:n = true
, numberless .bool_set:N = \l__crthm_creating_numberless_bool
, create~starred~version .bool_set:N = \l__crthm_creating_create_starred_bool
@@ -542,9 +554,9 @@
, copy~existed .code:n = { \bool_set_true:N \l__crthm_creating_copy_existed_bool
\tl_set:Nn \l__crthm_creating_copy_existed_tl { #1 } }
, copy~existed .value_required:n = true
- , copy-existed .meta:n = { copy~existed = #1 }
+ , copy-existed .meta:n = { copy~existed = { #1 } }
, copy-existed .value_required:n = true
- , copy existed .meta:n = { copy~existed = #1 }
+ , copy existed .meta:n = { copy~existed = { #1 } }
, copy existed .value_required:n = true
, quiet .bool_set:N = \l__crthm_creating_quiet_bool
, quiet .initial:n = { false }
@@ -555,27 +567,27 @@
{
, parent~counter .code:n = { \crthm_counter_within:en { \l__crthm_current_env_tl } { #1 } }
, parent~counter .value_required:n = true
- , parent-counter .meta:n = { parent~counter = #1 }
+ , parent-counter .meta:n = { parent~counter = { #1 } }
, parent-counter .value_required:n = true
- , parent counter .meta:n = { parent~counter = #1 }
+ , parent counter .meta:n = { parent~counter = { #1 } }
, parent counter .value_required:n = true
- , number~within .meta:n = { parent~counter = #1 }
+ , number~within .meta:n = { parent~counter = { #1 } }
, number~within .value_required:n = true
- , number-within .meta:n = { parent~counter = #1 }
+ , number-within .meta:n = { parent~counter = { #1 } }
, number-within .value_required:n = true
- , number within .meta:n = { parent~counter = #1 }
+ , number within .meta:n = { parent~counter = { #1 } }
, number within .value_required:n = true
, shared~counter .code:n = { \crthm_counter_alias:en { \l__crthm_current_env_tl } { #1 } }
, shared~counter .value_required:n = true
- , shared-counter .meta:n = { shared~counter = #1 }
+ , shared-counter .meta:n = { shared~counter = { #1 } }
, shared-counter .value_required:n = true
- , shared counter .meta:n = { shared~counter = #1 }
+ , shared counter .meta:n = { shared~counter = { #1 } }
, shared counter .value_required:n = true
- , number~like .meta:n = { shared~counter = #1 }
+ , number~like .meta:n = { shared~counter = { #1 } }
, number~like .value_required:n = true
- , number-like .meta:n = { shared~counter = #1 }
+ , number-like .meta:n = { shared~counter = { #1 } }
, number-like .value_required:n = true
- , number like .meta:n = { shared~counter = #1 }
+ , number like .meta:n = { shared~counter = { #1 } }
, number like .value_required:n = true
, unknown .code:n = {}
}
@@ -692,33 +704,33 @@
, name .value_required:n = true
, name~style .code:n = { \exp_args:Ne \NameTheorem { \l__crthm_current_env_tl } { #1 } }
, name~style .value_required:n = true
- , name-style .meta:n = { name~style = #1 }
+ , name-style .meta:n = { name~style = { #1 } }
, name-style .value_required:n = true
- , name style .meta:n = { name~style = #1 }
+ , name style .meta:n = { name~style = { #1 } }
, name style .value_required:n = true
, parent~counter .code:n = { \crthm_counter_within:en { \l__crthm_current_env_tl } { #1 } }
, parent~counter .value_required:n = true
- , parent-counter .meta:n = { parent~counter = #1 }
+ , parent-counter .meta:n = { parent~counter = { #1 } }
, parent-counter .value_required:n = true
- , parent counter .meta:n = { parent~counter = #1 }
+ , parent counter .meta:n = { parent~counter = { #1 } }
, parent counter .value_required:n = true
- , number~within .meta:n = { parent~counter = #1 }
+ , number~within .meta:n = { parent~counter = { #1 } }
, number~within .value_required:n = true
- , number-within .meta:n = { parent~counter = #1 }
+ , number-within .meta:n = { parent~counter = { #1 } }
, number-within .value_required:n = true
- , number within .meta:n = { parent~counter = #1 }
+ , number within .meta:n = { parent~counter = { #1 } }
, number within .value_required:n = true
, shared~counter .code:n = { \crthm_counter_alias:en { \l__crthm_current_env_tl } { #1 } }
, shared~counter .value_required:n = true
- , shared-counter .meta:n = { shared~counter = #1 }
+ , shared-counter .meta:n = { shared~counter = { #1 } }
, shared-counter .value_required:n = true
- , shared counter .meta:n = { shared~counter = #1 }
+ , shared counter .meta:n = { shared~counter = { #1 } }
, shared counter .value_required:n = true
- , number~like .meta:n = { shared~counter = #1 }
+ , number~like .meta:n = { shared~counter = { #1 } }
, number~like .value_required:n = true
- , number-like .meta:n = { shared~counter = #1 }
+ , number-like .meta:n = { shared~counter = { #1 } }
, number-like .value_required:n = true
- , number like .meta:n = { shared~counter = #1 }
+ , number like .meta:n = { shared~counter = { #1 } }
, number like .value_required:n = true
, unknown .code:n = {}
}
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index 660f3e6375..cb9c5ee12e 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -15,7 +15,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2022/03/08}{1.643}
+\ProvidesExplClass{easybook}{2022/03/10}{1.643}
{Easily typesetting Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -303,7 +303,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2022/03/08}{1.643}
+\ProvidesExplPackage{easybase}{2022/03/10}{1.643}
{Easily typesetting Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -433,9 +433,10 @@
}
\PassOptionsToPackage{list = off}{bicaption}
-\PassOptionsToPackage{many}{tcolorbox}
+\PassOptionsToPackage{nonewpage}{imakeidx}
\PassOptionsToPackage{upint}{newtxmath}
\PassOptionsToPackage{svgnames}{xcolor}
+\PassOptionsToPackage{many}{tcolorbox}
\ProcessKeysOptions{easybase}
\PassOptionsToPackage{\g__eb_ctex_options_clist}{ctex}
\@ifclassloaded{ctexbook}{}
@@ -548,10 +549,10 @@
{
\color{ctex@emph}
\eb@tag@brackets@left
- \bgroup
- \ignorespaces{#1}\unskip\@@italiccorr
- \eb@tag@brackets@right
- \egroup
+ {
+ \ignorespaces{#1}\unskip\@@italiccorr
+ \eb@tag@brackets@right
+ }
}
}
\ctex_define:nn { style }
@@ -837,14 +838,14 @@
{ \bool_set_true:N \l__eb_fnpara_bottom_bool }
{ flush }
{
- \tl_set:Nn \l__eb_footnote_value_tl { default }
+ \tl_set:Nn \l__eb_footnote_value_tl { plain }
\clist_push:Nn \l__eb_footnote_value_clist {#1}
}
}
{
\bool_lazy_or:nnT
{ \str_if_eq_p:nn {#1} { hang } }
- { \str_if_eq_p:nn {#1} { default } }
+ { \str_if_eq_p:nn {#1} { plain } }
{ \tl_set:Nn \l__eb_footnote_value_tl {#1} }
}
}
@@ -873,12 +874,12 @@
\clist_new:N \l__eb_footnote_value_clist
\ctex_define:nn { hdrset }
{
- fnindent .dim_set:N = \footindent,
- fnindent .initial:n = 0.8em,
- fnparskip .skip_set:N = \footparskip,
+ fnfirstindent .dim_set:N = \fnfirstindent,
+ fnfirstindent .initial:n = 0.8em,
+ fnparskip .skip_set:N = \fnparskip,
fnparskip .initial:n = 0ex plus .1ex,
- fnparindent .tl_set:N = \footparindent,
- fnparindent .initial:n = 2em,
+ fnafterindent .tl_set:N = \fnafterindent,
+ fnafterindent .initial:n = 2em,
fnpara-form .tl_set:N = \l__eb_fnpara_format_tl,
fntext-pos .tl_set:N = \l__eb_fntext_position_tl,
fntext-pos .initial:n = super,
@@ -888,7 +889,7 @@
fncust-form .code:n = \eb_fnboth_format_set:nn {#1} { cust },
fnboth-form .meta:n = { fnmate-form = #1,fncust-form = #1 },
footnotetype .multichoices:nn =
- { default,hang,bottom,para,flush }
+ { plain,hang,bottom,para,flush }
{ \eb_footnote_value_handle:n {#1} },
footnotetype .value_required:n = true,
footnotetype .initial:n = hang,
@@ -931,51 +932,61 @@
\eb_fnpara_if_pos_bottom:
}
\cs_new_protected:Npn \setspread #1 { \linespread{#1}\selectfont }
+\cs_new:Npn \eb@footmisc@ifvoid #1#2#3 { \ifvoid #1#2\else #3\fi }
\cs_new_protected:Npn \eb_fnpara_if_pos_bottom:
{
\bool_if:NT \l__eb_fnpara_bottom_bool
{
- \cs_set:Npn \@makecol
+ \@ifpackageloaded{footmisc}
+ {\msg_warning:nn { easybase } { bottom-not-compatible }}
{
- \setbox\@outputbox\box\@cclv
- \xdef\@freelist{\@freelist\@midlist}
- \global\let\@midlist\@empty
- \@combinefloats
- \eb@footmisc@ifvoid\footins{}
- {
- \setbox\@outputbox\vbox
- \bgroup
- \boxmaxdepth\@maxdepth
- \unvbox\@outputbox
- \vfill\relax
- \vskip\skip\footins
- \color@begingroup
- \normalcolor\footnoterule
- \unvbox\footins
- \color@endgroup
- \egroup
- }
- \eb@footmisc@ifvoid\@kludgeins
- {\@makespecialcolbox}
+ \cs_set:Npn \@makecol
{
- \setbox\@outputbox\vbox to\@colht
+ \setbox\@outputbox\box\@cclv
+ \xdef\@freelist{\@freelist\@midlist}
+ \global\let\@midlist\@empty
+ \@combinefloats
+ \eb@footmisc@ifvoid\footins{}
{
- \@texttop\dimen@\dp\@outputbox
+ \setbox\@outputbox\vbox
+ \bgroup
+ \boxmaxdepth\@maxdepth
\unvbox\@outputbox
- \vskip -\dimen@\@textbottom
+ \vfill\relax
+ \vskip\skip\footins
+ \color@begingroup
+ \normalcolor\footnoterule
+ \unvbox\footins
+ \color@endgroup
+ \egroup
}
+ \eb@footmisc@ifvoid\@kludgeins
+ {\@makespecialcolbox}
+ {
+ \setbox\@outputbox\vbox to\@colht
+ {
+ \@texttop\dimen@\dp\@outputbox
+ \unvbox\@outputbox
+ \vskip -\dimen@\@textbottom
+ }
+ }
+ \global\maxdepth\@maxdepth
}
- \global\maxdepth\@maxdepth
}
}
}
+\msg_new:nnn { easybase } { bottom-not-compatible }
+ {
+ Not~compatible~with~the~'footmisc'~package, \\
+ Please~use~the~'bottom'~option~of~'footmisc'~package.
+ }
\cs_new_protected:Npn \eb_footnote_direct_hang:
{
\hbox_set:Nn \l_tmpa_box
{
- \dim_compare:nNnTF { \footindent } > { 0pt }
- { \hbox_to_wd:nn { \footindent } { \eb@makefnmark\hss } }
+ \dim_compare:nNnTF { \fnfirstindent } > { 0pt }
+ { \hbox_to_wd:nn { \fnfirstindent } { \eb@makefnmark\hss } }
{ \eb@makefnmark }
}
\dim_set:Nn \leftmargin { \box_wd:N \l_tmpa_box }
@@ -987,23 +998,23 @@
\mode_leave_vertical:
\hbox_overlap_left:n { \box_use:N \l_tmpa_box }
}
-\cs_new_protected:Npn \eb_footnote_direct_default:
+\cs_new_protected:Npn \eb_footnote_direct_plain:
{
\noindent
\clist_if_in:NnT \l__eb_footnote_value_clist { flush }
- { \dim_zero:N \footindent }
- \int_case:nn { \dim_sign:V \footindent }
+ { \dim_zero:N \fnfirstindent }
+ \int_case:nn { \dim_sign:V \fnfirstindent }
{
{ 1 } { \use_i:nnn }
{ 0 } { \use_ii:nnn }
{ -1 } { \use_iii:nnn }
}
- { \hbox_to_wd:nn { \footindent } { \hss\eb@makefnmark } }
+ { \hbox_to_wd:nn { \fnfirstindent } { \hss\eb@makefnmark } }
{ \hbox_overlap_left:n { \eb@makefnmark } }
{
\hbox_overlap_left:n
{
- \hbox_to_wd:nn { -\footindent }
+ \hbox_to_wd:nn { -\fnfirstindent }
{ \eb@makefnmark\hss }
}
}
@@ -1014,21 +1025,32 @@
\str_case:Vn \l__eb_footnote_value_tl
{
{ hang } { \use_i:nn }
- { default } { \use_ii:nn }
+ { plain } { \use_ii:nn }
}
{ \eb_footnote_direct_hang: }
- { \eb_footnote_direct_default: }
- \skip_set:NV \parskip \footparskip
- \dim_set:NV \parindent \footparindent
+ { \eb_footnote_direct_plain: }
+ \skip_set:NV \parskip \fnparskip
+ \dim_set:NV \parindent \fnafterindent
\l__eb_fnpara_format_tl{#1}
\tl_if_eq:NnT \l__eb_footnote_value_tl { hang } { \par }
\group_end:
}
-\cs_set_eq:NN \eb@makefntext@save \@makefntext
+\eb_patch_cmd:wnn { \@footnotetext,\@mpfootnotetext }
+ { \reset@font }
+ {
+ \setspread{\fp_use:N \l__eb_spread_footnote_fp}
+ \tl_use:N \l__eb_subfont_footnote_tl
+ }
+\cs_set_eq:NN \eb@@makefntext \@makefntext
+\cs_set_eq:NN \eb@@footnotetext \@footnotetext
\ctex_at_end_package:nn { footmisc }
{
\eb_package_date_check:nn { footmisc } { 2022/02/10 }
- \notbool{FN@para}{\cs_set_eq:NN \@makefntext \eb@makefntext@save}{}
+ \ifbool{FN@para}{}
+ {
+ \cs_set_eq:NN \@makefntext \eb@@makefntext
+ \cs_set_eq:NN \@footnotetext \eb@@footnotetext
+ }
\ifboolexpr
{
bool {FN@hangfoot} or
@@ -1045,7 +1067,7 @@
\msg_new:nnn { easybase } { footmisc }
{
It~is~not~recommended~that~you~use~the \\
- hang,~symbol,~perpage,~marginal,~flushmargin~or~bottom \\
+ hang,~symbol,~perpage,~marginal~or~flushmargin \\
options~of~the~'footmisc'~package.
}
@@ -1079,12 +1101,6 @@
\@footnotemark
}
}
-\eb_patch_cmd:wnn { \@footnotetext,\@mpfootnotetext }
- { \reset@font }
- {
- \setspread{\fp_use:N \l__eb_spread_footnote_fp}
- \tl_use:N \l__eb_subfont_footnote_tl
- }
\ctex_at_end_package:nn { hyperref }
{
\cs_set:Npn \@xfootnotemark [#1]
@@ -1140,13 +1156,12 @@
\defdownfntmark
{
\eb_fnmate_format_initial:
- \tl_if_eq:NnT \l__eb_fntext_position_tl { super }
+ \tl_if_eq:NnTF \l__eb_fntext_position_tl { super }
{ \eb@fnmate@super* }
+ { \use:n }
{
\tl_use:N \l__eb_fntext_before_tl
- \bgroup
- \l__eb_fnmate_format_tl{\@thefnmark}
- \egroup
+ { \l__eb_fnmate_format_tl{\@thefnmark} }
}
\tl_use:N \l__eb_fntext_after_tl
}
@@ -1196,8 +1211,6 @@
\eb@@makefnmark{#1}{#1}\@footnotetext{#2}
\group_end:
}
-\cs_new:Npn \eb@footmisc@ifvoid #1#2#3 { \ifvoid #1#2\else #3\fi }
-\cs_set:Npn \thempfootnote { \int_to_alph:n { \c@mpfootnote } }
\newcounter{bichapter}
\newcounter{bisection}[bichapter]
@@ -1557,18 +1570,18 @@
{
\normalsize\normalfont
\titlerule*[#3]{\IfValueTF{#4}{\scalebox{#4}{#5}}{#5}}#6
- \bgroup
- \IfBooleanF{#2}
{
- \IfBooleanTF{#1}
- {\thecontentspage}
+ \IfBooleanF{#2}
{
- \bool_if:NTF \l__eb_toc_dot_align_bool
- { \contentspage }
- { \thecontentspage }
+ \IfBooleanTF{#1}
+ {\thecontentspage}
+ {
+ \bool_if:NTF \l__eb_toc_dot_align_bool
+ { \contentspage }
+ { \thecontentspage }
+ }
}
}
- \egroup
}
\ctex_set:n
{
@@ -1619,7 +1632,6 @@
\group_begin:
\tl_set_eq:NN \eb@toc@title \indexname
\cs_set_eq:NN \imki@indexlevel \use_none:n
- \setkeys{imkiindex}{noclearpage}
\IfValueT{#3}{\keys_set:nn { eb/floattoc } {#3}}
\cs_set_protected:Npn \imki@indexheaders
{
@@ -1797,8 +1809,9 @@
\cs_set_protected:Npn \hangpara #1#2
{
- \setlength{\hangindent}{#1}
- \hangafter #2\noindent\ignorespaces
+ \dim_set:Nn \hangindent {#1}
+ \int_set:Nn \hangafter {#2}
+ \noindent\ignorespaces
}
\DeclareDocumentEnvironment{hangparas}{mm+b}
{
@@ -2312,7 +2325,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2022/03/08}{1.643}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2022/03/10}{1.643}
{Customization of tcolorbox for easybook}
\cs_set_protected:Npn \addtotcbstyle #1#2
diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf
index fe31a2f561..38e91e5c54 100644
--- a/macros/latex/contrib/easybook/easybook.pdf
+++ b/macros/latex/contrib/easybook/easybook.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex
index ae9ecb96b5..495bca8f59 100644
--- a/macros/latex/contrib/easybook/easybook.tex
+++ b/macros/latex/contrib/easybook/easybook.tex
@@ -21,8 +21,8 @@
name = easybook,
color-scheme = blue,
title = EASYBOOK使用手册,
- version = v1.643,
- date = 2022/03/08,
+ version = v1.644,
+ date = 2022/03/10,
authors = 瞿毅,
info = 简便地排版中文学位论文或书籍,
email = q1jx@foxmail.com,
@@ -790,20 +790,20 @@
\end{commands}
\subsection{脚注格式}
-模块 \module*{hdrset} 还可以灵活调整脚注编号和内容的格式。格式主要包括脚注标记的编号类型、字体、附加符号、对齐方式和缩进距离等,以及脚注内容的首行缩进、行距和字体等。基本思想是默认脚注和自定义编号脚注标记的格式分离,两种类型脚注各自正文和内容的标记又共享格式,默认脚注中正文和内容标记的编号类型分离。
+模块 \module*{hdrset} 还可以灵活调整脚注编号和内容的格式。格式主要包括脚注标记的编号类型、字体、附加符号和对齐方式等,以及脚注内容的首行缩进、行距和字体等。基本思想是默认脚注和自定义编号脚注标记的格式分离,两种类型脚注各自正文和内容的标记又共享格式,默认脚注中正文和内容标记的编号类型分离。目前脚注模块基本兼容 \pkg*{footmisc} 宏包。
\begin{options}
- \keychoice{footnotetype}{hang,default,flush,bottom}\Module{hdrset}\Default{hang}
- 脚注的类型。悬挂缩进 \code{hang} 是默认值,\code{default} 是原始的类型,\code{flush} 使脚注内容标记位于脚注首行边缘外侧并右对齐。当存在浮动环境排版时,脚注可能位于页面中间,\code{bottom} 使脚注始终位于页面底端。其中 \code{bottom} 是复合选项,可以与前三种类型重复或复合使用:
+ \keychoice{footnotetype}{plain,hang,flush,bottom}\Module{hdrset}\Default{hang}
+ 脚注的类型。悬挂缩进 \code{hang} 是默认值,\code{plain} 是原始的类型,\code{flush} 使脚注内容标记位于脚注首行边缘外侧并右对齐。当存在浮动环境排版时,脚注可能位于页面中间,\code{bottom} 使脚注始终位于页面底端。其中 \code{bottom} 是复合选项,可以与前三种类型重复或复合使用:
\begin{ctexexam}
- \ebhdrset{footnotetype = default,footnotetype = bottom}
+ \ebhdrset{footnotetype = plain,footnotetype = bottom}
\ebhdrset{footnotetype = {hang,bottom}}
\end{ctexexam}
- \keyval{fnindent}{刚性长度}\Default{0.8em}
- 每个脚注首段的首行缩进(选项 \option*{hang} 为整体缩进),等于长度 \cs{footindent} 的值。
+ \keyval{fnfirstindent}{刚性长度}\Default{0.8em}
+ 每个脚注首段的首行缩进(选项 \option*{hang} 为整体缩进),等于长度 \cs{fnfirstindent} 的值。
+ \keyval{fnafterindent}{刚性长度}\Default{2em}
+ 每个脚注第二段及之后段落的首行缩进,等于长度 \cs{fnafterindent} 的值。
\keyval{fnparskip}{弹性长度}\Default{0ex}
- 不同脚注的段落间距,等于长度 \cs{footparskip} 的值。
- \keyval{fnparindent}{刚性长度}\Default{2em}
- 每个脚注第二段及之后段落的首行缩进,等于长度 \cs{footparindent} 的值。
+ 不同脚注的段落间距,等于长度 \cs{fnparskip} 的值。
\keychoice{fntext-pos}{normal,super}\Default{super}
设置脚注内容标记的位置,正常文本或是上标形式。
\keychoice{fnmark-num}{plain,pifont,pifont*,pisans,pisans*,short num}\Default{plain}
@@ -904,7 +904,7 @@
引导线选项 \option{tocrule} 中一般可以使用基于 \cs*{xleaders} 命令的 \cs{tocrule} 绘制引导线。
\begin{commands}
\command{tocrule}[\sarg\harg\oarg{引导点间距}\darg{放大因子}\marg{引导点}\oarg{页码格式}]
- 生成目录引导线的命令,需要在引导线选项 \option{tocrule} 中使用。带有星号的命令与 \keyis{dotalign}{false} 效果相同。带有 \harg{} 号的命令不添加引导线后的目录页码。\meta{引导点间距} 需带有长度单位,\meta{放大因子} 为 \meta{引导点} 的放大倍数。\meta{页码格式} 的代码位于页码前面,可以设置页码字体和距离等,最后一个命令可以带有一个参数为页码编号。
+ 生成目录引导线的命令,需要在引导线选项 \option{tocrule} 中使用。带有星号的命令与 \keyis{dotalign}{false} 效果相同。带有 \harg{} 号的命令不添加引导线后的目录页码。\meta{引导点间距} 需带有长度单位,\meta{放大因子} 为 \meta{引导点} 的放大倍数。\meta{页码格式} 中最后一个命令可以带有一个参数为页码编号。
\end{commands}
\keyval{tocafter}{距离命令}\dtag\Default{\cs*{hspace}\Marg{1em}}
目录条目编号与标题间的代码,默认为插入 \code{1em} 横向距离。
@@ -1318,7 +1318,7 @@
\item 增加英文主文档目录钩子选项 \option{bibetween}。
\end{version}
\shortversion{v = 1.638,date = 2022/03/04,changes = 增加目录条目样式选项注册命令 \cs{RegisterTocName}。}
- \shortversion{v = 1.643,date = 2022/03/08,changes = 增加浮动环境目录声明命令 \cs{DeclareFloatList} 配合 \pkg*{caption} 宏包。}
+ \shortversion{v = 1.644,date = 2022/03/10,changes = 增加浮动环境目录声明命令 \cs{DeclareFloatList} 配合 \pkg*{caption} 宏包。}
\end{changelog}
\nocite{*}
diff --git a/macros/latex/contrib/functional/README.txt b/macros/latex/contrib/functional/README.txt
new file mode 100644
index 0000000000..fcb1672c0c
--- /dev/null
+++ b/macros/latex/contrib/functional/README.txt
@@ -0,0 +1,5 @@
+Functional: LaTeX2 functional interfaces to LaTeX3 programming layer
+Copyright : 2022 (c) Jianrui Lyu <tolvjr@163.com>
+Repository: https://github.com/lvjr/functional
+Repository: https://bitbucket.org/lvjr/functional
+License : The LaTeX Project Public License 1.3c
diff --git a/macros/latex/contrib/functional/functional.pdf b/macros/latex/contrib/functional/functional.pdf
new file mode 100644
index 0000000000..f9f553a0da
--- /dev/null
+++ b/macros/latex/contrib/functional/functional.pdf
Binary files differ
diff --git a/macros/latex/contrib/functional/functional.sty b/macros/latex/contrib/functional/functional.sty
new file mode 100644
index 0000000000..95e5ada3dc
--- /dev/null
+++ b/macros/latex/contrib/functional/functional.sty
@@ -0,0 +1,686 @@
+%%% -*- coding: utf-8 -*-
+%% ----------------------------------------------------------------------------
+%% Functional: LaTeX2 functional interfaces to LaTeX3 programming layer
+%% Copyright : 2022 (c) Jianrui Lyu <tolvjr@163.com>
+%% Repository: https://github.com/lvjr/functional
+%% License : The LaTeX Project Public License 1.3c
+%% ----------------------------------------------------------------------------
+
+%%% --------------------------------------------------------
+%%> \section{Interfaces for Function Definitions (l3basics)}
+%%% --------------------------------------------------------
+
+\NeedsTeXFormat{LaTeX2e}[2018-04-01]
+
+\RequirePackage{expl3}
+\ProvidesExplPackage{functional}{2022-03-10}{2022A}
+ {^^JLaTeX2 functional interfaces to LaTeX3 programming layer}
+
+\cs_generate_variant:Nn \iow_log:n { V }
+\cs_generate_variant:Nn \tl_set:Nn { Ne }
+
+\tl_new:N \gResultTl
+\int_new:N \l__fun_arg_count_int
+\tl_new:N \l__fun_parameters_defined_tl
+\tl_const:Nn \c__fun_parameter_defined_i__tl { } % no argument
+\tl_const:Nn \c__fun_parameter_defined_i_i_tl { #1 }
+\tl_const:Nn \c__fun_parameter_defined_i_ii_tl { #1 #2 }
+\tl_const:Nn \c__fun_parameter_defined_i_iii_tl { #1 #2 #3 }
+\tl_const:Nn \c__fun_parameter_defined_i_iv_tl { #1 #2 #3 #4 }
+\tl_const:Nn \c__fun_parameter_defined_i_v_tl { #1 #2 #3 #4 #5 }
+\tl_const:Nn \c__fun_parameter_defined_i_vi_tl { #1 #2 #3 #4 #5 #6 }
+\tl_const:Nn \c__fun_parameter_defined_i_vii_tl { #1 #2 #3 #4 #5 #6 #7 }
+\tl_const:Nn \c__fun_parameter_defined_i_viii_tl { #1 #2 #3 #4 #5 #6 #7 #8 }
+\tl_const:Nn \c__fun_parameter_defined_i_ix_tl { #1 #2 #3 #4 #5 #6 #7 #8 #9 }
+\tl_new:N \l__fun_parameters_called_tl
+\tl_const:Nn \c__fun_parameter_called_i_i_tl { {#1} }
+\tl_const:Nn \c__fun_parameter_called_i_ii_tl { {#1}{#2} }
+\tl_const:Nn \c__fun_parameter_called_i_iii_tl { {#1}{#2}{#3} }
+\tl_const:Nn \c__fun_parameter_called_i_iv_tl { {#1}{#2}{#3}{#4} }
+\tl_const:Nn \c__fun_parameter_called_i_v_tl { {#1}{#2}{#3}{#4}{#5} }
+\tl_const:Nn \c__fun_parameter_called_i_vi_tl { {#1}{#2}{#3}{#4}{#5}{#6} }
+\tl_const:Nn \c__fun_parameter_called_i_vii_tl { {#1}{#2}{#3}{#4}{#5}{#6}{#7} }
+\tl_new:N \l__fun_parameters_true_tl
+\tl_new:N \l__fun_parameters_false_tl
+\tl_const:Nn \c__fun_parameter_called_i_tl { {#1} }
+\tl_const:Nn \c__fun_parameter_called_ii_tl { {#2} }
+\tl_const:Nn \c__fun_parameter_called_iii_tl { {#3} }
+\tl_const:Nn \c__fun_parameter_called_iv_tl { {#4} }
+\tl_const:Nn \c__fun_parameter_called_v_tl { {#5} }
+\tl_const:Nn \c__fun_parameter_called_vi_tl { {#6} }
+\tl_const:Nn \c__fun_parameter_called_vii_tl { {#7} }
+\tl_const:Nn \c__fun_parameter_called_viii_tl { {#8} }
+\tl_const:Nn \c__fun_parameter_called_ix_tl { {#9} }
+\tl_new:N \l__fun_argument_tl
+\tl_new:N \l__fun_argument_i_tl
+\tl_new:N \l__fun_argument_ii_tl
+\tl_new:N \l__fun_argument_iii_tl
+\tl_new:N \l__fun_argument_iv_tl
+\tl_new:N \l__fun_argument_v_tl
+\tl_new:N \l__fun_argument_vi_tl
+\tl_new:N \l__fun_argument_vii_tl
+\tl_new:N \l__fun_argument_viii_tl
+\tl_new:N \l__fun_argument_ix_tl
+
+%% #1: function name; #2: argument specification; #3 function body
+\cs_new_protected:Npn \__fun_new_function:Nnn #1 #2 #3
+ {
+ \int_set:Nn \l__fun_arg_count_int { \tl_count:n {#2} } % spaces are ignored
+ \tl_set_eq:Nc \l__fun_parameters_defined_tl
+ { c__fun_parameter_defined_i_ \int_to_roman:n { \l__fun_arg_count_int } _tl }
+ \exp_last_unbraced:NcV \cs_new_protected:Npn
+ { __fun_defined_ \cs_to_str:N #1 : w }
+ \l__fun_parameters_defined_tl
+ {
+ \__fun_group_begin:
+ \tl_gclear:N \gResultTl
+ #3
+ \__fun_tracing_log:e { [O] ~ \gResultTl }
+ \__fun_group_end:
+ }
+ \use:c { __fun_new_with_arg_ \int_to_roman:n { \l__fun_arg_count_int } :NnV }
+ #1 {#2} \l__fun_parameters_defined_tl
+ }
+\cs_generate_variant:Nn \__fun_new_function:Nnn { cne }
+
+\cs_set_eq:NN \PrgNewFunction \__fun_new_function:Nnn
+
+\tl_new:N \g__fun_last_result_tl
+
+%% #1: function name; #2: argument specification; #3 function body
+\cs_new_protected:Npn \__fun_new_conditional:Nnn #1 #2 #3
+ {
+ \__fun_new_function:Nnn #1 { #2 } { #3 }
+ \tl_set_eq:Nc \l__fun_parameters_called_tl
+ { c__fun_parameter_called_i_ \int_to_roman:n { \l__fun_arg_count_int } _tl }
+ \tl_set_eq:Nc \l__fun_parameters_true_tl
+ { c__fun_parameter_called_ \int_to_roman:n { \l__fun_arg_count_int + 1 } _tl }
+ \tl_set_eq:Nc \l__fun_parameters_false_tl
+ { c__fun_parameter_called_ \int_to_roman:n { \l__fun_arg_count_int + 2 } _tl }
+ \__fun_new_function:cne { \cs_to_str:N #1 TF } { #2 n n }
+ {
+ #1 \exp_not:V \l__fun_parameters_called_tl
+ \exp_not:n
+ {
+ \tl_set_eq:NN \g__fun_last_result_tl \gResultTl
+ \tl_gclear:N \gResultTl
+ \exp_last_unbraced:NV \bool_if:NTF \g__fun_last_result_tl
+ }
+ \exp_not:V \l__fun_parameters_true_tl
+ \exp_not:V \l__fun_parameters_false_tl
+ }
+ }
+
+\cs_set_eq:NN \PrgNewConditional \__fun_new_conditional:Nnn
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+%% Some times we need to create a function without arguments
+\cs_new_protected:Npn \__fun_new_with_arg_:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_:Nnn { NnV }
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+\cs_new_protected:Npn \__fun_new_with_arg_i:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \tl_set:Nn \l__fun_argument_i_tl { ##1 }
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_i:Nnn { NnV }
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+\cs_new_protected:Npn \__fun_new_with_arg_ii:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \tl_set:Nn \l__fun_argument_i_tl { ##1 }
+ \tl_set:Nn \l__fun_argument_ii_tl { ##2 }
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_ii:Nnn { NnV }
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+\cs_new_protected:Npn \__fun_new_with_arg_iii:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \tl_set:Nn \l__fun_argument_i_tl { ##1 }
+ \tl_set:Nn \l__fun_argument_ii_tl { ##2 }
+ \tl_set:Nn \l__fun_argument_iii_tl { ##3 }
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_iii:Nnn { NnV }
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+\cs_new_protected:Npn \__fun_new_with_arg_iv:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \tl_set:Nn \l__fun_argument_i_tl { ##1 }
+ \tl_set:Nn \l__fun_argument_ii_tl { ##2 }
+ \tl_set:Nn \l__fun_argument_iii_tl { ##3 }
+ \tl_set:Nn \l__fun_argument_iv_tl { ##4 }
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_iv:Nnn { NnV }
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+\cs_new_protected:Npn \__fun_new_with_arg_v:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \tl_set:Nn \l__fun_argument_i_tl { ##1 }
+ \tl_set:Nn \l__fun_argument_ii_tl { ##2 }
+ \tl_set:Nn \l__fun_argument_iii_tl { ##3 }
+ \tl_set:Nn \l__fun_argument_iv_tl { ##4 }
+ \tl_set:Nn \l__fun_argument_v_tl { ##5 }
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_v:Nnn { NnV }
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+\cs_new_protected:Npn \__fun_new_with_arg_vi:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \tl_set:Nn \l__fun_argument_i_tl { ##1 }
+ \tl_set:Nn \l__fun_argument_ii_tl { ##2 }
+ \tl_set:Nn \l__fun_argument_iii_tl { ##3 }
+ \tl_set:Nn \l__fun_argument_iv_tl { ##4 }
+ \tl_set:Nn \l__fun_argument_v_tl { ##5 }
+ \tl_set:Nn \l__fun_argument_vi_tl { ##6 }
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_vi:Nnn { NnV }
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+\cs_new_protected:Npn \__fun_new_with_arg_vii:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \tl_set:Nn \l__fun_argument_i_tl { ##1 }
+ \tl_set:Nn \l__fun_argument_ii_tl { ##2 }
+ \tl_set:Nn \l__fun_argument_iii_tl { ##3 }
+ \tl_set:Nn \l__fun_argument_iv_tl { ##4 }
+ \tl_set:Nn \l__fun_argument_v_tl { ##5 }
+ \tl_set:Nn \l__fun_argument_vi_tl { ##6 }
+ \tl_set:Nn \l__fun_argument_vii_tl { ##7 }
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_vii:Nnn { NnV }
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+\cs_new_protected:Npn \__fun_new_with_arg_viii:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \tl_set:Nn \l__fun_argument_i_tl { ##1 }
+ \tl_set:Nn \l__fun_argument_ii_tl { ##2 }
+ \tl_set:Nn \l__fun_argument_iii_tl { ##3 }
+ \tl_set:Nn \l__fun_argument_iv_tl { ##4 }
+ \tl_set:Nn \l__fun_argument_v_tl { ##5 }
+ \tl_set:Nn \l__fun_argument_vi_tl { ##6 }
+ \tl_set:Nn \l__fun_argument_vii_tl { ##7 }
+ \tl_set:Nn \l__fun_argument_viii_tl { ##8 }
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_viii:Nnn { NnV }
+
+%% #1: function name; #2: argument specifications; #3 parameters tl defined
+\cs_new_protected:Npn \__fun_new_with_arg_ix:Nnn #1 #2 #3
+ {
+ \cs_new_protected:Npn #1 #3
+ {
+ \tl_set:Nn \l__fun_argument_i_tl { ##1 }
+ \tl_set:Nn \l__fun_argument_ii_tl { ##2 }
+ \tl_set:Nn \l__fun_argument_iii_tl { ##3 }
+ \tl_set:Nn \l__fun_argument_iv_tl { ##4 }
+ \tl_set:Nn \l__fun_argument_v_tl { ##5 }
+ \tl_set:Nn \l__fun_argument_vi_tl { ##6 }
+ \tl_set:Nn \l__fun_argument_vii_tl { ##7 }
+ \tl_set:Nn \l__fun_argument_viii_tl { ##8 }
+ \tl_set:Nn \l__fun_argument_ix_tl { ##9 }
+ \__fun_evaluate:Nn #1 {#2}
+ }
+ }
+\cs_generate_variant:Nn \__fun_new_with_arg_ix:Nnn { NnV }
+
+\int_new:N \g__fun_nesting_level_int
+\int_new:N \l__fun_argtype_number_int
+\tl_new:N \l__fun_argtype_tl
+\tl_const:Nn \c__fun_argtype_m_tl { m }
+\tl_const:Nn \c__fun_argtype_M_tl { M }
+\tl_const:Nn \c__fun_argtype_n_tl { n }
+\tl_const:Nn \c__fun_argtype_N_tl { N }
+
+%% #1: function name; #2: argument specifications
+\cs_new_protected:Npn \__fun_evaluate:Nn #1 #2
+ {
+ \int_zero:N \l__fun_argtype_number_int
+ \int_gincr:N \g__fun_nesting_level_int
+ \__fun_arguments_gclear:
+ \tl_map_variable:nNn { #2 } \l__fun_argtype_tl % spaces are ignored
+ {
+ \int_incr:N \l__fun_argtype_number_int
+ \tl_set_eq:Nc \l__fun_argument_tl
+ { l__fun_argument_ \int_to_roman:n { \l__fun_argtype_number_int } _tl }
+ \tl_case:Nn \l__fun_argtype_tl
+ {
+ \c__fun_argtype_m_tl
+ {
+ \__fun_evaluate_and_put_argument:N \l__fun_argument_tl
+ }
+ \c__fun_argtype_M_tl
+ {
+ \__fun_evaluate_and_put_argument:N \l__fun_argument_tl
+ }
+ \c__fun_argtype_n_tl
+ {
+ \__fun_arguments_gput:e { { \exp_not:V \l__fun_argument_tl } }
+ }
+ \c__fun_argtype_N_tl
+ {
+ \__fun_arguments_gput:e { \exp_not:V \l__fun_argument_tl }
+ }
+ }
+ }
+ \__fun_arguments_log:N #1
+ \__fun_arguments_called:c { __fun_defined_ \cs_to_str:N #1 : w }
+ \int_gdecr:N \g__fun_nesting_level_int
+ \__fun_return_result:
+ }
+
+\cs_set_eq:NN \__fun_cs_temp:w \scan_stop:
+
+\cs_new_protected:Npn \__fun_evaluate_and_put_argument:N #1
+ {
+ \cs_set_eq:Nc \__fun_cs_temp:w
+ {
+ __fun_defined_ \exp_last_unbraced:Ne \cs_to_str:N { \tl_head:N #1 } : w
+ }
+ \cs_if_exist:NTF \__fun_cs_temp:w
+ {
+ #1
+ \__fun_arguments_gput:e { { \exp_not:V \gResultTl } }
+ }
+ {
+ \__fun_arguments_gput:e { { \exp_not:V #1 } }
+ }
+ }
+
+\cs_new_protected:Npn \__fun_arguments_called:N #1
+ {
+ \exp_last_unbraced:Nv
+ #1 { g__fun_arguments_ \int_use:N \g__fun_nesting_level_int _tl }
+ }
+\cs_generate_variant:Nn \__fun_arguments_called:N { c }
+
+\cs_new_protected:Npn \__fun_arguments_gclear:
+ {
+ \tl_gclear:c { g__fun_arguments_ \int_use:N \g__fun_nesting_level_int _tl }
+ }
+
+\cs_new_protected:Npn \__fun_arguments_log:N #1
+ {
+ \__fun_tracing_log:e
+ {
+ [I] ~ \token_to_str:N #1
+ \exp_not:v { g__fun_arguments_ \int_use:N \g__fun_nesting_level_int _tl }
+ }
+ }
+
+\cs_new_protected:Npn \__fun_arguments_gput:n #1
+ {
+ \tl_gput_right:cn
+ { g__fun_arguments_ \int_use:N \g__fun_nesting_level_int _tl } { #1 }
+ }
+\cs_generate_variant:Nn \__fun_arguments_gput:n { e }
+
+\cs_new_protected:Npn \__fun_put_result:n #1
+ {
+ \tl_gput_right:Nn \gResultTl { #1 }
+ }
+\cs_generate_variant:Nn \__fun_put_result:n { e, V }
+
+\PrgNewFunction \Result { m }
+ {
+ \__fun_put_result:n { #1 }
+ }
+
+\PrgNewFunction \Name { m }
+ {
+ \exp_args:Nc \__fun_put_result:n { #1 }
+ }
+\cs_set_eq:NN \UseName \Name
+
+\PrgNewFunction \Expand { m }
+ {
+ \__fun_put_result:e { #1 }
+ }
+\cs_set_eq:NN \UseExpand \Expand
+
+\PrgNewFunction \Value { M }
+ {
+ \__fun_put_result:V #1
+ }
+\cs_set_eq:NN \UseValue \Value
+
+\cs_set_eq:NN \ExpNot \exp_not:n
+\cs_set_eq:NN \ExpValue \exp_not:V
+
+\cs_new_protected:Npn \__fun_return_result:
+ {
+ \int_compare:nNnT { \g__fun_nesting_level_int } = { 0 }
+ { \tl_use:N \gResultTl }
+ }
+
+\tl_new:N \l__fun_variable_type_tl
+
+\prg_new_protected_conditional:Npnn \__fun_if_global_variable:N #1 { TF }
+ {
+ \tl_set:Ne \l__fun_variable_type_tl
+ { \exp_args:Ne \tl_head:n { \cs_to_str:N #1 } }
+ \str_if_eq:VnTF \l__fun_variable_type_tl { g }
+ { \prg_return_true: }
+ {
+ \str_if_eq:VnTF \l__fun_variable_type_tl { c }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ }
+
+%% We must not put an assignment inside a group
+\cs_new_protected:Npn \__fun_do_assignment:Nnn #1 #2 #3
+ {
+ \__fun_group_end:
+ \__fun_if_global_variable:NTF #1 { #2 } { #3 }
+ \__fun_group_begin:
+ }
+
+\bool_new:N \l__fun_scoping_bool
+
+\cs_new_protected:Npn \__fun_scoping_true:
+ {
+ \cs_set_eq:NN \__fun_group_begin: \group_begin:
+ \cs_set_eq:NN \__fun_group_end: \group_end:
+ }
+
+\cs_new_protected:Npn \__fun_scoping_false:
+ {
+ \cs_set_eq:NN \__fun_group_begin: \scan_stop:
+ \cs_set_eq:NN \__fun_group_end: \scan_stop:
+ }
+
+\cs_new_protected:Npn \__fun_scoping_set:
+ {
+ \bool_if:NTF \l__fun_scoping_bool
+ { \__fun_scoping_true: } { \__fun_scoping_false: }
+ }
+
+\bool_new:N \l__fun_tracing_bool
+\tl_new:N \l__tracing_text_tl
+
+\cs_new_protected:Npn \__fun_tracing_log_on:n #1
+ {
+ \tl_set:Ne \l__tracing_text_tl
+ {
+ \prg_replicate:nn
+ { \int_eval:n { (\g__fun_nesting_level_int - 1) * 4 } } { ~ }
+ }
+ \tl_put_right:Nn \l__tracing_text_tl { #1 }
+ \iow_log:V \l__tracing_text_tl
+ }
+\cs_generate_variant:Nn \__fun_tracing_log_on:n { e, V }
+
+\cs_new_protected:Npn \__fun_tracing_log_off:n #1 { }
+\cs_generate_variant:Nn \__fun_tracing_log_off:n { e, V }
+
+\cs_new_protected:Npn \__fun_tracing_true:
+ {
+ \cs_set_eq:NN \__fun_tracing_log:n \__fun_tracing_log_on:n
+ \cs_set_eq:NN \__fun_tracing_log:e \__fun_tracing_log_on:e
+ \cs_set_eq:NN \__fun_tracing_log:V \__fun_tracing_log_on:V
+ }
+
+\cs_new_protected:Npn \__fun_tracing_false:
+ {
+ \cs_set_eq:NN \__fun_tracing_log:n \__fun_tracing_log_off:n
+ \cs_set_eq:NN \__fun_tracing_log:e \__fun_tracing_log_off:e
+ \cs_set_eq:NN \__fun_tracing_log:V \__fun_tracing_log_off:V
+ }
+
+\cs_new_protected:Npn \__fun_tracing_set:
+ {
+ \bool_if:NTF \l__fun_tracing_bool
+ { \__fun_tracing_true: } { \__fun_tracing_false: }
+ }
+
+\keys_define:nn { functional }
+ {
+ scoping .bool_set:N = \l__fun_scoping_bool,
+ tracing .bool_set:N = \l__fun_tracing_bool,
+ }
+
+\NewDocumentCommand \Functional { m }
+ {
+ \keys_set:nn { functional } { #1 }
+ \__fun_scoping_set:
+ \__fun_tracing_set:
+ }
+
+\Functional { scoping = false, tracing = false }
+
+\PrgNewFunction \UseOne { n }
+ {
+ \Result { #1 }
+ }
+
+\PrgNewFunction \GobbleOne { n }
+ {
+ \Result { }
+ }
+
+\PrgNewFunction \UseGobble { n n }
+ {
+ \UseOne { #1 }
+ }
+
+\PrgNewFunction \GobbleUse { n n }
+ {
+ \UseOne { #2 }
+ }
+
+%%% --------------------------------------------------------
+%%> \section{Interfaces for Control Structures (l3prg)}
+%%% --------------------------------------------------------
+
+\bool_const:Nn \cTrueBool { \c_true_bool }
+\bool_const:Nn \cFalseBool { \c_false_bool }
+
+\bool_new:N \lTmpaBool \bool_new:N \lTmpbBool \bool_new:N \lTmpcBool
+\bool_new:N \lTmpiBool \bool_new:N \lTmpjBool \bool_new:N \lTmpkBool
+\bool_new:N \l@Funx@Bool \bool_new:N \l@Funy@Bool \bool_new:N \l@Funz@Bool
+
+\bool_new:N \gTmpaBool \bool_new:N \gTmpbBool \bool_new:N \gTmpcBool
+\bool_new:N \gTmpiBool \bool_new:N \gTmpjBool \bool_new:N \gTmpkBool
+\bool_new:N \g@Funx@Bool \bool_new:N \g@Funy@Bool \bool_new:N \g@Funz@Bool
+
+\cs_set_eq:NN \BoolNew \bool_new:N
+\cs_set_eq:NN \BoolLog \bool_log:N
+
+\PrgNewFunction \BoolSetTrue { M }
+ {
+ \__fun_do_assignment:Nnn #1 { \bool_gset_true:N #1 } { \bool_set_true:N #1 }
+ }
+
+\PrgNewFunction \BoolSetFalse { M }
+ {
+ \__fun_do_assignment:Nnn #1 { \bool_gset_false:N #1 } { \bool_set_false:N #1 }
+ }
+
+\PrgNewConditional \BoolIf { N }
+ {
+ \Result { #1 }
+ }
+
+%%% --------------------------------------------------------
+%%> \section{Interfaces for Token Lists (l3tl)}
+%%% --------------------------------------------------------
+
+\tl_new:N \lTmpaTl \tl_new:N \lTmpbTl \tl_new:N \lTmpcTl
+\tl_new:N \lTmpiTl \tl_new:N \lTmpjTl \tl_new:N \lTmpkTl
+\tl_new:N \l@Funx@Tl \tl_new:N \l@Funy@Tl \tl_new:N \l@Funz@Tl
+
+\tl_new:N \gTmpaTl \tl_new:N \gTmpbTl \tl_new:N \gTmpcTl
+\tl_new:N \gTmpiTl \tl_new:N \gTmpjTl \tl_new:N \gTmpkTl
+\tl_new:N \g@Funx@Tl \tl_new:N \g@Funy@Tl \tl_new:N \g@Funz@Tl
+
+\cs_set_eq:NN \TlNew \tl_new:N
+\cs_set_eq:NN \TlLog \tl_log:N
+
+\PrgNewFunction \TlClear { M }
+ {
+ \__fun_do_assignment:Nnn #1 { \tl_gclear:N #1 } { \tl_clear:N #1 }
+ }
+
+\PrgNewFunction \TlSet { M m }
+ {
+ \__fun_do_assignment:Nnn #1 { \tl_gset:Nn #1 {#2} } { \tl_set:Nn #1 {#2} }
+ }
+
+\PrgNewFunction \TlPutLeft { M m }
+ {
+ \__fun_do_assignment:Nnn #1
+ { \tl_gput_left:Nn #1 {#2} } { \tl_put_left:Nn #1 {#2} }
+ }
+
+\PrgNewFunction \TlPutRight { M m }
+ {
+ \__fun_do_assignment:Nnn #1
+ { \tl_gput_right:Nn #1 {#2} } { \tl_put_right:Nn #1 {#2} }
+ }
+
+\PrgNewFunction \TlUse { M }
+ {
+ \Result { \Value #1 }
+ }
+
+\PrgNewConditional \TlIfEmpty { N }
+ {
+ \tl_if_empty:NTF #1
+ { \Result { \cTrueBool } }
+ { \Result { \cFalseBool } }
+ }
+
+\PrgNewConditional \TlIfEq { N N }
+ {
+ \tl_if_eq:NNTF #1 #2
+ { \Result { \cTrueBool } }
+ { \Result { \cFalseBool } }
+ }
+
+%%% --------------------------------------------------------
+%%> \section{Interfaces for Integers (l3int)}
+%%% --------------------------------------------------------
+
+\int_new:N \lTmpaInt \int_new:N \lTmpbInt \int_new:N \lTmpcInt
+\int_new:N \lTmpiInt \int_new:N \lTmpjInt \int_new:N \lTmpkInt
+\int_new:N \l@Funx@Int \int_new:N \l@Funy@Int \int_new:N \l@Funz@Int
+
+\int_new:N \gTmpaInt \int_new:N \gTmpbInt \int_new:N \gTmpcInt
+\int_new:N \gTmpiInt \int_new:N \gTmpjInt \int_new:N \gTmpkInt
+\int_new:N \g@Funx@Int \int_new:N \g@Funy@Int \int_new:N \g@Funz@Int
+
+\cs_set_eq:NN \IntNew \int_new:N
+\cs_set_eq:NN \IntLog \int_log:N
+
+\PrgNewFunction \IntZero { M }
+ {
+ \__fun_do_assignment:Nnn #1 { \int_gzero:N #1 } { \int_zero:N #1 }
+ }
+
+\PrgNewFunction \IntIncr { M }
+ {
+ \__fun_do_assignment:Nnn #1 { \int_gincr:N #1 } { \int_incr:N #1 }
+ }
+
+\PrgNewFunction \IntDecr { M }
+ {
+ \__fun_do_assignment:Nnn #1 { \int_gdecr:N #1 } { \int_decr:N #1 }
+ }
+
+\PrgNewFunction \IntSet { M m }
+ {
+ \__fun_do_assignment:Nnn #1 { \int_gset:Nn #1 {#2} } { \int_set:Nn #1 {#2} }
+ }
+
+\PrgNewFunction \IntAdd { M m }
+ {
+ \__fun_do_assignment:Nnn #1 { \int_gadd:Nn #1 {#2} } { \int_add:Nn #1 {#2} }
+ }
+
+\PrgNewFunction \IntSub { M m }
+ {
+ \__fun_do_assignment:Nnn #1 { \int_gsub:Nn #1 {#2} } { \int_sub:Nn #1 {#2} }
+ }
+
+\PrgNewFunction \IntUse { M }
+ {
+ \Result { \Value #1 }
+ }
+
+\PrgNewFunction \IntEval { m }
+ {
+ \Result { \Expand { \int_eval:n { #1 } } }
+ }
+
+\PrgNewFunction \IntMathAdd { m m }
+ {
+ \int_set:Nn \l@Funx@Int { \int_eval:n { #1 + #2 } }
+ \Result { \Value \l@Funx@Int }
+ }
+
+\PrgNewFunction \IntMathSub { m m }
+ {
+ \int_set:Nn \l@Funx@Int { \int_eval:n { #1 - #2 } }
+ \Result { \Value \l@Funx@Int }
+ }
+
+\PrgNewFunction \IntMathMult { m m }
+ {
+ \int_set:Nn \l@Funx@Int { \int_eval:n { #1 * #2 } }
+ \Result { \Value \l@Funx@Int }
+ }
+
+\PrgNewFunction \IntMathDiv { m m }
+ {
+ \int_set:Nn \l@Funx@Int { \int_eval:n { #1 / #2 } }
+ \Result { \Value \l@Funx@Int }
+ }
+
+\PrgNewFunction \IntStepVariable { m m m M n }
+ {
+ \int_step_variable:nnnNn { #1 } { #2 } { #3 } #4 { #5 }
+ }
+
+\PrgNewConditional \IntCompare { m N m }
+ {
+ \int_compare:nNnTF {#1} #2 {#3}
+ { \Result { \cTrueBool } }
+ { \Result { \cFalseBool } }
+ }
+
diff --git a/macros/latex/contrib/functional/functional.tex b/macros/latex/contrib/functional/functional.tex
new file mode 100644
index 0000000000..18dfa30662
--- /dev/null
+++ b/macros/latex/contrib/functional/functional.tex
@@ -0,0 +1,994 @@
+% -*- coding: utf-8 -*-
+
+\documentclass[oneside]{book}
+\usepackage[a4paper,margin=2.5cm]{geometry}
+
+\newcommand*{\myversion}{2022A}
+\newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)}
+\newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi}
+
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{4pt plus 1pt minus 1pt}
+
+\usepackage{codehigh}
+
+\colorlet{highback}{blue9}
+%\CodeHigh{lite}
+\CodeHigh{language=latex/latex2,style/main=highback,style/code=highback}
+\NewCodeHighEnv{code}{style/main=gray9,style/code=gray9}
+\NewCodeHighEnv{demo}{style/main=gray9,style/code=gray9,demo}
+
+\NewDocumentCommand\MySubScript{m}{$_{#1}$}
+
+\ExplSyntaxOn
+\NewDocumentCommand\PrintVarList{m}{
+ \clist_set:Nn \l_tmpa_clist {#1}
+ \clist_map_inline:Nn \l_tmpa_clist
+ {
+ \token_to_str:N ##1 ~
+ }
+}
+\NewDocumentCommand\RelaceChacters{m}{
+ \tl_set:Nn \lTmpaTl {#1}
+ \regex_replace_once:nnN { \_ } { \c{MySubScript} } \lTmpaTl
+}
+\ExplSyntaxOff
+
+\NewDocumentEnvironment{variable}{m}{
+ \vspace{5pt}
+ \begin{minipage}{\linewidth}
+ \hrule\vspace{4pt}\obeylines%
+ \begingroup
+ \ttfamily\bfseries\color{azure3}
+ \PrintVarList{#1}
+ \endgroup
+ \par\vspace{4pt}\hrule
+ \end{minipage}\par\nopagebreak\vspace{4pt}
+}{%
+ \vspace{5pt}%
+}
+
+\NewDocumentEnvironment{function}{m}{
+ \vspace{5pt}%
+}{\vspace{5pt}}
+
+\NewDocumentEnvironment{syntax}{}{%
+ \begin{minipage}{\linewidth}
+ \hrule\vspace{4pt}\obeylines%
+}{%
+ \par\vspace{4pt}\hrule
+ \end{minipage}\par\nopagebreak\vspace{4pt}
+}
+
+\NewDocumentEnvironment{texnote}{}{}{}
+
+\NewDocumentCommand\cs{m}{%
+ \texttt{\bfseries\color{purple3}\expandafter\string\csname#1\endcsname}%
+}
+\NewDocumentCommand\meta{m}{%
+ \RelaceChacters{#1}%
+ \textsl{$\langle$\ignorespaces\lTmpaTl\unskip$\rangle$}%
+}
+\NewDocumentCommand\Arg{m}{%
+ \RelaceChacters{#1}%
+ \texttt{\{}\textsl{$\langle$\ignorespaces\lTmpaTl\unskip$\rangle$}\texttt{\}}%
+}
+
+\let\tn=\cs
+
+\RenewDocumentCommand\emph{m}{%
+ \underline{\textsl{#1}}%
+}
+
+\usepackage{hyperref}
+\hypersetup{
+ colorlinks=true,
+ urlcolor=blue3,
+ linkcolor=blue3,
+}
+
+\usepackage{functional}
+%\Functional{scoping=false,tracing=true}
+
+\begin{document}
+
+\title{\sffamily LaTeX2 \textcolor{green3}{Functional} Interfaces to LaTeX3 Programming Layer}
+\author{Jianrui Lyu (tolvjr@163.com)\\\url{https://github.com/lvjr/functional}}
+\date{\mydate\vspace{1cm}\\\myabstract\vspace{10cm}}
+
+\newcommand\myabstract{\parbox{\linewidth}{\hrule\vspace{0.8em}\large
+LaTeX3 programming layer (\textsf{expl3}) is very powerful for advanced users,
+but it is a little complicated for normal users.
+This \textcolor{green3}{\sffamily functional} package aims to provide
+intuitive LaTeX2 functional interfaces for it.
+\par\vspace{0.5em}
+Although there are functions in LaTeX3, the evaluation of them is from outside to inside.
+With this package, the evaluation of functions is from inside to outside,
+which is the same as other programming languages such as \texttt{JavaScript} or \texttt{Lua}.
+In this way, it is rather easy to debug code too.
+\par\vspace{0.5em}
+Note that many paragraphs in this manual are copied from the documentation of \textsf{expl3}.
+\par\vspace{0.8em}\hrule}}
+
+{\let\newpage\relax\vspace{-4cm}\maketitle}
+
+\tableofcontents
+
+\chapter{Overview of Features}
+
+\section{Evaluation from Inside to Outside}
+
+We will compare our first example with a similar \verb!Lua! example:
+
+\begin{code}
+-- lua code --
+function MathSquare (arg)
+ local lTmpaInt = arg * arg
+ return lTmpaInt
+end
+print(MathSquare(5))
+print(MathSquare(MathSquare(5)))
+\end{code}
+
+\begin{codehigh}
+%% function code
+\ExplSyntaxOn
+\PrgNewFunction \MathSquare { m } {
+ \IntSet \lTmpaInt { \IntEval { #1 * #1 } }
+ \Result { \Value \lTmpaInt }
+}
+\ExplSyntaxOff
+\MathSquare{5}
+\MathSquare{\MathSquare{5}}
+\end{codehigh}
+
+%\ExplSyntaxOn
+%\PrgNewFunction \MathSquare { m }{
+% \IntSet \lTmpaInt { \IntEval { #1 * #1 } }
+% \Result { \Value \lTmpaInt }
+%}
+%\ExplSyntaxOff
+%\MathSquare{5}
+%\MathSquare{\MathSquare{5}}
+
+%\ExplSyntaxOn
+%\PrgNewFunction \MathCubic { m }
+% {
+% \IntSet \lTmpaInt { \IntEval { #1 * #1 * #1 } }
+% \Result { \Value \lTmpaInt }
+% }
+%\ExplSyntaxOff
+%\MathCubic{2}
+%\MathCubic{\MathCubic{2}}
+
+Both examples calculate first the square of $5$ and produce $25$,
+then calculate the square of $25$ and produce $625$.
+In contrast to \verb!expl3!, this \verb!functional! package
+does evaluation of functions from inside to outside,
+which means composition of functions works like othe programming languages
+such as \verb!Lua! or \verb!JavsScript!.
+
+You can define new functions with \cs{PrgNewFunction} command.
+To make composition of functions work as expected,
+every function \emph{must not} insert directly any token to the input stream.
+Instead, a function \emph{must} pass the result (if any) to \verb!functional! package
+with \cs{Result} command. And \verb!functional! package is responsible for
+inserting result tokens to the input stream at the appropriate time.
+
+To remove space tokens inside function code in defining functions,
+you'd better put function definitions inside \verb!\ExplSyntaxOn! and
+\verb!\ExplSyntaxOff! block. Within this block, \verb!~! is used to input a space.
+
+At the end of this section,
+we will compare our factorial example with a similar \verb!Lua! example:
+
+\begin{code}
+-- lua code --
+function Factorial (n)
+ if n == 0 then
+ return 1
+ else
+ return n * Factorial(n-1)
+ end
+end
+print(Factorial(4))
+\end{code}
+
+\begin{codehigh}
+\ExplSyntaxOn
+\PrgNewFunction \Factorial { m } {
+ \IntCompareTF {#1} = {0} {
+ \Result {1}
+ }{
+ \Result { \IntMathMult {#1} { \Factorial { \IntMathSub{#1}{1} } } }
+ }
+}
+\ExplSyntaxOff
+\Factorial{4}
+\end{codehigh}
+
+%\ExplSyntaxOn
+%\PrgNewFunction \Factorial { m } {
+% \IntCompareTF {#1} = {0} {
+% \Result {1}
+% }{
+% \Result { \IntMathMult {#1} { \Factorial { \IntMathSub{#1}{1} } } }
+% }
+%}
+%\ExplSyntaxOff
+%\Factorial{0}
+%\Factorial{4}
+
+\section{Group Scoping of Functions}
+
+In \verb!Lua! language, a function or a condition expression makes a block,
+and the values of local variables will be reset after a block.
+For example
+
+\begin{code}
+-- lua code --
+local a = 1
+print(a) ---- 1
+function SomeFun()
+ local a = 2
+ print(a) ---- 2
+ if 1 > 0 then
+ local a = 3
+ print(a) ---- 3
+ end
+ print(a) ---- 2
+end
+SomeFun()
+print(a) ---- 1
+\end{code}
+
+In \verb!functional! package, a condition expression is in fact a function,
+and you can make every function become a group by setting
+\verb!\Functional{scoping=true}!. For example
+
+\begin{codehigh}
+\Functional{scoping=true}
+\ExplSyntaxOn
+\IntSet \lTmpaInt {1}
+\IntLog \lTmpaInt % ---- 1
+\PrgNewFunction \SomeFun { } {
+ \IntSet \lTmpaInt {2}
+ \IntLog \lTmpaInt % ---- 2
+ \IntCompareTF {1} > {0} {
+ \IntSet \lTmpaInt {3}
+ \IntLog \lTmpaInt % ---- 3
+ }{ }
+ \IntLog \lTmpaInt % ---- 2
+}
+\SomeFun
+\IntLog \lTmpaInt % ---- 1
+\ExplSyntaxOff
+\end{codehigh}
+
+Same as \verb!expl3!, the names of local variables \emph{must} start with \verb!l!,
+while names of global variables \emph{must} start with \verb!g!.
+The difference is that \verb!functional! package provides only one function for setting
+both local and global varianbles of the same type,
+by checking leading letters of their names. So for integer variables, you can write
+\verb!\IntSet\lTmpaInt{1}! and \verb!\IntSet\gTmpbInt{2}!.
+
+The previous example will produce different result
+if we change variable from \verb!\lTmpaInt! to \verb!\gTmpaInt!.
+
+\begin{codehigh}
+\Functional{scoping=true}
+\IntSet \gTmpaInt {1}
+\IntLog \gTmpaInt % ---- 1
+\PrgNewFunction \SomeFun { } {
+ \IntSet \gTmpaInt {2}
+ \IntLog \gTmpaInt % ---- 2
+ \IntCompareTF {1} > {0} {
+ \IntSet \gTmpaInt {3}
+ \IntLog \gTmpaInt % ---- 3
+ }{ }
+ \IntLog \gTmpaInt % ---- 3
+}
+\SomeFun
+\IntLog \gTmpaInt % ---- 3
+\end{codehigh}
+
+As you can see, the values of global variables will never be reset after a group.
+
+\section{Tracing Evaluation of Functions}
+
+Since every function in \verb!functional! package will pass its return value to
+the package, it is quite easy to debug your code.
+You can turn on the tracing by setting \verb!\Functional{tracing=true}!.
+For example, the tracing log of the first example in this chapter will be the following:
+
+% FIXME: spaces at the first line will be removed
+%\begin{codehigh}[]
+% [I] \MathSquare{5}
+% [I] \IntEval{5*5}
+% [I] \Expand{\int_eval:n {5*5}}
+% [O] 25
+% [I] \Result{25}
+% [O] 25
+% [O] 25
+% [I] \IntSet\lTmpaInt {25}
+% [O]
+% [I] \Value\lTmpaInt
+% [O] 25
+% [I] \Result{25}
+% [O] 25
+% [O] 25
+%\end{codehigh}
+\begin{codehigh}[]
+[I] \MathSquare{5}
+ [I] \IntEval{5*5}
+ [I] \Expand{\int_eval:n {5*5}}
+ [O] 25
+ [I] \Result{25}
+ [O] 25
+ [O] 25
+ [I] \IntSet\lTmpaInt {25}
+ [O]
+ [I] \Value\lTmpaInt
+ [O] 25
+ [I] \Result{25}
+ [O] 25
+[O] 25
+[I] \MathSquare{25}
+ [I] \IntEval{25*25}
+ [I] \Expand{\int_eval:n {25*25}}
+ [O] 625
+ [I] \Result{625}
+ [O] 625
+ [O] 625
+ [I] \IntSet\lTmpaInt {625}
+ [O]
+ [I] \Value\lTmpaInt
+ [O] 625
+ [I] \Result{625}
+ [O] 625
+[O] 625
+\end{codehigh}
+
+\section{Definitions of Functions}
+
+Within \verb!expl3!, there are eight commands for defining new functions,
+which is good for power users.
+
+\begin{code}[language=latex/latex3]
+\cs_new:Npn
+\cs_new_nopar:Npn
+\cs_new_protected:Npn
+\cs_new_protected_nopar:Npn
+\cs_new:Nn
+\cs_new_nopar:Nn
+\cs_new_protected:Nn
+\cs_new_protected_nopar:Nn
+\end{code}
+
+Within \verb!functional! package, there is only one command (\cs{PrgNewFunction})
+for defining new functions, which is good for normal users.
+The created functions are always protected and accept \verb!\par! in their arguments.
+
+Since \verb!functional! package gets the results of functions by evaluation
+(including expansion and execution by \TeX), it is natural to protect all functions.
+
+\section{Variants of Arguments}
+
+Within \verb!expl3!, there are several expansion variants for arguments,
+and many expansion functions for expanding them, which are necessary for power users.
+
+\begin{code}[language=latex/latex3]
+\module_foo:c
+\module_bar:e
+\module_bar:x
+\module_bar:f
+\module_bar:o
+\module_bar:V
+\module_bar:v
+\end{code}
+
+\begin{code}[language=latex/latex3]
+\exp_args:Nc
+\exp_args:Ne
+\exp_args:Nx
+\exp_args:Nf
+\exp_args:No
+\exp_args:NV
+\exp_args:Nv
+\end{code}
+
+Within \verb!functional! package, there are only three variants
+(\verb!c!, \verb!e!, \verb!V!) are provided, and these variants are defined
+as functions (\cs{Name}, \cs{Expand}, \cs{Value}, respetively),
+which are easier to use for normal users.
+
+\begin{demohigh}
+\newcommand\test{uvw}
+\Name{test}
+\end{demohigh}
+
+\begin{demohigh}
+\newcommand\test{uvw}
+\Expand{111\test222}
+\end{demohigh}
+
+\begin{demohigh}
+\IntSet\lTmpaInt{123}
+\Value\lTmpaInt
+\end{demohigh}
+
+The most interesting feature is that you can compose these functions.
+For example, you can easily get the \verb!v! variant of \verb!expl3! by
+simply composing \cs{Name} and \cs{Value} functions:
+
+\begin{demohigh}
+\IntSet\lTmpaInt{123}
+\Value{\Name{lTmpaInt}}
+\end{demohigh}
+
+\chapter{Basic Definitions (\texttt{l3basics})}
+
+\section{Defining Functions and Conditionals}
+
+\begin{function}{\PrgNewFunction}
+\begin{syntax}
+\cs{PrgNewFunction} \meta{function} \Arg{argument specification} \Arg{code}
+\end{syntax}
+Creates protected \meta{function} for evaluating the \meta{code}.
+Within the \meta{code}, the parameters (\verb|#1|, \verb|#2|,
+\emph{etc.}) will be replaced by those absorbed by the function.
+The returned value \emph{must} be passed with \cs{Result} function.
+The definition is global and an error results if the
+\meta{function} is already defined.\par
+The \Arg{argument specification} in a list of letters,
+where each letter is one of the following argument specifiers
+(nearly all of them are \texttt{M} or \texttt{m} for functions provided by this package):\par
+{\centering\begin{tabular}{ll}
+%\hline
+ \texttt{M} & single-token argument, which will be manipulated first \\
+ \texttt{m} & multi-token argument, which will be manipulated first \\
+ \texttt{N} & single-token argument, which will not be manipulated first \\
+ \texttt{n} & multi-token argument, which will not be manipulated first \\
+%\hline
+\end{tabular}\par}
+The argument manipulation for argument type \texttt{M} or \texttt{m}
+is: if the argument starts with a function defined with \cs{PrgNewFunction},
+the argument will be evaluated and replaced with the returned value.
+\end{function}
+
+\begin{function}{\PrgNewConditional}
+\begin{syntax}
+\cs{PrgNewConditional} \meta{function} \Arg{argument specification} \Arg{code}
+\end{syntax}
+Creates protected conditional \meta{function} for evaluating the \meta{code}.
+The returned value of the \meta{function} \emph{must} be either \verb!\cTrueBool!
+or \verb!\cFalseBool! and be passed with \cs{Result} function..
+The definition is global and an error results if the \meta{function} is already defined.
+\par
+Assume the \meta{function} is \verb!\FooIfBar!, then another function \verb!\FooIfBarTF!
+will be created at the same time. \verb!\FooIfBarTF! function has two extra arguments
+which are \Arg{true code} and \Arg{false code}.\par
+\end{function}
+
+\begin{function}{\Result}
+\begin{syntax}
+\cs{Result} \Arg{tokens}
+\end{syntax}
+Appends \meta{tokens} to \verb!\gResultTl!, which holds the returned value of current function.
+This function is normally used in the \meta{code} of \cs{PrgNewFunction} and \cs{PrgNewConditional}.
+\end{function}
+
+\section{Expanding and Using Tokens}
+
+\begin{function}{\Name}
+\begin{syntax}
+\cs{Name} \Arg{control sequence name}
+\end{syntax}
+Expands the \meta{control sequence name} until only characters
+remain, then converts this into a control sequence and returns it.
+The \meta{control sequence name} must consist of character tokens %,
+%typically a mixture of category code $10$ (space), $11$ (letter) and $12$ (other).
+when exhaustively expanded.%
+%\begin{texnote}
+%Protected macros that appear in a \texttt{c}-type argument are
+%expanded despite being protected; \cs{exp_not:n} also has no
+%effect. An internal error occurs if non-characters or active
+%characters remain after full expansion, as the conversion to a
+%control sequence is not possible.
+%\end{texnote}
+\end{function}
+
+\begin{function}{\Value}
+\begin{syntax}
+\cs{Value} \meta{variable}
+\end{syntax}
+Recovers the content of a \meta{variable} and returns the value.
+An error is raised if the variable does not exist or if it is invalid.
+Note that it is the same as \cs{TlUse} for \meta{tl var}, or \cs{IntUse} for \meta{int var}.
+\end{function}
+
+\begin{function}{\Expand}
+\begin{syntax}
+\cs{Expand} \Arg{tokens}
+\end{syntax}
+Expands the \meta{tokens} exhaustively and returns the result.
+\end{function}
+
+\begin{function}{\ExpNot}
+\begin{syntax}
+\cs{ExpNot} \Arg{tokens}
+\end{syntax}
+Prevents expansion of the \meta{tokens} inside the argument of \cs{Expand} function.
+The argument of \cs{ExpNot} \emph{must} be surrounded by braces.
+%\begin{texnote}
+%This is the \eTeX{} \tn{unexpanded} primitive. In an
+%|x|-expanding definition (\cs{cs_new:Npx}), \cs{exp_not:n}~|{#1}|
+%is equivalent to |##1| rather than to~|#1|, namely it inserts the
+%two characters |#| and~|1|. In an |e|-type argument
+%\cs{exp_not:n}~|{#}| is equivalent to |#|, namely it inserts the
+%character~|#|.
+%\end{texnote}
+\end{function}
+
+\begin{function}{\ExpValue}
+\begin{syntax}
+\cs{ExpValue} \meta{variable}
+\end{syntax}
+Recovers the content of the \meta{variable}, then prevents expansion
+of this material inside the argument of \cs{Expand} function.
+\end{function}
+
+\begin{function}{\UseOne,\GobbleOne}
+\begin{syntax}
+\cs{UseOne} \Arg{argument}
+\cs{GobbleOne} \Arg{argument}
+\end{syntax}
+The function \cs{UseOne} absorbs one argument and returns it.
+%\begin{texnote}
+%The \cs{UseOne} function is equivalent to \LaTeXe{}'s \tn{@firstofone}.
+%\end{texnote}
+\cs{GobbleOne} absorbs one argument and returns nothing.
+%\begin{texnote}
+%These are equivalent to \LaTeXe{}'s \tn{@gobble}, \tn{@gobbbletwo},
+%\emph{etc.}
+%\end{texnote}
+For example
+\begin{demohigh}
+\UseOne{abc}\GobbleOne{ijk}\UseOne{xyz}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\UseGobble,\GobbleUse}
+\begin{syntax}
+\cs{UseGobble} \Arg{arg_1} \Arg{arg_2}
+\cs{GobbleUse} \Arg{arg_1} \Arg{arg_2}
+\end{syntax}
+These functions absorb two arguments.
+The function \cs{UseGobble} discards the second argument,
+and returns the content of the first argument.
+\cs{GobbleUse} discards the first argument,
+and returns the content of the second argument.
+%\begin{texnote}
+%These are equivalent to \LaTeXe{}'s \tn{@firstoftwo} and
+%\tn{@secondoftwo}.
+%\end{texnote}
+For example
+\begin{demohigh}
+\UseGobble{abc}{uvw}\GobbleUse{abc}{uvw}
+\end{demohigh}
+\end{function}
+
+\chapter{Control Structures (\texttt{l3prg})}
+
+\section{Scratch Variables of Booleans}
+
+\begin{variable}{\lTmpaBool,\lTmpbBool,\lTmpcBool,\lTmpiBool,\lTmpjBool,\lTmpkBool}
+Scratch booleans for local assignment. These are never used by
+the \verb!functional! package, and so are safe for use with any
+function. However, they may be overwritten by other
+code and so should only be used for short-term storage.
+\end{variable}
+
+\begin{variable}{\gTmpaBool,\gTmpbBool,\gTmpcBool,\gTmpiBool,\gTmpjBool,\gTmpkBool}
+Scratch booleans for global assignment. These are never used by
+the \verb!functional! package, and so are safe for use with any
+function. However, they may be overwritten by other
+code and so should only be used for short-term storage.
+\end{variable}
+
+%\BoolIfTF\cTrueBool{\Result{true}}{\Result{false}}
+%\BoolIfTF\cFalseBool{\Result{true}}{\Result{false}}
+
+\section{Public Functions for Booleans}
+
+\begin{function}{\BoolNew}
+\begin{syntax}
+\cs{BoolNew} \meta{boolean}
+\end{syntax}
+Creates a new \meta{boolean} or raises an error if the
+name is already taken. The declaration is global. The
+\meta{boolean} is initially \texttt{false}.
+\end{function}
+
+\begin{function}{\BoolSetTrue}
+\begin{syntax}
+\cs{BoolSetTrue} \meta{boolean}
+\end{syntax}
+Sets \meta{boolean} logically \texttt{true}.
+\end{function}
+
+\begin{function}{\BoolSetFalse}
+\begin{syntax}
+\cs{BoolSetFalse} \meta{boolean}
+\end{syntax}
+Sets \meta{boolean} logically \texttt{false}.
+\end{function}
+
+\begin{function}{\BoolIf,\BoolIfTF}
+\begin{syntax}
+\cs{BoolIf} \meta{boolean}
+\cs{BoolIfTF} \meta{boolean} \Arg{true code} \Arg{false code}
+\end{syntax}
+Tests the current truth of \meta{boolean}, and continues evaluation
+based on this result. For example
+\begin{demohigh}
+\BoolSetTrue\lTmpaBool
+\BoolIfTF\lTmpaBool{\Result{True!}}{\Result{False!}}
+\BoolSetFalse\lTmpaBool
+\BoolIfTF\lTmpaBool{\Result{True!}}{\Result{False!}}
+\end{demohigh}
+\end{function}
+
+\chapter{Token Lists (\texttt{l3tl})}
+
+\section{Scratch Variables of Token Lists}
+
+\begin{variable}{\lTmpaTl,\lTmpbTl,\lTmpcTl,\lTmpiTl,\lTmpjTl,\lTmpkTl}
+Scratch token lists for local assignment. These are never used by
+the \verb!functional! package, and so are safe for use with any
+function. However, they may be overwritten by other
+code and so should only be used for short-term storage.
+\end{variable}
+
+\begin{variable}{\gTmpaTl,\gTmpbTl,\gTmpcTl,\gTmpiTl,\gTmpjTl,\gTmpkTl}
+Scratch token lists for global assignment. These are never used by
+the \verb!functional! package, and so are safe for use with any
+function. However, they may be overwritten by other
+code and so should only be used for short-term storage.
+\end{variable}
+
+\section{Public Functions for Token Lists}
+
+\begin{function}{\TlNew}
+\begin{syntax}
+\cs{TlNew} \meta{tl~var}
+\end{syntax}
+Creates a new \meta{tl~var} or raises an error if the
+name is already taken. The declaration is global. The
+\meta{tl~var} is initially empty.
+\end{function}
+
+\begin{function}{\TlUse}
+\begin{syntax}
+\cs{TlUse} \meta{tl~var}
+\end{syntax}
+Recovers the content of a \meta{tl~var} and returns the value.
+An error is raised if the variable
+does not exist or if it is invalid. Note that it is possible to use
+a \meta{tl~var} directly without an accessor function.
+\end{function}
+
+\begin{function}{\TlSet}
+\begin{syntax}
+\cs{TlSet} \meta{tl~var} \Arg{tokens}
+\end{syntax}
+Sets \meta{tl~var} to contain \meta{tokens},
+removing any previous content from the variable. For example
+\begin{demohigh}
+\TlSet\lTmpiTl{\IntMathMult{4}{5}}
+\TlUse\lTmpiTl
+\end{demohigh}
+\end{function}
+
+\begin{function}{\TlClear}
+\begin{syntax}
+\cs{TlClear} \meta{tl~var}
+\end{syntax}
+Clears all entries from the \meta{tl~var}. For example
+\begin{demohigh}
+\TlSet\lTmpjTl{One}
+\TlClear\lTmpjTl
+\TlSet\lTmpjTl{Two}
+\TlUse\lTmpjTl
+\end{demohigh}
+\end{function}
+
+\begin{function}{\TlPutLeft}
+\begin{syntax}
+\cs{TlPutLeft} \meta{tl~var} \Arg{tokens}
+\end{syntax}
+Appends \meta{tokens} to the left side of the current content of
+\meta{tl~var}. For example
+\begin{demohigh}
+\TlSet\lTmpkTl{Functional}
+\TlPutLeft\lTmpkTl{Hello}
+\TlUse\lTmpkTl
+\end{demohigh}
+\end{function}
+
+\begin{function}{\TlPutRight}
+\begin{syntax}
+\cs{TlPutRight} \meta{tl~var} \Arg{tokens}
+\end{syntax}
+Appends \meta{tokens} to the right side of the current content of
+\meta{tl~var}. For example
+\begin{demohigh}
+\TlSet\lTmpkTl{Functional}
+\TlPutRight\lTmpkTl{World}
+\TlUse\lTmpkTl
+\end{demohigh}
+\end{function}
+
+\begin{function}{\TlIfEmpty,\TlIfEmptyTF}
+\begin{syntax}
+\cs{TlIfEmpty} \meta{tl~var}
+\cs{TlIfEmptyTF} \meta{tl~var} \Arg{true code} \Arg{false code}
+\end{syntax}
+Tests if the \meta{token list variable} is entirely empty
+(\emph{i.e.}~contains no tokens at all). For example
+\begin{demohigh}
+\TlSet\lTmpaTl{abc}
+\TlIfEmptyTF\lTmpaTl{\Result{Empty}}{\Result{NonEmpty}}
+\TlClear\lTmpaTl
+\TlIfEmptyTF\lTmpaTl{\Result{Empty}}{\Result{NonEmpty}}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\TlIfEq,\TlIfEqTF}
+\begin{syntax}
+\cs{TlIfEq} \meta{tl~var_1} \meta{tl~var_2}
+\cs{TlIfEqTF} \meta{tl~var_1} \meta{tl~var_2} \Arg{true code} \Arg{false code}
+\end{syntax}
+Compares the content of two \meta{token list variables} and
+is logically \texttt{true} if the two contain the same list of
+tokens (\emph{i.e.}~identical in both the list of characters they
+contain and the category codes of those characters). For example
+\begin{demohigh}
+\TlSet\lTmpaTl{abc}
+\TlSet\lTmpbTl{abc}
+\TlSet\lTmpcTl{xyz}
+\TlIfEqTF\lTmpaTl\lTmpbTl{\Result{Yes}}{\Result{No}}
+\TlIfEqTF\lTmpaTl\lTmpcTl{\Result{Yes}}{\Result{No}}
+\end{demohigh}
+%See also \cs{StrIfEqTF} for a comparison that ignores category codes.
+\end{function}
+
+\chapter{Integers (\texttt{l3int})}
+
+\section{Scratch Variables of Integers}
+
+\begin{variable}{\lTmpaInt,\lTmpbInt,\lTmpcInt,\lTmpiInt,\lTmpjInt,\lTmpkInt}
+Scratch integer for local assignment. These are never used by
+the \verb!functional! package, and so are safe for use with any
+function. However, they may be overwritten by other
+code and so should only be used for short-term storage.
+\end{variable}
+
+\begin{variable}{\gTmpaInt,\gTmpbInt,\gTmpcInt,\gTmpiInt,\gTmpjInt,\gTmpkInt}
+Scratch integer for global assignment. These are never used by
+the \verb!functional! package, and so are safe for use with any
+function. However, they may be overwritten by other
+code and so should only be used for short-term storage.
+\end{variable}
+
+\section{Public Functions for Integers}
+
+\begin{function}{\IntEval}
+\begin{syntax}
+\cs{IntEval} \Arg{integer expression}
+\end{syntax}
+Evaluates the \meta{integer expression} and returns the result:
+for positive results an
+explicit sequence of decimal digits not starting with~\texttt{0},
+for negative results \texttt{-}~followed by such a sequence, and
+\texttt{0}~for zero. For example
+\begin{demohigh}
+\IntEval{(1+4)*(2-3)/5}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntMathAdd}
+\begin{syntax}
+\cs{IntMathAdd} \Arg{integer expression_1} \Arg{integer expression_2}
+\end{syntax}
+Adds \Arg{integer expression_1} and \Arg{integer expression_2},
+and returns the result. For example
+\begin{demohigh}
+\IntMathAdd{7}{3}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntMathSub}
+\begin{syntax}
+\cs{IntMathSub} \Arg{integer expression_1} \Arg{integer expression_2}
+\end{syntax}
+Subtracts \Arg{integer expression_1} from \Arg{integer expression_2},
+and returns the result. For example
+\begin{demohigh}
+\IntMathSub{7}{3}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntMathMult}
+\begin{syntax}
+\cs{IntMathMult} \Arg{integer expression_1} \Arg{integer expression_2}
+\end{syntax}
+Multiplies \Arg{integer expression_1} by \Arg{integer expression_2},
+and returns the result. For example
+\begin{demohigh}
+\IntMathMult{7}{3}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntMathDiv}
+\begin{syntax}
+\cs{IntMathDiv} \Arg{integer expression_1} \Arg{integer expression_2}
+\end{syntax}
+Divides \Arg{integer expression_1} by \Arg{integer expression_2},
+and returns the result. For example
+\begin{demohigh}
+\IntMathDiv{7}{3}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntNew}
+\begin{syntax}
+\cs{IntNew} \meta{integer}
+\end{syntax}
+Creates a new \meta{integer} or raises an error if the name is
+already taken. The declaration is global. The \meta{integer} is
+initially equal to $0$.
+\end{function}
+
+\begin{function}{\IntUse}
+\begin{syntax}
+\cs{IntUse} \meta{integer}
+\end{syntax}
+Recovers the content of an \meta{integer} and returns the value.
+An error is raised if the variable does
+not exist or if it is invalid. Can be omitted in places where an
+\meta{integer} is required (such as in the first and third arguments
+of \cs{IntCompareTF}).%
+%\begin{texnote}
+%\cs{IntUse} is the \TeX{} primitive \tn{the}: this is one of
+%several \verb!functional! names for this primitive.
+%\end{texnote}
+\end{function}
+
+\begin{function}{\IntSet}
+\begin{syntax}
+\cs{IntSet} \meta{integer} \Arg{integer expression}
+\end{syntax}
+Sets \meta{integer} to the value of \meta{integer expression},
+which must evaluate to an integer (as described for \cs{IntEval}).
+For example
+\begin{demohigh}
+\IntSet\lTmpaInt{3+5}
+\IntUse\lTmpaInt
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntZero}
+\begin{syntax}
+\cs{IntZero} \meta{integer}
+\end{syntax}
+Sets \meta{integer} to $0$. For example
+\begin{demohigh}
+\IntSet\lTmpaInt{5}
+\IntZero\lTmpaInt
+\IntUse\lTmpaInt
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntIncr}
+\begin{syntax}
+\cs{IntIncr} \meta{integer}
+\end{syntax}
+Increases the value stored in \meta{integer} by $1$.
+For example
+\begin{demohigh}
+\IntSet\lTmpaInt{5}
+\IntIncr\lTmpaInt
+\IntUse\lTmpaInt
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntDecr}
+\begin{syntax}
+\cs{IntDecr} \meta{integer}
+\end{syntax}
+Decreases the value stored in \meta{integer} by $1$.
+For example
+\begin{demohigh}
+\IntSet\lTmpaInt{5}
+\IntDecr\lTmpaInt
+\IntUse\lTmpaInt
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntAdd}
+\begin{syntax}
+\cs{IntAdd} \meta{integer} \Arg{integer expression}
+\end{syntax}
+Adds the result of the \meta{integer expression} to the current
+content of the \meta{integer}. For example
+\begin{demohigh}
+\IntSet\lTmpaInt{5}
+\IntAdd\lTmpaInt{2}
+\IntUse\lTmpaInt
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntSub}
+\begin{syntax}
+\cs{IntSub} \meta{integer} \Arg{integer expression}
+\end{syntax}
+Subtracts the result of the \meta{integer expression} from the
+current content of the \meta{integer}. For example
+\begin{demohigh}
+\IntSet\lTmpaInt{5}
+\IntSub\lTmpaInt{3}
+\IntUse\lTmpaInt
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntStepVariable}
+\begin{syntax}
+\cs{IntStepVariable} \Arg{initial value} \Arg{step} \Arg{final value} \meta{tl~var} \Arg{code}
+\end{syntax}
+This function first evaluates the \meta{initial value}, \meta{step}
+and \meta{final value}, all of which should be integer expressions.
+Then for each \meta{value} from the \meta{initial value} to the
+\meta{final value} in turn (using \meta{step} between each
+\meta{value}), the \meta{code} is evaluated,
+with the \meta{tl~var} defined as the current \meta{value}. Thus
+the \meta{code} should make use of the \meta{tl~var}.
+For example
+\begin{demohigh}
+\TlClear\lTmpaTl
+\IntStepVariable{1}{3}{30}\lTmpiTl{
+ \TlPutRight\lTmpaTl{\Value\lTmpiTl}
+ \TlPutRight\lTmpaTl{ }
+}
+\Result{\Value\lTmpaTl}
+\end{demohigh}
+\end{function}
+
+\begin{function}{\IntCompare,\IntCompareTF}
+\begin{syntax}
+\cs{IntCompare} \Arg{intexpr_1} \meta{relation} \Arg{intexpr_2}
+\cs{IntCompareTF} \Arg{intexpr_1} \meta{relation} \Arg{intexpr_2} \Arg{true code} \Arg{false code}
+\end{syntax}
+This function first evaluates each of the \meta{integer expressions}
+as described for \cs{IntEval}. The two results are then
+compared using the \meta{relation}:\par
+{\centering\begin{tabular}{ll}
+Equal & \texttt{=} \\
+Greater than & \texttt{>} \\
+Less than & \texttt{<} \\
+\end{tabular}\par}
+For example
+\begin{demohigh}
+\IntCompareTF{2}>{1}{\Result{Greater}}{\Result{Less}}
+\IntCompareTF{2}>{3}{\Result{Greater}}{\Result{Less}}
+\end{demohigh}
+\end{function}
+
+\chapter{The Source Code}
+
+%\CodeHigh{lite}
+\setlength\parskip{0pt}
+\dochighinput[language=latex/latex3]{functional.sty}
+
+\end{document}
+
diff --git a/macros/latex/contrib/tiscreen/README b/macros/latex/contrib/tiscreen/README
index 17f81e8592..ce974f7cbe 100644
--- a/macros/latex/contrib/tiscreen/README
+++ b/macros/latex/contrib/tiscreen/README
@@ -4,6 +4,8 @@ This package mimics the screen and buttons of older Texas instruments dot
matrix display calculators, specifically the TI-82 STATS.
Changes:
+- 2021/12/31 Added all buttons
+- 2021/12/18 Add TI-84 characters
- 2021/09/18 Added buttons
- 2021/07/22 Added bracket symbols
- 2021/06/10 Simplified example code in documentation
diff --git a/macros/latex/contrib/tiscreen/doc/tiscreen-doc.pdf b/macros/latex/contrib/tiscreen/doc/tiscreen-doc.pdf
index 3b8f41078b..577278af1d 100644
--- a/macros/latex/contrib/tiscreen/doc/tiscreen-doc.pdf
+++ b/macros/latex/contrib/tiscreen/doc/tiscreen-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/tiscreen/doc/tiscreen-doc.tex b/macros/latex/contrib/tiscreen/doc/tiscreen-doc.tex
index b1e689ba74..6e0207271e 100644
--- a/macros/latex/contrib/tiscreen/doc/tiscreen-doc.tex
+++ b/macros/latex/contrib/tiscreen/doc/tiscreen-doc.tex
@@ -1,14 +1,16 @@
-% TODO: make funciton for printing \LCDcmd
-
\documentclass[a4paper,12pt]{article}
+
\usepackage[iso,english]{isodate}
\usepackage[margin=1in]{geometry}
\usepackage[english]{babel}
+\usepackage{hyperref}
\usepackage{parskip}
+
+\usepackage{amsmath}
\usepackage[color]{tiscreen}
\usepackage{multicol}
-\usepackage{hyperref}
\usepackage{array}
+\usepackage{longtable}
\usepackage{fancyvrb-ex}
\fvset{
frame=single,
@@ -19,30 +21,46 @@
}
\newcommand{\LCDsymb}[1]{\large \textLCD{1}|{#1}~|}
-\newcommand{\printcmd}[1]{\texttt{\textbackslash #1}}
-\title{TI calculator screen (and buttons)\\{\small TI-82 STATS}}
-\author{Mustafa Ibrahim}
+\title{TI calculator screen (and buttons)\\{\small TI-82 STATS, TI-84}}
+\author{Mustafa Ibrahim, Caleb Bibb}
+\date{2021-12-31}
\begin{document}
\maketitle
\begin{center}
-\tiscreen
-|10^6*(4^7+1){rarrow}X |
-| 1.6385E10|
-|{sqrt}(X)*X/10! |
-| 577971782.1|
-|cos{ar}(cos(Ans)) |
-| 62.11246|
-|{fcur} |
-| |
+ \begin{tabular}{cc}
+ \tiscreen
+ |10^6*(4^7+1){rarrow}X |
+ | 1.6385E10|
+ |{sqrt}(X)*X/10! |
+ | 577971782.1|
+ |cos{ar}(cos(Ans)) |
+ | 62.11246|
+ |{fcur} |
+ | |
+ &
+ \tibtnextramatrix
+ \end{tabular}
-\tibtnmatrixextra
+ \dotfill
+
+ \begin{tabular}{ccccc}
+ \tibtnsecond & \tibtnmode & \tibtndel & & \\
+ \tibtnalpha & \tibtnxton & \tibtnstat & & \\
+ \tibtnmath & \tibtnmatrix & \tibtnprgm & \tibtnvars & \tibtnclear \\
+ \tibtnxnone & \tibtnsin & \tibtncos & \tibtntan & \tibtnpower \\
+ \tibtnxtwo & \tibtncomma & \tibtnleftparen & \tibtnrightparen & \tibtndiv \\
+ \tibtnlog & \tibtnseven & \tibtneight & \tibtnnine & \tibtntimes \\
+ \tibtnln & \tibtnfour & \tibtnfive & \tibtnsix & \tibtnminus \\
+ \tibtnsto & \tibtnone & \tibtntwo & \tibtnthree & \tibtnplus \\
+ \tibtnon & \tibtnzero & \tibtndot & \tibtnneg & \tibtnenter \\
+ \end{tabular}
\end{center}
-\tableofcontents\newpage
+\newpage\tableofcontents\newpage
\section{Quickstart}
@@ -59,22 +77,19 @@
| |
| |
-\tibtnmatrixextra
+Lorem \tibtnmath{} ipsum
-Lorem
-\tibtn[white]{tibtngray}{MATH}
-ipsum
-
-\tibtnextra{\tibtn[white]{tibtngray}{MATH}}{TEST}{A}
+\tibtnextramath
\end{SideBySideExample}
\section{Package option(s)}
-\subsection{Color}
-Using the \texttt{color} option will change the colors used by the
-\printcmd{LCD} command for printing the screen using \printcmd{tiscreen}. The
-colors are defined as \texttt{tiscreenfg} (foreground, i.e. font color) and
-\texttt{tiscreenbg} (background) and redefined like this:
+\subsection{Color} \label{sec:color}
+
+Using the \texttt{color} option will change the colors used by the \verb|\LCD|
+command for printing the screen using \verb|\tiscreen|. The colors are defined
+as \texttt{tiscreenfg} (foreground, i.e. font color) and \texttt{tiscreenbg}
+(background) and redefined like this:
\begin{Verbatim}
% Add this to your preamble
@@ -82,12 +97,27 @@ colors are defined as \texttt{tiscreenfg} (foreground, i.e. font color) and
\definecolor{tiscreenfg}{HTML}{FFFFFF}
\end{Verbatim}
-\part{Screen}
+\subsection{Defined colors} \label{sec:colordef}
+
+\begin{tabular}{lcl}
+ Name & Color & Usage \\ \hline
+ tiscreenfg & {\ttfamily \color{tiscreenfg}{000000}} & LCD commands \\
+ tiscreenbg & {\ttfamily \color{tiscreenbg}{5d9345}} & LCD commands \\
+ tibtngray & {\ttfamily \color{tibtngray}{494F54}} & Buttons \\
+ tibtnyellow & {\ttfamily \colorbox{tibtncaseblack}{\color{tibtnyellow}{F1E78B}}} & Buttons \\
+ tibtngreen & {\ttfamily \colorbox{tibtncaseblack}{\color{tibtngreen}{D5DE93}}} & Buttons \\
+ tibtnwhite & {\ttfamily \colorbox{tibtncaseblack}{\color{tibtnwhite}{E2E2E2}}} & Buttons \\
+ tibtnblue & {\ttfamily \colorbox{tibtncaseblack}{\color{tibtnblue}{CDE2E9}}} & Buttons \\
+ tibtncaseblack & {\ttfamily \color{tibtncaseblack}{232A32}} & Buttons \\
+\end{tabular}
+
+\clearpage\part{Screen}
+
\section{LCD size}
The default LCD size is $8 \times 16$ (the size of the TI-82 STATS). It can be
changed by redefining the variables used to determine the size of the display
-or by using the original \printcmd{LCD} command.
+or by using the original \verb|\LCD| command.
\begin{Verbatim}
% First method (For entire document)
@@ -103,68 +133,147 @@ or by using the original \printcmd{LCD} command.
|SIZE |
\end{Verbatim}
-\section{Additional defined characters} \LCDcolors{black}{white}
+\section{(Re)defined characters} \LCDcolors{black}{white}
+
\begin{center}
- \begin{tabular}{|l|l|>{\ttfamily}l|}
+ \begin{longtable}{|l|l|l|}
\multicolumn{3}{c}{\textbf{Added characters}} \\
\hline
- Name & Symbol &\textnormal{\printcmd{LCD} Code} \\
+ Name & Symbol & \verb|\LCD| \textnormal{Code} \\
\hline
- E & \LCDsymb{sciE} & \{sciE\} \\
- $\sigma$ & \LCDsymb{sigma} & \{sigma\} \\
- $x^2$ & \LCDsymb{sq} & \{sq\} \\
- $x^{-1}$ & \LCDsymb{ar} & \{ar\} \\
- $y^x$ & \LCDsymb{cx} & \{cx\} \\
- $x_1$ & \LCDsymb{sub1} & \{sub1\} \\
- $x_2$ & \LCDsymb{sub2} & \{sub2\} \\
- $x_3$ & \LCDsymb{sub3} & \{sub3\} \\
- $x_4$ & \LCDsymb{sub4} & \{sub4\} \\
- $x_5$ & \LCDsymb{sub5} & \{sub5\} \\
- $x_6$ & \LCDsymb{sub6} & \{sub6\} \\
- $\bar x$ & \LCDsymb{barx} & \{barx\} \\
- $\bar y$ & \LCDsymb{bary} & \{bary\} \\
+ E & \LCDsymb{sciE} & \verb|{sciE}| \\
+ $\sigma$ & \LCDsymb{sigma} & \verb|{sigma}| \\
+ $\Sigma$ & \LCDsymb{Sigma} & \verb|{Sigma}| \\
+ $x^2$ & \LCDsymb{sq} & \verb|{sq}| \\
+ $x^{-1}$ & \LCDsymb{ar} & \verb|{ar}| \\
+ $x^3$ & \LCDsymb{c3} & \verb|{c3}| \\
+ $y^x$ & \LCDsymb{cx} & \verb|{cx}| \\
+ $x_1$ & \LCDsymb{sub1} & \verb|{sub1}| \\
+ $x_2$ & \LCDsymb{sub2} & \verb|{sub2}| \\
+ $x_3$ & \LCDsymb{sub3} & \verb|{sub3}| \\
+ $x_4$ & \LCDsymb{sub4} & \verb|{sub4}| \\
+ $x_5$ & \LCDsymb{sub5} & \verb|{sub5}| \\
+ $x_6$ & \LCDsymb{sub6} & \verb|{sub6}| \\
+ $x_{10}$ & \LCDsymb{sub10} & \verb|{sub10}| \\
+ $\bar x$ & \LCDsymb{barx} & \verb|{barx}| \\
+ $\bar y$ & \LCDsymb{bary} & \verb|{bary}| \\
+ $-x$ & \LCDsymb{dash} & \verb|{dash}| \\
+ $\rightarrow$ & \LCDsymb{sto} & \verb|{sto}| \\
+ $\theta$ & \LCDsymb{theta} & \verb|{theta}| \\
+ $\pi$ & \LCDsymb{pi} & \verb|{pi}| \\
+ $\eta$ & \LCDsymb{eta} & \verb|{eta}| \\
+ $+$ & \LCDsymb{tick} & \verb|{tick}| \\
+ $^\circ$ & \LCDsymb{degree} & \verb|{degree}| \\
+ & \LCDsymb{square} & \verb|{square}| \\
+ & \LCDsymb{alpha} & \verb|{alpha}| \\
+ $\uparrow$ & \LCDsymb{2nd} & \verb|{2nd}| \\
+ $\geq$ & \LCDsymb{geq} & \verb|{geq}| \\
+ $\leq$ & \LCDsymb{leq} & \verb|{leq}| \\
+ $\neq$ & \LCDsymb{neq} & \verb|{neq}| \\
+ $x^3$ & \LCDsymb{c3} & \verb|{c3}| \\
+ $A^T$ & \LCDsymb{transpose} & \verb|{transpose}| \\
+ $A^r$ & \LCDsymb{upr} & \verb|{upr}| \\
+ $chi$ & \LCDsymb{chi} & \verb|{chi}| \\
+ $\triangleright$ & \LCDsymb{fwedge} & \verb|{fwedge}| \\
+ $\triangleleft$ & \LCDsymb{bwedge} & \verb|{bwedge}| \\
+ $\mathbf{N}$ & \LCDsymb{bbN} & \verb|{bbN}| \\
+ $\mathbf{/}$ & \LCDsymb{bb/} & \verb|{bb/}| \\
\hline
\multicolumn{3}{c}{\textbf{Redefined characters}} \\
\hline
- ! & \LCDsymb{!} & \{!\} \\
- \{ & \LCDsymb{lb} & \{lb\} \\
- \} & \LCDsymb{rb} & \{rb\} \\
- $[$ & \LCDsymb{rb} & \{rb\} \\
- $]$ & \LCDsymb{rb} & \{rb\} \\
- $\sqrt{x}$ & \LCDsymb{sqrt} & \{sqrt\} \\
- e & \LCDsymb{e} & e \\
- i & \LCDsymb{i} & i \\
- v & \LCDsymb{v} & v \\
- w & \LCDsymb{w} & w \\
+ ! & \LCDsymb{!} & \{!\} \\
+ \{ & \LCDsymb{lb} & \{lb\} \\
+ \} & \LCDsymb{rb} & \{rb\} \\
+ $[$ & \LCDsymb{[} & \{[\} \\
+ $]$ & \LCDsymb{]} & \{]\} \\
+ $\sqrt{x}$ & \LCDsymb{sqrt} & \{sqrt\} \\
+ e & \LCDsymb{e} & \{e\} \\
+ i & \LCDsymb{i} & \{i\} \\
+ v & \LCDsymb{v} & \{v\} \\
+ w & \LCDsymb{w} & \{w\} \\
+ Ellipses & \LCDsymb{ell} & \{ell\} \\
+ Apostrophe & \LCDsymb{'} & \{'\} \\
+ List & \LCDsymb{L} & \{L\} \\
+ Underscore & \LCDsymb{_} & \{\_\} \\
\hline
- \end{tabular}
+ \end{longtable}
\end{center}
-\part{Buttons}
-\section{Usage}
-
-Use the \printcmd{tibtn} command only prints the button and is usefull when
-needing the buttons to be displayed inline. The \printcmd{tibtnextra} takes
-extra arguments to show extra options for the button (accesed by the
-\tibtnsecond{} and \tibtnalpha{} buttons).
+\clearpage\part{Buttons}
-\begin{SideBySideExample}[xrightmargin=5.5cm]
-\tibtnextra{\tibtn[white]{tibtngray}{MATH}}{TEST}{A}
+\section{Usage}
-Lorem
-\tibtn[white]{tibtngray}{MATH}
-ipsum
-\end{SideBySideExample}
+The \verb|\tibtn<...>| commands only prints the button and are useful when
+displaying buttons inline. The \verb|\tibtnextra<...>| commands shows the extra
+functionality of the button (accessed by the \tibtnsecond{} and \tibtnalpha{}
+buttons). See secion \ref{sec:button} for defined buttons and section
+\ref{sec:buttonscustom} for how to define custom buttons.
-\section{Defined buttons}
+\section{Defined buttons} \label{sec:button}
\begin{center}
- \begin{tabular}{|>{\ttfamily}l|l|}
- \multicolumn{2}{c}{\textbf{Defined buttons}} \\ \hline
- \textnormal{Command} & Output \\ \hline
- \printcmd{tibtnmatrix} & \tibtnmatrix{} \\ \hline
- \printcmd{tibtnmatrixextra} & \tibtnmatrixextra{} \\ \hline
- \end{tabular}
+ \begin{longtable}{lrlr}
+ \verb|\tibtnsecond| & \tibtnsecond & \tibtnextrasecond & \verb|\tibtnextrasecond| \\
+ \verb|\tibtnmode| & \tibtnmode & \tibtnextramode & \verb|\tibtnextramode| \\
+ \verb|\tibtndel| & \tibtndel & \tibtnextradel & \verb|\tibtnextradel| \\
+ \verb|\tibtnalpha| & \tibtnalpha & \tibtnextraalpha & \verb|\tibtnextraalpha| \\
+ \verb|\tibtnxton| & \tibtnxton & \tibtnextraxton & \verb|\tibtnextraxton| \\
+ \verb|\tibtnstat| & \tibtnstat & \tibtnextrastat & \verb|\tibtnextrastat| \\
+ \verb|\tibtnmath| & \tibtnmath & \tibtnextramath & \verb|\tibtnextramath| \\
+ \verb|\tibtnmatrix| & \tibtnmatrix & \tibtnextramatrix & \verb|\tibtnextramatrix| \\
+ \verb|\tibtnprgm| & \tibtnprgm & \tibtnextraprgm & \verb|\tibtnextraprgm| \\
+ \verb|\tibtnvars| & \tibtnvars & \tibtnextravars & \verb|\tibtnextravars| \\
+ \verb|\tibtnclear| & \tibtnclear & \tibtnextraclear & \verb|\tibtnextraclear| \\
+ \verb|\tibtnxnone| & \tibtnxnone & \tibtnextraxnone & \verb|\tibtnextraxnone| \\
+ \verb|\tibtnsin| & \tibtnsin & \tibtnextrasin & \verb|\tibtnextrasin| \\
+ \verb|\tibtncos| & \tibtncos & \tibtnextracos & \verb|\tibtnextracos| \\
+ \verb|\tibtntan| & \tibtntan & \tibtnextratan & \verb|\tibtnextratan| \\
+ \verb|\tibtnpower| & \tibtnpower & \tibtnextrapower & \verb|\tibtnextrapower| \\
+ \verb|\tibtnxtwo| & \tibtnxtwo & \tibtnextraxtwo & \verb|\tibtnextraxtwo| \\
+ \verb|\tibtncomma| & \tibtncomma & \tibtnextracomma & \verb|\tibtnextracomma| \\
+ \verb|\tibtnleftparen| & \tibtnleftparen & \tibtnextraleftparen & \verb|\tibtnextraleftparen| \\
+ \verb|\tibtnrightparen| & \tibtnrightparen & \tibtnextrarightparen & \verb|\tibtnextrarightparen| \\
+ \verb|\tibtndiv| & \tibtndiv & \tibtnextradiv & \verb|\tibtnextradiv| \\
+ \verb|\tibtnlog| & \tibtnlog & \tibtnextralog & \verb|\tibtnextralog| \\
+ \verb|\tibtnseven| & \tibtnseven & \tibtnextraseven & \verb|\tibtnextraseven| \\
+ \verb|\tibtneight| & \tibtneight & \tibtnextraeight & \verb|\tibtnextraeight| \\
+ \verb|\tibtnnine| & \tibtnnine & \tibtnextranine & \verb|\tibtnextranine| \\
+ \verb|\tibtntimes| & \tibtntimes & \tibtnextratimes & \verb|\tibtnextratimes| \\
+ \verb|\tibtnln| & \tibtnln & \tibtnextraln & \verb|\tibtnextraln| \\
+ \verb|\tibtnfour| & \tibtnfour & \tibtnextrafour & \verb|\tibtnextrafour| \\
+ \verb|\tibtnfive| & \tibtnfive & \tibtnextrafive & \verb|\tibtnextrafive| \\
+ \verb|\tibtnsix| & \tibtnsix & \tibtnextrasix & \verb|\tibtnextrasix| \\
+ \verb|\tibtnminus| & \tibtnminus & \tibtnextraminus & \verb|\tibtnextraminus| \\
+ \verb|\tibtnsto| & \tibtnsto & \tibtnextrasto & \verb|\tibtnextrasto| \\
+ \verb|\tibtnone| & \tibtnone & \tibtnextraone & \verb|\tibtnextraone| \\
+ \verb|\tibtntwo| & \tibtntwo & \tibtnextratwo & \verb|\tibtnextratwo| \\
+ \verb|\tibtnthree| & \tibtnthree & \tibtnextrathree & \verb|\tibtnextrathree| \\
+ \verb|\tibtnplus| & \tibtnplus & \tibtnextraplus & \verb|\tibtnextraplus| \\
+ \verb|\tibtnon| & \tibtnon & \tibtnextraon & \verb|\tibtnextraon| \\
+ \verb|\tibtnzero| & \tibtnzero & \tibtnextrazero & \verb|\tibtnextrazero| \\
+ \verb|\tibtndot| & \tibtndot & \tibtnextradot & \verb|\tibtnextradot| \\
+ \verb|\tibtnneg| & \tibtnneg & \tibtnextraneg & \verb|\tibtnextraneg| \\
+ \verb|\tibtnenter| & \tibtnenter & \tibtnextraenter & \verb|\tibtnextraenter| \\
+ \end{longtable}
\end{center}
+\section{Custom buttons} \label{sec:buttonscustom}
+
+Buttons are defined using the \verb|\tibtn| and \verb|\tibtnextra|. It's often
+convenient to define a \verb|\tibtn| command then use it inside
+\verb|\tibtnextra| (See example below). See section \ref{sec:colordef} for a
+list of defined colors.
+
+\verb|\tibtn[<text color>]{<button color>}{<text>}|
+
+\verb|\tibtnextra{<middle>}{<top left>}{<top right>}|
+
+\begin{SideBySideExample}[xrightmargin=5.5cm]
+\def\tibtnfoo{\tibtn[black]{tibtnblue}{FOO}}
+\tibtnfoo{}
+
+\def\tibtnextrafoo{\tibtnextra{\tibtnfoo}{BAR}{BAZ}}
+\tibtnextrafoo
+\end{SideBySideExample}
+
\end{document}
diff --git a/macros/latex/contrib/tiscreen/tex/tiscreen.sty b/macros/latex/contrib/tiscreen/tex/tiscreen.sty
index d4219f1eb7..adf8f48f71 100644
--- a/macros/latex/contrib/tiscreen/tex/tiscreen.sty
+++ b/macros/latex/contrib/tiscreen/tex/tiscreen.sty
@@ -4,7 +4,7 @@
% version the license is at: http://www.latex-project.org/lppl.txt
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tiscreen}[2021/09/18 Ti calculator screen]
+\ProvidesPackage{tiscreen}[2021/12/31 Ti calculator screen]
\def\tiscreenX{16}
\def\tiscreenY{8}
@@ -13,8 +13,18 @@
\RequirePackage{tikz}
\RequirePackage{tcolorbox}
\RequirePackage{array}
+\RequirePackage{xcolor}
+\RequirePackage{tipa}
+\RequirePackage{textgreek}
+\RequirePackage{wasysym}
+
+%
+% SCREEN CHARACTERS
+%
-% Define screen characters
+% TODO add reverse alpha and reverse arrow
+
+% Define characters
\DefineLCDchar{barx}{11111000001000101010001000101010001}
\DefineLCDchar{bary}{11111000001000110001011110000101110}
\DefineLCDchar{ar}{00011000011100100001000010000000000}
@@ -27,7 +37,32 @@
\DefineLCDchar{sub4}{00000000000100001010011100001000010}
\DefineLCDchar{sub5}{00000000000111001000011000001001100}
\DefineLCDchar{sub6}{00000000000011001000011100101001110}
+\DefineLCDchar{sub10}{00000000001011110101101011010110111}
\DefineLCDchar{cx}{00101000100010100000000000000000000}
+\DefineLCDchar{dash}{00000000000011100000000000000000000}
+\DefineLCDchar{sto}{00000001000001011111000100010000000}
+\DefineLCDchar{theta}{00110010011000111111100011001001100}
+\DefineLCDchar{pi}{00000000001111101010010100101010011}
+\DefineLCDchar{tick}{00000000000000000100011100010000000}
+\DefineLCDchar{degree}{01100100101001001100000000000000000}
+\DefineLCDchar{square}{00000000000000001110010100111000000}
+\DefineLCDchar{alpha}{11111110111010110001101011010111111}
+\DefineLCDchar{2nd}{11111110111000101010110111101111011}
+\DefineLCDchar{geq}{10000011000001101100100000000011111}
+\DefineLCDchar{leq}{00001001101100000110000010000011111}
+\DefineLCDchar{neq}{00010000101111100100111110100001000}
+\DefineLCDchar{c3}{01100000100010000010011000000000000}
+\DefineLCDchar{transpose}{01110001000010000100001000000000000}
+\DefineLCDchar{upr}{10110110001000010000000000000000000}
+\DefineLCDchar{chi}{10000010010101000100010101001000001}
+\DefineLCDchar{fwedge}{00000010000110001110011000100000000}
+\DefineLCDchar{bwedge}{00000000010001100111000110000100000}
+\DefineLCDchar{upwedge}{000000000000100010101000111111}
+\DefineLCDchar{Fcdf}{11111100011010011100101001000010000}
+\DefineLCDchar{Sigma}{11111010000010000010001000100011111}
+\DefineLCDchar{eta}{00000000001011001001010011001010010}
+\DefineLCDchar{bbN}{10001110011110111111101111001110001}
+\DefineLCDchar{bb/}{00000000010001100110011001100010000}
% Redefine screen characters
\DefineLCDchar{sqrt}{00111001000010000100101000110000100}
\DefineLCDchar{!}{00100001000010000100000000010000100}
@@ -39,8 +74,15 @@
\DefineLCDchar{]}{01100001000010000100001000010001100}
\DefineLCDchar{lb}{00011001000010001000001000010000011}
\DefineLCDchar{rb}{11000001000010000010001000010011000}
+\DefineLCDchar{ell}{00000000000000000000000000000010101}
+\DefineLCDchar{'}{00100001000000000000000000000000000}
+\DefineLCDchar{L}{00000000000010000100001000010000111}
+\DefineLCDchar{_}{00000000000000000000000000000011111}
+
+%
+% COLORS
+%
-\RequirePackage{xcolor}
% Screen colors
\definecolor{tiscreenfg}{HTML}{000000}
\definecolor{tiscreenbg}{HTML}{5d9345}
@@ -56,11 +98,14 @@
\DeclareOption*{\PackageWarning{tiscreen}{Unknown ‘\CurrentOption’}}
\ProcessOptions\relax
-% Screen commands
+%
+% COMMANDS
+%
+
\newcommand{\tiscreen}{\LCD{\tiscreenY}{\tiscreenX}}
-% Button commands
\newcommand{\tibtn}[3][black]{\tikz{\bfseries\tiny\sffamily \node[fill=#2, draw, rounded corners, minimum height=2.5em, minimum width=4.5em, align=center] {\textcolor{#1}{#3}};}}
+
\newcommand{\tibtnextra}[3]{%
\tcbox[colback=tibtncaseblack,size=small]{%
\begin{tabular}{l@{}r}%
@@ -71,9 +116,93 @@
}%
}
-% Button definitions
-\def\tibtnsecond{\tibtn{tibtnyellow}{2nd}}
-\def\tibtnalpha{\tibtn{tibtngreen}{ALPHA}}
+%
+% BUTTON DEFINITIONS
+%
-\def\tibtnmatrix{\tibtn[white]{tibtngray}{MATRX}}
-\def\tibtnmatrixextra{\tibtnextra{\tibtnmatrix}{ANGLE}{B}}
+% Special
+\def\tibtnalpha{\tibtn{tibtngreen}{ALPHA}} % ALPHA
+\def\tibtnsecond{\tibtn{tibtnyellow}{2nd}} % EXTRA
+\def\tibtnenter{\tibtn[black]{tibtnblue}{ENTER}} % ENTER
+\def\tibtnextraalpha{\tibtnextra{\tibtnalpha}{A-LOCK}{}} % ALPHA
+\def\tibtnextrasecond{\tibtnextra{\tibtnsecond}{}{}} % EXTRA
+\def\tibtnextraenter{\tibtnextra{\tibtnenter}{ENTRY\hspace{0.25ex}}{SOLVE}} % ENTER
+% Operators
+\def\tibtndiv {\tibtn[black]{tibtnblue}{$\div$}} % division
+\def\tibtntimes{\tibtn[black]{tibtnblue}{\scriptsize\texttimes}} % times
+\def\tibtnminus{\tibtn[black]{tibtnblue}{\footnotesize --}} % minus
+\def\tibtnplus {\tibtn[black]{tibtnblue}{\footnotesize +}} % plus
+\def\tibtnextradiv {\tibtnextra{\tibtndiv} {e} {M}} % division
+\def\tibtnextratimes{\tibtnextra{\tibtntimes}{[} {R}} % times
+\def\tibtnextraminus{\tibtnextra{\tibtnminus}{]} {W}} % minus
+\def\tibtnextraplus {\tibtnextra{\tibtnplus} {MEM}{!!}} % plus
+% Numbers
+\def\tibtnzero{\tibtn[black]{tibtnwhite} {\scriptsize 0}} % 0
+\def\tibtnone {\tibtn[black]{tibtnwhite}{\scriptsize 1}} % 1
+\def\tibtntwo {\tibtn[black]{tibtnwhite}{\scriptsize 2}} % 2
+\def\tibtnthree{\tibtn[black]{tibtnwhite}{\scriptsize 3}} % 3
+\def\tibtnfour {\tibtn[black]{tibtnwhite}{\scriptsize 4}} % 4
+\def\tibtnfive {\tibtn[black]{tibtnwhite}{\scriptsize 5}} % 5
+\def\tibtnsix {\tibtn[black]{tibtnwhite}{\scriptsize 6}} % 6
+\def\tibtnseven{\tibtn[black]{tibtnwhite}{\scriptsize 7}} % 7
+\def\tibtneight{\tibtn[black]{tibtnwhite}{\scriptsize 8}} % 8
+\def\tibtnnine {\tibtn[black]{tibtnwhite}{\scriptsize 9}} % 9
+\def\tibtnextrazero {\tibtnextra{\tibtnzero} {CATALOG}{\large \textvisiblespace}} % 0
+\def\tibtnextraone {\tibtnextra{\tibtnone} {L1} {Y}} % 1
+\def\tibtnextratwo {\tibtnextra{\tibtntwo} {L2} {Z}} % 2
+\def\tibtnextrathree{\tibtnextra{\tibtnthree}{L3} {\texttheta}} % 3
+\def\tibtnextrafour {\tibtnextra{\tibtnfour} {L4} {T}} % 4
+\def\tibtnextrafive {\tibtnextra{\tibtnfive} {L5} {U}} % 5
+\def\tibtnextrasix {\tibtnextra{\tibtnsix} {L6} {V}} % 6
+\def\tibtnextraseven{\tibtnextra{\tibtnseven}{u} {O}} % 7
+\def\tibtnextraeight{\tibtnextra{\tibtneight}{v} {P}} % 8
+\def\tibtnextranine {\tibtnextra{\tibtnnine} {w} {Q}} % 9
+% Misc
+\def\tibtnmode {\tibtn[white]{tibtngray}{MODE}} % MODE
+\def\tibtndel {\tibtn[white]{tibtngray}{DEL}} % DEL
+\def\tibtnxton {\tibtn[white]{tibtngray}{X,T,\texttheta,n}} % X,T,ϴ,n
+\def\tibtnstat {\tibtn[white]{tibtngray}{STAT}} % STAT
+\def\tibtnmath {\tibtn[white]{tibtngray}{MATH}} % MATH
+\def\tibtnmatrix {\tibtn[white]{tibtngray}{MATRX}} % MATRIX
+\def\tibtnprgm {\tibtn[white]{tibtngray}{PRGM}} % PRGM
+\def\tibtnvars {\tibtn[white]{tibtngray}{VARS}} % VARS
+\def\tibtnclear {\tibtn[white]{tibtngray}{CLEAR}} % CLEAR
+\def\tibtnxnone {\tibtn[white]{tibtngray}{x\textsuperscript{-1}}} % x^-1
+\def\tibtnsin {\tibtn[white]{tibtngray}{SIN}} % SIN
+\def\tibtncos {\tibtn[white]{tibtngray}{COS}} % COS
+\def\tibtntan {\tibtn[white]{tibtngray}{TAN}} % TAN
+\def\tibtnpower {\tibtn[white]{tibtngray}{$\wedge$}} % ^
+\def\tibtnxtwo {\tibtn[white]{tibtngray}{x\textsuperscript{2}}} % x^2
+\def\tibtncomma {\tibtn[white]{tibtngray}{\large ,}} % comma
+\def\tibtnleftparen {\tibtn[white]{tibtngray}{(}} % left parenthesis
+\def\tibtnrightparen{\tibtn[white]{tibtngray}{)}} % right parenthesis
+\def\tibtnlog {\tibtn[white]{tibtngray}{LOG}} % log
+\def\tibtnln {\tibtn[white]{tibtngray}{LN}} % LN
+\def\tibtnsto {\tibtn[white]{tibtngray}{STO\RIGHTarrow}} % STO
+\def\tibtnon {\tibtn[white]{tibtngray}{ON}} % ON
+\def\tibtndot {\tibtn[black]{tibtnwhite}{\huge $\cdot$}} % dot
+\def\tibtnneg {\tibtn[black]{tibtnwhite}{(---)}} % negative
+\def\tibtnextramode {\tibtnextra{\tibtnmode} {QUIT}{}} % MODE
+\def\tibtnextradel {\tibtnextra{\tibtndel} {INS}{}} % DEL
+\def\tibtnextraxton {\tibtnextra{\tibtnxton} {LINK}{}} % X,T,ϴ,n
+\def\tibtnextrastat {\tibtnextra{\tibtnstat} {LIST}{}} % STAT
+\def\tibtnextramath {\tibtnextra{\tibtnmath} {TEST}{A}} % MATH
+\def\tibtnextramatrix {\tibtnextra{\tibtnmatrix} {ANGLE}{B}} % MATRIX
+\def\tibtnextraprgm {\tibtnextra{\tibtnprgm} {DRAW}{C}} % PRGM
+\def\tibtnextravars {\tibtnextra{\tibtnvars} {DISTR}{}} % VARS
+\def\tibtnextraclear {\tibtnextra{\tibtnclear} {}{}} % CLEAR
+\def\tibtnextraxnone {\tibtnextra{\tibtnxnone} {FINANCE\hspace{1ex}}{D}} % x^-1
+\def\tibtnextrasin {\tibtnextra{\tibtnsin} {SIN\textsuperscript{-1}}{E}} % SIN
+\def\tibtnextracos {\tibtnextra{\tibtncos} {COS\textsuperscript{-1}}{F}} % COS
+\def\tibtnextratan {\tibtnextra{\tibtntan} {TAN\textsuperscript{-1}}{G}} % TAN
+\def\tibtnextrapower {\tibtnextra{\tibtnpower} {\scriptsize\mdseries\textpi}{H}} % ^
+\def\tibtnextraxtwo {\tibtnextra{\tibtnxtwo} {$\sqrt{\phantom{x}}$}{I}} % x^2
+\def\tibtnextracomma {\tibtnextra{\tibtncomma} {EE}{J}} % comma
+\def\tibtnextraleftparen {\tibtnextra{\tibtnleftparen} {\{}{K}} % left parenthesis
+\def\tibtnextrarightparen{\tibtnextra{\tibtnrightparen}{\}}{L}} % right parenthesis
+\def\tibtnextralog {\tibtnextra{\tibtnlog} {10$^x$}{N}} % LOG
+\def\tibtnextraln {\tibtnextra{\tibtnln} {e$^x$}{S}} % LN
+\def\tibtnextrasto {\tibtnextra{\tibtnsto} {RCL}{X}} % STO
+\def\tibtnextraon {\tibtnextra{\tibtnon} {OFF}{}} % ON
+\def\tibtnextradot {\tibtnextra{\tibtndot} {\scriptsize $i$}{:}} % dot
+\def\tibtnextraneg {\tibtnextra{\tibtnneg} {ANS}{?}} % negative
diff --git a/macros/latex/contrib/verifiche/verifiche-example.pdf b/macros/latex/contrib/verifiche/verifiche-example.pdf
index 8200bf65e7..72d381a5b3 100644
--- a/macros/latex/contrib/verifiche/verifiche-example.pdf
+++ b/macros/latex/contrib/verifiche/verifiche-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/verifiche/verifiche.dtx b/macros/latex/contrib/verifiche/verifiche.dtx
index a17c536143..4172a0771f 100644
--- a/macros/latex/contrib/verifiche/verifiche.dtx
+++ b/macros/latex/contrib/verifiche/verifiche.dtx
@@ -16,7 +16,7 @@
%
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}
-%<package>\ProvidesPackage{verifiche} [2022/02/10 v4.3 .dtx verifiche file]
+%<package>\ProvidesPackage{verifiche} [2022/03/10 v4.4 .dtx verifiche file]
%<*driver>
\documentclass{ltxdoc}
\usepackage[utf8]{inputenc}
@@ -66,7 +66,7 @@
%</driver>
% \fi
%
-% \CheckSum{801}
+% \CheckSum{820}
% \changes{v1.0}{2020/06/14}{Initial version.}
% \changes{v2.0}{2020/06/26}{Better performance in exercise environment.}
% \changes{v2.1}{2020/06/30}{Introduced closedquestionitem to control |item| symbol.}
@@ -76,6 +76,7 @@
% \changes{v4.1}{2021/02/16}{Introduce ptrulerlength to change the aspect of the exercise score.}
% \changes{v4.2}{2021/08/18}{Solved truefalse issue in solutionsmode. Add noexercisept global option to hide the score of each exercise.}
% \changes{v4.3}{2022/02/10}{Move |parindent{0pt}| inside the environment.}
+% \changes{v4.4}{2022/03/10}{Minor update. Fixed labels issues.}
% \GetFileInfo{verifiche.sty}
% \DoNotIndex{\newcommand,\newenvironment,\def,\begin,\end,\par}
% \DoNotIndex{\DeclareOption,\ExecuteOptions,\ProcessOptions,\RequirePackage}
@@ -1067,40 +1068,50 @@ dell'esercizio somministrato
% \end{macrocode}
%
%\subsection{Labels}
+%\iffalse
+%%labels
+%\fi
%Some labels are define as a variable in order to leave the user the possibility of customization the predefine texts.
-% \begin{macrocode}
-\newcommand{\@durationlabeldefault}{Time:}%
-\newcommand{\@asyearlabeldefault}{School year}%
-\newcommand{\headercandidatenamelabel}{Student name}%
-\newcommand{\headerclasslabel}{Class}%
-\newcommand{\headerdatelabel}{Date}%
-\newcommand{\exerciselabel}{Exercise}%
-\newcommand{\solutionlabel}{Solution}%
-% \end{macrocode}
%If the package \textsf{babel} or \textsf{polyglossia} is loaded with the italian language specify, than the predefine labels are redefine:
% \begin{macrocode}
\@ifpackageloaded{babel}{%
\addto\captionsitalian{%
- \renewcommand{\@durationlabeldefault}{Tempo della prova:}%
- \renewcommand{\@asyearlabeldefault}{Anno scolastico}%
- \renewcommand{\headercandidatenamelabel}{Nome e Cognome}%
- \renewcommand{\headerclasslabel}{Classe}%
- \renewcommand{\headerdatelabel}{Data}%
- \renewcommand{\exerciselabel}{Quesito}%
- \renewcommand{\solutionlabel}{Soluzione}%
+ \def\@verifiche@durationlabeldefault{Tempo della prova:}%
+ \def\@verifiche@asyearlabeldefault{Anno scolastico}%
+ \def\@verifiche@headercandidatenamelabel{Nome e Cognome}%
+ \def\@verifiche@headerclasslabel{Classe}%
+ \def\@verifichhe@headerdatelabel{Data}%
+ \def\@verifiche@exerciselabel{Quesito}%
+ \def\@verifiche@solutionlabel{Soluzione}%
}}{%
\@ifpackageloaded{polyglossia}{%
\addto\captionsitalian{%
- \renewcommand{\@durationlabeldefault}{Tempo della prova:}%
- \renewcommand{\@asyearlabeldefault}{Anno scolastico}%
- \renewcommand{\headercandidatenamelabel}{Nome e Cognome}%
- \renewcommand{\headerclasslabel}{Classe}%
- \renewcommand{\headerdatelabel}{Data}%
- \renewcommand{\exerciselabel}{Quesito}%
- \renewcommand{\solutionlabel}{Soluzione}%
- }}{}
- }%
+ \def\@verifiche@durationlabeldefault{Tempo della prova:}%
+ \def\@verifiche@asyearlabeldefault{Anno scolastico}%
+ \def\@verifiche@headercandidatenamelabel{Nome e Cognome}%
+ \def\@verifiche@headerclasslabel{Classe}%
+ \def\@verifichhe@headerdatelabel{Data}%
+ \def\@verifiche@exerciselabel{Quesito}%
+ \def\@verifiche@solutionlabel{Soluzione}%
+ }}{
+ \def\@verifiche@durationlabeldefault{Time:}%
+ \def\@verifiche@asyearlabeldefault{School year}%
+ \def\@verifiche@headercandidatenamelabel{Name and Surname}%
+ \def\@verifiche@headerclasslabel{Class}%
+ \def\@verifichhe@headerdatelabel{Date}%
+ \def\@verifiche@exerciselabel{Exercise}%
+ \def\@verifiche@solutionlabel{Solution}%
+ }}%
% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\@durationlabeldefault}{\@verifiche@durationlabeldefault}%
+\newcommand{\@asyearlabeldefault}{\@verifiche@asyearlabeldefault}%
+\newcommand{\headercandidatenamelabel}{\@verifiche@headercandidatenamelabel}%
+\newcommand{\headerclasslabel}{\@verifiche@headerclasslabel}%
+\newcommand{\headerdatelabel}{\@verifichhe@headerdatelabel}%
+\newcommand{\exerciselabel}{\@verifiche@exerciselabel}%
+\newcommand{\solutionlabel}{\@verifiche@solutionlabel}%
+% \end{macrocode}
%\subsection{Macro and environment}
%\iffalse
%%macro and environment
@@ -1156,18 +1167,23 @@ dell'esercizio somministrato
\hspace*{\fill}\@durationpreamble\space\bfseries #1\hspace*{\fill}}
% \end{macrocode}
% \begin{macrocode}
-\newcommand{\@header@candidatename}{\noindent\headercandidatenamelabel\space\underline{\hspace{\candidatenamerulerlength}}}
-\newcommand{\@header@class}{\headerclasslabel\space\underline{\hspace{\classrulerlength}}}
-\newcommand{\@header@date}{\headerdatelabel\space\underline{\hspace{\daterulerlength}}}
-\newcommand{\@header}{\@header@candidatename\hfill\@header@class\hfill\@header@date}
-% \end{macrocode}
-% \begin{macrocode}
-\newcommand{\eserciziolabel}{%
- Quesito}
+\newcommand{\@header@candidatename}{%
+ \noindent\headercandidatenamelabel%
+ \space\underline{\hspace{\candidatenamerulerlength}}}
+\newcommand{\@header@class}{%
+ \headerclasslabel\space%
+ \underline{\hspace{\classrulerlength}}}
+\newcommand{\@header@date}{%
+ \headerdatelabel\space%
+ \underline{\hspace{\daterulerlength}}}
+\newcommand{\@header}{%
+ \@header@candidatename\hfill\@header@class\hfill\@header@date}
% \end{macrocode}
% \begin{macrocode}
\newcommand{\solutionfont}{%
- \footnotesize\ifsolutionscolor\color{\solutionscolor}\fi\itshape}
+ \footnotesize%
+ \ifsolutionscolor\color{\solutionscolor}\fi%
+ \itshape}
% \end{macrocode}
% \begin{macrocode}
\newcommand{\diffsymb}{%
@@ -1181,7 +1197,8 @@ dell'esercizio somministrato
%%pt prefix
%\fi
% \begin{macrocode}
-\newcommand{\@ptprefix}{\underline{\hspace{\ptrulerlength}}/}
+\newcommand{\@ptprefix}{%
+ \underline{\hspace{\ptrulerlength}}/}
\newcommand{\ptprefix}[1]{%
\renewcommand{\@ptprefix}{#1}}
% \end{macrocode}
@@ -1307,13 +1324,19 @@ dell'esercizio somministrato
\define@key{esercizio}{pt}[none]{
\ifshowexercisept%
\def\pointes{#1}%
- \def\espoint{\hfill\@ptprefix\@lpt@delimiter\pointes\space\@useptlabel{\pointes}\@rpt@delimiter}
+ \def\espoint{%
+ \hfill\@ptprefix\@lpt@delimiter%
+ \pointes\space\@useptlabel{\pointes}%
+ \@rpt@delimiter}
\showmarginexercisetrue
\fi}%
\define@key{esercizio}{partialpt}[none]{%
\ifshowexercisept%
\def\@totalpartialpt{\convertreftonum{ptes@\theexercisenumber}}%
- \def\sumpartialpt{\@ptprefix\@lpt@delimiter\@totalpartialpt\space\@useptlabel{\@totalpartialpt}\@rpt@delimiter}%
+ \def\sumpartialpt{%
+ \@ptprefix\@lpt@delimiter%
+ \@totalpartialpt\space\@useptlabel{\@totalpartialpt}%
+ \@rpt@delimiter}%
\showmarginexercisetrue
\fi}%
% \end{macrocode}
@@ -1402,7 +1425,9 @@ dell'esercizio somministrato
\NewDocumentCommand{\partialpt}{m}{%
\ifshowexercisept%
\leavevmode\reversemarginpar\marginpar{%
- \hfill\@partialptprefix\@lpartialpt@delimiter#1\space\@usepartialptlabel{#1}\@rpartialpt@delimiter%
+ \hfill\@partialptprefix%
+ \@lpartialpt@delimiter#1\space\@usepartialptlabel{#1}%
+ \@rpartialpt@delimiter%
\addtocounter{partialpoints}{#1}}%
\fi}%
% \end{macrocode}
@@ -1537,8 +1562,12 @@ dell'esercizio somministrato
\begin{tikzpicture}%
\draw[step=\spacedim, \openquestionlinecolor]%
(0,0) grid (\openquestionwidth,-\openquestionheight);%
- \node[anchor=base west, align=left, text width=\openquestionwidth,%
- inner sep=0cm, font=\solutionfont, execute at begin node=\setlength{\baselineskip}{\spacedim}]%
+ \node[%
+ anchor=base west,%
+ align=left, text width=\openquestionwidth,%
+ inner sep=0cm,%
+ font=\solutionfont,%
+ execute at begin node=\setlength{\baselineskip}{\spacedim}]%
at (0, -\spacedim){\ifsol#2\fi};
\end{tikzpicture}%
\else% if lined open question
@@ -1546,8 +1575,11 @@ dell'esercizio somministrato
\pgfmathparse{int(\openquestionheight/\spacedim)}%
\foreach \y in {1, ..., \pgfmathresult}%
\draw[\openquestionlinecolor] (0, -\y*\spacedim) -- +(\openquestionwidth,0);%
- \node[anchor=base west,align=left, text width=\openquestionwidth,%
- inner sep=0cm, font=\solutionfont, execute at begin node=\setlength{\baselineskip}{\spacedim}]%
+ \node[%
+ anchor=base west,align=left,%
+ text width=\openquestionwidth,%
+ inner sep=0cm, font=\solutionfont,%
+ execute at begin node=\setlength{\baselineskip}{\spacedim}]%
at (0, -\spacedim){\ifsol#2\fi};%
\end{tikzpicture}%
\fi%
diff --git a/macros/latex/contrib/verifiche/verifiche.pdf b/macros/latex/contrib/verifiche/verifiche.pdf
index 78fa0d6757..584d9276ed 100644
--- a/macros/latex/contrib/verifiche/verifiche.pdf
+++ b/macros/latex/contrib/verifiche/verifiche.pdf
Binary files differ
diff --git a/macros/latex/contrib/xsavebox/ChangeLog b/macros/latex/contrib/xsavebox/ChangeLog
index b2097c7004..040cc92a78 100644
--- a/macros/latex/contrib/xsavebox/ChangeLog
+++ b/macros/latex/contrib/xsavebox/ChangeLog
@@ -1,3 +1,7 @@
+2022-03-10
+ * v0.17
+ * fix: content saving optimised
+
2020-03-04
* v0.16
* fix: dvisvgm-special `bbox' option `transform' added
@@ -9,7 +13,7 @@
2019-08-13
* v0.14
* fix: existing \theXXX macros, such as LaTeX counters, could accidentally
- be overwritten
+ be overwritten
2019-06-24
* v0.13
diff --git a/macros/latex/contrib/xsavebox/xsavebox.pdf b/macros/latex/contrib/xsavebox/xsavebox.pdf
index 9f8d52ba89..39e3051880 100644
--- a/macros/latex/contrib/xsavebox/xsavebox.pdf
+++ b/macros/latex/contrib/xsavebox/xsavebox.pdf
Binary files differ
diff --git a/macros/latex/contrib/xsavebox/xsavebox.sty b/macros/latex/contrib/xsavebox/xsavebox.sty
index 2f3fac684f..36aeaaa1d0 100644
--- a/macros/latex/contrib/xsavebox/xsavebox.sty
+++ b/macros/latex/contrib/xsavebox/xsavebox.sty
@@ -45,11 +45,11 @@
%
% The Current Maintainer of this work is A. Grahn.
-\RequirePackage{xparse}
+\NeedsTeXFormat{LaTeX2e}[2020-10-01]
\RequirePackage{l3keys2e}
-\def\g@xsb@version@tl{0.16}
-\def\g@xsb@date@tl{2020/03/04}
+\def\g@xsb@version@tl{0.17}
+\def\g@xsb@date@tl{2022/03/10}
\ProvidesExplPackage{xsavebox}{\g@xsb@date@tl}{\g@xsb@version@tl}
{saveboxes for repeating content without code replication}
@@ -149,24 +149,21 @@
\DeclareDocumentCommand\xsavebox{smO{\width}O{c}+m}{
\xsb_check_box_name:n{#2}
\group_begin:
- \tl_set:Nn\l_xsb_content_grouped_tl{
- \group_begin:
- \cs_set:Nn\ocgxii_beginocg:nnnn{}\cs_set:Nn\ocgxii_endocg:{}
- #5
- \group_end:
- }
\xsb_push_props: %new, empty properties dict
\xsb_beginLTR:
- \IfBooleanTF{#1}{
- %later colour injection possible (pdfTeX, LuaTeX)
- \hbox_set:Nn\l_xsb_raw_box{\l_xsb_content_grouped_tl} %raw content
- \hbox_set:Nn\l_xsb_box{ %content re-aligned
- \makebox[#3][#4]{\l_xsb_content_grouped_tl}
+ \hbox_set:Nn\l_xsb_raw_box{ %raw content
+ \bool_lazy_and:nnF{
+ \tl_if_exist_p:c{xsb@\int_use:N\g_xsb_id_int}
+ }{
+ \bool_if_p:c{c_\tl_use:c{xsb@\int_use:N\g_xsb_id_int}_bool}
+ }{ %prevent unused boxes from creating OCGs/OCMDs
+ \DeclareDocumentEnvironment{ocg}{O{}mmm}{\ignorespaces}{\unskip}
+ \DeclareDocumentEnvironment{ocmd}{O{}m}{\ignorespaces}{\unskip}
}
- }{
- %the LaTeX way (no colour injection)
- \sbox\l_xsb_raw_box{\l_xsb_content_grouped_tl} %raw content
- \savebox\l_xsb_box[#3][#4]{\l_xsb_content_grouped_tl} %re-aligned
+ #5
+ }
+ \hbox_set:Nn\l_xsb_box{ %content re-aligned
+ \makebox[#3][#4]{\hbox_unpack:N\l_xsb_raw_box}
}
%process one of \l_xsb_raw_box or \l_xsb_box
\dim_compare:nTF{\box_wd:N\l_xsb_raw_box>\box_wd:N\l_xsb_box}{
@@ -176,31 +173,25 @@
%for colour injection
\hbox_set:Nn\l_xsb_box{
\makebox[\box_wd:N\l_xsb_raw_box][l]{
- \makebox[#3][s]{#5}
+ \makebox[#3][s]{\hbox_unpack:N\l_xsb_raw_box}
}
}
}{
%no colour injection
\savebox\l_xsb_box[\box_wd:N\l_xsb_raw_box][l]{
- \makebox[#3][s]{#5}
+ \makebox[#3][s]{\hbox_unpack:N\l_xsb_raw_box}
}
}
\xsb_process_box:nnnN{#2}{#3}{#4}\l_xsb_box
}{ % raw content
- \IfBooleanTF{#1}{
- \hbox_set:Nn\l_xsb_raw_box{#5}
- }{
- \sbox\l_xsb_raw_box{#5}
+ \IfBooleanF{#1}{
+ \sbox\l_xsb_raw_box{\hbox_unpack:N\l_xsb_raw_box}
}
\xsb_process_box:nnnN{#2}{#3}{#4}\l_xsb_raw_box
}
}{
- \IfBooleanTF{#1}{
- \hbox_set:Nn\l_xsb_box{ %content re-aligned
- \makebox[#3][#4]{#5}
- }
- }{
- \savebox\l_xsb_box[#3][#4]{#5} %re-aligned
+ \IfBooleanF{#1}{
+ \savebox\l_xsb_box[#3][#4]{\hbox_unpack:N\l_xsb_raw_box}
}
\xsb_process_box:nnnN{#2}{\width}{c}\l_xsb_box
}
@@ -219,7 +210,7 @@
\DeclareDocumentEnvironment{xlrbox*}{m}{
\xsb_check_box_name:n{#1}
- \xsb_xlrbox_star:
+ \xsb_xlrbox:
}{
\xsb_endxlrbox_star:n{#1}
}
@@ -243,27 +234,27 @@
\group_begin:
\xsb_push_props: %new, empty properties dict
\xsb_beginLTR:
- \hbox_set:Nw\l_xsb_box\group_begin:
+ \hbox_set:Nw\l_xsb_box
+ \bool_lazy_and:nnF{ %prevent unused boxes from creating OCGs/OCMDs
+ \tl_if_exist_p:c{xsb@\int_use:N\g_xsb_id_int}
+ }{
+ \bool_if_p:c{c_\tl_use:c{xsb@\int_use:N\g_xsb_id_int}_bool}
+ }{
+ \DeclareDocumentEnvironment{ocg}{O{}mmm}{\ignorespaces}{\unskip}
+ \DeclareDocumentEnvironment{ocmd}{O{}m}{\ignorespaces}{\unskip}
+ }
\ignorespaces
}
\cs_new_protected_nopar:Nn\xsb_endxlrbox:n{
\unskip
- \group_end:\hbox_set_end:
+ \hbox_set_end:
\sbox\l_xsb_box{\hbox_unpack_drop:N\l_xsb_box}
\xsb_process_box:nnnN{#1}{\width}{c}\l_xsb_box
\xsb_endLTR:
\group_end:
}
-\cs_new_protected:Nn\xsb_xlrbox_star:{
- \group_begin:
- \xsb_push_props: %new, empty properties dict
- \xsb_beginLTR:
- \hbox_set:Nw\l_xsb_box
- \ignorespaces
-}
-
\cs_new_protected_nopar:Nn\xsb_endxlrbox_star:n{
\unskip
\hbox_set_end:
diff --git a/macros/latex/contrib/xsavebox/xsavebox.tex b/macros/latex/contrib/xsavebox/xsavebox.tex
index b7d437cfb0..0c1cbc6f68 100644
--- a/macros/latex/contrib/xsavebox/xsavebox.tex
+++ b/macros/latex/contrib/xsavebox/xsavebox.tex
@@ -4,6 +4,14 @@
% http://mirrors.ctan.org/macros/latex/base/lppl.txt
% for the details of that license.
%
+\listfiles
+%%%%%%% pdfmanagement-testphase %%%%%%
+\RequirePackage{pdfmanagement-testphase} % load the package
+\DeclareDocumentMetadata % activates the PDF management interface
+{
+ %uncompress,
+}
+%%%%%% /pdfmanagement-testphase %%%%%%
\documentclass[a4paper]{article}
\frenchspacing
\usepackage[UKenglish]{babel}
@@ -33,12 +41,7 @@
pdfsubject={Documentation},
pdfauthor={Alexander Grahn},
pdfkeywords={PDF features, XObject, savebox, LaTeX, dvips, repeated content, repeated graphics, eps, PostScript, ps2pdf, XeLaTeX, pdfLaTeX, LuaLaTeX, dvipdfmx, dvisvgm},
- citebordercolor={0 0 1},
- filebordercolor={0 0 1},
- linkbordercolor={0 0 1},
- menubordercolor={0 0 1},
- pagebordercolor={0 0 1},
- urlbordercolor={0 0 1},
+ allcolors=blue,
% pdfpagelayout=SinglePage
}
diff --git a/macros/luatex/latex/pyluatex/example/beamer.tex b/macros/luatex/latex/pyluatex/example/beamer.tex
new file mode 100644
index 0000000000..6dea2ea6c9
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/beamer.tex
@@ -0,0 +1,122 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{beamer}
+
+\usepackage{pyluatex}
+\usepackage{listings}
+\usepackage{xcolor}
+\lstset{
+ language=Python,
+ breaklines=true,
+ framesep=1ex,
+ frame=lrtb,
+ framerule=0pt,
+ numbers=none,
+ basicstyle=\ttfamily,
+ keywordstyle=\bfseries\color{green!40!black},
+ stringstyle=\bfseries\color{red!80!black},
+ identifierstyle=\color{blue},
+ backgroundcolor=\color{gray!10!white},
+}
+
+\usepackage{luacode}
+\begin{luacode}
+function pytypeset()
+ tex.print("\\begin{lstlisting}[language=Python]")
+ tex.print(pyluatex.get_last_code())
+ tex.print("\\end{lstlisting}")
+ tex.print("") -- ensure newline
+end
+
+function pytypeset_inline()
+ -- assume there is only one line of code in get_last_code()
+ tex.print("\\lstinline[columns=fixed]@" .. pyluatex.get_last_code()[1] .. "@")
+end
+\end{luacode}
+
+\newcommand*{\pytypeset}{%
+ \textbf{Input:}
+ \directlua{pytypeset()}
+ \textbf{Output:}
+ \begin{center}
+ \directlua{tex.print(pyluatex.get_last_output())}
+ \end{center}
+}
+\newcommand*{\coderaw}{\directlua{tex.print(pyluatex.get_last_code())}}
+\newcommand*{\codeinline}{\directlua{pytypeset_inline()}}
+\newcommand*{\outputraw}{\directlua{tex.print(pyluatex.get_last_output())}}
+
+\title{PyLuaTeX Example -- BEAMER Presentation}
+\author{Tobias Enderle}
+
+\begin{document}
+
+\maketitle
+
+%%%%%%%%%%%%%%%%%%%%%% frame
+
+\begin{frame}{Important}
+Using PyLuaTeX environments (\emph{python} or \emph{pythonq}) inside BEAMER frames
+requires the \emph{fragile} option for those frames.
+\end{frame}
+
+%%%%%%%%%%%%%%%%%%%%%% frame
+
+\begin{frame}[fragile]{Slide 1}
+\begin{pythonq}
+msg = 'Hello slide 1'
+
+print(msg)
+\end{pythonq}
+\pytypeset
+
+Calling \pycq{print('test', end='')}\codeinline\ in Python outputs ``\outputraw''.
+
+\begin{python}
+x = 4
+\end{python}
+The value of \pyq{x}\codeinline\ is \outputraw.
+
+The result of \pyq{17 + 300}$\coderaw$ is \outputraw.
+\end{frame}
+
+%%%%%%%%%%%%%%%%%%%%%% frame
+
+\begin{pythonq}
+msg = 'Hello slide 2'
+
+print(msg)
+\end{pythonq}
+
+\begin{frame}{Slide 1}
+\pytypeset
+
+The \emph{fragile} option is not required in this frame because
+the \emph{pythonq} environment is outside the frame.
+Only the macro \emph{\textbackslash pytypeset} for typesetting the code and output is inside
+the frame.
+\end{frame}
+
+%%%%%%%%%%%%%%%%%%%%%% frame
+
+\newenvironment{typesetpython}
+ {\PyLTVerbatimEnv\begin{pythonq}}
+ {\end{pythonq}\pytypeset}
+
+\begin{frame}[fragile]{Slide 2}
+\begin{typesetpython}
+msg = 'Custom environment'
+
+print(msg)
+\end{typesetpython}
+\end{frame}
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/data-visualization.tex b/macros/luatex/latex/pyluatex/example/data-visualization.tex
new file mode 100644
index 0000000000..3a2d20a2bd
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/data-visualization.tex
@@ -0,0 +1,137 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pgfplots}
+\pgfplotsset{compat=1.15}
+\usepackage{pyluatex}
+\usepackage{booktabs}
+
+\usepackage{url}
+\urldef\dataurl\url{https://population.un.org/wpp/Download/Files/1_Indicators%20(Standard)/CSV_FILES/WPP2019_TotalPopulationBySex.csv}
+
+\begin{python}
+import pandas as pd
+import datetime
+
+def pgf_coords(x, y):
+ return ' '.join(f'({a},{b})' for a, b in zip(x, y))
+
+file = 'population.csv'
+df = pd.read_csv(file)
+data = df.set_index(['Location', 'Time']).sort_index()
+world_data = data.loc['World']
+
+year = datetime.datetime.now().year
+current_pop = world_data.loc[year].PopTotal
+
+diffs = world_data.PopTotal.diff()
+highest_increase_year = diffs.idxmax()
+highest_increase = diffs.max() / 1e3
+\end{python}
+
+\title{PyLuaTeX Example -- Data Visualization}
+\author{Tobias Enderle}
+
+\begin{document}
+
+\maketitle
+
+This document demonstrates how data can be visualized flexibly in a \LaTeX{}
+document with the help of the Python package \emph{pandas} and the \LaTeX{}
+package \emph{pgfplots}.
+
+We show some statistics of the United Nations' \emph{World Population Prospects}%
+\footnote{United Nations, Department of Economic and Social Affairs, Population
+Division (2019). World Population Prospects 2019, Online Edition. Rev.\ 1.} in the
+form of plots, tables or individual values.
+The data file \texttt{\py{file}} is a subset of the file
+\texttt{WPP2019\_TotalPopulationBySex.csv}\footnote{\dataurl{} (last accessed:
+2021/07/04)}.
+
+The following plot shows the estimated world population between \py{df.Time.iloc[0]}
+and \py{df.Time.iloc[-1]}. The red lines mark the current year and population.
+
+\begin{center}
+\begin{tikzpicture}
+\begin{axis}[
+ width=\textwidth,
+ height=0.7\textwidth,
+ enlarge x limits=false,
+ ymin=0,
+ ylabel={Estimated world population in billions},
+ xlabel={Year},
+ xticklabel style={/pgf/number format/1000 sep=},
+ grid=both,
+]
+\addplot[no marks,black,thick] coordinates {%
+ \py{pgf_coords(world_data.index, world_data.PopTotal / 1e6)}%
+};
+\draw[red,thick] (axis cs:\py{year},0) |- (axis cs:0,\py{current_pop / 1e6});
+\end{axis}
+\end{tikzpicture}
+\end{center}
+
+The year with the highest increase of \py{round(highest_increase)} million people
+was \py{highest_increase_year}. The world population is expected to reach a value
+of \py{round(world_data.loc[2100].PopTotal / 1e6, 2)} billion by 2100.
+
+The following table shows the total as well as the male and female population at
+the beginning of each decade. The values are given in thousands.
+\begin{center}
+\begin{python}
+table_data = world_data.iloc[::10].reset_index()
+table_data = table_data[['Time', 'PopTotal', 'PopMale', 'PopFemale']]
+table_data.columns = ['Year', 'Total (thousands)', 'Male (thousands)', 'Female (thousands)']
+table = table_data.style.hide(axis='index').format(
+ formatter={
+ 'Total (thousands)': '{:,.0f}',
+ 'Male (thousands)': '{:,.0f}',
+ 'Female (thousands)': '{:,.0f}'
+ }
+).to_latex(hrules=True)
+print(table)
+\end{python}
+\end{center}
+
+The plot below shows the estimated population of China and the United States
+of America (USA). The numbers are given in millions.
+\begin{center}
+\begin{python}
+marker_year = 2030
+plots = [
+ ('China', data.loc['China'].PopTotal / 1e3),
+ ('USA', data.loc['United States of America'].PopTotal / 1e3)
+]
+\end{python}
+\begin{tikzpicture}
+\begin{axis}[
+ width=\textwidth,
+ height=0.55\textwidth,
+ enlarge x limits=false,
+ ymin=0,
+ ylabel={Estimated population in millions},
+ xlabel={Year},
+ xticklabel style={/pgf/number format/1000 sep=},
+ grid=both,
+]
+\pgfplotsinvokeforeach{0,1}{%
+ \addplot[no marks,black,thick] coordinates {%
+ \py{pgf_coords(plots[#1][1].index, plots[#1][1])}%
+ };
+ \node[below] at (axis cs:\py{marker_year},\py{plots[#1][1].loc[marker_year]})
+ {\py{plots[#1][0]}};
+}
+\end{axis}
+\end{tikzpicture}
+\end{center}
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/matplotlib-external.tex b/macros/luatex/latex/pyluatex/example/matplotlib-external.tex
new file mode 100644
index 0000000000..bdea9c0afd
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/matplotlib-external.tex
@@ -0,0 +1,53 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pyluatex}
+\usepackage{graphicx}
+
+\title{PyLuaTeX Example -- Matplotlib External}
+\author{Tobias Enderle}
+
+\begin{document}
+
+\maketitle
+
+In this document we demonstrate how \emph{matplotlib} plots can be generated and
+included in a document. In the Python code in this document, the plot is
+configured and saved to an external PDF file. This PDF file is then
+included as picture using \verb|\includegraphics|.
+
+\begin{center}
+\begin{python}
+# example based on
+# https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html
+import matplotlib.pyplot as plt
+import numpy as np
+
+t = np.arange(0.0, 2.0, 0.01)
+s = 1 + np.sin(2 * np.pi * t)
+
+fig, ax = plt.subplots()
+ax.plot(t, s)
+
+ax.set(xlabel='time (s)', ylabel='voltage (mV)',
+ title='About as simple as it gets, folks')
+ax.grid()
+
+fig.savefig('matplotlib-plot.pdf', bbox_inches='tight', pad_inches=0.1)
+\end{python}
+\includegraphics[width=0.8\textwidth]{matplotlib-plot.pdf}
+\end{center}
+
+For an alternative approach using the PGF backend, consider the example
+\verb|matplotlib-pgf.tex|.
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/matplotlib-pgf.tex b/macros/luatex/latex/pyluatex/example/matplotlib-pgf.tex
new file mode 100644
index 0000000000..2962be862f
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/matplotlib-pgf.tex
@@ -0,0 +1,61 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pyluatex}
+\usepackage{unicode-math}
+\usepackage{pgf}
+\usepackage{url}
+
+\title{PyLuaTeX Example -- Matplotlib PGF}
+\author{Tobias Enderle}
+
+\begin{document}
+
+\maketitle
+
+In this document we demonstrate how \emph{matplotlib} plots can be generated and
+included in a document. In the Python code in this document, the plot is
+configured and saved to PGF\footnote{\url{https://ctan.org/pkg/pgf}} code.
+The PGF code is then included in the document and creates the plot.
+
+To avoid intermediate files, the PGF code is saved into an in-memory file
+using the Python \verb|io.StringIO| class%
+\footnote{\url{https://docs.python.org/3/library/io.html#io.StringIO}}.
+
+\begin{center}
+\begin{python}
+# example based on
+# https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html
+import matplotlib.pyplot as plt
+import numpy as np
+import io
+
+t = np.arange(0.0, 2.0, 0.01)
+s = 1 + np.sin(2 * np.pi * t)
+
+fig, ax = plt.subplots(figsize=(5, 3.5))
+ax.plot(t, s)
+
+ax.set(xlabel='time (s)', ylabel='voltage (mV)',
+ title='About as simple as it gets, folks')
+ax.grid()
+
+with io.StringIO() as file: # save to "in-memory file"
+ fig.savefig(file, format='pgf', bbox_inches='tight', pad_inches=0.1)
+ print(file.getvalue())
+\end{python}
+\end{center}
+
+For an alternative approach of creating plots with \emph{matplotlib},
+consider the example \verb|matplotlib-external.tex|.
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/population.csv b/macros/luatex/latex/pyluatex/example/population.csv
new file mode 100644
index 0000000000..9f7f2c11c2
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/population.csv
@@ -0,0 +1,454 @@
+Location,Variant,LocID,VarID,Time,MidPeriod,PopMale,PopFemale,PopTotal,PopDensity
+World,Medium,900,2,1950,1950.5,1266259.5559999999,1270171.462,2536431.018,19.497
+World,Medium,900,2,1951,1951.5,1290237.638,1293796.5890000002,2584034.227,19.863
+World,Medium,900,2,1952,1952.5,1313854.565,1317007.125,2630861.69,20.223
+World,Medium,900,2,1953,1953.5,1337452.7859999998,1340156.275,2677609.0609999998,20.581999999999997
+World,Medium,900,2,1954,1954.5,1361313.834,1363532.92,2724846.7539999997,20.945
+World,Medium,900,2,1955,1955.5,1385658.299,1387361.616,2773019.915,21.316
+World,Medium,900,2,1956,1956.5,1410643.208,1411800.0459999999,2822443.2539999997,21.695
+World,Medium,900,2,1957,1957.5,1436364.62,1436941.438,2873306.058,22.086
+World,Medium,900,2,1958,1958.5,1462864.322,1462822.358,2925686.68,22.489
+World,Medium,900,2,1959,1959.5,1490141.399,1489434.7480000001,2979576.147,22.903000000000002
+World,Medium,900,2,1960,1960.5,1518186.7019999998,1516763.013,3034949.715,23.329
+World,Medium,900,2,1961,1961.5,1547019.3530000001,1544824.16,3091843.5130000003,23.766
+World,Medium,900,2,1962,1962.5,1576718.9030000002,1573701.858,3150420.7610000004,24.215999999999998
+World,Medium,900,2,1963,1963.5,1607439.247,1603561.699,3211000.9460000005,24.682
+World,Medium,900,2,1964,1964.5,1639369.3280000002,1634608.9440000001,3273978.272,25.166
+World,Medium,900,2,1965,1965.5,1672618.879,1666964.631,3339583.51,25.671
+World,Medium,900,2,1966,1966.5,1707237.638,1700684.993,3407922.631,26.195999999999998
+World,Medium,900,2,1967,1967.5,1743114.2219999998,1735655.882,3478770.104,26.74
+World,Medium,900,2,1968,1968.5,1779990.92,1771608.5159999998,3551599.436,27.3
+World,Medium,900,2,1969,1969.5,1817510.8,1808170.165,3625680.965,27.87
+World,Medium,900,2,1970,1970.5,1855390.166,1845046.876,3700437.042,28.444000000000003
+World,Medium,900,2,1971,1971.5,1893576.3180000002,1882183.7119999998,3775760.03,29.023000000000003
+World,Medium,900,2,1972,1972.5,1932065.884,1919584.7040000001,3851650.588,29.607
+World,Medium,900,2,1973,1973.5,1970688.779,1957091.74,3927780.519,30.191999999999997
+World,Medium,900,2,1974,1974.5,2009259.494,1994534.6840000001,4003794.1780000003,30.776
+World,Medium,900,2,1975,1975.5,2047666.0259999998,2031814.448,4079480.474,31.358
+World,Medium,900,2,1976,1976.5,2085824.4530000002,2068842.374,4154666.827,31.936
+World,Medium,900,2,1977,1977.5,2123811.87,2105694.049,4229505.919,32.510999999999996
+World,Medium,900,2,1978,1978.5,2161887.5919999997,2142646.0069999998,4304533.598999999,33.088
+World,Medium,900,2,1979,1979.5,2200418.504,2180087.681,4380506.185,33.672
+World,Medium,900,2,1980,1980.5,2239689.027,2218314.4390000002,4458003.466,34.268
+World,Medium,900,2,1981,1981.5,2279673.275,2257323.344,4536996.619,34.875
+World,Medium,900,2,1982,1982.5,2320329.605,2297056.921,4617386.526000001,35.493
+World,Medium,900,2,1983,1983.5,2361892.5840000003,2337676.603,4699569.187,36.124
+World,Medium,900,2,1984,1984.5,2404645.374,2379366.143,4784011.517,36.773
+World,Medium,900,2,1985,1985.5,2448724.603,2422197.063,4870921.666,37.442
+World,Medium,900,2,1986,1986.5,2494279.319,2466288.681,4960568.0,38.131
+World,Medium,900,2,1987,1987.5,2541075.233,2511446.765,5052521.998,38.836999999999996
+World,Medium,900,2,1988,1988.5,2588387.929,2557038.065,5145425.994,39.552
+World,Medium,900,2,1989,1989.5,2635233.492,2602207.942,5237441.433999999,40.259
+World,Medium,900,2,1990,1990.5,2680895.262,2646335.779,5327231.041,40.949
+World,Medium,900,2,1991,1991.5,2725113.1789999995,2689176.204,5414289.382999999,41.618
+World,Medium,900,2,1992,1992.5,2768050.729,2730869.164,5498919.892999999,42.269
+World,Medium,900,2,1993,1993.5,2809940.82,2771656.778,5581597.597999999,42.903999999999996
+World,Medium,900,2,1994,1994.5,2851196.9960000003,2811953.432,5663150.427999999,43.531000000000006
+World,Medium,900,2,1995,1995.5,2892141.5489999996,2852071.381,5744212.93,44.153999999999996
+World,Medium,900,2,1996,1996.5,2932815.962,2892075.9689999996,5824891.931,44.773999999999994
+World,Medium,900,2,1997,1997.5,2973160.99,2931884.6569999997,5905045.647000001,45.391000000000005
+World,Medium,900,2,1998,1998.5,3013295.709,2971498.3660000004,5984794.075,46.004
+World,Medium,900,2,1999,1999.5,3053349.42,3010889.613,6064239.033,46.614
+World,Medium,900,2,2000,2000.5,3093433.858,3050059.9480000003,6143493.806,47.223
+World,Medium,900,2,2001,2001.5,3133601.7610000004,3089024.77,6222626.531,47.832
+World,Medium,900,2,2002,2002.5,3173900.4489999996,3127872.723,6301773.172,48.44
+World,Medium,900,2,2003,2003.5,3214422.0310000004,3166763.11,6381185.141,49.051
+World,Medium,900,2,2004,2004.5,3255262.626,3205896.765,6461159.391,49.665
+World,Medium,900,2,2005,2005.5,3296485.267,3245421.689,6541906.956,50.286
+World,Medium,900,2,2006,2006.5,3338132.9289999995,3285384.988,6623517.917,50.913000000000004
+World,Medium,900,2,2007,2007.5,3380183.02,3325763.623,6705946.642999999,51.547
+World,Medium,900,2,2008,2008.5,3422546.3819999998,3366542.29,6789088.672,52.18600000000001
+World,Medium,900,2,2009,2009.5,3465089.423,3407677.565,6872766.988,52.82899999999999
+World,Medium,900,2,2010,2010.5,3507703.635,3449119.953,6956823.5879999995,53.475
+World,Medium,900,2,2011,2011.5,3550332.5930000003,3490861.575,7041194.168,54.123999999999995
+World,Medium,900,2,2012,2012.5,3592963.006,3532864.9510000004,7125827.957,54.773999999999994
+World,Medium,900,2,2013,2013.5,3635575.332,3575006.709,7210582.041,55.426
+World,Medium,900,2,2014,2014.5,3678161.837,3617128.922,7295290.759,56.077
+World,Medium,900,2,2015,2015.5,3720696.374,3659100.5930000003,7379796.967,56.727
+World,Medium,900,2,2016,2016.5,3763157.2210000004,3700864.713,7464021.933999999,57.373999999999995
+World,Medium,900,2,2017,2017.5,3805469.0930000003,3742389.807,7547858.9,58.018
+World,Medium,900,2,2018,2018.5,3847487.861,3783603.252,7631091.113,58.658
+World,Medium,900,2,2019,2019.5,3889034.611,3824433.5939999996,7713468.205,59.291000000000004
+World,Medium,900,2,2020,2020.5,3929973.953,3864824.776,7794798.728999999,59.917
+World,Medium,900,2,2021,2021.5,3970238.39,3904727.3419999997,7874965.732000001,60.533
+World,Medium,900,2,2022,2022.5,4009829.762,3944122.815,7953952.5770000005,61.14
+World,Medium,900,2,2023,2023.5,4048771.753,3983028.585,8031800.3379999995,61.738
+World,Medium,900,2,2024,2024.5,4087120.942,4021484.313,8108605.255,62.32899999999999
+World,Medium,900,2,2025,2025.5,4124919.51,4059517.943,8184437.453,62.912
+World,Medium,900,2,2026,2026.5,4162157.7630000003,4097118.8880000003,8259276.651000001,63.486999999999995
+World,Medium,900,2,2027,2027.5,4198812.392,4134265.9260000004,8333078.318,64.054
+World,Medium,900,2,2028,2028.5,4234898.159,4170965.142,8405863.301,64.61399999999999
+World,Medium,900,2,2029,2029.5,4270434.916999999,4207225.806,8477660.723,65.166
+World,Medium,900,2,2030,2030.5,4305436.923,4243050.448,8548487.371,65.71
+World,Medium,900,2,2031,2031.5,4339910.899,4278438.555,8618349.454,66.247
+World,Medium,900,2,2032,2032.5,4373852.541999999,4313375.331,8687227.873,66.777
+World,Medium,900,2,2033,2033.5,4407252.206,4347831.306,8755083.512,67.298
+World,Medium,900,2,2034,2034.5,4440095.078,4381767.627,8821862.705,67.811
+World,Medium,900,2,2035,2035.5,4472370.475,4415153.754,8887524.229,68.316
+World,Medium,900,2,2036,2036.5,4504074.999,4447973.886,8952048.885,68.812
+World,Medium,900,2,2037,2037.5,4535212.7639999995,4480224.852,9015437.616,69.29899999999999
+World,Medium,900,2,2038,2038.5,4565789.971,4511903.674,9077693.645,69.778
+World,Medium,900,2,2039,2039.5,4595815.916,4543012.646000001,9138828.562,70.248
+World,Medium,900,2,2040,2040.5,4625296.608,4573550.774,9198847.382000001,70.709
+World,Medium,900,2,2041,2041.5,4654233.007,4603512.476,9257745.483,71.16199999999999
+World,Medium,900,2,2042,2042.5,4682621.46,4632886.693,9315508.152999999,71.60600000000001
+World,Medium,900,2,2043,2043.5,4710457.197,4661661.05,9372118.247000001,72.041
+World,Medium,900,2,2044,2044.5,4737734.143,4689821.239,9427555.382000001,72.467
+World,Medium,900,2,2045,2045.5,4764446.973999999,4717356.298,9481803.272,72.884
+World,Medium,900,2,2046,2046.5,4790594.206,4744260.467,9534854.673,73.292
+World,Medium,900,2,2047,2047.5,4816175.052,4770532.697,9586707.749,73.691
+World,Medium,900,2,2048,2048.5,4841185.259,4796172.061000001,9637357.32,74.08
+World,Medium,900,2,2049,2049.5,4865620.226,4821179.92,9686800.146,74.46
+World,Medium,900,2,2050,2050.5,4889476.137,4845557.763,9735033.9,74.831
+World,Medium,900,2,2051,2051.5,4912753.77,4869307.988,9782061.758,75.192
+World,Medium,900,2,2052,2052.5,4935453.691000001,4892431.75,9827885.441,75.544
+World,Medium,900,2,2053,2053.5,4957572.608,4914928.954,9872501.562,75.887
+World,Medium,900,2,2054,2054.5,4979106.4,4936798.851,9915905.251,76.221
+World,Medium,900,2,2055,2055.5,5000054.515,4958044.231000001,9958098.746,76.545
+World,Medium,900,2,2056,2056.5,5020416.864,4978668.303,9999085.167000001,76.86
+World,Medium,900,2,2057,2057.5,5040200.141,4998681.121,10038881.262,77.166
+World,Medium,900,2,2058,2058.5,5059417.113,5018100.967,10077518.08,77.46300000000001
+World,Medium,900,2,2059,2059.5,5078085.161,5036951.199,10115036.36,77.752
+World,Medium,900,2,2060,2060.5,5096218.399,5055251.284,10151469.683,78.032
+World,Medium,900,2,2061,2061.5,5113824.311000001,5073012.898,10186837.208999999,78.304
+World,Medium,900,2,2062,2062.5,5130906.26,5090242.78,10221149.04,78.567
+World,Medium,900,2,2063,2063.5,5147469.268,5106949.7360000005,10254419.004,78.82300000000001
+World,Medium,900,2,2064,2064.5,5163517.276000001,5123141.078,10286658.354,79.071
+World,Medium,900,2,2065,2065.5,5179054.658,5138824.657,10317879.315,79.311
+World,Medium,900,2,2066,2066.5,5194087.268999999,5154010.81,10348098.079,79.543
+World,Medium,900,2,2067,2067.5,5208621.301,5168709.529,10377330.83,79.768
+World,Medium,900,2,2068,2068.5,5222662.0030000005,5182928.529,10405590.532,79.985
+World,Medium,900,2,2069,2069.5,5236214.416999999,5196674.719,10432889.136,80.195
+World,Medium,900,2,2070,2070.5,5249283.714,5209955.787,10459239.501,80.398
+World,Medium,900,2,2071,2071.5,5261875.63,5222779.228,10484654.858,80.593
+World,Medium,900,2,2072,2072.5,5273995.495,5235154.907,10509150.402,80.781
+World,Medium,900,2,2073,2073.5,5285647.053,5247095.808,10532742.861,80.96300000000001
+World,Medium,900,2,2074,2074.5,5296833.337,5258616.666,10555450.002999999,81.137
+World,Medium,900,2,2075,2075.5,5307558.352,5269729.843,10577288.195,81.305
+World,Medium,900,2,2076,2076.5,5317828.46,5280445.712,10598274.172,81.46600000000001
+World,Medium,900,2,2077,2077.5,5327650.719,5290770.19,10618420.909,81.62100000000001
+World,Medium,900,2,2078,2078.5,5337030.84,5300705.978999999,10637736.819,81.77
+World,Medium,900,2,2079,2079.5,5345975.152,5310253.081,10656228.233,81.91199999999999
+World,Medium,900,2,2080,2080.5,5354490.414,5319414.04,10673904.454,82.04799999999999
+World,Medium,900,2,2081,2081.5,5362581.26,5328192.075,10690773.335,82.177
+World,Medium,900,2,2082,2082.5,5370256.1,5336596.326,10706852.426,82.301
+World,Medium,900,2,2083,2083.5,5377530.581,5344640.794,10722171.375,82.419
+World,Medium,900,2,2084,2084.5,5384423.2979999995,5352342.146000001,10736765.444,82.531
+World,Medium,900,2,2085,2085.5,5390949.038,5359713.315,10750662.353,82.63799999999999
+World,Medium,900,2,2086,2086.5,5397115.414,5366758.609,10763874.023,82.73899999999999
+World,Medium,900,2,2087,2087.5,5402924.365,5373477.654,10776402.019000001,82.835
+World,Medium,900,2,2088,2088.5,5408377.091,5379871.857000001,10788248.947999999,82.927
+World,Medium,900,2,2089,2089.5,5413472.043,5385941.323,10799413.365999999,83.012
+World,Medium,900,2,2090,2090.5,5418208.072000001,5391684.231000001,10809892.303,83.09299999999999
+World,Medium,900,2,2091,2091.5,5422585.5139999995,5397097.129,10819682.643,83.16799999999999
+World,Medium,900,2,2092,2092.5,5426605.848999999,5402175.11,10828780.959,83.238
+World,Medium,900,2,2093,2093.5,5430270.716,5406911.3610000005,10837182.077,83.303
+World,Medium,900,2,2094,2094.5,5433580.881,5411297.917,10844878.798,83.36200000000001
+World,Medium,900,2,2095,2095.5,5436535.751,5415324.393999999,10851860.145,83.416
+World,Medium,900,2,2096,2096.5,5439132.293,5418979.294,10858111.587000001,83.464
+World,Medium,900,2,2097,2097.5,5441365.752,5422249.024,10863614.775999999,83.506
+World,Medium,900,2,2098,2098.5,5443228.989,5425118.647000001,10868347.636,83.542
+World,Medium,900,2,2099,2099.5,5444712.816000001,5427571.318,10872284.134000001,83.573
+World,Medium,900,2,2100,2100.5,5445805.4629999995,5429588.256,10875393.719,83.596
+China,Medium,156,2,1950,1950.5,287739.865,266679.404,554419.269,59.055
+China,Medium,156,2,1951,1951.5,295567.965,274341.143,569909.108,60.705
+China,Medium,156,2,1952,1952.5,301939.82399999996,280636.673,582576.497,62.053999999999995
+China,Medium,156,2,1953,1953.5,307333.563,286032.31899999996,593365.882,63.203
+China,Medium,156,2,1954,1954.5,312143.382,290908.934,603052.316,64.235
+China,Medium,156,2,1955,1955.5,316679.542,295562.01,612241.552,65.214
+China,Medium,156,2,1956,1956.5,321165.115,300198.118,621363.233,66.185
+China,Medium,156,2,1957,1957.5,325739.211,304938.437,630677.6479999999,67.178
+China,Medium,156,2,1958,1958.5,330466.798,309828.979,640295.777,68.202
+China,Medium,156,2,1959,1959.5,335354.975,314857.756,650212.731,69.258
+China,Medium,156,2,1960,1960.5,340401.908,320006.146,660408.054,70.344
+China,Medium,156,2,1961,1961.5,345648.969,325303.732,670952.701,71.468
+China,Medium,156,2,1962,1962.5,351226.376,330876.278,682102.6540000001,72.655
+China,Medium,156,2,1963,1963.5,357372.80100000004,336966.283,694339.084,73.959
+China,Medium,156,2,1964,1964.5,364379.894,343874.708,708254.6020000001,75.441
+China,Medium,156,2,1965,1965.5,372429.283,351789.68700000003,724218.97,77.141
+China,Medium,156,2,1966,1966.5,381611.05799999996,360803.82899999997,742414.887,79.079
+China,Medium,156,2,1967,1967.5,391796.727,370784.44899999996,762581.176,81.22800000000001
+China,Medium,156,2,1968,1968.5,402668.343,381406.37200000003,784074.715,83.51700000000001
+China,Medium,156,2,1969,1969.5,413776.039,392209.902,805985.941,85.851
+China,Medium,156,2,1970,1970.5,424765.456,402835.929,827601.385,88.15299999999999
+China,Medium,156,2,1971,1971.5,435557.24700000003,413202.46200000006,848759.709,90.40700000000001
+China,Medium,156,2,1972,1972.5,446159.375,423326.58700000006,869485.962,92.615
+China,Medium,156,2,1973,1973.5,456413.55299999996,433071.815,889485.368,94.745
+China,Medium,156,2,1974,1974.5,466158.309,442305.89700000006,908464.2059999999,96.766
+China,Medium,156,2,1975,1975.5,475291.833,450949.05600000004,926240.8890000001,98.66
+China,Medium,156,2,1976,1976.5,483746.63,458938.782,942685.412,100.412
+China,Medium,156,2,1977,1977.5,491570.92299999995,466320.348,957891.271,102.031
+China,Medium,156,2,1978,1978.5,498936.41,473269.031,972205.441,103.556
+China,Medium,156,2,1979,1979.5,506094.367,480037.847,986132.214,105.039
+China,Medium,156,2,1980,1980.5,513254.169,486835.059,1000089.228,106.52600000000001
+China,Medium,156,2,1981,1981.5,520383.823,493638.388,1014022.2109999999,108.01
+China,Medium,156,2,1982,1982.5,527494.38,500454.609,1027948.9890000001,109.494
+China,Medium,156,2,1983,1983.5,534882.8539999999,507548.547,1042431.401,111.036
+China,Medium,156,2,1984,1984.5,542922.384,515249.589,1058171.973,112.713
+China,Medium,156,2,1985,1985.5,551836.686,523752.677,1075589.363,114.568
+China,Medium,156,2,1986,1986.5,561798.689,533215.417,1095014.106,116.637
+China,Medium,156,2,1987,1987.5,572625.011,543470.464,1116095.475,118.883
+China,Medium,156,2,1988,1988.5,583740.46,553983.774,1137724.2340000002,121.186
+China,Medium,156,2,1989,1989.5,594344.178,564013.215,1158357.393,123.384
+China,Medium,156,2,1990,1990.5,603859.475,573024.206,1176883.6809999999,125.35799999999999
+China,Medium,156,2,1991,1991.5,612077.869,580819.4079999999,1192897.277,127.06299999999999
+China,Medium,156,2,1992,1992.5,619162.85,587548.3929999999,1206711.243,128.535
+China,Medium,156,2,1993,1993.5,625367.136,593449.923,1218817.0590000001,129.82399999999998
+China,Medium,156,2,1994,1994.5,631105.159,598914.8670000001,1230020.0259999998,131.018
+China,Medium,156,2,1995,1995.5,636686.865,604233.674,1240920.539,132.179
+China,Medium,156,2,1996,1996.5,642170.0970000001,609466.081,1251636.178,133.32
+China,Medium,156,2,1997,1997.5,647469.136,614526.881,1261996.017,134.423
+China,Medium,156,2,1998,1998.5,652586.59,619395.759,1271982.3490000002,135.487
+China,Medium,156,2,1999,1999.5,657496.739,624018.094,1281514.8329999999,136.503
+China,Medium,156,2,2000,2000.5,662187.757,628363.01,1290550.767,137.465
+China,Medium,156,2,2001,2001.5,666683.3420000001,632446.405,1299129.747,138.379
+China,Medium,156,2,2002,2002.5,671028.743,636323.5129999999,1307352.256,139.255
+China,Medium,156,2,2003,2003.5,675255.679,640047.843,1315303.522,140.102
+China,Medium,156,2,2004,2004.5,679398.8559999999,643685.7829999999,1323084.639,140.93
+China,Medium,156,2,2005,2005.5,683485.9,647290.48,1330776.38,141.75
+China,Medium,156,2,2006,2006.5,687528.8509999999,650879.793,1338408.644,142.563
+China,Medium,156,2,2007,2007.5,691533.479,654460.412,1345993.8909999998,143.371
+China,Medium,156,2,2008,2008.5,695511.0179999999,658058.462,1353569.48,144.178
+China,Medium,156,2,2009,2009.5,699470.312,661699.098,1361169.41,144.987
+China,Medium,156,2,2010,2010.5,703414.0190000001,665396.585,1368810.604,145.80100000000002
+China,Medium,156,2,2011,2011.5,707339.988,669157.645,1376497.6330000001,146.62
+China,Medium,156,2,2012,2012.5,711236.6309999999,672969.777,1384206.408,147.441
+China,Medium,156,2,2013,2013.5,715082.615,676800.72,1391883.335,148.259
+China,Medium,156,2,2014,2014.5,718849.365,680604.6009999999,1399453.966,149.065
+China,Medium,156,2,2015,2015.5,722508.0059999999,684339.8620000001,1406847.868,149.85299999999998
+China,Medium,156,2,2016,2016.5,726052.413,687996.94,1414049.3530000001,150.62
+China,Medium,156,2,2017,2017.5,729462.38,691559.4140000001,1421021.794,151.362
+China,Medium,156,2,2018,2018.5,732677.7829999999,694970.0059999999,1427647.789,152.06799999999998
+China,Medium,156,2,2019,2019.5,735624.2590000001,698159.433,1433783.6919999998,152.722
+China,Medium,156,2,2020,2020.5,738247.34,701076.434,1439323.774,153.312
+China,Medium,156,2,2021,2021.5,740521.76,703694.3420000001,1444216.102,153.833
+China,Medium,156,2,2022,2022.5,742454.663,706016.7409999999,1448471.404,154.286
+China,Medium,156,2,2023,2023.5,744065.907,708061.767,1452127.674,154.67600000000002
+China,Medium,156,2,2024,2024.5,745391.547,709863.315,1455254.862,155.009
+China,Medium,156,2,2025,2025.5,746460.564,711447.684,1457908.2480000001,155.291
+China,Medium,156,2,2026,2026.5,747276.937,712815.314,1460092.251,155.524
+China,Medium,156,2,2027,2027.5,747838.01,713959.628,1461797.638,155.70600000000002
+China,Medium,156,2,2028,2028.5,748159.905,714892.941,1463052.846,155.839
+China,Medium,156,2,2029,2029.5,748261.449,715629.887,1463891.336,155.929
+China,Medium,156,2,2030,2030.5,748158.67,716181.48,1464340.15,155.976
+China,Medium,156,2,2031,2031.5,747862.303,716555.199,1464417.5019999999,155.985
+China,Medium,156,2,2032,2032.5,747379.071,716751.3509999999,1464130.4219999998,155.954
+China,Medium,156,2,2033,2033.5,746715.948,716764.8979999999,1463480.846,155.885
+China,Medium,156,2,2034,2034.5,745878.396,716586.728,1462465.124,155.77700000000002
+China,Medium,156,2,2035,2035.5,744872.12,716210.91,1461083.03,155.63
+China,Medium,156,2,2036,2036.5,743703.8809999999,715637.291,1459341.1719999998,155.444
+China,Medium,156,2,2037,2037.5,742381.178,714870.995,1457252.1730000002,155.221
+China,Medium,156,2,2038,2038.5,740910.927,713917.517,1454828.4440000001,154.963
+China,Medium,156,2,2039,2039.5,739299.95,712784.316,1452084.2659999998,154.671
+China,Medium,156,2,2040,2040.5,737554.247,711477.173,1449031.42,154.346
+China,Medium,156,2,2041,2041.5,735680.127,710000.1209999999,1445680.2480000001,153.989
+China,Medium,156,2,2042,2042.5,733681.708,708353.4240000001,1442035.132,153.601
+China,Medium,156,2,2043,2043.5,731559.998,706534.714,1438094.7119999998,153.181
+China,Medium,156,2,2044,2044.5,729314.3659999999,704539.7540000001,1433854.12,152.72899999999998
+China,Medium,156,2,2045,2045.5,726945.6240000001,702366.6209999999,1429312.245,152.245
+China,Medium,156,2,2046,2046.5,724457.8670000001,700018.6540000001,1424476.521,151.73
+China,Medium,156,2,2047,2047.5,721856.9079999999,697501.7170000001,1419358.625,151.185
+China,Medium,156,2,2048,2048.5,719147.363,694819.8879999999,1413967.251,150.611
+China,Medium,156,2,2049,2049.5,716334.2890000001,691978.021,1408312.31,150.009
+China,Medium,156,2,2050,2050.5,713423.046,688982.1209999999,1402405.167,149.379
+China,Medium,156,2,2051,2051.5,710419.052,685838.6590000001,1396257.711,148.725
+China,Medium,156,2,2052,2052.5,707328.2409999999,682556.026,1389884.267,148.046
+China,Medium,156,2,2053,2053.5,704157.431,679145.186,1383302.6169999999,147.345
+China,Medium,156,2,2054,2054.5,700913.91,675618.718,1376532.628,146.624
+China,Medium,156,2,2055,2055.5,697605.077,671989.066,1369594.1430000002,145.884
+China,Medium,156,2,2056,2056.5,694236.435,668265.517,1362501.9519999998,145.129
+China,Medium,156,2,2057,2057.5,690814.766,664458.498,1355273.264,144.359
+China,Medium,156,2,2058,2058.5,687350.2579999999,660583.299,1347933.5569999998,143.577
+China,Medium,156,2,2059,2059.5,683854.2890000001,656656.81,1340511.0990000002,142.787
+China,Medium,156,2,2060,2060.5,680336.5190000001,652694.113,1333030.632,141.99
+China,Medium,156,2,2061,2061.5,676802.515,648705.017,1325507.5320000001,141.189
+China,Medium,156,2,2062,2062.5,673256.2,644698.187,1317954.387,140.384
+China,Medium,156,2,2063,2063.5,669703.0129999999,640685.639,1310388.652,139.578
+China,Medium,156,2,2064,2064.5,666147.951,636679.512,1302827.463,138.773
+China,Medium,156,2,2065,2065.5,662594.759,632689.816,1295284.575,137.969
+China,Medium,156,2,2066,2066.5,659047.11,628724.807,1287771.9170000001,137.16899999999998
+China,Medium,156,2,2067,2067.5,655506.156,624789.118,1280295.274,136.373
+China,Medium,156,2,2068,2068.5,651969.562,620883.947,1272853.509,135.58
+China,Medium,156,2,2069,2069.5,648432.998,617008.089,1265441.087,134.79
+China,Medium,156,2,2070,2070.5,644893.129,613161.094,1258054.223,134.004
+China,Medium,156,2,2071,2071.5,641351.274,609346.35,1250697.624,133.22
+China,Medium,156,2,2072,2072.5,637808.587,605567.542,1243376.129,132.44
+China,Medium,156,2,2073,2073.5,634261.382,601824.674,1236086.0559999999,131.664
+China,Medium,156,2,2074,2074.5,630704.816,598116.8420000001,1228821.658,130.89
+China,Medium,156,2,2075,2075.5,627136.211,594443.942,1221580.153,130.119
+China,Medium,156,2,2076,2076.5,623555.764,590807.931,1214363.695,129.35
+China,Medium,156,2,2077,2077.5,619967.166,587211.554,1207178.72,128.585
+China,Medium,156,2,2078,2078.5,616375.748,583656.551,1200032.299,127.823
+China,Medium,156,2,2079,2079.5,612788.74,580144.787,1192933.527,127.06700000000001
+China,Medium,156,2,2080,2080.5,609212.75,576678.547,1185891.297,126.31700000000001
+China,Medium,156,2,2081,2081.5,605650.279,573259.213,1178909.492,125.573
+China,Medium,156,2,2082,2082.5,602104.505,569889.834,1171994.3390000002,124.837
+China,Medium,156,2,2083,2083.5,598583.619,566576.527,1165160.146,124.109
+China,Medium,156,2,2084,2084.5,595097.241,563326.747,1158423.988,123.391
+China,Medium,156,2,2085,2085.5,591652.894,560146.31,1151799.2040000001,122.686
+China,Medium,156,2,2086,2086.5,588253.0129999999,557035.545,1145288.558,121.992
+China,Medium,156,2,2087,2087.5,584898.214,553994.4839999999,1138892.6979999999,121.311
+China,Medium,156,2,2088,2088.5,581591.547,551027.779,1132619.326,120.64299999999999
+China,Medium,156,2,2089,2089.5,578335.645,548140.749,1126476.394,119.988
+China,Medium,156,2,2090,2090.5,575131.301,545335.627,1120466.928,119.348
+China,Medium,156,2,2091,2091.5,571976.983,542610.331,1114587.314,118.72200000000001
+China,Medium,156,2,2092,2092.5,568869.0229999999,539958.87,1108827.893,118.109
+China,Medium,156,2,2093,2093.5,565801.9870000001,537372.45,1103174.437,117.506
+China,Medium,156,2,2094,2094.5,562769.159,534840.583,1097609.742,116.914
+China,Medium,156,2,2095,2095.5,559762.949,532352.252,1092115.201,116.32799999999999
+China,Medium,156,2,2096,2096.5,556775.037,529896.299,1086671.336,115.74799999999999
+China,Medium,156,2,2097,2097.5,553796.475,527461.5970000001,1081258.072,115.17200000000001
+China,Medium,156,2,2098,2098.5,550817.703,525037.152,1075854.855,114.596
+China,Medium,156,2,2099,2099.5,547828.515,522612.036,1070440.551,114.02
+China,Medium,156,2,2100,2100.5,544818.071,520175.386,1064993.457,113.439
+United States of America,Medium,840,2,1950,1950.5,79233.218,79571.179,158804.397,17.361
+United States of America,Medium,840,2,1951,1951.5,80165.741,80706.523,160872.264,17.587
+United States of America,Medium,840,2,1952,1952.5,81281.509,81984.517,163266.02599999998,17.848
+United States of America,Medium,840,2,1953,1953.5,82534.378,83375.618,165909.99599999998,18.137
+United States of America,Medium,840,2,1954,1954.5,83884.15299999999,84852.237,168736.39,18.445999999999998
+United States of America,Medium,840,2,1955,1955.5,85296.618,86388.719,171685.337,18.769000000000002
+United States of America,Medium,840,2,1956,1956.5,86743.656,87961.35,174705.00600000002,19.099
+United States of America,Medium,840,2,1957,1957.5,88203.12,89548.35699999999,177751.47699999998,19.432000000000002
+United States of America,Medium,840,2,1958,1958.5,89658.37,91130.01699999999,180788.387,19.764
+United States of America,Medium,840,2,1959,1959.5,91097.416,92688.83300000001,183786.24899999998,20.092
+United States of America,Medium,840,2,1960,1960.5,92510.602,94209.96800000001,186720.57,20.412
+United States of America,Medium,840,2,1961,1961.5,93888.04199999999,95681.808,189569.85,20.724
+United States of America,Medium,840,2,1962,1962.5,95217.352,97096.395,192313.747,21.024
+United States of America,Medium,840,2,1963,1963.5,96482.77699999999,98449.623,194932.4,21.31
+United States of America,Medium,840,2,1964,1964.5,97667.821,99740.67599999999,197408.497,21.581
+United States of America,Medium,840,2,1965,1965.5,98763.245,100970.43400000001,199733.67899999997,21.835
+United States of America,Medium,840,2,1966,1966.5,99759.41,102136.35,201895.76,22.070999999999998
+United States of America,Medium,840,2,1967,1967.5,100664.42199999999,103240.659,203905.081,22.291
+United States of America,Medium,840,2,1968,1968.5,101509.677,104296.079,205805.75600000002,22.499000000000002
+United States of America,Medium,840,2,1969,1969.5,102339.103,105320.171,207659.27399999998,22.701
+United States of America,Medium,840,2,1970,1970.5,103185.603,106327.737,209513.34,22.904
+United States of America,Medium,840,2,1971,1971.5,104062.103,107321.976,211384.079,23.109
+United States of America,Medium,840,2,1972,1972.5,104963.948,108305.85699999999,213269.805,23.315
+United States of America,Medium,840,2,1973,1973.5,105885.329,109293.46800000001,215178.797,23.523000000000003
+United States of America,Medium,840,2,1974,1974.5,106813.662,110301.23599999999,217114.89800000002,23.735
+United States of America,Medium,840,2,1975,1975.5,107740.711,111340.539,219081.25,23.95
+United States of America,Medium,840,2,1976,1976.5,108666.035,112420.39199999999,221086.427,24.169
+United States of America,Medium,840,2,1977,1977.5,109597.272,113538.38699999999,223135.65899999999,24.393
+United States of America,Medium,840,2,1978,1978.5,110543.20199999999,114680.105,225223.307,24.622
+United States of America,Medium,840,2,1979,1979.5,111515.448,115823.873,227339.32100000003,24.853
+United States of America,Medium,840,2,1980,1980.5,112521.78199999999,116954.57800000001,229476.36,25.086
+United States of America,Medium,840,2,1981,1981.5,113568.715,118067.35,231636.065,25.323
+United States of America,Medium,840,2,1982,1982.5,114652.95199999999,119168.899,233821.85100000002,25.561999999999998
+United States of America,Medium,840,2,1983,1983.5,115760.64,120269.59599999999,236030.236,25.803
+United States of America,Medium,840,2,1984,1984.5,116871.96800000001,121384.881,238256.849,26.046
+United States of America,Medium,840,2,1985,1985.5,117974.009,122525.81300000001,240499.822,26.291999999999998
+United States of America,Medium,840,2,1986,1986.5,119063.541,123699.59599999999,242763.137,26.539
+United States of America,Medium,840,2,1987,1987.5,120149.52,124903.26,245052.78,26.789
+United States of America,Medium,840,2,1988,1988.5,121246.288,126125.97,247372.258,27.043000000000003
+United States of America,Medium,840,2,1989,1989.5,122374.171,127351.638,249725.80899999998,27.3
+United States of America,Medium,840,2,1990,1990.5,123549.353,128570.95599999999,252120.30899999998,27.561999999999998
+United States of America,Medium,840,2,1991,1991.5,124767.793,129771.57800000001,254539.371,27.826
+United States of America,Medium,840,2,1992,1992.5,126028.071,130962.537,256990.608,28.094
+United States of America,Medium,840,2,1993,1993.5,127351.15699999999,132180.973,259532.13,28.372
+United States of America,Medium,840,2,1994,1994.5,128763.429,133477.775,262241.20399999997,28.668000000000003
+United States of America,Medium,840,2,1995,1995.5,130278.69900000001,134885.042,265163.74100000004,28.988000000000003
+United States of America,Medium,840,2,1996,1996.5,131912.038,136422.97,268335.00800000003,29.335
+United States of America,Medium,840,2,1997,1997.5,133644.783,138068.851,271713.63399999996,29.704
+United States of America,Medium,840,2,1998,1998.5,135415.666,139759.643,275175.309,30.081999999999997
+United States of America,Medium,840,2,1999,1999.5,137140.99599999998,141407.152,278548.148,30.451
+United States of America,Medium,840,2,2000,2000.5,138761.58800000002,142949.326,281710.914,30.796999999999997
+United States of America,Medium,840,2,2001,2001.5,140249.955,144358.03699999998,284607.99199999997,31.113000000000003
+United States of America,Medium,840,2,2002,2002.5,141624.546,145654.766,287279.312,31.406
+United States of America,Medium,840,2,2003,2003.5,142928.38199999998,146887.185,289815.567,31.683000000000003
+United States of America,Medium,840,2,2004,2004.5,144227.34900000002,148127.314,292354.663,31.96
+United States of America,Medium,840,2,2005,2005.5,145568.081,149425.428,294993.50899999996,32.249
+United States of America,Medium,840,2,2006,2006.5,146962.229,150796.74800000002,297758.977,32.551
+United States of America,Medium,840,2,2007,2007.5,148389.984,152218.441,300608.425,32.863
+United States of America,Medium,840,2,2008,2008.5,149828.894,153657.128,303486.022,33.177
+United States of America,Medium,840,2,2009,2009.5,151244.42,155063.145,306307.565,33.486
+United States of America,Medium,840,2,2010,2010.5,152610.91,156400.559,309011.469,33.781
+United States of America,Medium,840,2,2011,2011.5,153923.75699999998,157660.294,311584.05100000004,34.063
+United States of America,Medium,840,2,2012,2012.5,155189.795,158854.09,314043.885,34.330999999999996
+United States of America,Medium,840,2,2013,2013.5,156408.505,159992.034,316400.539,34.589
+United States of America,Medium,840,2,2014,2014.5,157581.861,161091.561,318673.422,34.838
+United States of America,Medium,840,2,2015,2015.5,158712.12099999998,162166.191,320878.312,35.079
+United States of America,Medium,840,2,2016,2016.5,159798.231,163217.761,323015.99199999997,35.312
+United States of America,Medium,840,2,2017,2017.5,160840.943,164243.815,325084.75800000003,35.538000000000004
+United States of America,Medium,840,2,2018,2018.5,161847.18300000002,165249.08,327096.26300000004,35.758
+United States of America,Medium,840,2,2019,2019.5,162826.299,166238.61800000002,329064.917,35.974000000000004
+United States of America,Medium,840,2,2020,2020.5,163786.016,167216.631,331002.647,36.185
+United States of America,Medium,840,2,2021,2021.5,164729.43099999998,168185.643,332915.07399999996,36.394
+United States of America,Medium,840,2,2022,2022.5,165658.009,169147.259,334805.268,36.601
+United States of America,Medium,840,2,2023,2023.5,166575.859,170103.372,336679.231,36.806
+United States of America,Medium,840,2,2024,2024.5,167487.134,171055.428,338542.56200000003,37.01
+United States of America,Medium,840,2,2025,2025.5,168395.211,172004.393,340399.604,37.213
+United States of America,Medium,840,2,2026,2026.5,169301.417,172950.55800000002,342251.975,37.415
+United States of America,Medium,840,2,2027,2027.5,170206.89899999998,173893.8,344100.69899999996,37.617
+United States of America,Medium,840,2,2028,2028.5,171114.152,174833.695,345947.847,37.819
+United States of America,Medium,840,2,2029,2029.5,172025.652,175769.389,347795.041,38.021
+United States of America,Medium,840,2,2030,2030.5,172942.431,176699.445,349641.876,38.223
+United States of America,Medium,840,2,2031,2031.5,173866.197,177623.98100000003,351490.17799999996,38.425
+United States of America,Medium,840,2,2032,2032.5,174794.664,178540.788,353335.45200000005,38.626999999999995
+United States of America,Medium,840,2,2033,2033.5,175719.72600000002,179443.194,355162.92,38.827
+United States of America,Medium,840,2,2034,2034.5,176630.367,180322.605,356952.972,39.022
+United States of America,Medium,840,2,2035,2035.5,177518.371,181172.62600000002,358690.99700000003,39.211999999999996
+United States of America,Medium,840,2,2036,2036.5,178380.987,181990.87300000002,360371.86,39.396
+United States of America,Medium,840,2,2037,2037.5,179219.545,182778.075,361997.62,39.574
+United States of America,Medium,840,2,2038,2038.5,180035.11,183534.887,363569.99700000003,39.746
+United States of America,Medium,840,2,2039,2039.5,180830.299,184263.237,365093.536,39.912
+United States of America,Medium,840,2,2040,2040.5,181607.268,184964.88199999998,366572.15,40.074
+United States of America,Medium,840,2,2041,2041.5,182366.18600000002,185640.23899999997,368006.425,40.231
+United States of America,Medium,840,2,2042,2042.5,183106.822,186289.733,369396.555,40.383
+United States of America,Medium,840,2,2043,2043.5,183830.78,186915.525,370746.305,40.53
+United States of America,Medium,840,2,2044,2044.5,184540.09,187520.30399999997,372060.394,40.674
+United States of America,Medium,840,2,2045,2045.5,185236.65,188106.707,373343.357,40.814
+United States of America,Medium,840,2,2046,2046.5,185921.665,188676.40300000002,374598.06799999997,40.951
+United States of America,Medium,840,2,2047,2047.5,186596.355,189231.27899999998,375827.63399999996,41.086000000000006
+United States of America,Medium,840,2,2048,2048.5,187262.735,189774.509,377037.244,41.218
+United States of America,Medium,840,2,2049,2049.5,187923.02899999998,190309.65,378232.679,41.349
+United States of America,Medium,840,2,2050,2050.5,188579.208,190839.889,379419.097,41.478
+United States of America,Medium,840,2,2051,2051.5,189232.345,191367.08399999997,380599.429,41.607
+United States of America,Medium,840,2,2052,2052.5,189883.539,191892.91100000002,381776.45,41.736000000000004
+United States of America,Medium,840,2,2053,2053.5,190534.84399999998,192420.046,382954.89,41.865
+United States of America,Medium,840,2,2054,2054.5,191188.474,192951.26899999997,384139.74299999996,41.994
+United States of America,Medium,840,2,2055,2055.5,191846.063,193488.79,385334.85299999994,42.125
+United States of America,Medium,840,2,2056,2056.5,192508.44600000003,194033.858,386542.304,42.257
+United States of America,Medium,840,2,2057,2057.5,193175.556,194587.00199999998,387762.55799999996,42.39
+United States of America,Medium,840,2,2058,2058.5,193846.889,195148.59399999998,388995.48299999995,42.525
+United States of America,Medium,840,2,2059,2059.5,194521.41100000002,195718.60100000002,390240.01200000005,42.661
+United States of America,Medium,840,2,2060,2060.5,195198.145,196296.747,391494.89200000005,42.798
+United States of America,Medium,840,2,2061,2061.5,195876.59,196883.051,392759.641,42.937
+United States of America,Medium,840,2,2062,2062.5,196556.23,197476.97100000002,394033.201,43.076
+United States of America,Medium,840,2,2063,2063.5,197235.919,198076.891,395312.81,43.216
+United States of America,Medium,840,2,2064,2064.5,197914.288,198680.62,396594.908,43.356
+United States of America,Medium,840,2,2065,2065.5,198589.917,199286.177,397876.094,43.496
+United States of America,Medium,840,2,2066,2066.5,199262.08899999998,199892.635,399154.724,43.636
+United States of America,Medium,840,2,2067,2067.5,199929.62300000002,200499.0,400428.62299999996,43.775
+United States of America,Medium,840,2,2068,2068.5,200590.16,201103.092,401693.25200000004,43.913000000000004
+United States of America,Medium,840,2,2069,2069.5,201240.872,201702.39800000002,402943.27,44.05
+United States of America,Medium,840,2,2070,2070.5,201879.543,202294.861,404174.404,44.185
+United States of America,Medium,840,2,2071,2071.5,202505.163,202879.40899999999,405384.57200000004,44.317
+United States of America,Medium,840,2,2072,2072.5,203117.401,203455.438,406572.839,44.446999999999996
+United States of America,Medium,840,2,2073,2073.5,203715.712,204021.944,407737.656,44.574
+United States of America,Medium,840,2,2074,2074.5,204299.793,204578.014,408877.80700000003,44.699
+United States of America,Medium,840,2,2075,2075.5,204869.565,205123.073,409992.638,44.821000000000005
+United States of America,Medium,840,2,2076,2076.5,205424.918,205656.583,411081.501,44.94
+United States of America,Medium,840,2,2077,2077.5,205966.046,206178.59699999998,412144.643,45.056000000000004
+United States of America,Medium,840,2,2078,2078.5,206493.603,206689.938,413183.541,45.169
+United States of America,Medium,840,2,2079,2079.5,207008.556,207191.865,414200.42100000003,45.281000000000006
+United States of America,Medium,840,2,2080,2080.5,207511.92899999997,207685.46899999998,415197.398,45.39
+United States of America,Medium,840,2,2081,2081.5,208004.333,208171.37,416175.703,45.497
+United States of America,Medium,840,2,2082,2082.5,208486.67,208649.857,417136.527,45.602
+United States of America,Medium,840,2,2083,2083.5,208960.672,209121.41,418082.08200000005,45.705
+United States of America,Medium,840,2,2084,2084.5,209428.38600000003,209586.514,419014.9,45.806999999999995
+United States of America,Medium,840,2,2085,2085.5,209891.65399999998,210045.78399999999,419937.43799999997,45.908
+United States of America,Medium,840,2,2086,2086.5,210351.40600000002,210499.734,420851.14,46.008
+United States of America,Medium,840,2,2087,2087.5,210808.532,210949.358,421757.89,46.107
+United States of America,Medium,840,2,2088,2088.5,211264.603,211396.30899999998,422660.912,46.205
+United States of America,Medium,840,2,2089,2089.5,211721.343,211842.59100000001,423563.934,46.303999999999995
+United States of America,Medium,840,2,2090,2090.5,212180.09,212289.832,424469.922,46.403
+United States of America,Medium,840,2,2091,2091.5,212641.671,212739.046,425380.717,46.503
+United States of America,Medium,840,2,2092,2092.5,213106.46600000001,213190.72600000002,426297.19200000004,46.603
+United States of America,Medium,840,2,2093,2093.5,213574.50699999998,213645.047,427219.554,46.70399999999999
+United States of America,Medium,840,2,2094,2094.5,214045.658,214102.053,428147.711,46.805
+United States of America,Medium,840,2,2095,2095.5,214519.734,214561.93,429081.664,46.907
+United States of America,Medium,840,2,2096,2096.5,214996.568,215025.012,430021.58,47.01
+United States of America,Medium,840,2,2097,2097.5,215476.046,215491.866,430967.912,47.114
+United States of America,Medium,840,2,2098,2098.5,215958.082,215963.3,431921.38200000004,47.218
+United States of America,Medium,840,2,2099,2099.5,216442.63199999998,216440.331,432882.963,47.323
+United States of America,Medium,840,2,2100,2100.5,216929.693,216924.198,433853.891,47.428999999999995
diff --git a/macros/luatex/latex/pyluatex/example/readme-custom-env.tex b/macros/luatex/latex/pyluatex/example/readme-custom-env.tex
new file mode 100644
index 0000000000..b3257fbb01
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/readme-custom-env.tex
@@ -0,0 +1,25 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pyluatex}
+
+\newenvironment{custompy}
+{\PyLTVerbatimEnv\begin{python}}
+{\end{python}}
+
+\begin{document}
+
+\begin{custompy}
+print('Hello PyLuaTeX')
+\end{custompy}
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/readme-example.tex b/macros/luatex/latex/pyluatex/example/readme-example.tex
new file mode 100644
index 0000000000..177aa40c15
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/readme-example.tex
@@ -0,0 +1,32 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pyluatex}
+
+\begin{python}
+import math
+import random
+
+random.seed(0)
+
+greeting = 'Hello PyLuaTeX!'
+\end{python}
+
+\newcommand{\randint}[2]{\py{random.randint(#1, #2)}}
+
+\begin{document}
+\py{greeting}
+
+$\sqrt{371} = \py{math.sqrt(371)}$
+
+\randint{2}{5}
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/repl.tex b/macros/luatex/latex/pyluatex/example/repl.tex
new file mode 100644
index 0000000000..28de0090cf
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/repl.tex
@@ -0,0 +1,84 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pyluatex}
+\usepackage{listings}
+\usepackage{xcolor}
+\lstset{
+ language=Python,
+ breaklines=true,
+ framesep=1ex,
+ frame=lrtb,
+ framerule=0pt,
+ numbers=none,
+ basicstyle=\ttfamily,
+ keywordstyle=\bfseries\color{green!40!black},
+ stringstyle=\bfseries\color{red!80!black},
+ identifierstyle=\color{blue},
+ backgroundcolor=\color{gray!10!white},
+}
+\usepackage{luacode}
+
+\begin{luacode}
+function pytypeset()
+ tex.print("\\begin{lstlisting}")
+ tex.print(pyluatex.get_last_output())
+ tex.print("\\end{lstlisting}")
+end
+\end{luacode}
+
+\newcommand{\pytypeset}{\directlua{pytypeset()}}
+
+\newenvironment{pyrepl}
+{\PyLTVerbatimEnv\begin{pythonrepl}}
+{\end{pythonrepl}\pytypeset}
+
+\begin{filecontents*}{repl.py}
+def square(x):
+ return x**2
+
+square(5)
+\end{filecontents*}
+
+\title{PyLuaTeX Example -- Typesetting Python Interactive Console Sessions}
+\author{Tobias Enderle}
+
+\begin{document}
+
+\maketitle
+
+PyLuaTeX allows you to run and typeset Python code in an interactive console
+or read–eval–print loop (REPL) fashion. Very much like in an IPython session,
+code is prefixed with \verb|>>>| (or \verb|...| in case of multi-line commands)
+and the results are printed automatically.
+
+Both code and output are stored in PyLuaTeX's ouput buffer and can be accessed
+by \verb|pyluatex.get_last_output()|. In this way, you can adjust the typesetting
+to your needs. For examples on typesetting see \verb|typesetting-listings.tex|
+and \verb|typesetting-minted.tex|.
+
+In the following example, we use the custom environment \verb|pyrepl|, which is
+based on the \verb|pythonrepl| environment provided by PyLuaTeX.
+\begin{pyrepl}
+def fun():
+ print('Hello PyLuaTeX!')
+
+3 + 1 *\
+4
+fun()
+\end{pyrepl}
+
+Python sessions can also be read from files:
+\pyfilerepl{repl.py}
+\pytypeset
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/sessions.tex b/macros/luatex/latex/pyluatex/example/sessions.tex
new file mode 100644
index 0000000000..8d206a6b0c
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/sessions.tex
@@ -0,0 +1,54 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pyluatex}
+
+\title{PyLuaTeX Example -- Sessions}
+\author{Tobias Enderle}
+
+\pysession{session-a}
+\pyc{greeting = "Hi, I'm session A"}
+\pyc{var = 'Only available in session A'}
+
+\pysession{session-b}
+\pyc{greeting = "Hi, I'm session B"}
+
+\begin{document}
+
+\maketitle
+
+In this document the use of sessions is demonstrated.
+Sessions provide a way to structure and separate code.
+Variables, function definitions, etc. of one session are only accessible
+by that very session.
+This can be helpful if you have long documents with a lot of code.
+
+\paragraph{Session A}
+\pysession{session-a}
+The content of the variable \texttt{greeting} in session A is:\\
+\py{greeting}
+
+\paragraph{Session B}
+\pysession{session-b}
+The content of the variable \texttt{greeting} in session B is:\\
+\py{greeting}
+
+The variable \texttt{var} is only defined in session A, therefore
+an error is printed here:
+\begin{python}
+try:
+ print(var)
+except NameError as e:
+ print(e)
+\end{python}
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/typesetting-example.tex b/macros/luatex/latex/pyluatex/example/typesetting-example.tex
new file mode 100644
index 0000000000..7c6cc91015
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/typesetting-example.tex
@@ -0,0 +1,43 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pyluatex}
+\usepackage{listings}
+\usepackage{luacode}
+
+\begin{luacode}
+function pytypeset()
+ tex.print("\\begin{lstlisting}[language=Python]")
+ tex.print(pyluatex.get_last_code())
+ tex.print("\\end{lstlisting}")
+ tex.print("") -- ensure newline
+end
+\end{luacode}
+
+\newcommand*{\pytypeset}{%
+ \noindent\textbf{Input:}
+ \directlua{pytypeset()}
+ \textbf{Output:}
+ \begin{center}
+ \directlua{tex.print(pyluatex.get_last_output())}
+ \end{center}
+}
+
+\begin{document}
+
+\begin{pythonq}
+greeting = 'Hello PyLuaTeX!'
+print(greeting)
+\end{pythonq}
+\pytypeset
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/typesetting-listings.tex b/macros/luatex/latex/pyluatex/example/typesetting-listings.tex
new file mode 100644
index 0000000000..f83a6abd9a
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/typesetting-listings.tex
@@ -0,0 +1,94 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pyluatex}
+\usepackage{listings}
+\usepackage{xcolor}
+\lstset{
+ language=Python,
+ breaklines=true,
+ framesep=1ex,
+ frame=lrtb,
+ framerule=0pt,
+ numbers=none,
+ basicstyle=\ttfamily,
+ keywordstyle=\bfseries\color{green!40!black},
+ stringstyle=\bfseries\color{red!80!black},
+ identifierstyle=\color{blue},
+ backgroundcolor=\color{gray!10!white},
+}
+
+\usepackage{luacode}
+\begin{luacode}
+function pytypeset()
+ tex.print("\\begin{lstlisting}")
+ tex.print(pyluatex.get_last_code())
+ tex.print("\\end{lstlisting}")
+end
+
+function pytypeset_inline()
+ -- assume there is only one line of code in get_last_code()
+ tex.print("\\lstinline[columns=fixed]@" .. pyluatex.get_last_code()[1] .. "@")
+end
+\end{luacode}
+
+\newcommand*{\pytypeset}{%
+ \noindent\textbf{Input:}
+ \directlua{pytypeset()}
+ \textbf{Output:}
+ \begin{center}
+ \directlua{tex.print(pyluatex.get_last_output())}
+ \end{center}
+}
+\newcommand*{\coderaw}{\directlua{tex.print(pyluatex.get_last_code())}}
+\newcommand*{\codeinline}{\directlua{pytypeset_inline()}}
+\newcommand*{\outputraw}{\directlua{tex.print(pyluatex.get_last_output())}}
+
+\title{PyLuaTeX Example -- Typesetting Code Using the \emph{listings} Package}
+\author{Tobias Enderle}
+
+\begin{document}
+
+\maketitle
+
+\section*{Typesetting of Code Blocks and Ouput}
+\begin{pythonq}
+msg = 'Hello'
+
+print(msg)
+\end{pythonq}
+\pytypeset
+
+\section*{Typesetting of Inline Code and Ouput}
+Calling \pycq{print('test', end='')}\codeinline\ in Python outputs ``\outputraw''.
+
+\begin{python}
+x = 4
+\end{python}
+The value of \pyq{x}\codeinline\ is \outputraw.
+
+The result of \pyq{17 + 300}$\coderaw$ is \outputraw.
+
+\section*{Custom Environments}
+You can create a custom environment for typesetting:
+
+\newenvironment{typesetpython}
+{\PyLTVerbatimEnv\begin{pythonq}}
+{\end{pythonq}\pytypeset}
+
+\begin{typesetpython}
+msg = 'Custom environment'
+
+print(msg)
+\end{typesetpython}
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/example/typesetting-minted.tex b/macros/luatex/latex/pyluatex/example/typesetting-minted.tex
new file mode 100644
index 0000000000..f36c7b802b
--- /dev/null
+++ b/macros/luatex/latex/pyluatex/example/typesetting-minted.tex
@@ -0,0 +1,81 @@
+%% Copyright 2021-2022 Tobias Enderle
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\documentclass{article}
+
+\usepackage{pyluatex}
+\usepackage{minted}
+
+\usepackage{luacode}
+\begin{luacode}
+function pytypeset()
+ tex.print("\\begin{minted}[bgcolor=gray!10!white]{python}")
+ tex.print(pyluatex.get_last_code())
+ tex.print("\\end{minted}")
+ tex.print("") -- ensure newline
+end
+
+function pytypeset_inline()
+ -- assume there is only one line of code in get_last_code()
+ tex.print("\\mintinline{python}@" .. pyluatex.get_last_code()[1] .. "@")
+end
+\end{luacode}
+
+\newcommand*{\pytypeset}{%
+ \noindent\textbf{Input:}
+ \directlua{pytypeset()}
+ \textbf{Output:}
+ \begin{center}
+ \directlua{tex.print(pyluatex.get_last_output())}
+ \end{center}
+}
+\newcommand*{\coderaw}{\directlua{tex.print(pyluatex.get_last_code())}}
+\newcommand*{\codeinline}{\directlua{pytypeset_inline()}}
+\newcommand*{\outputraw}{\directlua{tex.print(pyluatex.get_last_output())}}
+
+\title{PyLuaTeX Example -- Typesetting Code Using the \emph{minted} Package}
+\author{Tobias Enderle}
+
+\begin{document}
+
+\maketitle
+
+\section*{Typesetting of Code Blocks and Ouput}
+\begin{pythonq}
+msg = 'Hello'
+
+print(msg)
+\end{pythonq}
+\pytypeset
+
+\section*{Typesetting of Inline Code and Ouput}
+Calling \pycq{print('test', end='')}\codeinline\ in Python outputs ``\outputraw''.
+
+\begin{python}
+x = 4
+\end{python}
+The value of \pyq{x}\codeinline\ is \outputraw.
+
+The result of \pyq{17 + 300}$\coderaw$ is \outputraw.
+
+\section*{Custom Environments}
+You can create a custom environment for typesetting:
+
+\newenvironment{typesetpython}
+{\PyLTVerbatimEnv\begin{pythonq}}
+{\end{pythonq}\pytypeset}
+
+\begin{typesetpython}
+msg = 'Custom environment'
+
+print(msg)
+\end{typesetpython}
+
+\end{document}
diff --git a/macros/luatex/latex/pyluatex/pyluatex-interpreter.py b/macros/luatex/latex/pyluatex/pyluatex-interpreter.py
index 4d713e7ab3..77d09bbb64 100644
--- a/macros/luatex/latex/pyluatex/pyluatex-interpreter.py
+++ b/macros/luatex/latex/pyluatex/pyluatex-interpreter.py
@@ -31,6 +31,8 @@ import json
import textwrap
from collections import defaultdict
import re
+import os
+import sys
class Interpreter(InteractiveInterpreter):
def execute_repl(self, code, ignore_errors):
@@ -104,6 +106,13 @@ class Handler(socketserver.StreamRequestHandler):
self.wfile.write((json.dumps(response) + '\n').encode('utf-8'))
if __name__ == '__main__':
+ try:
+ tex_file = sys.argv[1]
+ tex_file_folder = os.path.normpath(os.path.dirname(tex_file))
+ sys.path.insert(0, tex_file_folder)
+ except:
+ pass
+
with socketserver.TCPServer(('localhost', 0), Handler) as server:
print(server.server_address[1], end='\n', flush=True) # publish port
server.handle_request()
diff --git a/macros/luatex/latex/pyluatex/pyluatex.lua b/macros/luatex/latex/pyluatex/pyluatex.lua
index f9d8ff68a6..0b785239da 100644
--- a/macros/luatex/latex/pyluatex/pyluatex.lua
+++ b/macros/luatex/latex/pyluatex/pyluatex.lua
@@ -31,6 +31,8 @@ pyluatex = pyluatex or {
session = "default"
}
+local dir_sep = package.config:sub(1,1)
+
-- status.filename: path to pyluatex.sty
local folder = file.pathpart(file.collapsepath(status.filename, true))
local tcp = nil
@@ -43,6 +45,23 @@ local env_repl_mode = false
local last_code = nil
local last_output = nil
+local function get_tex_file()
+ for k, v in ipairs(arg) do
+ if not v:find("^%-") then
+ local path = lfs.currentdir() .. dir_sep .. v
+ if lfs.attributes(path, "mode") == "file" then
+ return path
+ else
+ path = path .. ".tex"
+ if lfs.attributes(path, "mode") == "file" then
+ return path
+ end
+ end
+ end
+ end
+ return nil
+end
+
local function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
@@ -51,14 +70,22 @@ local function err_cmd(message)
return "\\PackageError{PyLuaTeX}{" .. message .. "}{}"
end
-function pyluatex.start(executable)
+function pyluatex.start(executable, local_imports)
local script = file.join(folder, "pyluatex-interpreter.py")
- local is_windows = package.config:sub(1,1) ~= "/"
- local cmd
+ local is_windows = dir_sep ~= "/"
+
+ local cmd = ""
+ if local_imports then
+ local tex_file = get_tex_file()
+ if tex_file ~= nil then
+ cmd = " \"" .. tex_file .. "\""
+ end
+ end
+ cmd = executable .. " \"" .. script .. "\"" .. cmd
if is_windows then
- cmd = "start /B " .. executable .. " \"" .. script .. "\""
+ cmd = "start /B " .. cmd
else
- cmd = executable .. " \"" .. script .. "\" &"
+ cmd = cmd .. " &"
end
local f = io.popen(cmd, "r")
local port = f:read("*l")
diff --git a/macros/luatex/latex/pyluatex/pyluatex.pdf b/macros/luatex/latex/pyluatex/pyluatex.pdf
index 173c053483..62127e2871 100644
--- a/macros/luatex/latex/pyluatex/pyluatex.pdf
+++ b/macros/luatex/latex/pyluatex/pyluatex.pdf
Binary files differ
diff --git a/macros/luatex/latex/pyluatex/pyluatex.sty b/macros/luatex/latex/pyluatex/pyluatex.sty
index 6c247993a9..3413dba4c3 100644
--- a/macros/luatex/latex/pyluatex/pyluatex.sty
+++ b/macros/luatex/latex/pyluatex/pyluatex.sty
@@ -1,15 +1,15 @@
%% Copyright 2021-2022 Tobias Enderle
%%
%% This work may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3
+%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
-%% and version 1.3 or later is part of all distributions of LaTeX
+%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{pyluatex}[2022/02/13 v0.4.2 Execute Python code on the fly]
+\ProvidesPackage{pyluatex}[2022/03/10 v0.4.3 Execute Python code on the fly]
\RequirePackage{expl3}
\ExplSyntaxOn
@@ -27,20 +27,16 @@
\DeclareStringOption[python3]{executable}
\DeclareBoolOption{ignoreerrors}
\DeclareBoolOption{verbose}
+\DeclareBoolOption[true]{localimports}
\DeclareStringOption[veryveryend]{shutdown}
\ProcessKeyvalOptions*
-\ifpyluatex@ignoreerrors
- \directlua{pyluatex.ignore_errors = true}
-\else
- \directlua{pyluatex.ignore_errors = false}
-\fi
-\ifpyluatex@verbose
- \directlua{pyluatex.verbose = true}
-\else
- \directlua{pyluatex.verbose = false}
-\fi
-\directlua{pyluatex.start([==[\pyluatex@executable]==])}
+\directlua{pyluatex.ignore_errors = \ifpyluatex@ignoreerrors true\else false\fi}
+\directlua{pyluatex.verbose = \ifpyluatex@verbose true\else false\fi}
+\directlua{pyluatex.start(
+ [==[\pyluatex@executable]==],
+ \ifpyluatex@localimports true\else false\fi
+)}
\ExplSyntaxOn
\cs_generate_variant:Nn \tl_if_eq:nnTF { V }
diff --git a/macros/luatex/latex/pyluatex/pyluatex.tex b/macros/luatex/latex/pyluatex/pyluatex.tex
index 7446313863..eeff387c21 100644
--- a/macros/luatex/latex/pyluatex/pyluatex.tex
+++ b/macros/luatex/latex/pyluatex/pyluatex.tex
@@ -15,7 +15,7 @@
\usepackage{url}
\title{The \emph{pyluatex} package}
\author{Tobias Enderle\\\url{https://github.com/tndrle/PyLuaTeX}}
-\date{v0.4.2 (2022/02/13)}
+\date{v0.4.3 (2022/03/10)}
\begin{document}
\maketitle
\raggedright
@@ -90,34 +90,12 @@ The folder \inlcode|example| contains additional example documents:
\item \inlcode|typesetting-minted.tex|\\[0.5ex]
A detailed example for typesetting code and output with the \textit{minted} package
\end{itemize}
-For more intricate use cases have a look at our tests in the folder \inlcode|test|.
-
\section{Installation}
PyLuaTeX is available in TeX Live, MiKTeX, and on CTAN\footnote{\url{https://ctan.org/pkg/pyluatex}} as \inlcode|pyluatex|.
To install PyLuaTeX in \textbf{TeX Live} run \inlcode|tlmgr install pyluatex|.\\[0.5ex]
In \textbf{MiKTeX}, PyLuaTeX can be installed in the \textit{MiKTeX Console}.
-To install PyLuaTeX \textbf{manually}, do the following steps:
-\begin{enumerate}
-\item Locate your local \textit{TEXMF} folder\\[0.5ex]
-The location of this folder may vary. Typical defaults for TeX Live are \inlcode|~/texmf| for Linux,
-\inlcode|~/Library/texmf| for macOS, and \inlcode|C:\Users\<user name>\texmf| for Windows.
-If you are lucky, the command \inlcode|kpsewhich -var-value=TEXMFHOME| tells you the location.
-For MiKTeX, the folder can be found and configured in the \textit{MiKTeX Console}.
-\item Download the latest release\footnote{\url{https://github.com/tndrle/PyLuaTeX/releases/latest}} of PyLuaTeX
-\item Put the downloaded files in the folder \inlcode|TEXMF/tex/latex/pyluatex| (where \inlcode|TEXMF| is the folder located in 1.)\\[0.5ex]
-The final folder structure must be
-\begin{tcblisting}{breakable,listing only,
- size=fbox,colframe=black!8,boxrule=3pt,colback=black!8}
-TEXMF/tex/latex/pyluatex/
-|-- pyluatex-interpreter.py
-|-- pyluatex-json.lua
-|-- pyluatex.lua
-|-- pyluatex.sty
-|-- ...
-\end{tcblisting}
-\end{enumerate}
\section{Reference}
PyLuaTeX offers a simple set of options, macros and environments.
@@ -129,9 +107,6 @@ For an example, see the Typesetting Code section.
\subsection{Package Options}
\begin{itemize}
-\item \inlcode|verbose|\\[0.5ex]
- If this option is set, Python input and output is written to the \LaTeX{} log file.\\[0.5ex]
- \textit{Example:} \inlcode|\usepackage[verbose]{pyluatex}|
\item \inlcode|executable|\\[0.5ex]
Specifies the path to the Python executable. (default: \inlcode|python3|)\\[0.5ex]
\textit{Example:} \inlcode|\usepackage[executable=/usr/local/bin/python3]{pyluatex}|
@@ -139,13 +114,19 @@ For an example, see the Typesetting Code section.
By default, PyLuaTeX aborts the compilation process when Python reports an error.
If the \inlcode|ignoreerrors| option is set, the compilation process is not aborted.\\[0.5ex]
\textit{Example:} \inlcode|\usepackage[ignoreerrors]{pyluatex}|
+\item \inlcode|localimports|\\[0.5ex]
+ If this option is set, the folder containing the TeX input file is added to the Python path. This allows local Python packages to be imported. (default: \inlcode|true|)\\[0.5ex]
+ \textit{Example:} \inlcode|\usepackage[localimports=false]{pyluatex}|
\item \inlcode|shutdown|\\[0.5ex]
Specifies when the Python process is shut down. (default: \inlcode|veryveryend|)\\[0.5ex]
\textit{Options:} \inlcode|veryveryend|, \inlcode|veryenddocument|, \inlcode|off|\\[0.5ex]
PyLuaTeX uses the hooks of the package \textit{atveryend} to shut down the Python interpreter when the compilation is done. With the option \inlcode|veryveryend|, Python is shut down in the \inlcode|\AtVeryVeryEnd| hook. With the option \inlcode|veryenddocument|, Python is shut down in the \inlcode|\AtVeryEndDocument| hook. With the option \inlcode|off|, Python is not shut down explicitly. However, the Python process will shut down when the LuaTeX process finishes even if \inlcode|off| is selected. Using \inlcode|off| on Windows might lead to problems with SyncTeX, though.\\[0.5ex]
\textit{Example:} \inlcode|\usepackage[shutdown=veryenddocument]{pyluatex}|
+\item \inlcode|verbose|\\[0.5ex]
+ If this option is set, Python input and output is written to the \LaTeX{} log file.\\[0.5ex]
+ \textit{Example:} \inlcode|\usepackage[verbose]{pyluatex}|
\end{itemize}
-Package options (except for \inlcode|executable| and \inlcode|shutdown|) can be changed in the document with the
+The package options \inlcode|verbose| and \inlcode|ignoreerrors| can be changed in the document with the
\inlcode|\pyoption| command, e.g. \inlcode|\pyoption{verbose}{true}| or \inlcode|\pyoption{ignoreerrors}{false}|.
\subsection{Macros}