texlive[76003] Master/texmf-dist: piton (8aug25)

commits+karl at tug.org commits+karl at tug.org
Fri Aug 8 23:42:13 CEST 2025


Revision: 76003
          https://tug.org/svn/texlive?view=revision&revision=76003
Author:   karl
Date:     2025-08-08 23:42:12 +0200 (Fri, 08 Aug 2025)
Log Message:
-----------
piton (8aug25)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.pdf
    trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex
    trunk/Master/texmf-dist/doc/lualatex/piton/piton.pdf
    trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx
    trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua
    trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty

Modified: trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex	2025-08-08 21:33:26 UTC (rev 76002)
+++ trunk/Master/texmf-dist/doc/lualatex/piton/piton-french.tex	2025-08-08 21:42:12 UTC (rev 76003)
@@ -17,7 +17,7 @@
     end-escape-math = \) ,
     detected-commands =  { highLight , footnote } ,
     vertical-detected-commands = newpage ,
-    raw-detected-commands = NomTable ,
+    raw-detected-commands = { NomTable , rowcolor } ,
   }
 
 
@@ -428,9 +428,7 @@
 \item \index{path-write} La clé \Definition{path-write} indique un chemin où
 seront écrits les fichiers écrits par l'emploi de la clé |write| précédente.
 
-\item \index{join (clé)} \colorbox{yellow!50}{\textbf{Nouveau 4.4}}
-
-\nobreak
+\item \index{join (clé)} 
 La clé \Definition{join} est similaire à la clé |write| mais les fichiers créés sont
 \emph{joints} (comme «pièces jointes») dans le \textsc{pdf}. Attention :
 certains lecteurs de \textsc{pdf} ne proposent pas d'outil permettant d'accéder à
@@ -437,9 +435,7 @@
 ces fichiers joints. Parmi les lecteurs qui le proposent, on peut citer le
 logiciel gratuit Foxit PDF Reader, disponible sur toutes les plateformes.
 
-\item \index{print (clé)} \colorbox{yellow!50}{\textbf{Nouveau 4.5}}
-
-\nobreak
+\item \index{print (clé)}
 La clé \Definition{print} contrôle l'affichage effectif du contenu des
 environnements |{Piton}| dans le \textsc{pdf}. Bien entendu, la valeur initiale de cette
 clé est |true|. Néanmoins, dans certains circonstances, il peut être utile
@@ -521,10 +517,11 @@
 quand la clé |line-numbers| est utilisée. Voir un exemple à la partie
 \ref{example-numbering} p.~\pageref{example-numbering}.
 
-\item \index{background-color} La clé \Definition{background-color} fixe la
-couleur de fond des environnements |{Piton}| et des listings produits par
-|\PitonInputFile| (ce fond a une largeur que l'on peut fixer avec la clé |width| ou
-la clé |max-width| décrites ci-dessous).
+\item \index{background-color} \label{background-color} La clé
+\Definition{background-color} fixe la couleur de fond des environnements
+|{Piton}| et des listings produits par |\PitonInputFile| (ce fond a une largeur
+que l'on peut fixer avec la clé |width| ou la clé |max-width| décrites
+ci-dessous).
 
 La clé |background-color| accepte une couleur définie
 «à la volée», c'est-à-dire que l'on peut écrire par exemple
@@ -881,13 +878,10 @@
   (bien entendu).}
 
 \medskip
-\colorbox{yellow!50}{\textbf{Nouveau 4.5}}
+Il existe aussi les commandes suivantes similaires à celles de LaTeX3 :
+\DefinitionCommand{RenewPitonEnvironment},
+\DefinitionCommand{DeclarePitonEnvironment}  et \DefinitionCommand{ProvidePitonEnvironment},
 
-\nobreak
-\smallskip
-La version 4.5 définit aussi les commandes \DefinitionCommand{RenewPitonEnvironment},
-\DefinitionCommand{DeclarePitonEnvironment}  et \DefinitionCommand{ProvidePitonEnvironment}
-(similaires aux commandes correspondantes de L3).
 
 
 \bigskip
@@ -901,7 +895,7 @@
 \bigskip
 Si on souhaite un environnement |{Python}| qui compose le code inclus dans une boîte de
 \pkg{mdframed}, on peut écrire (à condition, bien entendu, d'avoir chargé l'extension
-\pkg{mdframed} et, dans ce document, il a été chargé avec la clé |framemethod=tikz|):
+\pkg{mdframed} et, dans ce document, elle a été chargée avec la clé |framemethod=tikz|):
 
 \begin{Verbatim}
 ~emphase#\NewPitonEnvironment@{Python}{}
@@ -2086,7 +2080,10 @@
 \end{itemize}
 
 
-\bigskip 
+\bigskip
+\indexcommand{zlabel}
+\indexcommand{zcref}
+\index{label-as-zlabel}
 Si l'utilisateur a demandé l'affichage des numéros de ligne avec |line-numbers|, il est
 possible de faire référence à ce numéro de ligne avec la commande |\label| placée dans un
 commentaire LaTeX.\footnote{Cette fonctionnalité est implémentée en redéfinissant, dans
@@ -2093,10 +2090,11 @@
   les environnements |{Piton}|, la commande |\label|. Il peut donc y avoir des
   incompatibilités avec les extensions qui redéfinissent (globalement) cette commande
   |\label| (comme \pkg{varioref}, \pkg{refcheck}, \pkg{showlabels}, etc.)}
+De même, la commande |\zlabel| du paquetage \pkg{zref} peut être utilisée.\footnote{
+  Y compris la commande |\zcref| de \pkg{zref-clever}.}
+L'option globale |label-as-zlabel| permet d'utiliser |\label| à la place de |\zlabel| dans
+les commentaires LaTeX (ce qui est le comportement par défaut de \pkg{zref} en général).
 
-
-
-
 \subsubsection{La clé «math-comments»}
 
 \index{math-comments}
@@ -2201,9 +2199,10 @@
 défaut. 
 
 \medskip
-Supposons, par exemple, que l'on souhaite, dans le texte courant, introduire des
-spécifications de tables \textsc{sql} par le nom de la table, suivi, entre parenthèses,
-par les noms de ses champs (ex. : |client (non, prénom)|).
+Supposons, par exemple, que l'on souhaite, dans le texte courant d'un document
+traitant des bases de données, introduire des spécifications de tables
+\textsc{sql} par le nom de la table, suivi, entre parenthèses, par les noms de
+ses champs (ex. : |client (non, prénom)|).
 
 Si on insère cet élément dans une commande |\piton|, le mot \emph{client} ne va pas
 être reconnu comme un nom de table mais comme un nom de champ. On peut définir
@@ -2391,8 +2390,103 @@
         return s
 \end{Piton}
 
+\subsubsection{La commande \textbackslash rowcolor}
 
+\indexcommand{rowcolor}
 
+\colorbox{yellow!50}{\textbf{Nouveau 4.8}}
+
+\nobreak
+\medskip
+L'extension \pkg{piton} propose une commande \DefinitionCommand{rowcolor} qui,
+placée dans une ligne de code, indique que cette ligne de code devra avoir un
+fond coloré (avec la couleur en argument\footnote{La commande |\rowcolor|
+  ne prend qu'un seul argument : il n'y a pas d'argument optionnel pour l'espace
+  colorimétrique. Néanmoins, il est possible d'écrire, par exemple :
+  \verb|\rowcolor{[rgb]{0.8,1,0.8}}|.} de |\rowcolor|).
+
+\medskip
+On documente cette commande dans la partie sur les échappements vers LaTeX, car
+cette commande n'est utilisable, justement, qu'à travers un échappement vers
+LaTeX, par exemple via la clé |raw-detected-commands|
+(cf.~p.~\pageref{raw-detected-commands}).
+
+\nobreak
+\begin{Verbatim}[formatcom=\footnotesize\color{gray}]
+\PitonOptions{raw-detected-commands = rowcolor} % dans le préambule
+\end{Verbatim}
+
+\medskip
+
+\begin{BVerbatim}[boxwidth=87mm,baseline=c]
+\begin{Piton}[width=min]
+def fact(n):
+    if n==0:
+        return 1 ~emphase#\rowcolor{yellow!50}@
+    else:
+        return n*fact(n-1)
+\end{Piton}        
+\end{BVerbatim}
+\hspace{1cm}
+\begin{Piton}[width=min,box]
+def fact(n):
+    if n==0:
+        return 1 \rowcolor{yellow!50}
+    else:
+        return n*fact(n-1)
+\end{Piton}        
+
+
+\bigbreak
+Voici maintenant le même exemple avec utilisation conjointe de la clé
+|background-color| (cf. p.~\pageref{background-color}) :
+
+\medskip
+\begin{BVerbatim}[boxwidth=91mm,baseline=c]
+\begin{Piton}[width=min,~emphase#background-color=gray!15@]
+def fact(n):
+    if n==0:
+        return 1 ~emphase#\rowcolor{yellow!50}@
+    else:
+        return n*fact(n-1)
+\end{Piton}        
+\end{BVerbatim}
+\hspace{6mm}
+\begin{Piton}[width=min,box,background-color=gray!15]
+def fact(n):
+    if n==0:
+        return 1 \rowcolor{yellow!50}
+    else:
+        return n*fact(n-1)
+\end{Piton}        
+
+
+\bigbreak
+Comme on le constate, une marge a été ajoutée à gauche et à droite par la clé
+|background-color|. Pour avoir une telle marge sans couleur de fond générale, il
+convient d'utiliser |background-color| avec
+la couleur spéciale |none|.
+
+\medskip
+\begin{BVerbatim}[boxwidth=87mm,baseline=c]
+\begin{Piton}[width=min,~emphase#background-color=none@]
+def fact(n):
+    if n==0:
+        return 1 ~emphase#\rowcolor{yellow!50}@
+    else:
+        return n*fact(n-1)
+\end{Piton}        
+\end{BVerbatim}
+\hspace{1cm}
+\begin{Piton}[width=min,box,background-color=none]
+def fact(n):
+    if n==0:
+        return 1 \rowcolor{yellow!50}
+    else:
+        return n*fact(n-1)
+\end{Piton}        
+
+
 \subsection{Comportement dans la classe Beamer}
 
 \label{beamer}
@@ -2515,7 +2609,7 @@
 
 \medskip
 Il y a néanmoins une restriction : ces environnements doivent englober des \emph{lignes
-  entières de code Python}. Les instructions |\begin{...}| et |\end{...}| doivent être
+  entières de code}. Les instructions |\begin{...}| et |\end{...}| doivent être
 seules sur leurs lignes.
 
 
@@ -2950,11 +3044,8 @@
 
 
 \vspace{1cm} On peut aussi faire afficher les commentaires dans une deuxième colonne à
-droite si on limite la largeur du code proprement dit avec la clé |width|. Dans l'exemple
-qui suit, on utilise la clé |width| avec la valeur spéciale~|min|. Plusieurs compilations
-sont nécessaires.
+droite si on limite la largeur du code proprement dit avec la clé |width|. 
 
-
 \begingroup
 \fvset{commandchars=\~\&\@,formatcom=\small\color{gray}}
 \begin{Verbatim}
@@ -3298,7 +3389,7 @@
 ne peut pas procéder comme précédemment (dans l'utilisation «standard» de \pkg{pyluatex})
 car, bien sûr, c'est le retour fait par |{pythonrepl}| qui doit être traité par
 \pkg{piton}. De ce fait, il ne sera pas possible de mettre des surcharges (avec
-|detected-commands| ou le mécanisme |escape|) dans le code.
+|detected-commands|, |begin-escape|, etc.) dans le code.
 
 \begin{Verbatim}
 \ExplSyntaxOn
@@ -3585,6 +3676,7 @@
 \normalfont Style  & Usage \\
 \midrule
 Number & les nombres \\
+String.Short & les caractères (entre \texttt{'}) \\  
 String.Long & les chaînes de caractères (entre \texttt{"}) \\
 String.Interpol & les éléments \texttt{\%d}, \texttt{\%i}, \texttt{\%f}, \texttt{\%c},
                   etc. dans les chaînes de caractères ; ce style hérite du style
@@ -3833,7 +3925,7 @@
 
 \section*{Remerciements}
 
-Remerciements à Yann Salmon pour ses nombreuses suggestions pertinentes.
+Remerciements à Yann Salmon et Pierre Le Scornet pour leurs nombreuses suggestions pertinentes.
 
 \section*{Autre documentation}
 

Modified: trunk/Master/texmf-dist/doc/lualatex/piton/piton.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx	2025-08-08 21:33:26 UTC (rev 76002)
+++ trunk/Master/texmf-dist/source/lualatex/piton/piton.dtx	2025-08-08 21:42:12 UTC (rev 76003)
@@ -51,7 +51,7 @@
     end-escape-math = \) ,
     detected-commands = { highLight, footnote } ,
     vertical-detected-commands = newpage ,
-    raw-detected-commands = NameTable
+    raw-detected-commands = { NameTable , rowcolor } 
   }
 
 \parindent 0pt
@@ -88,12 +88,12 @@
 % \iffalse
 %<*STY>
 % \fi
-\def\PitonFileVersion{4.7}
-\def\PitonFileDate{2025/07/09}
+\def\PitonFileVersion{4.8}
+\def\PitonFileDate{2025/08/08}
 % \iffalse
 %</STY>
 %<*LUA>
-piton_version = "4.7" -- 2025/07/09
+piton_version = "4.8" -- 2025/08/08
 %</LUA>
 %\fi
 %
@@ -220,7 +220,7 @@
 %
 % \indexenv{Piton}
 % 
-% The package \pkg{piton} provides several tools to typeset informatic codes: the
+% The package \pkg{piton} provides several tools to typeset computer listings: the
 % command |\piton|, the environment |{Piton}| and the command |\PitonInputFile|.
 %
 % \begin{itemize}
@@ -409,10 +409,7 @@
 % \item \index{path-write} The key \Definition{path-write} specifies a path
 % where the files written by the key |write| will be written.
 %
-% \item \index{join} \colorbox{yellow!50}{\textbf{New 4.4}}
-%
-% \nobreak
-% The key \Definition{join} is similar to the key |write| but the files which
+% \item The key \Definition{join} is similar to the key |write| but the files which
 % are created are joined (as \emph{joined files}) in the \textsc{pdf}. Be
 % careful: Some \textsc{pdf} readers don't provide any tool to access to these
 % joined files. Among the applications wich provide an access to those joined
@@ -419,10 +416,8 @@
 % files, we will mention the free application Foxit~PDF~Reader, which is
 % available on all the platforms.
 %
-% \item \index{print} \colorbox{yellow!50}{\textbf{New 4.5}}
-%
-% \nobreak
-% The key \Definition{print} controls whether the content of the environment is
+% \item \index{print}
+% The key \Definition{print} controls whether the content of the environment is 
 % actually printed (with the syntactic formating) in the \textsc{pdf}. Of
 % course, the initial value of |print| is |true|. However, it may be useful to
 % use |print=false| in some circonstancies (for example, when the key |write| or
@@ -495,10 +490,11 @@
 % inserted to fit the numbers of lines. See an example part
 % \ref{example-numbering} on page~\pageref{example-numbering}.
 %
-% \item \index{background-color} The key \Definition{background-color} sets the
-% background color of the environments |{Piton}| and the listings produced by
-% |\PitonInputFile| (it's possible to fix the width of that background with the
-% key |width| or the key |max-width| described below).
+% \item \index{background-color} \label{background-color} The key
+% \Definition{background-color} sets the background color of the environments
+% |{Piton}| and the listings produced by |\PitonInputFile| (it's possible to fix
+% the width of that background with the key |width| or the key |max-width|
+% described below).
 
 % The key |background-color| accepts a color
 % defined «on the fly». For example, it's possible to write
@@ -855,14 +851,10 @@
 % not allowed (of course)}
 %
 % \medskip
-% \colorbox{yellow!50}{\textbf{New 4.5}}
-%
-% \nobreak
-% \smallskip
-% The version 4.5 provides the commands \DefinitionCommand{RenewPitonEnvironment},
+% There also exist three other commands \DefinitionCommand{RenewPitonEnvironment},
 % \DefinitionCommand{DeclarePitonEnvironment} and
-% \DefinitionCommand{ProvidePitonEnvironment} (similar to the corresponding
-% commands of L3).
+% \DefinitionCommand{ProvidePitonEnvironment}, similar to the corresponding
+% commands of L3.
 % 
 % \bigskip
 % With the following instruction, a new environment |{Python}| will be
@@ -2079,7 +2071,21 @@
 % the standard command \texttt{\textbackslash label} in the environments
 % \texttt{\{Piton\}}. Therefore, incompatibilities may occur with extensions
 % which redefine (globally) that command \texttt{\textbackslash label} (for
-% example: \pkg{varioref}, \pkg{refcheck}, \pkg{showlabels}, etc.)}
+% example: \pkg{varioref}, \pkg{refcheck}, \pkg{showlabels}, etc.).} The same goes
+% for the |\zlabel| command from the \pkg{zref} package.\footnote{Using the
+% command \texttt{\textbackslash zcref} command from \pkg{zref-clever} is also 
+% supported.}
+% 
+% \subsubsection{The key ``label-as-zlabel''}
+% 
+% \index{label-as-zlabel}
+% 
+% The key |label-as-zlabel| will be used to indicate if the user wants |\label|
+% inside |Piton| environments to be replaced by a |\zlabel|-compatible command
+% (which is the default behavior of \pkg{zref} outside of such environments).
+% 
+% That feature is activated by the key \Definition{label-as-zlabel}, \emph{which is
+% available only in the preamble of the document}.
 %
 % \subsubsection{The key ``math-comments''}
 %
@@ -2093,10 +2099,11 @@
 % That feature is activated by the key \Definition{math-comments}, \emph{which is
 % available only in the preamble of the document}.
 %
-% \medskip
-% Here is a example, where we have assumed that the preamble of the document
-% contains the instruction |\PitonOptions{math-comment}|:
-% 
+% \nobreak
+% \begin{Verbatim}[formatcom=\footnotesize\color{gray}]
+% \PitonOptions{math-comment} % in the preamble
+% \end{Verbatim}
+%
 % \begin{Verbatim}
 % \begin{Piton}
 % def square(x):
@@ -2181,9 +2188,10 @@
 % LaTeX by default).
 %
 % \medskip
-% Imagine, for example, that we wisth, in the main text of a document, introduce
-% some specifications of tables of the language \textsc{sql} by the the name of the table,
-% followed, between brackets, by the names of its fields (ex. : |client(name,town)|).
+% Imagine, for example, that we wish, in the main text of a document about
+% databases, introduce some specifications of tables of the language
+% \textsc{sql} by the the name of the table, followed, between brackets, by the
+% names of its fields (ex. : |client(name,town)|).
 %
 % If we insert that element in a command |\piton|, the word \emph{client} won't be
 % recognized as a name of table but as a name of field. It's possible to define
@@ -2364,8 +2372,104 @@
 %         for \(k\) in range(\(n\)): s += \(\smash{\frac{(-1)^k}{2k+1} x^{2k+1}}\)
 %         return s
 % \end{Piton}
-% 
 %
+%
+% \subsubsection{The command \textbackslash rowcolor}
+%
+% \indexcommand{rowcolor}
+%
+% \colorbox{yellow!50}{\textbf{New 4.8}}
+%
+% \nobreak
+% \medskip
+% The extension \pkg{piton} provides a command \DefinitionCommand{rowcolor}
+% which, when place within a line of code, specifies that this line will have a
+% colored background (with the color in the argument\footnote{The command
+% |\rowcolor| takes in only one argument. There is no optional argument between
+% square brackets for the colorimetric space. However, it's possible to write
+% something like |\rowcolor{[rgb]{0.8,1,0.8}}|.} of the command).
+%
+% \medskip
+% We documente that command in the part which deals about the escapes to LaTeX because
+% this command can only be used through an escape to LaTeX, for example with the key
+% |raw-detected-commands| (cf.~p.~\pageref{raw-detected-commands}).
+%
+% \nobreak
+% \begin{Verbatim}[formatcom=\footnotesize\color{gray}]
+% \PitonOptions{raw-detected-commands = rowcolor} % in the preamble
+% \end{Verbatim}
+%
+% \medskip
+%
+% \begin{BVerbatim}[boxwidth=87mm,baseline=c]
+% \begin{Piton}[width=min]
+% def fact(n):
+%     if n==0:
+%         return 1 ~emphase#\rowcolor{yellow!50}@
+%     else:
+%         return n*fact(n-1)
+% \end{Piton}        
+% \end{BVerbatim}
+% \hspace{1cm}
+% \begin{Piton}[width=min,box]
+% def fact(n):
+%     if n==0:
+%         return 1 \rowcolor{yellow!50}
+%     else:
+%         return n*fact(n-1)
+% \end{Piton}        
+%
+%
+% \bigbreak
+% Here is now the same example with the join use of the key |background-color|
+% (cf. p.~\pageref{background-color}).
+%
+% \medskip
+% \begin{BVerbatim}[boxwidth=87mm,baseline=c]
+% \begin{Piton}[width=min,~emphase#background-color=gray!15@]
+% def fact(n):
+%     if n==0:
+%         return 1 ~emphase#\rowcolor{yellow!50}@
+%     else:
+%         return n*fact(n-1)
+% \end{Piton}        
+% \end{BVerbatim}
+% \hspace{1cm}
+% \begin{Piton}[width=min,box,background-color=gray!15]
+% def fact(n):
+%     if n==0:
+%         return 1 \rowcolor{yellow!50}
+%     else:
+%         return n*fact(n-1)
+% \end{Piton}        
+%
+%
+% \bigbreak
+% As you can see, a margin has been added on both sides of the code by the key
+% |background-color|. If you wish those margins without general background, you
+% should use |background-color| with the special value~|none|.
+%
+% \medskip
+% \begin{BVerbatim}[boxwidth=87mm,baseline=c]
+% \begin{Piton}[width=min,~emphase#background-color=none@]
+% def fact(n):
+%     if n==0:
+%         return 1 ~emphase#\rowcolor{yellow!50}@
+%     else:
+%         return n*fact(n-1)
+% \end{Piton}        
+% \end{BVerbatim}
+% \hspace{1cm}
+% \begin{Piton}[width=min,box,background-color=none]
+% def fact(n):
+%     if n==0:
+%         return 1 \rowcolor{yellow!50}
+%     else:
+%         return n*fact(n-1)
+% \end{Piton}        
+%
+%
+%
 % \subsection{Behaviour in the class Beamer}
 %
 % \label{beamer}
@@ -2489,7 +2593,7 @@
 % \smallskip
 %
 % However, there is a restriction: these environments must contain only \emph{whole
-% lines of Python code} in their body. The instructions |\begin{...}| and
+% lines of code} in their body. The instructions |\begin{...}| and
 % |\end{...}| must be alone on their lines.
 %
 %\medskip
@@ -2589,7 +2693,7 @@
 %
 %
 % \medskip
-% \textbf{Important remark} : If you use Beamer, you should know taht Beamer has
+% \textbf{Important remark} : If you use Beamer, you should know that Beamer has
 % its own system to extract the footnotes. Therefore, \pkg{piton} must be loaded
 % in that class without the option |footnote| nor the option |footnotehyper|.
 % 
@@ -3372,6 +3476,7 @@
 % \normalfont Style  & Use \\
 % \midrule
 % Number & the numbers \\
+% String.Short & the characters (between \texttt{'}) \\
 % String.Long & the strings (between \texttt{"}) \\
 % String.Interpol &  the elements \texttt{\%d}, \texttt{\%i}, \texttt{\%f},
 % \texttt{\%c}, etc. in the strings; that style inherits from the style |String.Long| \\
@@ -3379,8 +3484,8 @@
 % \texttt{!= == << >> - \~{} + / * \% = < > \& .} \verb+|+ \verb|@| \\ 
 % Name.Type & the following predefined types:
 %   |bool|, |char|, |char16_t|, |char32_t|, |double|, |float|, |int|, |int8_t|,
-%   |int16_t|, |int32_t|, |int64_t|, |long|, |short|, |signed|, |unsigned|,
-%   |void| et |wchar_t| \\  
+%   |int16_t|, |int32_t|, |int64_t|, |uint8_t|, |uint16_t|, |uint32_t|, |uint64_t|,
+%   |long|, |short|, |signed|, |unsigned|, |void| et |wchar_t| \\  
 % Name.Builtin & the following predefined functions: |printf|, |scanf|,
 % |malloc|, |sizeof| and |alignof|  \\ 
 % Name.Class & le nom des classes au moment de leur définition, c'est-à-dire
@@ -3766,6 +3871,20 @@
 \RequirePackage { amstext }
 %    \end{macrocode}
 %
+%    \begin{macrocode}
+\ProvideDocumentCommand { \IfPackageLoadedT } { m m }
+  { \IfPackageLoadedTF { #1 } { #2 } { } }
+
+\ProvideDocumentCommand { \IfPackageLoadedF } { m m }
+  { \IfPackageLoadedTF { #1 } { } { #2 } }
+
+\ProvideDocumentCommand { \IfClassLoadedF } { m m }
+  { \IfClassLoadedTF { #1 } { } { #2 } }
+
+\ProvideDocumentCommand { \IfClassLoadedF } { m m }
+  { \IfClassLoadedTF { #1 } { } { #2 } }
+%    \end{macrocode}
+%
 % \bigskip
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_error:n { \msg_error:nn { piton } }
@@ -3778,11 +3897,11 @@
 \cs_new_protected:Npn \@@_msg_new:nn { \msg_new:nnn { piton } }
 %    \end{macrocode}
 %
-% With Overleaf, by default, a document is compiled in non-stop mode. When there
-% is an error, there is no way to the user to use the key H in order to have
-% more information. That's why we decide to put that piece of information (for
-% the messages with such information) in the main part of the message when the
-% key |messages-for-Overleaf| is used (at load-time).
+% With Overleaf (and also TeXPage), by default, a document is compiled in
+% non-stop mode. When there is an error, there is no way to the user to use the
+% key H in order to have more information. That's why we decide to put that
+% piece of information (for the messages with such information) in the main part
+% of the message when the key |messages-for-Overleaf| is used (at load-time).
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_msg_new:nnn #1 #2 #3
   {
@@ -3821,16 +3940,16 @@
     LuaLaTeX~is~mandatory.\\
     The~package~'piton'~requires~the~engine~LuaLaTeX.\\
     \str_if_eq:onT \c_sys_jobname_str { output }
-      { If~you~use~Overleaf,~you~can~switch~to~LuaLaTeX~in~the~"Menu". \\}
-    \IfClassLoadedTF { beamer }
+      { If~you~use~Overleaf,~you~can~switch~to~LuaLaTeX~in~the~"Menu"~and~
+        if~you~use~TeXPage,~you~should~go~in~"Settings". \\ }
+    \IfClassLoadedT { beamer }
       {
         Since~you~use~Beamer,~don't~forget~to~use~piton~in~frames~with~
         the~key~'fragile'.\\
       }
-      { }
-    If~you~go~on,~the~package~'piton'~won't~be~loaded.
+    That~error~is~fatal.
   }
-\sys_if_engine_luatex:F { \msg_critical:nn { piton } { LuaLaTeX~mandatory } }
+\sys_if_engine_luatex:F { \@@_fatal:n { LuaLaTeX~mandatory } }
 %    \end{macrocode}
 % 
 % \bigskip
@@ -3879,8 +3998,6 @@
 %    \begin{macrocode}
 \bool_new:N \g_@@_beamer_bool
 %    \end{macrocode}
-%
-%
 % 
 % \bigskip
 % We define a set of keys for the options at load-time.
@@ -3905,9 +4022,9 @@
   {
     Unknown~key.\\
     You~have~used~the~key~'\l_keys_key_str'~when~loading~piton~
-    but~the~only~keys~available~here~
-    are~'beamer',~'footnote',~and~'footnotehyper'.~
-    Other~keys~are~available~in~\token_to_str:N \PitonOptions.\\ 
+    but~the~only~keys~available~here~are~'beamer',~'footnote'~
+    and~'footnotehyper'.~ Other~keys~are~available~in~
+    \token_to_str:N \PitonOptions.\\
     That~key~will~be~ignored.
   }
 %    \end{macrocode}
@@ -3925,9 +4042,8 @@
 \IfClassLoadedTF { beamer } 
   { \bool_gset_true:N \g_@@_beamer_bool } 
   {
-    \IfPackageLoadedTF { beamerarticle } 
-    { \bool_gset_true:N \g_@@_beamer_bool } 
-    { }
+    \IfPackageLoadedT { beamerarticle } 
+      { \bool_gset_true:N \g_@@_beamer_bool } 
   }
 %    \end{macrocode}
 %
@@ -4060,7 +4176,7 @@
 %    \end{macrocode}
 % 
 % \medskip
-% Each time an environment of \pkg{piton} is used, the informatic code in the
+% Each time an environment of \pkg{piton} is used, the computer listing in the
 % body of that environment will be stored in the following global string.
 %    \begin{macrocode}
 \tl_new:N \g_piton_last_code_tl
@@ -4150,7 +4266,7 @@
 %
 % \medskip
 % When the key |split-on-empty-lines| will be in force, then the following token
-% list will be inserted between the chunks of code (the informatic code provided
+% list will be inserted between the chunks of code (the computer listing provided
 % by the final user is split in chunks on the empty lines in the code). 
 %    \begin{macrocode}
 \tl_new:N \l_@@_split_separation_tl
@@ -4167,6 +4283,11 @@
 \clist_new:N \l_@@_bg_color_clist
 %    \end{macrocode}
 %
+% We will also keep in memory the length of the previous |clist| (for efficiency).
+%    \begin{macrocode}
+\int_new:N \l_@@_bg_colors_int 
+%    \end{macrocode}
+% 
 % \medskip
 % The package \pkg{piton} will also detect the lines of code which correspond to
 % the user input in a Python console, that is to say the lines of code beginning
@@ -4203,12 +4324,6 @@
 \str_new:N \l_@@_file_name_str 
 %    \end{macrocode}
 %
-% \medskip
-% We will count the environments |{Piton}| (and, in fact, also the commands
-% |\PitonInputFile|, despite the name |\g_@@_env_int|).
-%    \begin{macrocode}
-\int_new:N \g_@@_env_int 
-%    \end{macrocode}
 %
 % \medskip
 % The following flag corresponds to the key |print|. The initial value of that
@@ -4413,15 +4528,16 @@
           { 
             \string \newlabel { #1 } 
             { 
-%    \end{macrocode}
-% Remember that the content of a line is typeset in a box \emph{before} the
-% composition of the potential number of line.
-%    \begin{macrocode}
-              { \int_eval:n { \g_@@_visual_line_int + 1 } } 
+              { \int_use:N \g_@@_visual_line_int } 
               { \thepage } 
+              { } 
+              { line.#1 } 
+              { } 
             } 
           } 
         \@esphack
+        \IfPackageLoadedT { hyperref }
+          { \Hy at raisedlink { \hyper at anchorstart { line.#1 } \hyper at anchorend } }
       }
       { \@@_error:n { label~with~lines~numbers } }
   }
@@ -4428,6 +4544,46 @@
 %    \end{macrocode}
 %
 % \bigskip
+% 
+% The same goes for the command |\zlabel| if the |zref| package is loaded.
+% Note that |\label| will also be linked to |\@@_zlabel:n| if the key
+% |label-as-zlabel| is set to |true|.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_zlabel:n #1
+  {
+    \bool_if:NTF \l_@@_line_numbers_bool
+      {
+        \@bsphack
+        \protected at write \@auxout { }
+          {
+            \string \zref at newlabel { #1 }
+              {
+                \string \default { \int_use:N \g_@@_visual_line_int }
+                \string \page { \thepage }
+                \string \zc at type { line }
+                \string \anchor { line.#1 }
+              }
+          }
+        \@esphack
+        \IfPackageLoadedT { hyperref }
+          { \Hy at raisedlink { \hyper at anchorstart { line.#1 } \hyper at anchorend } }
+      }
+      { \@@_error:n { label~with~lines~numbers } }
+  }
+%    \end{macrocode}
+%
+% \bigskip
+% In the environments |{Piton}| the command |\rowcolor| will be linked to the
+% following one.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_rowcolor:n #1
+  {
+    \tl_gset:ce { g_@@_color_ \int_eval:n { \g_@@_line_int + 1 }_ tl } { #1 }
+    \bool_gset_true:N \g_@@_rowcolor_inside_bool 
+  }
+%    \end{macrocode}
+% 
+% \bigskip
 % The following commands corresponds to the keys |marker/beginning| and
 % |marker/end|. The values of that keys are functions that will be applied to
 % the ``\emph{range}'' specified by the final user in an individual
@@ -4457,22 +4613,7 @@
 \tl_new:N \g_@@_after_line_tl
 %    \end{macrocode}
 %
-% \smallskip
-% For example, the LPEG |Prompt| will trigger the following command which will
-% insert an instruction in the hook |\g_@@_begin_line_hook| to specify that a
-% background must be inserted to the current line of code.
-%    \begin{macrocode}
-\cs_new_protected:Npn \@@_prompt: 
-  { 
-    \tl_gset:Nn \g_@@_before_line_tl
-      { 
-        \tl_if_empty:NF \l_@@_prompt_bg_color_tl 
-          { \clist_set:No \l_@@_bg_color_clist { \l_@@_prompt_bg_color_tl } }
-      } 
-  }
-%    \end{macrocode}
 %
-%
 % \bigskip
 % The spaces at the end of a line of code are deleted by \pkg{piton}.
 % However, it's not actually true: they are replace by |\@@_trailing_space:|.
@@ -4487,9 +4628,13 @@
 \bool_new:N \g_@@_color_is_none_bool
 \bool_new:N \g_@@_next_color_is_none_bool
 %    \end{macrocode}
-% 
 %
 % \bigskip
+%    \begin{macrocode}
+\bool_new:N \g_@@_rowcolor_inside_bool
+%    \end{macrocode}
+% 
+% \bigskip
 % \subsubsection{Detected commands}
 %
 % There are four keys for ``detected commands and environments'':
@@ -4716,7 +4861,7 @@
 % If there is a background, we must remind that there is a left margin of 0.5~em
 % for the background...
 %    \begin{macrocode}
-        \clist_if_empty:NF \l_@@_bg_color_clist 
+        \bool_if:NT \g_@@_bg_bool
           { 
 %    \end{macrocode}
 % ... but if only if the key |left-margin| is not used !
@@ -4799,11 +4944,13 @@
         \hbox
           {
 %    \end{macrocode}
-% |\@@_color:N| sets the current color but also sets the booleans
-% |\g_@@_color_is_none_bool| and |\g_@@_next_color_is_none_bool|. It uses the value of
-% |\g_@@_line_int| which is the number of the current line.
+% The command |\@@_compute_and_set_color:| sets the current color but also sets the booleans
+% |\g_@@_color_is_none_bool| and |\g_@@_next_color_is_none_bool|. It uses the
+% current value of |\l_@@_bg_color_clist|, the value of
+% |\g_@@_line_int| (the number of the current line) but also potential token lists
+% of the form |\g_@@_color_12_tl| if the final user has used the command |\rowcolor|.
 %    \begin{macrocode}
-            \@@_color:N \l_@@_bg_color_clist
+            \@@_compute_and_set_color:
 %    \end{macrocode}
 % The colored panels are overlapping. However, if the special color |none| is used
 % we must not put such overlapping.
@@ -4871,31 +5018,58 @@
 %
 %
 % \bigskip
-% The command |\@@_color:N| will take in as argument a reference to a
-% comma-separated list of colors. A color will be picked by using the value of
-% |\g_@@_line_int| (modulo the number of colors in the list).
+% The command |\@@_compute_and_set_color:| sets the current color but also sets the booleans
+% |\g_@@_color_is_none_bool| and |\g_@@_next_color_is_none_bool|. It uses the
+% current value of |\l_@@_bg_color_clist|, the value of
+% |\g_@@_line_int| (the number of the current line) but also potential token lists
+% of the form |\g_@@_color_12_tl| if the final user has used the command |\rowcolor|.
 %    \begin{macrocode}
-\cs_set_protected:Npn \@@_color:N #1 
+\cs_set_protected:Npn \@@_compute_and_set_color: 
   {
-    \int_set:Nn \l_tmpa_int { \clist_count:N #1 }
-    \int_set:Nn \l_tmpb_int { \int_mod:nn \g_@@_line_int \l_tmpa_int + 1 }
-    \tl_set:Ne \l_tmpa_tl { \clist_item:Nn #1 \l_tmpb_int }
+    \int_compare:nNnTF \l_@@_bg_colors_int = \c_zero_int 
+      { \tl_set:Nn \l_tmpa_tl { none } }
+      {
+        \int_set:Nn \l_tmpb_int
+          { \int_mod:nn \g_@@_line_int \l_@@_bg_colors_int + 1 }
+        \tl_set:Ne \l_tmpa_tl { \clist_item:Nn \l_@@_bg_color_clist \l_tmpb_int }
+      }
+%    \end{macrocode}
+% The row may have a color specified by the command |\rowcolor|. We check that point now.
+%    \begin{macrocode}
+    \cs_if_exist:cT { g_@@_color_ \int_use:N \g_@@_line_int _ tl }
+      {
+        \tl_set_eq:Nc \l_tmpa_tl { g_@@_color_ \int_use:N \g_@@_line_int _ tl }
+%    \end{macrocode}
+% We don't need any longer the variable and that's why we delete it (it must be free
+% for the next environment of \pkg{piton}).
+%    \begin{macrocode}
+        \cs_undefine:c { g_@@_color_ \int_use:N \g_@@_line_int _ tl }
+      }
     \tl_if_eq:NnTF \l_tmpa_tl { none }
       { \bool_gset_true:N \g_@@_color_is_none_bool }
       {
         \bool_gset_false:N \g_@@_color_is_none_bool
-        \@@_color_i:o \l_tmpa_tl
+        \@@_color:o \l_tmpa_tl
       }
-% \end{macrocode}
+%    \end{macrocode}
 % We are looking for the next color because we have to know whether that
-% color is the special color |none|.
-% \begin{macrocode}
+% color is the special color |none| (for the vertical adjustment of the background color).
+%    \begin{macrocode}
     \int_compare:nNnTF { \g_@@_line_int + 1 } = \g_@@_nb_lines_int
       { \bool_gset_false:N \g_@@_next_color_is_none_bool }
       {
-        \int_set:Nn \l_tmpb_int
-          { \int_mod:nn { \g_@@_line_int + 1 } \l_tmpa_int + 1 }
-        \tl_set:Ne \l_tmpa_tl { \clist_item:Nn #1 \l_tmpb_int }
+        \int_compare:nNnTF \l_@@_bg_colors_int = \c_zero_int
+          { \tl_set:Nn \l_tmpa_tl { none } }
+          {
+            \int_set:Nn \l_tmpb_int
+              { \int_mod:nn { \g_@@_line_int + 1 } \l_@@_bg_colors_int + 1 }
+            \tl_set:Ne \l_tmpa_tl { \clist_item:Nn \l_@@_bg_color_clist \l_tmpb_int }
+          }
+        \cs_if_exist:cT { g_@@_color_ \int_eval:n { \g_@@_line_int + 1 } _ tl }
+          {
+            \tl_set_eq:Nc \l_tmpa_tl
+              { g_@@_color_ \int_eval:n { \g_@@_line_int + 1 } _ tl }
+          }     
         \tl_if_eq:NnTF \l_tmpa_tl { none }
           { \bool_gset_true:N \g_@@_next_color_is_none_bool }
           { \bool_gset_false:N \g_@@_next_color_is_none_bool }
@@ -4907,7 +5081,7 @@
 % The following command |\@@_color:n| will accept both the instruction
 % |\@@_color:n { red!15 }| and the instruction |\@@_color:n { [rgb]{0.9,0.9,0} }|.
 %    \begin{macrocode}
-\cs_set_protected:Npn \@@_color_i:n #1
+\cs_set_protected:Npn \@@_color:n #1
   {
     \tl_if_head_eq_meaning:nNTF { #1 } [ 
       { 
@@ -4917,7 +5091,7 @@
       }
       { \color { #1 } }
   }
-\cs_generate_variant:Nn \@@_color_i:n { o }
+\cs_generate_variant:Nn \@@_color:n { o }
 %    \end{macrocode}
 % 
 % \bigskip
@@ -4927,7 +5101,7 @@
 % \item In fact, it will be inserted between two commands
 % |\@@_begin_line:|...|\@@_end_of_line:|. 
 % \item When the key |break-lines-in-Piton| is in force, a line of the
-% informatic code (the \emph{input}) may result in several lines in the
+% computer listing (the \emph{input}) may result in several lines in the
 % \textsc{pdf} (the \emph{output}). 
 % \item Remind that |\@@_par:| has a rather complex behaviour because it will
 % finish and start paragraphs.
@@ -4981,8 +5155,7 @@
               \l_@@_continuation_symbol_tl 
             } 
             \skip_horizontal:n { 0.3 em }  
-            \clist_if_empty:NF \l_@@_bg_color_clist 
-              { \skip_horizontal:n { 0.5 em } }
+            \bool_if:NT \g_@@_bg_bool { \skip_horizontal:n { 0.5 em } }
           }  
         \bool_if:NT \l_@@_indent_broken_lines_bool
           { 
@@ -5017,6 +5190,7 @@
 \bool_new:N \l_@@_resume_bool 
 \bool_new:N \l_@@_split_on_empty_lines_bool
 \bool_new:N \l_@@_splittable_on_empty_lines_bool
+\bool_new:N \g_@@_label_as_zlabel_bool
 %    \end{macrocode}
 % 
 %
@@ -5112,7 +5286,6 @@
                 { \bool_set_false:N \l_@@_tcolorbox_bool }
             }
             { \@@_error:n { library~breakable~not~loaded } }
-
         }
         { \@@_error:n { tcolorbox~not~loaded } } ,
     tcolorbox .default:n = true ,
@@ -5177,6 +5350,10 @@
     comment-latex .value_required:n = true ,
     comment-latex .usage:n = preamble ,
 
+    label-as-zlabel .bool_gset:N = \g_@@_label_as_zlabel_bool ,
+    label-as-zlabel .default:n = true ,
+    label-as-zlabel .usage:n = preamble ,
+
     math-comments .bool_gset:N = \g_@@_math_comments_bool ,
     math-comments .default:n  = true ,
     math-comments .usage:n = preamble , 
@@ -5237,7 +5414,9 @@
 
     splittable       .int_set:N         = \l_@@_splittable_int ,
     splittable       .default:n         = 1 , 
-    background-color .clist_set:N       = \l_@@_bg_color_clist ,
+    background-color .code:n =
+      \clist_set:Nn \l_@@_bg_color_clist { #1 }
+      \int_set:Nn \l_@@_bg_colors_int { \clist_count:N \l_@@_bg_color_clist } ,
     background-color .value_required:n  = true ,
     prompt-background-color .tl_set:N         = \l_@@_prompt_bg_color_tl ,
     prompt-background-color .value_required:n = true ,
@@ -5684,7 +5863,7 @@
 %
 %  \bigskip 
 %  The following command does \emph{not} correspond to a user command. It will
-%  be used when we will have to ``rescan'' some chunks of informatic code. For
+%  be used when we will have to ``rescan'' some chunks of computer code. For
 %  example, it will be the initial value of the Piton style |InitialValues| (the
 %  default values of the arguments of a Python function).
 %    \begin{macrocode}
@@ -5720,7 +5899,6 @@
   {
     \legacy_if:nT { @inlabel } { \bool_set_true:N \l_@@_in_label_bool }
     \automatichyphenmode = 1
-    \int_gincr:N \g_@@_env_int
     \dim_compare:nNnT \l_@@_width_dim = \c_zero_dim
       {
         \dim_set_eq:NN \l_@@_width_dim \linewidth
@@ -5732,8 +5910,22 @@
     \int_gzero:N \g_@@_line_int
     \int_gzero:N \g_@@_nb_lines_int
     \dim_zero:N \parindent 
-    \dim_zero:N \lineskip 
-    \cs_set_eq:NN \label \@@_label:n
+    \dim_zero:N \lineskip
+    \cs_set_eq:NN \rowcolor \@@_rowcolor:n
+    \bool_gset_false:N \g_@@_bg_bool
+    \int_compare:nNnT \l_@@_bg_colors_int > { \c_zero_int }
+      { \bool_gset_true:N \g_@@_bg_bool }
+    \tl_if_empty:NF \l_@@_prompt_bg_color_tl
+      { \bool_gset_true:N \g_@@_bg_bool }
+    \bool_gset_false:N \g_@@_rowcolor_inside_bool
+    \IfPackageLoadedTF { zref-base }
+      {
+        \bool_if:NTF \g_@@_label_as_zlabel_bool 
+          { \cs_set_eq:NN \label \@@_zlabel:n }
+          { \cs_set_eq:NN \label \@@_label:n }
+        \cs_set_eq:NN \zlabel \@@_zlabel:n
+      }
+      { \cs_set_eq:NN \label \@@_label:n }
     \dim_zero:N \parskip
     \l_@@_font_command_tl
   }
@@ -5782,8 +5974,7 @@
 \cs_new_protected:Npn \@@_compute_width:
   {
     \dim_gset:Nn \g_@@_width_dim { \box_wd:N \g_@@_output_box }
-    \clist_if_empty:NTF \l_@@_bg_color_clist
-      { \dim_gadd:Nn \g_@@_width_dim \l_@@_left_margin_dim }
+    \bool_if:NTF \g_@@_bg_bool
       { 
         \dim_gadd:Nn \g_@@_width_dim { 0.5 em }
         \dim_compare:nNnTF \l_@@_left_margin_dim = \c_zero_dim 
@@ -5790,6 +5981,7 @@
           { \dim_gadd:Nn \g_@@_width_dim { 0.5 em } }
           { \dim_gadd:Nn \g_@@_width_dim \l_@@_left_margin_dim }
       }
+      { \dim_gadd:Nn \g_@@_width_dim \l_@@_left_margin_dim }
   }          
 %    \end{macrocode}
 %
@@ -5802,12 +5994,8 @@
 \cs_new_protected:Npn \@@_compute_code_width:
   {
     \dim_set_eq:NN \l_@@_code_width_dim \l_@@_width_dim
-    \clist_if_empty:NTF \l_@@_bg_color_clist
+    \bool_if:NTF \g_@@_bg_bool
 %    \end{macrocode}
-% If there is no background, we only subtract the left margin. 
-%    \begin{macrocode}
-      { \dim_sub:Nn \l_@@_code_width_dim \l_@@_left_margin_dim }
-%    \end{macrocode}
 % If there is a background, we subtract 0.5~em for the margin on the right.
 %    \begin{macrocode}
       { 
@@ -5825,6 +6013,10 @@
           { \dim_sub:Nn \l_@@_code_width_dim { 0.5 em } }
           { \dim_sub:Nn \l_@@_code_width_dim \l_@@_left_margin_dim }
       }
+%    \end{macrocode}
+% If there is no background, we only subtract the left margin. 
+%    \begin{macrocode}
+      { \dim_sub:Nn \l_@@_code_width_dim \l_@@_left_margin_dim } 
   }
 %    \end{macrocode}
 %
@@ -5938,7 +6130,7 @@
 \IfFormatAtLeastTF { 2025-06-01 }
   {
 %    \end{macrocode}
-% We will retreive the body of the environment in |\l_@@_listing_tl|.
+% We will retrieve the body of the environment in |\l_@@_listing_tl|.
 %    \begin{macrocode}
     \cs_new_protected:Npn \@@_store_body:n #1 
       {
@@ -5969,9 +6161,9 @@
 %    \end{macrocode}
 % Now, the main job.
 %    \begin{macrocode}
-            \bool_if:NT \g_@@_footnote_bool \savenotes % added
+            \bool_if:NT \g_@@_footnote_bool \savenotes 
             \@@_composition:
-            \bool_if:NT \g_@@_footnote_bool \endsavenotes % added 
+            \bool_if:NT \g_@@_footnote_bool \endsavenotes 
             #5
           }
           { \ignorespacesafterend }  
@@ -6228,7 +6420,10 @@
     \vbox_gset:Nn \g_@@_output_box
       { \@@_retrieve_gobble_parse:o \l_@@_listing_tl }
     \bool_if:NT \l_@@_minimize_width_bool { \@@_compute_width: }
-    \clist_if_empty:NF \l_@@_bg_color_clist { \@@_add_backgrounds_to_output_box: }
+    \bool_lazy_or:nnT
+      \g_@@_bg_bool
+      \g_@@_rowcolor_inside_bool
+      { \@@_add_backgrounds_to_output_box: }
   }
 %    \end{macrocode}
 %
@@ -6390,7 +6585,7 @@
       \l_@@_path_seq
       \l_file_search_path_seq  
     \file_get_full_name:nNTF { #3 } \l_@@_file_name_str
-      {  
+      {
         \@@_input_file:nn { #1 } { #2 }
         #4
       }
@@ -6407,9 +6602,27 @@
 % 
 %    \begin{macrocode}
 \NewDocumentCommand { \PitonInputFile } { d < > O { } m }
-  { \PitonInputFileTF < #1 >  [ #2 ] { #3 } { } { \@@_unknown_file:n { #3 } } }
+  {
+    \PitonInputFileTF < #1 > [ #2 ] { #3 } { }
+      {
+%    \end{macrocode}
+% The following line is for |latexmk| (suggestion of Y. Salmon).
+%    \begin{macrocode}
+        \iow_log:n { No~file~#3 }
+        \@@_unknown_file:n { #3 }
+      }
+  }
 \NewDocumentCommand { \PitonInputFileT } { d < > O { } m m }
-  { \PitonInputFileTF < #1 >  [ #2 ] { #3 } { #4 } { \@@_unknown_file:n { #3 } } }
+  {
+    \PitonInputFileTF < #1 >  [ #2 ] { #3 } { #4 }
+      {
+%    \end{macrocode}
+% The following line is for |latexmk| (suggestion of Y. Salmon).
+%    \begin{macrocode}
+        \iow_log:n { No~file~#3 }
+        \@@_unknown_file:n { #3 }
+      }
+  }
 \NewDocumentCommand { \PitonInputFileF } { d < > O { } m m }
   { \PitonInputFileTF < #1 >  [ #2 ] { #3 } { } { #4 } }
 %    \end{macrocode}
@@ -6431,7 +6644,7 @@
           { \@@_error_or_warning:n { overlay~without~beamer } }
       }
     \group_begin:
-% The following line is to allow programs such as |latexmk| to be aware that the
+% The following line is to allow tools such as |latexmk| to be aware that the
 % file (read by |\PitonInputFile|) is loaded during the compilation of the LaTeX
 % document. 
 %    \begin{macrocode}
@@ -7290,6 +7503,7 @@
     gobble,~
     indent-broken-lines,~
     join,~
+    label-as-zlabel,~
     language,~
     left-margin,~
     line-numbers/,~
@@ -7322,7 +7536,8 @@
 \@@_msg_new:nn { label~with~lines~numbers } 
   {
     You~can't~use~the~command~\token_to_str:N \label\
-    because~the~key~'line-numbers'~is~not~active.\\
+    or~\token_to_str:N \zlabel\ because~the~key~'line-numbers'
+    ~is~not~active.\\
     If~you~go~on,~that~command~will~ignored.
   }
 %    \end{macrocode}
@@ -7338,7 +7553,25 @@
     If~you~go~on,~that~argument~will~be~ignored.
   }
 %    \end{macrocode}
+%    
+% \bigskip
 %
+%    \begin{macrocode}
+\@@_msg_new:nn { label~as~zlabel~needs~zref~package }
+  {
+    The~key~'label-as-zlabel'~requires~the~package~'zref'.~
+    Please~load~the~package~'zref'~before~setting~the~key.\\
+    This~error~is~fatal.
+  }
+\hook_gput_code:nnn { begindocument } { . }
+  {
+    \bool_if:NT \g_@@_label_as_zlabel_bool
+      {
+        \IfPackageLoadedF { zref-base }
+          { \@@_fatal:n { label~as~zlabel~needs~zref~package } }
+      }
+  }
+%    \end{macrocode}
 % 
 % \bigskip
 % \subsubsection{We load piton.lua}
@@ -7573,7 +7806,32 @@
 % By convention, we will use names with an initial capital for \textsc{lpeg}
 % which return captures.
 %
+% \bigskip
 % 
+% The following functions allow to recognize numbers that contains |_| among
+% their digits, for example |1_000_000|, but also floating point numbers, numbers
+% with exponents and numbers with different bases.\footnote{The edge cases such as }
+%    \begin{macrocode}
+local allow_underscores_except_first
+function allow_underscores_except_first ( p )
+    return p * (P "_" + p)^0
+end
+local allow_underscores
+function allow_underscores ( p )
+    return (P "_" + p)^0
+end
+local digits_to_number
+function digits_to_number(prefix, digits)
+    -- The edge cases of what is allowed in number litterals is modelled after
+    -- OCaml numbers, which seems to be the most permissive language
+    -- in this regard (among C, OCaml, Python & SQL).
+    return prefix
+        * allow_underscores_except_first(digits^1)
+        * (P "." * #(1 - P ".") * allow_underscores(digits))^-1
+        * (S "eE" * S "+-"^-1 * allow_underscores_except_first(digits^1))^-1
+end
+%    \end{macrocode}
+% 
 % \bigskip
 % Here is the first use of our function~|K|. That function will be used to
 % construct \textsc{lpeg} which capture Python chunks for which we have a
@@ -7585,12 +7843,11 @@
 %    \begin{macrocode}
 local Number =
   K ( 'Number.Internal' ,
-      ( digit ^ 1 * P "." * # ( 1 - P "." ) * digit ^ 0 
-        + digit ^ 0 * P "." * digit ^ 1 
-        + digit ^ 1 )
-      * ( S "eE" * S "+-" ^ -1 * digit ^ 1 ) ^ -1
-      + digit ^ 1 
-    ) 
+      digits_to_number (P "0x" + P "0X", R "af" + R "AF" + digit)
+      + digits_to_number (P "0o" + P "0O", R "07")
+      + digits_to_number (P "0b" + P "0B", R "01")
+      + digits_to_number ( "" , digit )
+    )
 %    \end{macrocode}
 %
 % \bigskip
@@ -7960,35 +8217,13 @@
 % \bigskip
 % \paragraph{EOL}
 %
-% \bigskip
-% The following LPEG will detect the Python prompts when the user is typesetting
-% an interactive session of Python (directly or through |{pyconsole}| of
-% \pkg{pyluatex}). We have to detect that prompt twice. The first detection
-% (called \emph{hasty detection}) will be before the |\@@_begin_line:| because
-% you want to trigger a special background color for that row (and, after the
-% |\@@_begin_line:|, it's too late to change de background).
+% There may be empty lines in the transcription of the prompt, \emph{id est} lines of
+% the form |...| without space after and that's why we need |P " " ^ -1| with the |^ -1|.
 %    \begin{macrocode}
-local PromptHastyDetection = 
-  ( # ( P ">>>" + "..." ) * Lc [[ \@@_prompt: ]] ) ^ -1 
-%    \end{macrocode}
-% We remind that the marker |#| of \textsc{lpeg} specifies that the pattern will be
-% detected but won't consume any character.
-%
-% \medskip
-% With the following \textsc{lpeg}, a style will actually be applied to the
-% prompt (for instance, it's possible to decide to discard these prompts).
-%    \begin{macrocode}
 local Prompt = 
-  K ( 'Prompt' , ( ( P ">>>" + "..." ) * P " " ^ -1 + P ( true ) ) ) ^ -1  
+  K ( 'Prompt' , ( P ">>>" + "..." ) * P " " ^ -1 ) 
+  *   Lc [[ \rowcolor { \l_@@_prompt_bg_color_tl } ]] 
 %    \end{macrocode}
-% The |P ( true )| at the end is mandatory because we want the style to be
-% \emph{always} applied, even with an empty argument, in order, for example to
-% add a ``false'' prompt marker with the tuning:
-% 
-% \begin{Verbatim}
-% \SetPitonStyle{ Prompt = >>>\space }
-% \end{Verbatim}
-% 
 %
 %
 % \bigskip
@@ -8001,7 +8236,7 @@
     space ^ 0 * -1 
     + 
 %    \end{macrocode}
-% We recall that each line of the informatic code we have to parse will be sent
+% We recall that each line of the computer listing we have to parse will be sent
 % back to LaTeX between a pair |\@@_begin_line:| --
 % |\@@_end_line:|\footnote{Remember that the \texttt{\textbackslash
 % @@\_end\_line:} must be explicit because it will be used as marker in order to
@@ -8024,9 +8259,7 @@
                     -1 
                   + 
                     beamerBeginEnvironments 
-                  * PromptHastyDetection
                   * Lc [[ \@@_par:\@@_begin_line: ]]
-                  * Prompt
                 )
             )
        )
@@ -8056,6 +8289,7 @@
 % We open a Lua local scope for the language Python (of course, there will be
 % also global definitions).
 %    \begin{macrocode}
+--python Python
 do 
 %    \end{macrocode}
 %
@@ -8552,7 +8786,8 @@
        + Escape + EscapeMath
        + CommentLaTeX
        + Beamer
-       + DetectedCommands 
+       + DetectedCommands
+       + Prompt
        + LongString 
        + Comment
        + ExceptionInConsole
@@ -8591,9 +8826,7 @@
     Ct (
          ( space ^ 0 * "\r" ) ^ -1 
          * beamerBeginEnvironments 
-         * PromptHastyDetection
          * Lc [[ \@@_begin_line: ]]
-         * Prompt 
          * SpaceIndentation ^ 0 
          * ( space ^ 1 * -1 + space ^ 0 * EOL + Main ) ^ 0 
          * -1 
@@ -8613,6 +8846,7 @@
 % We open a Lua local scope for the language OCaml (of course, there will be also
 % global definitions).
 %    \begin{macrocode}
+--ocaml Ocaml OCaml
 do 
 %    \end{macrocode}
 %
@@ -9190,14 +9424,15 @@
                EOL 
                + comment 
                +  Q ( 1 
-                      - P ";;" 
+                      - P ";;"
+                      - P "type"
                       - ( ( Space + EOL ) * governing_keyword * EndKeyword )
                     ) 
              ) ^ 0  
              * 
              ( 
-               # ( ( Space + EOL ) * governing_keyword * EndKeyword )
-               + Q ";;" 
+               # ( P "type" + ( Space + EOL ) * governing_keyword * EndKeyword )
+               + Q ";;"
                + -1 
              ) 
            )
@@ -9215,8 +9450,8 @@
   end
   return nil
 end)
-  local Prompt = #start_of_line * K( 'Prompt', prompt)
-  local Answer = #start_of_line * (Q"-" + Q "val" * Space * Identifier )
+  local Prompt = #start_of_line * K( 'Prompt', prompt )
+  local Answer = #start_of_line * (Q "-" + Q "val" * Space * Identifier )
                  * SkipSpace * Q ":" * #(1- P"=") * SkipSpace
                  * (K ( 'TypeExpression' , Q ( 1 - P "=") ^ 1 ) ) * SkipSpace * Q "="
 %    \end{macrocode}
@@ -9308,6 +9543,7 @@
 % We open a Lua local scope for the language C (of course, there will be also
 % global definitions).
 %    \begin{macrocode}
+--c C c++ C++
 do 
 %    \end{macrocode}
 %
@@ -9348,9 +9584,10 @@
 
   local Type = 
     K ( 'Name.Type' ,
-        P "bool" + "char" + "char16_t" + "char32_t" + "double" + "float" + "int" +
-        "int8_t" + "int16_t" + "int32_t" + "int64_t" + "long" + "short" + "signed"
-        + "unsigned" + "void" + "wchar_t" ) * Q "*" ^ 0 
+        P "bool" + "char" + "char16_t" + "char32_t" + "double" + "float" +
+        "int8_t" + "int16_t" + "int32_t" + "int64_t" + "uint8_t" + "uint16_t" +
+        "uint32_t" + "uint64_t" + "int" + "long" + "short" + "signed" + "unsigned" +
+        "void" + "wchar_t" ) * Q "*" ^ 0 
 
   local DefFunction = 
     Type 
@@ -9380,6 +9617,13 @@
 % list of keywords).
 %
 % \bigskip
+%    \begin{macrocode}
+  local Character =
+    K ( 'String.Short' ,
+        P [['\'']] + P "'" * ( 1 - P "'" ) ^ 0 * P "'" )  
+%    \end{macrocode}
+% 
+% \bigskip
 % \paragraph{The strings of C}
 %
 %    \begin{macrocode}
@@ -9469,6 +9713,7 @@
        + Comment + LongComment
        + Delim
        + Operator
+       + Character
        + String
        + Punct
        + DefFunction
@@ -9518,6 +9763,7 @@
 % We open a Lua local scope for the language SQL (of course, there will be also
 % global definitions).
 %    \begin{macrocode}
+--sql SQL
 do 
 %    \end{macrocode}
 %
@@ -9803,6 +10049,7 @@
 % We open a Lua local scope for the language ``Minimal'' (of course, there
 % will be also global definitions).
 %    \begin{macrocode}
+--minimal Minimal
 do 
 %    \end{macrocode}
 %
@@ -9892,6 +10139,7 @@
 % We open a Lua local scope for the language ``Verbatim'' (of course, there
 % will be also global definitions).
 %    \begin{macrocode}
+--verbatim Verbatim
 do 
 %    \end{macrocode}
 
@@ -10240,7 +10488,7 @@
   piton.last_code = piton.Gobble ( n , code )
   piton.last_language = lang
 %    \end{macrocode}
-% We count the number of lines of the informatic code. The result will be stored
+% We count the number of lines of the computer listing. The result will be stored
 % by Lua in |\g_@@_nb_lines_int|. 
 %    \begin{macrocode}
   piton.CountLines ( piton.last_code ) 
@@ -10340,8 +10588,8 @@
 %
 % \bigskip
 % The following function will be used when the key |split-on-empty-lines| is in
-% force. With that key, the informatic code is split in chunks at the empty
-% lines (usually between the informatic functions defined in the informatic
+% force. With that key, the computer listing is split in chunks at the empty
+% lines (usually between the abstract functions defined in the computer
 % code). LaTeX will be able to change the page between the chunks. The second
 % argument |n| corresponds to the value of the key |gobble| (number of spaces to
 % gobble). 
@@ -11296,6 +11544,15 @@
 %
 % \verb|https://github.com/fpantigny/piton|
 %
+% \subsection*{Changes between versions 4.7 and 4.8}
+% 
+% New key |\rowcolor|
+%
+% The command |\label| redefined by \pkg{piton} is now compatible with \pkg{hyperref}
+% (thanks to P. Le Scornet).
+%
+% New key |label-as-zlabel|.
+%
 % \subsection*{Changes between versions 4.6 and 4.7}
 %
 % New key |rounded-corners|
@@ -11420,7 +11677,8 @@
 %
 % \section*{Acknowledgments}
 %
-% Acknowledgments to Yann Salmon for its numerous suggestions of improvments.
+% Acknowledgments to Yann Salmon and Pierre Le Scornet for their numerous suggestions
+% of improvments.
 %
 % \tableofcontents
 %

Modified: trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua	2025-08-08 21:33:26 UTC (rev 76002)
+++ trunk/Master/texmf-dist/tex/lualatex/piton/piton.lua	2025-08-08 21:42:12 UTC (rev 76003)
@@ -20,7 +20,7 @@
 -- -------------------------------------------
 -- 
 -- This file is part of the LuaLaTeX package 'piton'.
-piton_version = "4.7" -- 2025/07/09
+piton_version = "4.8" -- 2025/08/08
 
 
 
@@ -94,13 +94,30 @@
 local alphanum = letter + digit
 local identifier = letter * alphanum ^ 0
 local Identifier = K ( 'Identifier.Internal' , identifier )
+local allow_underscores_except_first
+function allow_underscores_except_first ( p )
+    return p * (P "_" + p)^0
+end
+local allow_underscores
+function allow_underscores ( p )
+    return (P "_" + p)^0
+end
+local digits_to_number
+function digits_to_number(prefix, digits)
+    -- The edge cases of what is allowed in number litterals is modelled after
+    -- OCaml numbers, which seems to be the most permissive language
+    -- in this regard (among C, OCaml, Python & SQL).
+    return prefix
+        * allow_underscores_except_first(digits^1)
+        * (P "." * #(1 - P ".") * allow_underscores(digits))^-1
+        * (S "eE" * S "+-"^-1 * allow_underscores_except_first(digits^1))^-1
+end
 local Number =
   K ( 'Number.Internal' ,
-      ( digit ^ 1 * P "." * # ( 1 - P "." ) * digit ^ 0
-        + digit ^ 0 * P "." * digit ^ 1
-        + digit ^ 1 )
-      * ( S "eE" * S "+-" ^ -1 * digit ^ 1 ) ^ -1
-      + digit ^ 1
+      digits_to_number (P "0x" + P "0X", R "af" + R "AF" + digit)
+      + digits_to_number (P "0o" + P "0O", R "07")
+      + digits_to_number (P "0b" + P "0B", R "01")
+      + digits_to_number ( "" , digit )
     )
 local lpeg_central = 1 - S " '\"\r[({})]" - digit
 if piton.begin_escape then
@@ -276,10 +293,9 @@
 end
 local CommentMath =
   P "$" * K ( 'Comment.Math' , ( 1 - S "$\r" ) ^ 1  ) * P "$" -- $
-local PromptHastyDetection =
-  ( # ( P ">>>" + "..." ) * Lc [[ \__piton_prompt: ]] ) ^ -1
 local Prompt =
-  K ( 'Prompt' , ( ( P ">>>" + "..." ) * P " " ^ -1 + P ( true ) ) ) ^ -1
+  K ( 'Prompt' , ( P ">>>" + "..." ) * P " " ^ -1 )
+  *   Lc [[ \rowcolor { \l__piton_prompt_bg_color_tl } ]]
 local EOL =
   P "\r"
   *
@@ -296,9 +312,7 @@
                     -1
                   +
                     beamerBeginEnvironments
-                  * PromptHastyDetection
                   * Lc [[ \__piton_par:\__piton_begin_line: ]]
-                  * Prompt
                 )
             )
        )
@@ -310,6 +324,7 @@
   * L ( ( 1 - P "\r" ) ^ 0 )
   * Lc "}}"
   * ( EOL + -1 )
+--python Python
 do
   local Operator =
     K ( 'Operator' ,
@@ -574,6 +589,7 @@
        + CommentLaTeX
        + Beamer
        + DetectedCommands
+       + Prompt
        + LongString
        + Comment
        + ExceptionInConsole
@@ -598,9 +614,7 @@
     Ct (
          ( space ^ 0 * "\r" ) ^ -1
          * beamerBeginEnvironments
-         * PromptHastyDetection
          * Lc [[ \__piton_begin_line: ]]
-         * Prompt
          * SpaceIndentation ^ 0
          * ( space ^ 1 * -1 + space ^ 0 * EOL + Main ) ^ 0
          * -1
@@ -607,6 +621,7 @@
          * Lc [[ \__piton_end_line: ]]
        )
 end
+--ocaml Ocaml OCaml
 do
   local SkipSpace = ( Q " " + EOL ) ^ 0
   local Space = ( Q " " + EOL ) ^ 1
@@ -935,12 +950,13 @@
                + comment
                +  Q ( 1
                       - P ";;"
+                      - P "type"
                       - ( ( Space + EOL ) * governing_keyword * EndKeyword )
                     )
              ) ^ 0
              *
              (
-               # ( ( Space + EOL ) * governing_keyword * EndKeyword )
+               # ( P "type" + ( Space + EOL ) * governing_keyword * EndKeyword )
                + Q ";;"
                + -1
              )
@@ -955,8 +971,8 @@
   end
   return nil
 end)
-  local Prompt = #start_of_line * K( 'Prompt', prompt)
-  local Answer = #start_of_line * (Q"-" + Q "val" * Space * Identifier )
+  local Prompt = #start_of_line * K( 'Prompt', prompt )
+  local Answer = #start_of_line * (Q "-" + Q "val" * Space * Identifier )
                  * SkipSpace * Q ":" * #(1- P"=") * SkipSpace
                  * (K ( 'TypeExpression' , Q ( 1 - P "=") ^ 1 ) ) * SkipSpace * Q "="
   local Main =
@@ -1010,6 +1026,7 @@
         * Lc [[ \__piton_end_line: ]]
       )
 end
+--c C c++ C++
 do
   local Delim = Q ( S "{[()]}" )
   local Punct = Q ( S ",:;!" )
@@ -1037,9 +1054,10 @@
 
   local Type =
     K ( 'Name.Type' ,
-        P "bool" + "char" + "char16_t" + "char32_t" + "double" + "float" + "int" +
-        "int8_t" + "int16_t" + "int32_t" + "int64_t" + "long" + "short" + "signed"
-        + "unsigned" + "void" + "wchar_t" ) * Q "*" ^ 0
+        P "bool" + "char" + "char16_t" + "char32_t" + "double" + "float" +
+        "int8_t" + "int16_t" + "int32_t" + "int64_t" + "uint8_t" + "uint16_t" +
+        "uint32_t" + "uint64_t" + "int" + "long" + "short" + "signed" + "unsigned" +
+        "void" + "wchar_t" ) * Q "*" ^ 0
 
   local DefFunction =
     Type
@@ -1050,6 +1068,9 @@
     * # P "("
   local DefClass =
     K ( 'Keyword' , "class" ) * Space * K ( 'Name.Class' , identifier )
+  local Character =
+    K ( 'String.Short' ,
+        P [['\'']] + P "'" * ( 1 - P "'" ) ^ 0 * P "'" )
   String =
     WithStyle ( 'String.Long.Internal' ,
         Q "\""
@@ -1094,6 +1115,7 @@
        + Comment + LongComment
        + Delim
        + Operator
+       + Character
        + String
        + Punct
        + DefFunction
@@ -1116,6 +1138,7 @@
          * Lc [[ \__piton_end_line: ]]
        )
 end
+--sql SQL
 do
   local LuaKeyword
   function LuaKeyword ( name ) return
@@ -1280,6 +1303,7 @@
          * Lc [[ \__piton_end_line: ]]
        )
 end
+--minimal Minimal
 do
   local Punct = Q ( S ",:;!\\" )
 
@@ -1342,6 +1366,7 @@
          * Lc [[ \__piton_end_line: ]]
        )
 end
+--verbatim Verbatim
 do
 
   local braces =

Modified: trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty	2025-08-08 21:33:26 UTC (rev 76002)
+++ trunk/Master/texmf-dist/tex/lualatex/piton/piton.sty	2025-08-08 21:42:12 UTC (rev 76003)
@@ -19,8 +19,8 @@
 %% LaTeX version 2005/12/01 or later.
 %% -------------------------------------------
 %% 
-\def\PitonFileVersion{4.7}
-\def\PitonFileDate{2025/07/09}
+\def\PitonFileVersion{4.8}
+\def\PitonFileDate{2025/08/08}
 
 
 
@@ -44,6 +44,17 @@
   { }
   { \msg_fatal:nn { piton } { latex-too-old } }
 \RequirePackage { amstext }
+\ProvideDocumentCommand { \IfPackageLoadedT } { m m }
+  { \IfPackageLoadedTF { #1 } { #2 } { } }
+
+\ProvideDocumentCommand { \IfPackageLoadedF } { m m }
+  { \IfPackageLoadedTF { #1 } { } { #2 } }
+
+\ProvideDocumentCommand { \IfClassLoadedF } { m m }
+  { \IfClassLoadedTF { #1 } { } { #2 } }
+
+\ProvideDocumentCommand { \IfClassLoadedF } { m m }
+  { \IfClassLoadedTF { #1 } { } { #2 } }
 \cs_new_protected:Npn \__piton_error:n { \msg_error:nn { piton } }
 \cs_new_protected:Npn \__piton_warning:n { \msg_warning:nn { piton } }
 \cs_new_protected:Npn \__piton_warning:nn { \msg_warning:nnn { piton } }
@@ -73,16 +84,16 @@
     LuaLaTeX~is~mandatory.\\
     The~package~'piton'~requires~the~engine~LuaLaTeX.\\
     \str_if_eq:onT \c_sys_jobname_str { output }
-      { If~you~use~Overleaf,~you~can~switch~to~LuaLaTeX~in~the~"Menu". \\}
-    \IfClassLoadedTF { beamer }
+      { If~you~use~Overleaf,~you~can~switch~to~LuaLaTeX~in~the~"Menu"~and~
+        if~you~use~TeXPage,~you~should~go~in~"Settings". \\ }
+    \IfClassLoadedT { beamer }
       {
         Since~you~use~Beamer,~don't~forget~to~use~piton~in~frames~with~
         the~key~'fragile'.\\
       }
-      { }
-    If~you~go~on,~the~package~'piton'~won't~be~loaded.
+    That~error~is~fatal.
   }
-\sys_if_engine_luatex:F { \msg_critical:nn { piton } { LuaLaTeX~mandatory } }
+\sys_if_engine_luatex:F { \__piton_fatal:n { LuaLaTeX~mandatory } }
 \RequirePackage { luacode }
 \__piton_msg_new:nnn { piton.lua~not~found }
   {
@@ -116,9 +127,9 @@
   {
     Unknown~key.\\
     You~have~used~the~key~'\l_keys_key_str'~when~loading~piton~
-    but~the~only~keys~available~here~
-    are~'beamer',~'footnote',~and~'footnotehyper'.~
-    Other~keys~are~available~in~\token_to_str:N \PitonOptions.\\
+    but~the~only~keys~available~here~are~'beamer',~'footnote'~
+    and~'footnotehyper'.~ Other~keys~are~available~in~
+    \token_to_str:N \PitonOptions.\\
     That~key~will~be~ignored.
   }
 \ProcessKeyOptions
@@ -125,9 +136,8 @@
 \IfClassLoadedTF { beamer }
   { \bool_gset_true:N \g__piton_beamer_bool }
   {
-    \IfPackageLoadedTF { beamerarticle }
-    { \bool_gset_true:N \g__piton_beamer_bool }
-    { }
+    \IfPackageLoadedT { beamerarticle }
+      { \bool_gset_true:N \g__piton_beamer_bool }
   }
 \lua_now:e
   {
@@ -206,6 +216,7 @@
 \tl_set:Nn \l__piton_split_separation_tl
   { \vspace { \baselineskip } \vspace { -1.25pt } }
 \clist_new:N \l__piton_bg_color_clist
+\int_new:N \l__piton_bg_colors_int
 \tl_new:N \l__piton_prompt_bg_color_tl
 \tl_new:N \l__piton_space_in_string_tl
 \str_new:N \l__piton_begin_range_str
@@ -212,7 +223,6 @@
 \str_new:N \l__piton_end_range_str
 \bool_new:N \g__piton_math_comments_bool
 \str_new:N \l__piton_file_name_str
-\int_new:N \g__piton_env_int
 \bool_new:N \l__piton_print_bool
 \bool_set_true:N \l__piton_print_bool
 \str_new:N \l__piton_write_str
@@ -266,29 +276,53 @@
           {
             \string \newlabel { #1 }
             {
-              { \int_eval:n { \g__piton_visual_line_int + 1 } }
+              { \int_use:N \g__piton_visual_line_int }
               { \thepage }
+              { }
+              { line.#1 }
+              { }
             }
           }
         \@esphack
+        \IfPackageLoadedT { hyperref }
+          { \Hy at raisedlink { \hyper at anchorstart { line.#1 } \hyper at anchorend } }
       }
       { \__piton_error:n { label~with~lines~numbers } }
   }
+\cs_new_protected:Npn \__piton_zlabel:n #1
+  {
+    \bool_if:NTF \l__piton_line_numbers_bool
+      {
+        \@bsphack
+        \protected at write \@auxout { }
+          {
+            \string \zref at newlabel { #1 }
+              {
+                \string \default { \int_use:N \g__piton_visual_line_int }
+                \string \page { \thepage }
+                \string \zc at type { line }
+                \string \anchor { line.#1 }
+              }
+          }
+        \@esphack
+        \IfPackageLoadedT { hyperref }
+          { \Hy at raisedlink { \hyper at anchorstart { line.#1 } \hyper at anchorend } }
+      }
+      { \__piton_error:n { label~with~lines~numbers } }
+  }
+\cs_new_protected:Npn \__piton_rowcolor:n #1
+  {
+    \tl_gset:ce { g__piton_color_ \int_eval:n { \g__piton_line_int + 1 }_ tl } { #1 }
+    \bool_gset_true:N \g__piton_rowcolor_inside_bool
+  }
 \cs_new:Npn \__piton_marker_beginning:n #1 { }
 \cs_new:Npn \__piton_marker_end:n #1 { }
 \tl_new:N \g__piton_before_line_tl
 \tl_new:N \g__piton_after_line_tl
-\cs_new_protected:Npn \__piton_prompt:
-  {
-    \tl_gset:Nn \g__piton_before_line_tl
-      {
-        \tl_if_empty:NF \l__piton_prompt_bg_color_tl
-          { \clist_set:No \l__piton_bg_color_clist { \l__piton_prompt_bg_color_tl } }
-      }
-  }
 \cs_new_protected:Npn \__piton_trailing_space: { }
 \bool_new:N \g__piton_color_is_none_bool
 \bool_new:N \g__piton_next_color_is_none_bool
+\bool_new:N \g__piton_rowcolor_inside_bool
 \clist_new:N \l__piton_detected_commands_clist
 \clist_new:N \l__piton_raw_detected_commands_clist
 \clist_new:N \l__piton_beamer_commands_clist
@@ -391,7 +425,7 @@
               { ! \l__piton_skip_empty_lines_bool && \l__piton_label_empty_lines_bool }
               { \__piton_print_number: }
           }
-        \clist_if_empty:NF \l__piton_bg_color_clist
+        \bool_if:NT \g__piton_bg_bool
           {
             \dim_compare:nNnT \l__piton_left_margin_dim = \c_zero_dim
               { \skip_horizontal:n { 0.5 em } }
@@ -440,7 +474,7 @@
         \offinterlineskip
         \hbox
           {
-            \__piton_color:N \l__piton_bg_color_clist
+            \__piton_compute_and_set_color:
             \dim_set:Nn \l_tmpa_dim { \box_dp:N \l__piton_line_box }
             \bool_if:NT \g__piton_next_color_is_none_bool
               { \dim_sub:Nn \l_tmpa_dim { 2.5 pt } }
@@ -493,29 +527,47 @@
         \box_use_drop:N \l__piton_line_box
      }
   }
-\cs_set_protected:Npn \__piton_color:N #1
+\cs_set_protected:Npn \__piton_compute_and_set_color:
   {
-    \int_set:Nn \l_tmpa_int { \clist_count:N #1 }
-    \int_set:Nn \l_tmpb_int { \int_mod:nn \g__piton_line_int \l_tmpa_int + 1 }
-    \tl_set:Ne \l_tmpa_tl { \clist_item:Nn #1 \l_tmpb_int }
+    \int_compare:nNnTF \l__piton_bg_colors_int = \c_zero_int
+      { \tl_set:Nn \l_tmpa_tl { none } }
+      {
+        \int_set:Nn \l_tmpb_int
+          { \int_mod:nn \g__piton_line_int \l__piton_bg_colors_int + 1 }
+        \tl_set:Ne \l_tmpa_tl { \clist_item:Nn \l__piton_bg_color_clist \l_tmpb_int }
+      }
+    \cs_if_exist:cT { g__piton_color_ \int_use:N \g__piton_line_int _ tl }
+      {
+        \tl_set_eq:Nc \l_tmpa_tl { g__piton_color_ \int_use:N \g__piton_line_int _ tl }
+        \cs_undefine:c { g__piton_color_ \int_use:N \g__piton_line_int _ tl }
+      }
     \tl_if_eq:NnTF \l_tmpa_tl { none }
       { \bool_gset_true:N \g__piton_color_is_none_bool }
       {
         \bool_gset_false:N \g__piton_color_is_none_bool
-        \__piton_color_i:o \l_tmpa_tl
+        \__piton_color:o \l_tmpa_tl
       }
     \int_compare:nNnTF { \g__piton_line_int + 1 } = \g__piton_nb_lines_int
       { \bool_gset_false:N \g__piton_next_color_is_none_bool }
       {
-        \int_set:Nn \l_tmpb_int
-          { \int_mod:nn { \g__piton_line_int + 1 } \l_tmpa_int + 1 }
-        \tl_set:Ne \l_tmpa_tl { \clist_item:Nn #1 \l_tmpb_int }
+        \int_compare:nNnTF \l__piton_bg_colors_int = \c_zero_int
+          { \tl_set:Nn \l_tmpa_tl { none } }
+          {
+            \int_set:Nn \l_tmpb_int
+              { \int_mod:nn { \g__piton_line_int + 1 } \l__piton_bg_colors_int + 1 }
+            \tl_set:Ne \l_tmpa_tl { \clist_item:Nn \l__piton_bg_color_clist \l_tmpb_int }
+          }
+        \cs_if_exist:cT { g__piton_color_ \int_eval:n { \g__piton_line_int + 1 } _ tl }
+          {
+            \tl_set_eq:Nc \l_tmpa_tl
+              { g__piton_color_ \int_eval:n { \g__piton_line_int + 1 } _ tl }
+          }
         \tl_if_eq:NnTF \l_tmpa_tl { none }
           { \bool_gset_true:N \g__piton_next_color_is_none_bool }
           { \bool_gset_false:N \g__piton_next_color_is_none_bool }
       }
   }
-\cs_set_protected:Npn \__piton_color_i:n #1
+\cs_set_protected:Npn \__piton_color:n #1
   {
     \tl_if_head_eq_meaning:nNTF { #1 } [
       {
@@ -525,7 +577,7 @@
       }
       { \color { #1 } }
   }
-\cs_generate_variant:Nn \__piton_color_i:n { o }
+\cs_generate_variant:Nn \__piton_color:n { o }
 \cs_new_protected:Npn \__piton_par:
   {
     \int_gincr:N \g__piton_line_int
@@ -545,8 +597,7 @@
               \l__piton_continuation_symbol_tl
             }
             \skip_horizontal:n { 0.3 em }
-            \clist_if_empty:NF \l__piton_bg_color_clist
-              { \skip_horizontal:n { 0.5 em } }
+            \bool_if:NT \g__piton_bg_bool { \skip_horizontal:n { 0.5 em } }
           }
         \bool_if:NT \l__piton_indent_broken_lines_bool
           {
@@ -572,6 +623,7 @@
 \bool_new:N \l__piton_resume_bool
 \bool_new:N \l__piton_split_on_empty_lines_bool
 \bool_new:N \l__piton_splittable_on_empty_lines_bool
+\bool_new:N \g__piton_label_as_zlabel_bool
 \keys_define:nn { PitonOptions / marker }
   {
     beginning .code:n = \cs_set:Nn \__piton_marker_beginning:n { #1 } ,
@@ -650,7 +702,6 @@
                 { \bool_set_false:N \l__piton_tcolorbox_bool }
             }
             { \__piton_error:n { library~breakable~not~loaded } }
-
         }
         { \__piton_error:n { tcolorbox~not~loaded } } ,
     tcolorbox .default:n = true ,
@@ -706,6 +757,10 @@
     comment-latex .value_required:n = true ,
     comment-latex .usage:n = preamble ,
 
+    label-as-zlabel .bool_gset:N = \g__piton_label_as_zlabel_bool ,
+    label-as-zlabel .default:n = true ,
+    label-as-zlabel .usage:n = preamble ,
+
     math-comments .bool_gset:N = \g__piton_math_comments_bool ,
     math-comments .default:n  = true ,
     math-comments .usage:n = preamble ,
@@ -757,7 +812,9 @@
 
     splittable       .int_set:N         = \l__piton_splittable_int ,
     splittable       .default:n         = 1 ,
-    background-color .clist_set:N       = \l__piton_bg_color_clist ,
+    background-color .code:n =
+      \clist_set:Nn \l__piton_bg_color_clist { #1 }
+      \int_set:Nn \l__piton_bg_colors_int { \clist_count:N \l__piton_bg_color_clist } ,
     background-color .value_required:n  = true ,
     prompt-background-color .tl_set:N         = \l__piton_prompt_bg_color_tl ,
     prompt-background-color .value_required:n = true ,
@@ -1033,7 +1090,6 @@
   {
     \legacy_if:nT { @inlabel } { \bool_set_true:N \l__piton_in_label_bool }
     \automatichyphenmode = 1
-    \int_gincr:N \g__piton_env_int
     \dim_compare:nNnT \l__piton_width_dim = \c_zero_dim
       {
         \dim_set_eq:NN \l__piton_width_dim \linewidth
@@ -1046,7 +1102,21 @@
     \int_gzero:N \g__piton_nb_lines_int
     \dim_zero:N \parindent
     \dim_zero:N \lineskip
-    \cs_set_eq:NN \label \__piton_label:n
+    \cs_set_eq:NN \rowcolor \__piton_rowcolor:n
+    \bool_gset_false:N \g__piton_bg_bool
+    \int_compare:nNnT \l__piton_bg_colors_int > { \c_zero_int }
+      { \bool_gset_true:N \g__piton_bg_bool }
+    \tl_if_empty:NF \l__piton_prompt_bg_color_tl
+      { \bool_gset_true:N \g__piton_bg_bool }
+    \bool_gset_false:N \g__piton_rowcolor_inside_bool
+    \IfPackageLoadedTF { zref-base }
+      {
+        \bool_if:NTF \g__piton_label_as_zlabel_bool
+          { \cs_set_eq:NN \label \__piton_zlabel:n }
+          { \cs_set_eq:NN \label \__piton_label:n }
+        \cs_set_eq:NN \zlabel \__piton_zlabel:n
+      }
+      { \cs_set_eq:NN \label \__piton_label:n }
     \dim_zero:N \parskip
     \l__piton_font_command_tl
   }
@@ -1078,8 +1148,7 @@
 \cs_new_protected:Npn \__piton_compute_width:
   {
     \dim_gset:Nn \g__piton_width_dim { \box_wd:N \g__piton_output_box }
-    \clist_if_empty:NTF \l__piton_bg_color_clist
-      { \dim_gadd:Nn \g__piton_width_dim \l__piton_left_margin_dim }
+    \bool_if:NTF \g__piton_bg_bool
       {
         \dim_gadd:Nn \g__piton_width_dim { 0.5 em }
         \dim_compare:nNnTF \l__piton_left_margin_dim = \c_zero_dim
@@ -1086,12 +1155,12 @@
           { \dim_gadd:Nn \g__piton_width_dim { 0.5 em } }
           { \dim_gadd:Nn \g__piton_width_dim \l__piton_left_margin_dim }
       }
+      { \dim_gadd:Nn \g__piton_width_dim \l__piton_left_margin_dim }
   }
 \cs_new_protected:Npn \__piton_compute_code_width:
   {
     \dim_set_eq:NN \l__piton_code_width_dim \l__piton_width_dim
-    \clist_if_empty:NTF \l__piton_bg_color_clist
-      { \dim_sub:Nn \l__piton_code_width_dim \l__piton_left_margin_dim }
+    \bool_if:NTF \g__piton_bg_bool
       {
         \dim_sub:Nn \l__piton_code_width_dim { 0.5 em }
         \dim_compare:nNnTF \l__piton_left_margin_dim = \c_zero_dim
@@ -1098,6 +1167,7 @@
           { \dim_sub:Nn \l__piton_code_width_dim { 0.5 em } }
           { \dim_sub:Nn \l__piton_code_width_dim \l__piton_left_margin_dim }
       }
+      { \dim_sub:Nn \l__piton_code_width_dim \l__piton_left_margin_dim }
   }
 \NewDocumentCommand { \NewPitonEnvironment } { }
   { \__piton_DefinePitonEnvironment:nnnnn { New } }
@@ -1161,9 +1231,9 @@
                 \int_gset:Nn \g__piton_visual_line_int
                   { \l__piton_number_lines_start_int - 1 }
               }
-            \bool_if:NT \g__piton_footnote_bool \savenotes % added
+            \bool_if:NT \g__piton_footnote_bool \savenotes
             \__piton_composition:
-            \bool_if:NT \g__piton_footnote_bool \endsavenotes % added
+            \bool_if:NT \g__piton_footnote_bool \endsavenotes
             #5
           }
           { \ignorespacesafterend }
@@ -1317,7 +1387,10 @@
     \vbox_gset:Nn \g__piton_output_box
       { \__piton_retrieve_gobble_parse:o \l__piton_listing_tl }
     \bool_if:NT \l__piton_minimize_width_bool { \__piton_compute_width: }
-    \clist_if_empty:NF \l__piton_bg_color_clist { \__piton_add_backgrounds_to_output_box: }
+    \bool_lazy_or:nnT
+      \g__piton_bg_bool
+      \g__piton_rowcolor_inside_bool
+      { \__piton_add_backgrounds_to_output_box: }
   }
 \cs_new_protected:Npn \__piton_add_backgrounds_to_output_box:
   {
@@ -1425,9 +1498,21 @@
 \cs_new_protected:Npn \__piton_unknown_file:n #1
   { \msg_error:nnn { piton } { Unknown~file } { #1 } }
 \NewDocumentCommand { \PitonInputFile } { d < > O { } m }
-  { \PitonInputFileTF < #1 >  [ #2 ] { #3 } { } { \__piton_unknown_file:n { #3 } } }
+  {
+    \PitonInputFileTF < #1 > [ #2 ] { #3 } { }
+      {
+        \iow_log:n { No~file~#3 }
+        \__piton_unknown_file:n { #3 }
+      }
+  }
 \NewDocumentCommand { \PitonInputFileT } { d < > O { } m m }
-  { \PitonInputFileTF < #1 >  [ #2 ] { #3 } { #4 } { \__piton_unknown_file:n { #3 } } }
+  {
+    \PitonInputFileTF < #1 >  [ #2 ] { #3 } { #4 }
+      {
+        \iow_log:n { No~file~#3 }
+        \__piton_unknown_file:n { #3 }
+      }
+  }
 \NewDocumentCommand { \PitonInputFileF } { d < > O { } m m }
   { \PitonInputFileTF < #1 >  [ #2 ] { #3 } { } { #4 } }
 \cs_new_protected:Npn \__piton_input_file:nn #1 #2
@@ -2005,6 +2090,7 @@
     gobble,~
     indent-broken-lines,~
     join,~
+    label-as-zlabel,~
     language,~
     left-margin,~
     line-numbers/,~
@@ -2033,7 +2119,8 @@
 \__piton_msg_new:nn { label~with~lines~numbers }
   {
     You~can't~use~the~command~\token_to_str:N \label\
-    because~the~key~'line-numbers'~is~not~active.\\
+    or~\token_to_str:N \zlabel\ because~the~key~'line-numbers'
+    ~is~not~active.\\
     If~you~go~on,~that~command~will~ignored.
   }
 \__piton_msg_new:nn { overlay~without~beamer }
@@ -2043,6 +2130,20 @@
     in~Beamer.\\
     If~you~go~on,~that~argument~will~be~ignored.
   }
+\__piton_msg_new:nn { label~as~zlabel~needs~zref~package }
+  {
+    The~key~'label-as-zlabel'~requires~the~package~'zref'.~
+    Please~load~the~package~'zref'~before~setting~the~key.\\
+    This~error~is~fatal.
+  }
+\hook_gput_code:nnn { begindocument } { . }
+  {
+    \bool_if:NT \g__piton_label_as_zlabel_bool
+      {
+        \IfPackageLoadedF { zref-base }
+          { \__piton_fatal:n { label~as~zlabel~needs~zref~package } }
+      }
+  }
 \cs_new_protected:Npn \__piton_test_version:n #1
   {
     \str_if_eq:onF \PitonFileVersion { #1 }



More information about the tex-live-commits mailing list.