From b8345f39630408bb198e7636381ce4240154ca9b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 15 Jan 2023 03:00:57 +0000 Subject: CTAN sync 202301150300 --- macros/luatex/latex/letgut/README.md | 2 +- .../luatex/latex/letgut/doc/letgut-banner-code.pdf | Bin 154201 -> 152973 bytes macros/luatex/latex/letgut/doc/letgut-code.pdf | Bin 702257 -> 787519 bytes macros/luatex/latex/letgut/doc/letgut.pdf | Bin 379438 -> 391120 bytes macros/luatex/latex/letgut/doc/letgut.tex | 373 +++-- macros/luatex/latex/letgut/source/letgut.org | 1651 +++++++++++++++++--- .../luatex/latex/pyluatex/pyluatex-interpreter.py | 37 +- macros/luatex/latex/pyluatex/pyluatex.lua | 17 +- macros/luatex/latex/pyluatex/pyluatex.pdf | Bin 82073 -> 83049 bytes macros/luatex/latex/pyluatex/pyluatex.sty | 2 +- macros/luatex/latex/pyluatex/pyluatex.tex | 19 +- 11 files changed, 1748 insertions(+), 353 deletions(-) (limited to 'macros/luatex') diff --git a/macros/luatex/latex/letgut/README.md b/macros/luatex/latex/letgut/README.md index e38b789e5e..13ebf86e3e 100644 --- a/macros/luatex/latex/letgut/README.md +++ b/macros/luatex/latex/letgut/README.md @@ -8,7 +8,7 @@ to the newsletter “La Lettre GUTenberg” of GUTenberg, the French TeX User Gr Release ------- -2022-10-03 v0.9.4 +2023-01-14 v0.9.6 Development ----------- diff --git a/macros/luatex/latex/letgut/doc/letgut-banner-code.pdf b/macros/luatex/latex/letgut/doc/letgut-banner-code.pdf index b232420d44..9499196c47 100644 Binary files a/macros/luatex/latex/letgut/doc/letgut-banner-code.pdf and b/macros/luatex/latex/letgut/doc/letgut-banner-code.pdf differ diff --git a/macros/luatex/latex/letgut/doc/letgut-code.pdf b/macros/luatex/latex/letgut/doc/letgut-code.pdf index 1e8e46f241..b8f926da80 100644 Binary files a/macros/luatex/latex/letgut/doc/letgut-code.pdf and b/macros/luatex/latex/letgut/doc/letgut-code.pdf differ diff --git a/macros/luatex/latex/letgut/doc/letgut.pdf b/macros/luatex/latex/letgut/doc/letgut.pdf index 23f2bf4091..235ae56383 100644 Binary files a/macros/luatex/latex/letgut/doc/letgut.pdf and b/macros/luatex/latex/letgut/doc/letgut.pdf differ diff --git a/macros/luatex/latex/letgut/doc/letgut.tex b/macros/luatex/latex/letgut/doc/letgut.tex index 91006a60ea..01fbebb836 100644 --- a/macros/luatex/latex/letgut/doc/letgut.tex +++ b/macros/luatex/latex/letgut/doc/letgut.tex @@ -67,7 +67,7 @@ } \author{Association GUTenberg} \date{% - Version 0.9.4 en date du \today% + Version 0.9.6 en date du \today% \texorpdfstring{% \\ \url{https://framagit.org/gutenberg/letgut}% @@ -205,7 +205,9 @@ Les options de la \letgutcls{} peuvent être spécifiées de deux façons : \item éditorial\footnote{Ou avertissement s'il n'est pas trouvé.} (cf. clé \refKey{editorial}) ; \item informations sur \gut{}\footnote{Ou avertissement si elles ne sont pas - trouvées.} (cf. clé \refKey{informations}). + trouvées.} (cf. clé \refKey{informations}) ; + \item fichiers attachés au \pdf{} produit (cf. clé + \refKey{reverse-files-attachement}). \end{itemize} \end{itemize} \end{docKeys} @@ -280,7 +282,7 @@ Les options de la \letgutcls{} peuvent être spécifiées de deux façons : \begin{itemize} \item n'est pas employée (les mois et année en cours sont alors utilisés) ; - \item est employée sous la forme \refKey*{date}⅛=⅛\meta{année}⅛-⅛\meta{mois} + \item est employée sous la forme \refKey*{date}™=™\meta{année}™-™\meta{mois} où \meta{année} et \meta{mois} doivent être des nombres entiers positifs. Les garde-fous suivants sont mis en place : \begin{itemize} @@ -291,7 +293,7 @@ Les options de la \letgutcls{} peuvent être spécifiées de deux façons : \end{itemize} \end{itemize} \item \enquote{\meta{texte}} si l'option est employée sous la forme - \refKey*{date}⅛=⅛\meta{texte}. + \refKey*{date}™=™\meta{texte}. \end{itemize} \end{docKey} } @@ -342,16 +344,30 @@ Les options de la \letgutcls{} peuvent être spécifiées de deux façons : a pour effet que cette table des matières est détaillée au maximum (son niveau de profondeur allant jusqu'aux sous-paragraphes), ce qui peut être utile lors de la conception d'un numéro de la \lettre{}. + + \begin{dbremark}{Tables des matières locales}{} + Chaque article peut contenir une table des matières locale, affichée au + moyen de la commande \docAuxCommand{localtableofcontents} (fournie par le + \package*{etoc} chargé en sous-main par la \letgutcls{}). Le niveau de + profondeur est par défaut celui des sections mais cela peut être modifié en + la faisant précéder de la commande \docAuxCommand{etocsetnexttocdepth} (dont + l'argument est par exemple ™subsection™). + \end{dbremark} \end{docKey} -\begin{dbremark}{Tables des matières locales}{} - Chaque article peut contenir une table des matières locale, affichée au moyen - de la commande \docAuxCommand{localtableofcontents} (fournie par le - \package*{etoc} chargé en sous-main par la \letgutcls{}). Le niveau de - profondeur est par défaut celui des sections mais cela peut être modifié en la - faisant précéder de la commande \docAuxCommand{etocsetnexttocdepth} (dont - l'argument est par exemple ⅛subsection⅛). -\end{dbremark} +\begin{docKey}{reverse-files-attachement}{}{\valinitdef[pas de valeur]} + Si, et seulement si, la \lettre{} est à la fois en version pour les lecteurs + (cf. \refKey{for-readers}) et en sortie écran (cf. \refKey{screen}), chacun + des fichiers nécessaires (et suffisants) à la compilation d'un de ses articles + est : + \begin{itemize} + \item attaché au \pdf{} produit ; + \item accessible en cliquant sur l'hyperlien correspondant en forme de + trombone : \noattachfile[icon=Paperclip] ; + \end{itemize} + L'option \refKey{reverse-files-attachement} inverse ce comportement par + défaut. +\end{docKey} \subsection{Options autres} \label{sec:options-autres} @@ -382,7 +398,7 @@ Si la commande \docAuxCommand{title}\marg{titre} est \begin{dbwarning}{\docAuxCommand{title} et \docAuxCommand{author} $\neq$ avant et après \lstinline+\\begin\{document\}+}{} Les commandes \docAuxCommand{title} et \docAuxCommand{author} ne se comportent - pas de la même façon avant et après ⅛\begin{document}⅛ (cf. sections + pas de la même façon avant et après ™\begin{document}™ (cf. sections \nameref{sec:structuration} \vpageref{sec:structuration} et \nameref{sec:sign-des-articl} \vpageref{sec:sign-des-articl}). \end{dbwarning} @@ -404,12 +420,29 @@ Si la commande \docAuxCommand{title}\marg{titre} est \end{itemize} \end{dbwarning} -\begin{docCommand}{inputarticle}{\marg{fichier enfant}} +\begin{docCommands} + { + { + doc name = inputarticle, + doc parameter = \marg{fichier enfant}, + }, + { + doc name = inputarticle*, + doc parameter = \marg{fichier enfant}, + }, + } Cette commande permet d'importer le contenu d'un article stocké dans un \meta{fichier enfant}\file{.tex}. + En version étoilée, les fichiers nécessaires (et suffisants) à la compilation + de l'article ne sont pas attachés au \pdf{} produit (cf. clé + \refKey{reverse-files-attachement}). + En plus de l'importation proprement dite, cette commande procède à un certain nombre de réinitialisations. +\end{docCommands} + +\begin{docCommand}{inputarticle}{\marg{fichier enfant}} \end{docCommand} \section{Structuration} @@ -483,6 +516,10 @@ On lira avec intérêt la section \enquote{\nameref{sec:acronymes}} doc name = person, doc parameter = \brackets{\meta{données$_1$} and \meta{données$_2$}[ and ...]} }, + { + doc name = person*, + doc parameter = \brackets{\meta{données$_1$} and \meta{données$_2$}[ and ...]} + }, { doc name = author, doc parameter = \marg{données} @@ -491,6 +528,10 @@ On lira avec intérêt la section \enquote{\nameref{sec:acronymes}} doc name = author, doc parameter = \brackets{\meta{données$_1$} and \meta{données$_2$}[ and ...]} }, + { + doc name = author*, + doc parameter = \brackets{\meta{données$_1$} and \meta{données$_2$}[ and ...]} + }, } \index{auteur} \index{personne} @@ -501,18 +542,20 @@ On lira avec intérêt la section \enquote{\nameref{sec:acronymes}} étant spécifiées : \begin{description} \item[pour un individu unique] selon l'un des formats suivants : - \begin{itemize} - \item \meta{nom} - \item \meta{nom}⅛, ⅛\meta{prénom} - \item \meta{nom}⅛, ⅛\meta{prénom}⅛, ⅛\meta{titre} - \end{itemize} -\item[pour des individus multiples :]\leavevmode - \begin{itemize} - \item selon le même schéma que pour un individu unique ; - \item les \meta{données} de chacun des individus étant séparées par le mot clé - ⅛and⅛. - \end{itemize} + \begin{itemize} + \item \meta{nom} + \item \meta{nom}™, ™\meta{prénom} + \item \meta{nom}™, ™\meta{prénom}™, ™\meta{titre} + \end{itemize} + \item[pour des individus multiples :]\leavevmode + \begin{itemize} + \item selon le même schéma que pour un individu unique ; + \item les \meta{données} de chacun des individus étant séparées par le mot clé + ™and™. + \end{itemize} \end{description} + Les version étoilées de ces commandes trient alphabétiquement les listes de + personnes ou d'auteurs. \end{docCommands} Indépendamment de la casse utilisée en entrée, pour chaque \meta{nom} et @@ -665,8 +708,10 @@ Unicode a prévu le caractère \Ucode[symbole numéro]{2116}. { { doc name = gutenberg }, { doc name = gut }, - % { doc name = lettre }, - % { doc name = lettregut }, + { doc name = assogut }, + { doc name = Assogut }, + { doc name = lettres }, + { doc name = lettresgut }, { doc name = cahier }, { doc name = cahiers }, { doc name = cahiergut }, @@ -689,23 +734,25 @@ Unicode a prévu le caractère \Ucode[symbole numéro]{2116}. \centering \begin{tabular}{ll} \toprule - \refCom{gutenberg} & \gutenberg \\ - \refCom{gut} & \gut \\ - % \refCom{lettre} & \lettre \\ - % \refCom{lettregut} & \lettregut \\ - \refCom{cahier} & \cahier \\ - \refCom{cahiergut} & \cahiergut \\ - \refCom{cahiers} & \cahiers \\ - \refCom{cahiersgut} & \cahiersgut \\ \midrule - \refCom{letgut} & \letgut \\ - \refCom{letgutcls} & \letgutcls \\ \midrule - \refCom{knuth} & \knuth \\ - \refCom{lamport} & \lamport \\ - \refCom{tl} & \tl \\ - \refCom{tugboat} & \tugboat \\ \midrule - \refCom{linux} & \linux \\ - \refCom{macos} & \macos \\ - \refCom{windows} & \windows \\ \bottomrule + \refCom{gutenberg} & \gutenberg \\ + \refCom{gut} & \gut \\ + \refCom{assogut} & \assogut \\ + \refCom{Assogut} & \Assogut \\ + \refCom{lettres} & \lettres \\ + \refCom{lettresgut} & \lettresgut \\ + \refCom{cahier} & \cahier \\ + \refCom{cahiergut} & \cahiergut \\ + \refCom{cahiers} & \cahiers \\ + \refCom{cahiersgut} & \cahiersgut \\ \midrule + \refCom{letgut} & \letgut \\ + \refCom{letgutcls} & \letgutcls \\ \midrule + \refCom{knuth} & \knuth \\ + \refCom{lamport} & \lamport \\ + \refCom{tl} & \tl \\ + \refCom{tugboat} & \tugboat \\ \midrule + \refCom{linux} & \linux \\ + \refCom{macos} & \macos \\ + \refCom{windows} & \windows \\ \bottomrule \end{tabular} \caption{Effet des commandes de raccourcis} \label{tab:raccourcis} @@ -754,7 +801,8 @@ de \docAuxCommand{section}% \ExplSyntaxOff \begin{ltx-code-result}[title addon=emploi de la commande \refCom{lettrenumber},listing options app={deletekeywords={[6]{cours,lettre}}}] -Si le numéro de la \lettre{} en cours est 46, celui de la \lettre +Si le numéro de la \lettre{} en cours est 46, +celui de la \lettre : \begin{enumerate} \item en cours est \lettrenumber ; \item en cours est le \lettrenumber* ; @@ -777,7 +825,7 @@ Si le numéro de la \lettre{} en cours est 46, celui de la \lettre \enquote{\lettre} et \enquote{\lettregut}, le cas échéant suivies du numéro de la \lettre{} : \begin{description} - \item[en cours] si l'\meta{argument optionnel} est un point (⅛.⅛) ; + \item[en cours] si l'\meta{argument optionnel} est un point (™.™) ; \item[décalé de celui en cours] de ce qui est spécifié si l'\meta{argument optionnel} est un entier relatif signé\footref{entier-signe} ; \item[spécifié] si l'\meta{argument optionnel} est autre. @@ -801,8 +849,7 @@ Si le numéro de la \lettre{} en cours est 46, on a : \item \lettre*[43] \item \lettre* \end{enumerate} -On fait usage de ces commandes -dans la \lettregut*[.]. +On fait usage de ces commandes dans la \lettregut*[.]. \end{ltx-code-result} \subsection{Touches de clavier} @@ -810,7 +857,7 @@ dans la \lettregut*[.]. Afin de disposer d'un moyen simple, riche et élégant pour composer des touches de clavier, la \letgutcls{} s'appuie sur le \package*{biolinum} et notamment sa -commande ⅛\LKey⅛. Cette dernière a été légèrement étendue de façon à faciliter +commande ™\LKey™. Cette dernière a été légèrement étendue de façon à faciliter la saisie pour toutes les touches des diacritiques utilisés en français. \begin{ltx-code-result}[title addon=touches de clavier] @@ -899,7 +946,7 @@ environnements \enquote{verbatim} suivants. ces codes et résulats : \begin{itemize} \item l'un sous l'autre par défaut ; - \item l'un à gauche de l'autre si l'option ⅛sidebyside⅛ est + \item l'un à gauche de l'autre si l'option ™sidebyside™ est employée. \end{itemize} \end{enumerate} @@ -907,7 +954,7 @@ environnements \enquote{verbatim} suivants. \begin{dbwarning}{Exemples de codes avec résultats : possiblement flottants}{exemples-flottants} - Si l'option ⅛sidebyside⅛ est passée à l'un ou l'autre des + Si l'option ™sidebyside™ est passée à l'un ou l'autre des environnements \refEnv{ltx-code-result} et \refEnv{ltx-code-external-result}, l'exemple : \begin{itemize} @@ -932,7 +979,7 @@ Ces trois environnements admettent des \meta{options} : \begin{itemize} \item (toutes) celles acceptées par l'environnement \docAuxEnvironment{tcblisting} et la commande \docAuxCommand{newtcblisting} - fournis par la bibliothèque ⅛listings⅛ du + fournis par la bibliothèque ™listings™ du \package*{tcolorbox}\footnote{Et, aussi, les commandes \docAuxCommand{DeclareTCBListing} et assimilées fournies par la bibliothèque \lstinline+xparse+ de ce package.}. Elles permettent notamment de surcharger @@ -940,29 +987,29 @@ Ces trois environnements admettent des \meta{options} : \begin{itemize} \item de faire figurer l'éventuel résultat, non pas sous le code comme c'est le cas par défaut, mais en regard (à droite) au moyen de l'option - ⅛sidebyside⅛ ; + ™sidebyside™ ; \item de supprimer les numéros de ligne au moyen de l'option \begin{ltx-code} listing options={numbers=none} \end{ltx-code} \end{itemize} \item trois spécifiques à ces environnements : - \begin{docKey*}{title addon}{=\meta{supplément au titre}}{\valinitdef} - Cette option permet d'adjoindre un \meta{supplément au titre} de ces - exemples, qui sont par défaut et automatiquement \enquote{Exemple \meta{n}}. - \end{docKey*} - \begin{docKey*}{result width}{=\meta{longueur}}{\valinitdef[\docAuxCommand*{linewidth}]} + \begin{docKey}{title addon}{=\meta{supplément}}{\valinitdef} + Cette option permet d'adjoindre au titre de ces exemples, qui sont par + défaut et automatiquement \enquote{Exemple \meta{n}}, un \meta{supplément}. + \end{docKey} + \begin{docKey}{result width}{=\meta{longueur}}{\valinitdef[\docAuxCommand*{linewidth}]} Cette option, utile seulement pour l'environnement \refEnv{ltx-code-external-result}, permet de spécifier une largeur autre que celle initiale pour le fichier image du résultat, compilé indépendamment de la \lettre{}. - \end{docKey*} - \begin{docKey*}{reference text}{=\meta{texte}}{\valinitdef[Cf. exemple \meta{n} page \meta{q}.]} + \end{docKey} + \begin{docKey}{reference text}{=\meta{texte}}{\valinitdef[Cf. exemple \meta{n} page \meta{q}.]} Cette option n'a d'effet que : \begin{itemize} \item avec l'un ou l'autre des environnements \refEnv{ltx-code-result} et \refEnv{ltx-code-external-result} ; - \item lorsque l'option ⅛sidebyside⅛ leur est passée ; + \item lorsque l'option ™sidebyside™ leur est passée ; \item lorsque l'exemple s'avère se trouver sur une page autre que celle de son point d'insertion. \end{itemize} @@ -972,9 +1019,9 @@ listing options={numbers=none} s'affranchir de ce texte en recourant à \lstinline+reference text=\{\}+.}. \begin{dbwarning}{\refKey{reference text} avant \lstinline+sidebyside+}{} Pour qu'elle soit prise en compte, l'option \refKey{reference text} doit - être passée \emph{avant} l'option ⅛sidebyside⅛. + être passée \emph{avant} l'option ™sidebyside™. \end{dbwarning} - \end{docKey*} + \end{docKey} \end{itemize} \subsubsection{Coloration syntaxique} @@ -984,16 +1031,16 @@ Par défaut, en début de document et de chaque fichier importé au moyen de \refCom{inputarticle}, le langage supposé dans ces exemples de codes est \hologo{TeX}, chargé (seulement) avec ses \enquote{dialectes} : \begin{itemize} -\item ⅛primitive⅛, ⅛common⅛, ⅛plain⅛, ⅛LaTeX⅛, ⅛AlLaTeX⅛ fournis par le +\item ™primitive™, ™common™, ™plain™, ™LaTeX™, ™AlLaTeX™ fournis par le \package*{listings} ; -\item ⅛classes⅛ fourni par \letgutcls{} (répertoriant les classes disponibles +\item ™classes™ fourni par \letgutcls{} (répertoriant les classes disponibles sur le \ctan{}). \end{itemize} Une conséquence notable est la suivante : \begin{dbwarning}{Coloration syntaxique réduite par défaut}{} La coloration syntaxique dans les exemples de codes n'est par défaut active - que pour le langage \hologo{TeX} et ses dialectes ⅛primitive⅛, ⅛common⅛, - ⅛plain⅛, ⅛LaTeX⅛, ⅛AlLaTeX⅛ et ⅛classes⅛. + que pour le langage \hologo{TeX} et ses dialectes ™primitive™, ™common™, + ™plain™, ™LaTeX™, ™AlLaTeX™ et ™classes™. \end{dbwarning} Il est néanmoins possible de spécifier d'autres langages et dialectes au moyen @@ -1049,7 +1096,7 @@ fournit la commande à arguments \enquote{verbatim} suivante. Il est possible de surcharger les réglages par défaut de cette commande au moyen d'\meta{options} qui sont (toutes) celles acceptées par l'environnement \docAuxEnvironment{tcblisting} et la commande \docAuxCommand{newtcblisting} - fournis par la bibliothèque ⅛listings⅛ du \package*{tcolorbox}\footnote{Et, + fournis par la bibliothèque ™listings™ du \package*{tcolorbox}\footnote{Et, aussi, les commandes \docAuxCommand{DeclareTCBListing} et assimilées fournies par la bibliothèque \lstinline+xparse+ de ce package.}. \end{docCommand} @@ -1113,7 +1160,7 @@ rg -g 0,25s user 0,23s system 320% cpu 0,150 total \begin{dbwarning}{Caractère d'échappement des listings}{} \lstset{escapechar=}% - La \letgutcls{} définit ⅛£⅛ comme caractère d'échappement dans \LaTeX{} au + La \letgutcls{} définit ™£™ comme caractère d'échappement dans \LaTeX{} au sein d'un listing. \end{dbwarning} @@ -1127,37 +1174,38 @@ Au besoin, on pourra désactiver ce caractère actif au moyen de \docAuxCommand{lstinline} du \package*{listings} mais, pour simplifier la tâche, la \letgutcls{} définit comme équivalent court de \docAuxCommand{lstinline} le caractère unicode % - \lstDeleteShortInline⅛% - \texttt{⅛} % - \lstMakeShortInline⅛% - (U+215B)\footnote{Peu susceptible d'être utilisé dans du texte + \lstDeleteShortInline™% + \texttt{™} % + \lstMakeShortInline™% + (\Ucode{2122})\footnote{Peu susceptible d'être utilisé dans du texte ordinaire.}. \end{dbwarning} Autrement dit, la \letgutcls{} contient l'instruction\footnote{À peu de choses près.} : - \lstDeleteShortInline⅛ + \lstDeleteShortInline™ \begin{ltx-code} -\lstMakeShortInline£\texttt{⅛}£ +\lstMakeShortInline£\texttt{™}£ \end{ltx-code} Au besoin, on pourra désactiver ce caractère actif au moyen de : \begin{ltx-code} -\lstDeleteShortInline£\texttt{⅛}£ +\lstDeleteShortInline£\texttt{™}£ \end{ltx-code} -\begin{dbremark}{Obtention du caractère \texttt{⅛}}{} +\begin{dbremark}{Obtention du caractère \texttt{™}}{} Le caractère % -\texttt{⅛} % +\texttt{™} % s'obtient : \begin{itemize} -\item sous \linux{} : \LKeyShiftAltGrX{2}\footnote{Touche \LKey{2} du clavier principal.} ; +\item sous \linux{} : \LKeyShiftAltGrX{8}\footnote{Touche \LKey{8} du clavier + principal.} ; \item sous \macos{} : à l'aide du visualiseur de caractères\footnote{Et possiblement de raccourcis claviers personnels.} ; -\item sous \windows{} : \LKeyAltX{8}+\LKey{5}+\LKey{3}+\LKey{9}. +\item sous \windows{} : \LKeyAltX{0}+\LKey{1}+\LKey{5}+\LKey{3}. \end{itemize} \end{dbremark} - \lstMakeShortInline⅛% + \lstMakeShortInline™% \section{Nouveautés apparues sur le \ctan} \label{sec:rubr-cons-aux} @@ -1229,6 +1277,16 @@ Les fiches de lecture d'un livre sont créées au moyen de l'environnement \begin{docKey}{bibkey}{=\meta{clé}}{\valinitdef} Cette clé permet de spécifier la \meta{clé} identifiant l'entrée d'un \file*{.bib} contenant les données bibliographiques du document rapporté. + \begin{dbwarning}{Fichier de bibliographie}{} + Ces données bibliographiques doivent se trouver dans un fichier + \meta{bibliographie}\file{.bib}, structurées selon le format du + \package*{biblatex} et chargées en préambule (par exemple dans le + fichier local de configuration, cf. \vpageref{sec:fichier-local-de}) au + moyen de la commande : +\begin{ltx-code} +\addbibressource{£\meta{bibliographie}£.bib} +\end{ltx-code} + \end{dbwarning} \end{docKey} \item[fortement conseillée :] \begin{docKey}{frontcover}{=\meta{fichier}}{\valinitdef} @@ -1280,10 +1338,10 @@ commande dédiée \refCom{letgutacro}. être employé au moyen des commandes fournies par le \package*{acro}, par exemple : \begin{itemize} - \item ⅛\ac{⅛\meta{court}⅛}⅛\footnote{Acronyme automatiquement affiché sous sa + \item ™\ac{™\meta{court}™}™\footnote{Acronyme automatiquement affiché sous sa forme complète à sa 1\iere{} occurrence, sous sa forme courte à ses occurrences suivantes.} ; - \item ⅛\acs{⅛\meta{court}⅛}⅛\footnote{Acronyme affiché sous sa forme courte + \item ™\acs{™\meta{court}™}™\footnote{Acronyme affiché sous sa forme courte seulement.}. \end{itemize} Toutefois, pour simplifier l'usage de ces acronymes, la \letgutcls{} crée @@ -1301,8 +1359,8 @@ commande dédiée \refCom{letgutacro}. % qui agit comme : \begin{itemize} - \item ⅛\ac{⅛\meta{court}⅛}⅛ en version non étoilée ; - \item ⅛\acs{⅛\meta{court}⅛}⅛ en version étoilée. + \item ™\ac{™\meta{court}™}™ en version non étoilée ; + \item ™\acs{™\meta{court}™}™ en version étoilée. \end{itemize} \end{docCommand} Ainsi, l'acronyme utilisé via \docAuxCommand{\meta{court}} figure, pour ses @@ -1412,6 +1470,143 @@ insère un filet horizontal. Cette commande permet d'accentuer la séparation entre deux articles. \end{docCommand} +\section{Annonces} +\label{sec:annonces} + +Afin de présenter aisément et de façon homogène les annonces à paraître dans la +\lettre{}, la \letgutcls{} fournit l'environnement \refEnv{announcement}. + +\begin{docEnvironment}[doclang/environment content=annonce]{announcement}{\oarg{couleur}\marg{titre}} + Cet environnement est dédié aux \meta{annonce}s. La spécification : + \begin{itemize} + \item d'un \meta{titre} (pouvant toutefois être vide) est obligatoire ; + \item d'une \meta{couleur} (du tire et des ornements) autre que celle (noire) + par défaut est possible. + \end{itemize} +\end{docEnvironment} + +\begin{ltx-code-result}[title addon=annonces] +\begin{announcement}[red!35!black]{Convocation \acs{ag} ordinaire} + Les adhérents de l'\assogut{} sont invités à participer à + l'\textbf{assemblée générale \emph{ordinaire}} de l'association + le \textbf{dimanche 11 décembre 2022}. +\end{announcement} +\end{ltx-code-result} + +\section{Rébus} +\label{sec:rebus} + +\tcbstartrecording\relax +Afin de présenter aisément et de façon homogène les rébus à paraître dans la +\lettre{}, la \letgutcls{} fournit l'environnement \refEnv{rebus}. + +\begin{docEnvironment}[doclang/environment content=rébus]{rebus}{\oarg{options}} + Cet environnement affiche un \meta{rébus} et s'emploie différemment selon que + la solution est prévue de figurer dans la \lettre{} : + \begin{description} + \item[en cours :] le rébus et sa solution doivent alors être séparées par + la commande \refCom{solution} ; + \item[suivante :] l'option \refKey{no solution} doit alors être employée. + \end{description} + La boîte contenant le rébus mentionne que sa solution se trouve, + respectivement : + \begin{itemize} + \item \enquote{page \meta{n}} ou \enquote{ci-dessous} ; + \item \enquote{dans la prochaine \lettre{}}. + \end{itemize} + + La commande séparant le rébus et sa solution prévue de figurer dans la + \lettre{} en cours est : + \begin{docCommand}{solution}{} + Cette commande débute la solution d'un rébus à l'intérieur d'un environment + \refEnv{rebus}. + \end{docCommand} + + En outre, cet environnement admet des \meta{options} : + \begin{itemize} + \item (toutes) celles acceptées par les environnements \refAux{tcolorbox} et + assimilés du \package*{tcolorbox}, destinées à, le cas échéant, modifier la + mise en forme par défaut de la boîte contenant le rébus ; + \item deux qui lui sont propres : + \begin{docKey}{title addon}{=\meta{supplément}}{\valinitdef} + Cette option permet d'adjoindre au titre d'un rébus, qui est par défaut et + automatiquement \enquote{Rébus}, un \meta{supplément} alors en italique et + entre parenthèses. + \end{docKey} + \begin{docKey}{no solution}{}{\valinitdef[\docValue*{false}][\docValue*{true}]} + Cette option est à spécifier pour un rébus dont la solution ne doit figurer + que dans la prochaine \lettre{}. + \end{docKey} + \end{itemize} +\end{docEnvironment} + +Ainsi le code : + +\begin{ltx-code}[title addon=rébus] +\begin{rebus}[no solution] + Rébus \emph{sans} solution dans le présent numéro. +\end{rebus} +\begin{rebus} + Rébus \emph{avec} solution dans le présent numéro. + \solution + Solution du rébus. +\end{rebus} +\end{ltx-code} + +donne-t-il les résultats suivants\footnote{Éventuellement pas immédiatement à la + suite car les boîtes contenant les rébus sont flottantes.}. + +\begin{rebus}[no solution,nofloat] + Rébus \emph{sans} solution dans le présent numéro. +\end{rebus} +\begin{rebus}[nofloat] + Rébus \emph{avec} solution dans le présent numéro. + \solution + Solution du rébus. +\end{rebus} + +La \letgutcls{} fournit bien sûr le moyen d'afficher les solutions des rébus de +la \lettre{} +soit en cours, soit précédente. + +\begin{docCommand}{rebussolution}{\oarg{solution}\oarg{numéro}\oarg{options}} + Cette commande affiche la ou les solutions du ou des rébus qui figurent dans + la \lettre{} : + \begin{description} + \item[en cours :] (commande \refCom{solution}) si ses 1\ier{} et + 2\ieme{} arguments optionnels \meta{solution} et \meta{numéro} sont + inutilisés ; + \item[précédente :] si son 1\ier{} argument optionnel \meta{solution} est + utilisé. Selon que 2\ieme{} argument optionnel \meta{numéro} est spécifié ou + pas, il est indiqué que la \meta{solution} est celle d'un rébus figurant + dans la \lettre{} : + \begin{itemize} + \item \meta{numéro} ; + \item précédente. + \end{itemize} + \end{description} + Cette commande admet comme \meta{options} (toutes) celles acceptées par les + environnements \refAux{tcolorbox} et assimilés du \package*{tcolorbox}, + destinées à, le cas échéant, modifier la mise en forme par défaut de la boîte + contenant la solution du rébus. +\end{docCommand} + +Ainsi le code : + +\begin{ltx-code}[title addon=solution de rébus] +\rebussolution +\rebussolution[Solution du rébus] +\rebussolution[Solution du rébus][49] +\end{ltx-code} + +donne-t-il donne-t-il les résultats suivants\footnote{Éventuellement pas + immédiatement à la suite car les boîtes contenant les solutions des rébus sont + flottantes.}. + +\rebussolution +\rebussolution[Solution du rébus] +\rebussolution[Solution du rébus][49] + \section{Boîtes d'alertes} \label{sec:boites-dalertes} @@ -1607,7 +1802,7 @@ dressons ci-après la liste en les regroupant selon ces deux catégories. \item[babel] support multilingue. \begin{description} \item[Options :] \docAuxKey*{english}, \docAuxKey*{french} ; - \item[Configuration] ⅛\renewcommand*\frenchtablename{Tableau}⅛. + \item[Configuration] ™\renewcommand*\frenchtablename{Tableau}™. \end{description} \item[varioref] références de pages intelligentes. \begin{description} @@ -1647,11 +1842,11 @@ dressons ci-après la liste en les regroupant selon ces deux catégories. \item[Options :]\leavevmode{} \begin{itemize} \item \docAuxKey*{first-style=footnote} ; - \item \docAuxKey*{format/short=}⅛\scshape⅛ ; - \item \docAuxKey*{format/foreign=}⅛\em⅛ ; + \item \docAuxKey*{format/short=}™\scshape™ ; + \item \docAuxKey*{format/foreign=}™\em™ ; \item \docAuxKey*{foreign/display} ; \item \docAuxKey*{locale/display} ; - \item \docAuxKey*{locale/format=}⅛\upshape⅛. + \item \docAuxKey*{locale/format=}™\upshape™. \end{itemize} \end{description} \item[hyperref] prise en charge étendue de l'hypertexte. diff --git a/macros/luatex/latex/letgut/source/letgut.org b/macros/luatex/latex/letgut/source/letgut.org index dd76cbe8d7..fb91c08587 100644 --- a/macros/luatex/latex/letgut/source/letgut.org +++ b/macros/luatex/latex/letgut/source/letgut.org @@ -54,7 +54,7 @@ new versions of the class on CTAN. % This field contains the version of the package. % The value is optional. % The value is restricted to 32 characters. - \version{0.9.4 2022-10-03} + \version{0.9.6 2023-01-14} % ------------------------------------------------------------------------- % This field contains the name of the author(s). % The value is optional. @@ -131,15 +131,8 @@ new versions of the class on CTAN. % The value is optional. % The value is restricted to 8192 characters. \begin{announcement} - ## [0.9.4] - 2022-10-03 - - ### Added - - Command `\lettrenumber` that displays various Lettre numbers related to the one of the current issue. - - Options of `\lettre` and `\lettregut` that add various Lettre numbers related to the one of the current issue. - - Command `\Ucode` for points and names of Unicode characters. - - ### Changed - - Documentation completed and improved. + ### Fixed + Hot fix for the attachment of the Lettre's source files to its PDF. \end{announcement} % ------------------------------------------------------------------------- % This field contains the one-liner for the package. @@ -186,6 +179,7 @@ new versions of the class on CTAN. % The value is optional. % The value is restricted to 2048 characters. \begin{note} + I am sorry for new this (corrective) update, so close to the previous one! \end{note} % ------------------------------------------------------------------------- % This field contains the archive file. @@ -209,12 +203,41 @@ new versions of the class on CTAN. ## [Unreleased] + ## [0.9.6] - 2023-01-14 + + ### Fixed + Hot fix for the attachment to the Lettre's PDF of its source files. + + ## [0.9.5] - 2023-01-13 + + ### Added + - Files (`.tex` source, images files, bibliographic files, etc.) used to typeset + an article possibly attached to the Lettre's PDF. + - Starred version of `\inputarticle` that prevents the previous feature. + - Boolean option that (un)forces the previous feature. + - Plural forms `\lettres` and `\lettresgut` of `\lettre` and `\lettregut`. + - Shortcuts for “(a|A)ssociation GUTenberg”. + - Starred versions of `\person` and `\author` that sort the lists of + persons/authors in alphabetic order. + - Environment for announcements. + - Environments and commands for rebus and their solutions. + + ### Changed + - `⅛` replaced by `™` as a short equivalent of ~\lstinline~ (the former is + considered as math if ~unicode-math~ is loaded). + - Documentation updated. + + ### Fixed + Several bugs and sub-optimalities. + ## [0.9.4] - 2022-10-03 ### Added - - Command `\lettrenumber` that displays various Lettre numbers related to the one of the current issue. - - Options of `\lettre` and `\lettregut` that add various Lettre numbers related to the one of the current issue. - - Command `\Ucode` for points and names of Unicode characters. + - Command `\lettrenumber` that displays various Lettre numbers related to the + one of the current issue. + - Options of `\lettre` and `\lettregut` that add various Lettre numbers related + to the one of the current issue. + - Command `\Ucode` for points and names of Unicode characters. ### Changed - Documentation improved. @@ -222,7 +245,8 @@ new versions of the class on CTAN. ## [0.9.3] - 2022-09-02 ### Changed - - Local conf. file doesn't require anymore to start with \ExplSyntaxOff in some instances. + - Local conf. file doesn't require anymore to start with \ExplSyntaxOff in some + instances. - Documentation improved. ## [0.9.2] - 2022-06-18 @@ -280,7 +304,7 @@ to the newsletter “La Lettre GUTenberg” of GUTenberg, the French TeX User Gr Release ------- -2022-10-03 v0.9.4 +2023-01-14 v0.9.6 Development ----------- @@ -359,7 +383,7 @@ the corresponding `.tex` file (which doesn't derive from an Org Mode file). % | v1.3c or later % See:| http://www.latex-project.org/lppl.txt % -% Copyright (C) 1994-2022 by Association GUTenberg +% Copyright (C) 1994-2023 by Association GUTenberg % % % This work may be distributed and/or modified under the @@ -405,7 +429,11 @@ We define some constant token lists immediately useful. #+begin_src latex \ExplSyntaxOn \tl_const:Nn \c__letgut_Lettre_tl { \emph{ Lettre } } + \tl_const:Nn \c__letgut_Lettres_tl { + \c__letgut_Lettre_tl \emph{ s } + } \tl_const:Nn \c__letgut_gutenberg_tl { GUTenberg } + \tl_const:Nn \c__letgut_association_tl { association } \tl_const:Nn \c__letgut_Lettre_gutenberg_tl { \c__letgut_Lettre_tl~\c_space_tl \c__letgut_gutenberg_tl } @@ -422,8 +450,8 @@ Now, we can announce the class name and its version: #+begin_src latex \ProvidesExplClass{letgut} - {2022-10-03} - {0.9.4} + {2023-01-14} + {0.9.6} { Class for the newsletter “The GUTenberg Letter” } @@ -528,6 +556,18 @@ Some messages are declared for future use. #+begin_src latex \bool_new:N \g__letgut_draft_bool #+end_src +- For the included files to (not) be attached. + #+begin_src latex + \bool_new:N \g__letgut_included_files_attached_bool + #+end_src +- For the acronym definitions file to (not) be attached. + #+begin_src latex + \bool_new:N \g__letgut_acronyms_file_attached_bool + #+end_src +- For the listings language file to (not) be attached. + #+begin_src latex + \bool_new:N \g__letgut_lstlanguage_file_attached_bool + #+end_src *** Dimensions :PROPERTIES: @@ -714,7 +754,6 @@ We close the ~\AddToHook{begindocument/before}~ argument. } #+end_src - *** Integers :PROPERTIES: :CUSTOM_ID: ImplementationDeclarationsIntegers-7pag55h0jlj0 @@ -830,13 +869,14 @@ We close the ~\AddToHook{begindocument/before}~ argument. :END: #+begin_src latex - \tl_new:N \g__letgut_mark_tl - \tl_new:N \g__letgut_title_tl - \tl_new:N \l_letgut_last_name_tl - \tl_new:N \l_letgut_first_name_tl - \tl_new:N \l_letgut_title_tl - \tl_new:N \l__letgut_title_addon_tl - \tl_new:N \l__letgut_reference_text_tl + \tl_new:N \g__letgut_mark_tl + \tl_new:N \g__letgut_title_tl + \tl_new:N \l_letgut_last_name_tl + \tl_new:N \l_letgut_first_name_tl + \tl_new:N \l_letgut_title_tl + \tl_new:N \l__letgut_title_addon_tl + \tl_new:N \l__letgut_reference_text_tl + \tl_new:N \g__letgut_effective_acronyms_file_tl #+end_src *** Comma separated lists @@ -859,6 +899,8 @@ We close the ~\AddToHook{begindocument/before}~ argument. #+begin_src latex \seq_new:N \l__letgut_first_last_names_items_seq + \seq_new:N \g__letgut_included_files_seq + \seq_new:N \g__letgut_added_bib_resources_seq #+end_src ** Class options @@ -1053,10 +1095,18 @@ We now load some packages. #+begin_src latex \RequirePackage{titlesec} #+end_src +- Driver-independent color extensions. + #+begin_src latex + \RequirePackage[table]{xcolor} + #+end_src - Several logos and ornaments. #+begin_src latex \RequirePackage{fourier-orns} #+end_src +- Drawing of Vectorian ornaments. + #+begin_src latex +\RequirePackage{pgfornament} + #+end_src - Control float placement. #+begin_src latex \RequirePackage[section,above]{placeins} @@ -1088,18 +1138,23 @@ We now load some packages. #+begin_src latex \RequirePackage{siunitx} #+end_src -- A collection of logos with bookmark support. - #+begin_src latex - \RequirePackage{hologo} - #+end_src -- Driver-independent color extensions. +- Additional TeX-family logos (which loads and extends \package{hologo} which is + collection of logos with bookmark support). #+begin_src latex - \RequirePackage[table]{xcolor} + \RequirePackage{bxtexlogo} #+end_src - Coloured boxes, for LaTeX examples and theorems, etc. #+begin_src latex \RequirePackage{tcolorbox} #+end_src +- Compile \TeX{} code stand-alone or as part of a document. + #+begin_src latex + \RequirePackage[group=false,subpreambles,sort]{standalone} + #+end_src +- Attach arbitrary files to a PDF document. + #+begin_src latex + \RequirePackage[icon=Paperclip]{attachfile2} + #+end_src - Expandable macros to extract the data from references and allow counter assignments or calculations. #+begin_src latex @@ -1146,6 +1201,10 @@ We now load some packages. #+begin_src latex \RequirePackage{acro} #+end_src +- Allow URL breaks at any alphanumerical character. + #+begin_src latex +\RequirePackage{xurl} + #+end_src The following packages have to be the last ones loaded. So we ensure this by loading them just before the begining of the document: @@ -1226,6 +1285,9 @@ We close the ~\AddToHook{begindocument/before}~ argument. \RenewDocumentCommand {\printbibliography} { O{} } { \phantomsection \__letgut_old_printbibliography[#1] + \bool_if:NT \g__letgut_included_files_attached_bool { + \seq_map_inline:Nn \g__letgut_added_bib_resources_seq {\seq_gput_right:Nn \g__letgut_included_files_seq {#1}} + } } #+end_src For printing the bibliography, we define two new bibheadings for the @@ -1236,37 +1298,45 @@ We close the ~\AddToHook{begindocument/before}~ argument. \defbibheading{subtitle}[\refname]{% \subtitle{#1}} #+end_src -- The acronyms will be typset in footnote, with small caps shape. When they are +- The acronyms will be typset in its short form, with small caps shape. When they are (English) foreign, it will be specified and the translation will be added. #+begin_src latex \acsetup{ - first-style=footnote, + first-style=short, format/short = {\scshape}, format/foreign = {\em}, foreign/display, locale/format = {\upshape}, locale/display, + make-links = true, + link-only-first = true } #+end_src - Moreover, we redefine the private macro ~\acro_footnote:n~ of the - \package*{acro} in order to make the footnotes displaying the long forms of the - acronyms ended by a period (like ordinary footnotes). + + We currently have to work around an ~acro~ bug (see \url{https://tex.stackexchange.com/q/661966/18401}). + #+begin_src latex - \cs_undefine:N \acro_footnote:n - \cs_new_protected:Npn \acro_footnote:n #1 - { - \tl_set:Ne \l__acro_tmpa_tl { - \l__acro_fnpct_check_tl - } - \exp_last_unbraced:Nno - \footnote {#1.} - \l__acro_tmpa_tl - } + \AddToHook{cmd/printacronyms/before}{\bool_set_false:N\l__acro_link_only_first_bool} + #+end_src + + In case the long form of an acronym is explicited in footnote, we want this + footnot to be ended with a period. + #+begin_src latex + \ProvideDocumentCommand \acroendfootnote {} {.} #+end_src The following settings for packages that have to be the last ones loaded are also done just before the begining of the document. +- (Temporary?) workaround that moves `standalone` code in hook `begindocument` + to `begindocument/before` in order to get rid of the issue + \url{https://tex.stackexchange.com/q/670638/18401}. + +#+begin_src latex + \RemoveFromHook{begindocument}[standalone] + \ExpandArgs{nv}\AddToHook{begindocument/before}{l__hook_return_tl} +#+end_src + #+begin_src latex \AddToHook{begindocument/before}{ #+end_src @@ -1287,16 +1357,17 @@ We close the ~\AddToHook{begindocument/before}~ argument. secondly in the parent directory, thirdly in the TDS). #+begin_src latex \file_if_exist:nTF {./\c__letgut_acronyms_file_tl}{ - \file_input:n {./\c__letgut_acronyms_file_tl} + \tl_gset:Nn \g__letgut_effective_acronyms_file_tl {./\c__letgut_acronyms_file_tl} }{ \file_if_exist:nTF {../\c__letgut_acronyms_file_tl}{ - \file_input:n {../\c__letgut_acronyms_file_tl} + \tl_gset:Nn \g__letgut_effective_acronyms_file_tl {../\c__letgut_acronyms_file_tl} }{ \file_if_exist:nT {\c__letgut_acronyms_file_tl}{ - \file_input:n {\c__letgut_acronyms_file_tl} + \tl_gset:Nn \g__letgut_effective_acronyms_file_tl {\c__letgut_acronyms_file_tl} } } } + \input {\g__letgut_effective_acronyms_file_tl} #+end_src - Depending on some chosen class options, some packages have to be loaded, @@ -1425,9 +1496,8 @@ We now define the options of the class: #+begin_src latex \keys_define:nn { letgut } { - , for-readers .bool_gset:N = \g__letgut_for_readers_bool + , for-readers .bool_gset:N = \g__letgut_for_readers_bool , for-readers .initial:n = { true } - , for-readers .default:n = { true } , for-authors .bool_gset_inverse:N = \g__letgut_for_readers_bool , draft .bool_gset:N = \g__letgut_draft_bool , draft .initial:n = { true } @@ -1439,7 +1509,9 @@ We now define the options of the class: \clist_set_eq:NN \g__letgut_pagecolor_clist \c__letgut_default_pagecolor_paper_clist } - , screen .bool_gset_inverse:N = \g__letgut_paper_bool + , screen .code:n = { + \bool_gset_false:N \g__letgut_paper_bool + } , number .int_gset:N = \g__letgut_number_int , date .code:n = { \__letgut_date_parse:n { #1 } } , date .initial:x = {\the\year-\the\month} @@ -1472,8 +1544,26 @@ We now define the options of the class: , informations .initial:n = { true } , detailedtoc .bool_gset:N = \g__letgut_detailedtoc_bool , detailedtoc .initial:n = { false } + , reverse-files-attachement .code:n = { + \AddToHook{begindocument/before}{ + \bool_lazy_and:nnTF {\g__letgut_for_readers_bool} {!\g__letgut_paper_bool} + { + \bool_gset_false:N \g__letgut_included_files_attached_bool + }{ + \bool_gset_true:N \g__letgut_included_files_attached_bool + } + } + } } \ProcessKeysOptions { letgut } + \AddToHook{begindocument/before}{ + \bool_lazy_and:nnTF {\g__letgut_for_readers_bool} {!\g__letgut_paper_bool} + { + \bool_gset_true:N \g__letgut_included_files_attached_bool + }{ + \bool_gset_false:N \g__letgut_included_files_attached_bool + } + } #+end_src #+begin_src latex @@ -1583,7 +1673,6 @@ We now define the headers. We create a box to display alerts. #+begin_src latex - \tcbuselibrary{xparse} \DeclareTCBox{\alertbox}{}{ nobeforeafter, colback=red!5!white, @@ -1647,6 +1736,137 @@ We now define the headers. } #+end_src +** Announcements +:PROPERTIES: +:CUSTOM_ID: ImplementationAnnounces-nahckb909pj0 +:END: +#+begin_src latex +\DeclareTColorBox{announcement}{ O{black} m } +{ + colframe=#1, + coltitle=#1, + borderline~ west={1cm}{0pt}{#1}, + IfBlankF={#2}{ + title=\hypersetup{hidelinks}#2, + phantom={\phantomsection\addcontentsline{toc}{title}{#2}}, + }, + enhanced, + sharp~ corners, + boxrule=0mm, + leftrule=1cm, + bottomrule=1cm, + toptitle=20pt, + bottomtitle=20pt, + center~ title, + fonttitle=\scshape\bfseries\huge, + fontupper=\Large, + fontlower=\Large, + skin=empty, + segmentation~ style=solid, + halign=center, + overlay~ unbroken~ and~ first ={ + \node[color=#1]~ at~ ([yshift=8pt]title.south) + {\pgfornament[width=0.4\linewidth]{88}}; + \node[color=white,anchor=north~ west]~ at~ (frame.north~ west) {\huge\bfseries\aldineright{}}; + }, +} +#+end_src + +** Rebus + :PROPERTIES: + :CUSTOM_ID: ImplementationRebus-osw8m3f0cpj0 + :END: + +#+begin_src latex + \NewDocumentCommand{\solution}{}{\tcblower} + \NewDocumentCommand{\displaysolutions}{}{% + \tcbstoprecording\tcbinputrecords% + } + \tcbset{% + rebus~ style/.style={% + enhanced, + boxrule=0pt, + frame~hidden, + fonttitle=\normalfont\large\bfseries, + before~ title={\lefthand\c_space_tl}, + halign=center, + title~ addon/.store~ in=\l__letgut_title_addon_tl, + after~ title={ + \tl_if_empty:NF {\l__letgut_title_addon_tl}{ + \c_space_tl(\emph{\l__letgut_title_addon_tl}) + } + }, + float = bh, + colback = __letgut_background_terminal_stdout, + colbacktitle = __letgut_background_terminal_stdin, + coltitle = black + } + } + \tcbset{ + no~ solution/.style={ + no~ recording, + after~ upper=dans~ la~ prochaine~ \lettre{}, + after~ upper~ pre={ + \par\bigskip\hfill\scriptsize\itshape + Solution\c_space_tl + }, + } + } + \NewTColorBox[auto~ counter]{rebus}{+!O{}}{% + rebus~ style, + fonttitle=\bfseries, + title={Rébus}, + label={rebus@\thetcbcounter}, + after~ upper={\vpageref[ci-dessous]{solution@\thetcbcounter}}, + after~ upper~ pre={ + \par\bigskip\hfill\scriptsize\itshape + Solution\c_space_tl + }, + lowerbox=ignored, + savelowerto=rebus-\thetcbcounter.tex, + record={\string\rebussolution*[\thetcbcounter][][]}, + #1 + } + \NewDocumentCommand{\rebussolution}{s +o o O{}}{% + \IfValueTF{#2}{ + \begin{tcolorbox}[ + rebus~ style, + halign=justify, + before~ title={\lefthand{}~Solution~ du~ rébus\c_space_tl}, + title={ + \IfBooleanTF{#1}{ + \vpageref[ci-dessus]{rebus@#2} + }{ + de~la~\lettre{}\c_space_tl + \IfValueTF{#3}{ + #3 + }{ + précédente + } + } + }, + phantomlabel={ + \IfBooleanT{#1}{ + solution@#2 + } + }, + #4 + ] + \IfBooleanTF{#1}{ + \file_if_exist_input:n {rebus-#2.tex} + }{ + #2 + } + \end{tcolorbox} + }{ + \IfValueF{#3}{ + \tcbstoprecording + \tcbinputrecords + } + } + } +#+end_src + ** “Title” and marks :PROPERTIES: :CUSTOM_ID: ImplementationTitleandmarks-5ylg55h0jlj0 @@ -1728,7 +1948,7 @@ Lettre. { \begin{picture}(0,0) \put(-2cm,-25.275cm){ - \includegraphics[scale=0.96]{ + \includegraphics*[scale=0.96]{ \c__letgut_banner_file_tl.pdf } } @@ -1904,15 +2124,13 @@ Here starts what is automatically added at the beginning of the document. #+begin_src latex \bool_if:NTF \g__letgut_editorial_bool { \file_if_exist:nTF {./\c__letgut_editorial_file_tl}{ - \RenewDocumentCommand\author{ m } { - \__letgut_author:n { #1 } + \RenewDocumentCommand\author{ s m } { + \__letgut_author:nn { #1 } {#2} } \pdfbookmark[1]{Éditorial}{ \c__letgut_editorial_file_tl } - \__letgut_input_article:n {./\c__letgut_editorial_file_tl} - % % \int_set:N \l_tmpa_int {\pagenumber} - % % \int_compare:nNnT \l_tmpa_int = 1 { \newpage } + \inputarticle{./\c__letgut_editorial_file_tl} #+end_src # < (Just not to disturb the parentheses balancing @@ -1969,12 +2187,15 @@ Membership reminder. :CUSTOM_ID: ImplementationLastpagehandling-jbng55h0jlj0 :END: -The last page is special: it should automatically contain some informations about -\gutenberg. +The last pages are special: they should automatically contain +# the list of the acronyms used in the \lettre, and +some informations about \gutenberg. #+begin_src latex \AddToHook{enddocument} { + % \clearpage + % \printacronyms[heading=title,display=used] #+end_src Conditionally to the fact the ~informations~ option is not set to ~false~: if the \file*{informations-gut.tex} which contains the informations about @@ -1985,17 +2206,17 @@ directory, thirdly in the TDS). Otherwise, a warning is displayed. \clearpage \phantomsection \file_if_exist:nTF {./\c__letgut_informations_gutenberg_file_tl}{ - \__letgut_input_article:n { + \inputarticle*{ ./\c__letgut_informations_gutenberg_file_tl } }{ \file_if_exist:nTF {../\c__letgut_informations_gutenberg_file_tl}{ - \__letgut_input_article:n { + \inputarticle*{ ../\c__letgut_informations_gutenberg_file_tl } }{ \file_if_exist:nTF {\c__letgut_informations_gutenberg_file_tl}{ - \__letgut_input_article:n { + \inputarticle*{ \c__letgut_informations_gutenberg_file_tl } }{ @@ -2041,8 +2262,32 @@ the author(s) of the “Lettre”. :CUSTOM_ID: ImplementationSectionssubsectionsetcFormat-tapg55h0jlj0 :END: +When used in titles, ~\hologo~ needs to be protected. In order to not bother the +user with this peticularity, we make this the default for it. + + #+begin_src latex + % \AddToHook{cmd/hologo/before}{\protect} + \NewCommandCopy{\__letgut_old_hologo}{\hologo} + \RenewDocumentCommand {\hologo} { m }{ + \protect\__letgut_old_hologo { #1 } + } + #+end_src + +We want the \package{hologo}'s ~\hologo~ command to have its mandatory argument +not uppercased in the context of ~\text_uppercase:n~ (as in titles, cf. just +below). + + #+begin_src latex + \tl_put_right:Nn \l_text_case_exclude_arg_tl { \hologo } + % \tl_put_right:Nn \l_text_case_exclude_arg_tl { \ac } + % \tl_put_right:Nn \l_text_case_exclude_arg_tl { \acs } + % \tl_put_right:Nn \l_text_case_exclude_arg_tl { \acl } + % \tl_put_right:Nn \l_text_case_exclude_arg_tl { \acf } + #+end_src + - We create the new level ~\title~ for the titles of the articles. They are displayed uppercased. + #+begin_src latex \AddToHook{begindocument/before}{% \titleclass{\title}{straight}[\part] @@ -2050,10 +2295,9 @@ the author(s) of the “Lettre”. \normalfont \LARGE \bfseries - \text_uppercase:n }{}{1em}{ - \aldineleft\c_space_tl - }{} + \aldineleft\c_space_tl\text_uppercase:n + } \etocsetlevel{title}{0} \def\toclevel@title{0}% \etocsetstyle {title} @@ -2239,14 +2483,14 @@ We define the command that lets us specify the newsletter setup. #+begin_src latex \NewDocumentCommand {\francophony} { } { \raisebox{-1.5pt}{ - \includegraphics[width=\f@size pt]{ + \includegraphics*[width=\f@size pt]{ letgut-francophony-icon } } } #+end_src -*** Persons and authors +*** Persons, authors and list of participants :PROPERTIES: :CUSTOM_ID: ImplementationDocumentcommandsPersonsandauthors-h5sg55h0jlj0 :END: @@ -2259,19 +2503,19 @@ For both persons and authors, the argument of: a single one, separated by a semicolon. #+begin_src latex - \NewDocumentCommand {\person} { m } { - \__letgut_process_list:n {#1} + \NewDocumentCommand {\person} { s m } { + \__letgut_process_list:nn {#1} {#2} } - \cs_new_protected:Npn \__letgut_author:n #1 + \cs_new_protected:Npn \__letgut_author:nn #1 #2 { \nopagebreak \begin{flushright} - \__letgut_process_list:n {#1} + \__letgut_process_list:nn {#1} {#2} \end{flushright} } \AddToHook{begindocument/end}{% - \RenewDocumentCommand\author{ m } { - \__letgut_author:n { #1 } + \RenewDocumentCommand\author{ s m } { + \__letgut_author:nn { #1 } { #2 } } } #+end_src @@ -2320,10 +2564,18 @@ For both persons and authors, the argument of: (#3) } \seq_new:N \l__letgut_items_seq - \cs_new_protected:Npn \__letgut_process_list:n #1 + \cs_new_protected:Npn \__letgut_process_list:nn #1 #2 { \seq_clear:N \l__letgut_items_seq - \seq_set_split:Nnn \l_tmpa_seq {~and~} {#1} + \seq_set_split:Nnn \l_tmpa_seq {~and~} {#2} + \IfBooleanT{#1}{ + \seq_sort:Nn \l_tmpa_seq + { + \str_compare:nNnTF { ##1 } > { ##2 } + { \sort_return_swapped: } + { \sort_return_same: } + } + } \seq_map_inline:Nn \l_tmpa_seq { \seq_set_from_clist:Nn \l_tmpb_seq {##1} \seq_pop_left:NN \l_tmpb_seq \l_letgut_last_name_tl @@ -2354,6 +2606,39 @@ For both persons and authors, the argument of: } #+end_src +The list of contributors (possibly the masthead) will be the list of the persons +who contributed to the current issue of the \lettre{}, with both a pre- and +a post-text, the whole in a centered boxed minipage. + + #+begin_src latex + \tl_const:Nn \c__letgut_preamble_list_of_contributors_tl { + De~ près,~ de~ loin,~ par~ leurs~ avis~ éclairés,~ par~ leurs~ remarques~ + pertinentes~ ou~ par~ leurs~ articles,~ ont~ contribué~ à~ cette~ + \lettre{}~ :~ % + } + \tl_const:Nn \c__letgut_postamble_list_of_contributors_tl { + \c_space_tl (et~ nous~ espérons~ n'avoir~ oublié~ personne). + } + \cs_new_protected:Nn \__letgut_list_of_contributors:nnn + { + \par + \fbox{ + \begin{minipage}[t]{\linewidth-2\fboxsep-2\fboxrule} + #1 + \person*{#3} + #2 + \end{minipage} + } + } + \NewDocumentCommand {\listofcontributors} { + O{\c__letgut_preamble_list_of_contributors_tl} + O{\c__letgut_postamble_list_of_contributors_tl} + m + } { + \__letgut_list_of_contributors:nnn {#1} {#2} {#3} + } + #+end_src + *** Horizontal rule :PROPERTIES: :CUSTOM_ID: ImplementationDocumentcommandsHorizontalrule-8vsg55h0jlj0 @@ -2429,11 +2714,19 @@ https://github.com/latex3/hyperref/issues/188#issuecomment-826302843. } \cs_new_protected:Nn \__letgut_software:nn { + #+end_src + +We split the software's name at spaces in order to apply the dedicated +font switch (~\ttfamily~) to all of it except to the spaces. + + #+begin_src latex + \seq_set_split:Nnn \l_tmpa_seq { ~ } { #2 } + \seq_set_map:NNn \l_tmpb_seq \l_tmpa_seq {{\l__letgut_softwares_font_switch_tl ##1}} \tl_if_empty:nTF {#1} { - {\l__letgut_softwares_font_switch_tl #2} + \seq_use:Nn \l_tmpb_seq { ~ } }{ - \href{#1}{{\l__letgut_softwares_font_switch_tl #2}} + \href{#1}{ \seq_use:Nn \l_tmpb_seq { ~ } } } } \cs_new_protected:Nn \__letgut_file:n @@ -2480,63 +2773,69 @@ frequently used. The more the users will resort to these commands, the less will be inconsistently typesetted these names and expressions. #+begin_src latex - \NewExpandableDocumentCommand { \gutenberg } { } { - \c__letgut_gutenberg_tl - } - \NewExpandableDocumentCommand { \gut } { } { - \c__letgut_gutenberg_tl - } - % \NewExpandableDocumentCommand { \lettre } { } { - % \c__letgut_Lettre_tl - % } - % \NewExpandableDocumentCommand { \lettregut } { } { - % \lettre \c_space_tl \gutenberg - % } - \NewExpandableDocumentCommand { \Cahier } { } { - \c__letgut_cahier_tl - } - \NewExpandableDocumentCommand { \Cahiers } { } { - \c__letgut_cahiers_tl - } - \NewExpandableDocumentCommand { \cahier } { } { - \c__letgut_cahier_tl - } - \NewExpandableDocumentCommand { \cahiers } { } { - \c__letgut_cahiers_tl - } - \NewExpandableDocumentCommand { \cahiergut } { } { - \cahier \c_space_tl \gutenberg - } - \NewExpandableDocumentCommand { \cahiersgut } { } { - \cahiers \c_space_tl \gutenberg - } - \NewExpandableDocumentCommand { \letgut } { } { - \class{letgut} - } - \NewExpandableDocumentCommand { \letgutcls } { } { - \class*{letgut} - } - \NewExpandableDocumentCommand { \tugboat } { } { - \c__letgut_tugboat_tl - } - \NewExpandableDocumentCommand { \knuth } { } { - \person{Knuth,~ Donald~ E.} - } - \NewExpandableDocumentCommand { \lamport } { } { - \person{Lamport,~ Leslie} - } - \NewExpandableDocumentCommand { \tl } { } { - \c__letgut_tex_live_tl - } - \NewExpandableDocumentCommand { \linux } { } { - \c__letgut_gnu_linux_tl - } - \NewExpandableDocumentCommand { \macos } { } { - \c__letgut_macOS_tl - } - \NewExpandableDocumentCommand { \windows } { } { - \c__letgut_windows_tl - } + \NewExpandableDocumentCommand { \gutenberg } { } { + \c__letgut_gutenberg_tl + } + \NewExpandableDocumentCommand { \gut } { } { + \c__letgut_gutenberg_tl + } + \NewExpandableDocumentCommand { \assogut } { } { + \c__letgut_association_tl \c_space_tl \c__letgut_gutenberg_tl + } + \NewExpandableDocumentCommand { \Assogut } { } { + \text_titlecase_first:n {\assogut} + } + \NewExpandableDocumentCommand { \lettres } { } { + \c__letgut_Lettres_tl + } + \NewExpandableDocumentCommand { \lettresgut } { } { + \c__letgut_Lettres_tl \c_space_tl \c__letgut_gutenberg_tl + } + \NewExpandableDocumentCommand { \Cahier } { } { + \c__letgut_cahier_tl + } + \NewExpandableDocumentCommand { \Cahiers } { } { + \c__letgut_cahiers_tl + } + \NewExpandableDocumentCommand { \cahier } { } { + \c__letgut_cahier_tl + } + \NewExpandableDocumentCommand { \cahiers } { } { + \c__letgut_cahiers_tl + } + \NewExpandableDocumentCommand { \cahiergut } { } { + \cahier \c_space_tl \gutenberg + } + \NewExpandableDocumentCommand { \cahiersgut } { } { + \cahiers \c_space_tl \gutenberg + } + \NewExpandableDocumentCommand { \letgut } { } { + \class{letgut} + } + \NewExpandableDocumentCommand { \letgutcls } { } { + \class*{letgut} + } + \NewExpandableDocumentCommand { \tugboat } { } { + \c__letgut_tugboat_tl + } + \NewExpandableDocumentCommand { \knuth } { } { + \person{Knuth,~ Donald~ E.} + } + \NewExpandableDocumentCommand { \lamport } { } { + \person{Lamport,~ Leslie} + } + \NewExpandableDocumentCommand { \tl } { } { + \c__letgut_tex_live_tl + } + \NewExpandableDocumentCommand { \linux } { } { + \c__letgut_gnu_linux_tl + } + \NewExpandableDocumentCommand { \macos } { } { + \c__letgut_macOS_tl + } + \NewExpandableDocumentCommand { \windows } { } { + \c__letgut_windows_tl + } #+end_src We define the command ~\lettrenumber~ that displays the number of @@ -2600,7 +2899,7 @@ resp. “\lettre” and “\lettregut”: \tl_if_empty:nF {#1} { #3 - \c_space_tl + \nobreakspace \__letgut_get_lettre_number:n {#1} } } @@ -3063,6 +3362,9 @@ extensions of the ~graphicx~ package. \par }{ \exp_args:NV \author{\g__letgut_bookreview_reviewer_tl} + \bool_if:NT \g__letgut_included_files_attached_bool { + \seq_map_inline:Nn \g__letgut_added_bib_resources_seq {\seq_gput_right:Nn \g__letgut_included_files_seq {##1}} + } } #+end_src @@ -3126,7 +3428,7 @@ for usual characters on French keyboards. - We specify the possible hyphenations of \enquote{\gutenberg}. #+begin_src latex - \hyphenation{GUT-enberg} + \hyphenation{GUTen-berg} #+end_src *** ISSN @@ -3192,70 +3494,11 @@ watermarks. } #+end_src -** Listings +*** Input of articles :PROPERTIES: -:CUSTOM_ID: ImplementationListings-514h55h0jlj0 +:CUSTOM_ID: ImplementationMiscellanousInputofarticles-aqok3ja00pj0 :END: -We define a style for all the listings which resets all the \TeX{} control -sequences and keywords, and fix some defaults. - -#+begin_src latex - \lstdefinestyle{__letgut_reset_listings_styles}{ - basicstyle=\ttfamily, - breaklines, - language=TeX,% - texcs={},% - language={},% - keywords={},% - keywords=[2]{},% - keywords=[3]{},% - keywords=[4]{},% - keywords=[5]{},% - otherkeywords={},% - alsoletter={},% - alsodigit={},% - escapechar=£, - columns=fullflexible, - keepspaces=true, - upquote=true, - showstringspaces=false, -#+end_src - -If line numbers are asked, they should always have the same layout and not be -selectable (hence the ~\__letgut_unselectable:n~). - -#+begin_src latex - numbersep=\c__letgut_number_sep_dim, - numberstyle=\scriptsize\ttfamily - \color{__letgut_foregroundLinenumber} - \__letgut_unselectable:n, - #+end_src - -Because of a current issue involving \package{parskip} and \package{listings} -(\url{https://github.com/FrankMittelbach/fmitex-parskip/issues/3}), we have to -set the skip below the displayed listings to a (almost) zero length. We do the -same for the above skip. - -#+begin_src latex - aboveskip={0\p@ \@plus 6\p@}, - belowskip={0\p@ \@plus 6\p@}, - } -#+end_src - -We define as short equivalent of ~\lstinline~ the character -\lstDeleteShortInline⅛\texttt{⅛} which is unlikely to be used in ordinary text. - -#+begin_src latex -\lstMakeShortInline[breaklines=false]⅛ -#+end_src - -We start with an empty listings style. - -#+begin_src latex - \lstset{ style=__letgut_reset_listings_styles } - #+end_src - We create our own ~\input~ command for the articles of the Lettre with the following characteristics: @@ -3264,52 +3507,299 @@ following characteristics: sequences and keywords specific to some class or packages) won't interfere with the ones of the current file. - All the acronyms are reset (each acronym is developped at its first occurrence). +- The source file of the article is attached to the \pdf{} (if desired, + otherwise, use the starred version). #+begin_src latex - \cs_new_protected:Npn \__letgut_input_article:n #1 + \cs_new_protected:Npn \__letgut_input_article:nn #1 #2 { \lstset{ style=__letgut_reset_listings_styles } \acresetall% - \file_input:n{#1}% + \input{#2}% + \bool_if:NT \g__letgut_included_files_attached_bool { + \IfBooleanF {#1}{ + \seq_gput_left:Nn \g__letgut_included_files_seq { + \attachfile[ + description={Source~ du~ présent~ article~ (fichier~ `#2.tex`)}, + mimetype=application/x-tex]% + {#2.tex}% + } + \bool_if:NT \g__letgut_acronyms_file_attached_bool { + \seq_gput_right:No \g__letgut_included_files_seq { + \c__letgut_acronyms_file_attached_tl + } + } + \bool_if:NT \g__letgut_lstlanguage_file_attached_bool { + \seq_gput_right:No \g__letgut_included_files_seq { + \c__letgut_lstlanguage_file_attached_tl + } + } + \seq_remove_duplicates:N \g__letgut_included_files_seq + \marginpar{\seq_use:Nn \g__letgut_included_files_seq { } } + \seq_clear:N \g__letgut_included_files_seq + \bool_gset_false:N \g__letgut_acronyms_file_attached_bool + \bool_gset_false:N \g__letgut_lstlanguage_file_attached_bool + } + } } - \NewDocumentCommand{\inputarticle}{m}{ - \__letgut_input_article:n { #1 } + \NewDocumentCommand{\inputarticle}{ s m }{ + \__letgut_input_article:nn { #1 } { #2 } } #+end_src -*** LaTeX listings and examples +*** Included graphics attached to the \pdf :PROPERTIES: -:CUSTOM_ID: ImplementationListingsLaTeXlistingsandexamples-xt4h55h0jlj0 +:CUSTOM_ID: ImplementationMiscellanousIncludedgraphicsattachedtothe\pdf-xoc34ja00pj0 :END: -We define the colors for the syntax highlighting of LaTeX listings. - -#+begin_src latex - \colorlet{__letgut_texcs}{blue} - \colorlet{__letgut_comment}{gray} - \colorlet{__letgut_argument_specification_separator}{red} - \colorlet{__letgut_argument_specification}{cyan} - \colorlet{__letgut_mandatory_argument}{purple} - \colorlet{__letgut_environment}{teal} - \colorlet{__letgut_key}{__letgut_mandatory_argument} - \colorlet{__letgut_value}{violet} - \colorlet{__letgut_optional_argument}{__letgut_key} - \colorlet{__letgut_math}{green!50!black} -#+end_src - -We add our own language files taken in account by the \package*{listings}. They -will be considered after the other usual ones, if found. They are searched firstly -in the current directory, secondly in the parent directory, thirdly in the TDS. +We hack the ~\includegraphics~ command in order to attach the included graphics +to the \pdf{} (if desired, otherwise, use the starred version). + +#+begin_src latex + \NewCommandCopy {\__letgut_orig_includegraphics} {\includegraphics} + \clist_set:Nx \l_tmpa_clist {\Gin@extensions} + \cs_new_protected:Npn \__letgut_includegraphics:nnn #1 #2 #3 + { + \file_if_exist:nTF {#3} { + \bool_if:NT \g__letgut_included_files_attached_bool { + \IfBooleanF {#1}{ + \seq_gput_left:Nn \g__letgut_included_files_seq { + \attachfile[ + description={ + Fichier~ image~ inclus~ dans~ le~ + présent~ article~ (fichier~ `#3`) + }, + mimetype=image + ] + {#3} + } + } + } + \__letgut_orig_includegraphics[#2]{#3} + }{ + \bool_gset_false:N \g_tmpa_bool + \clist_map_inline:Nn \l_tmpa_clist {% + \file_if_exist:nTF {#3##1} { + \clist_map_break:n { + \bool_if:NT \g__letgut_included_files_attached_bool { + \IfBooleanF {#1}{ + \seq_gput_left:Nn \g__letgut_included_files_seq { + \attachfile[ + description={Fichier~ image~ inclus~ dans~ le~ présent~ article~ (fichier~ `#3##1`)}, + mimetype=image/##1 + ] + {#3##1} + } + } + } + \__letgut_orig_includegraphics[#2]{#3} + \bool_gset_true:N \g_tmpa_bool + } + } + } + \bool_if:NF \g_tmpa_bool { + \@latex@error{File~ `#3'~ not~ found}% + {I~ could~ not~ locate~ the~ file~ with~ any~ of~ these~ extensions:^^J% + \clist_use:Nn \l_tmpa_clist { ~ }^^J\@ehc}% + } + } + } + \RenewDocumentCommand {\includegraphics} {s O{} m } { + \__letgut_includegraphics:nnn {#1} {#2} {#3} + } +#+end_src + +*** Added bibliographic ressources attached to the \pdf +:PROPERTIES: +:CUSTOM_ID: ImplementationMiscellanousAddedbibliographicressourcesattachedtothe\pdf-l4e34ja00pj0 +:END: + +We hack the ~\addbibresource~ command in order to attach the bibliographic +ressources to the \pdf{} (if desired, otherwise, use the starred version). + +#+begin_src latex + \NewCommandCopy {\__letgut_orig_addbibresource} {\addbibresource} + \cs_new_protected:Npn \__letgut_addbibresource:nnn #1 #2 #3 + { + \file_if_exist:nT {#3} { + \IfBooleanF {#1}{ + \seq_gput_left:Nn \g__letgut_added_bib_resources_seq { + \attachfile[ + description={ + Source~ du~ fichier~ bibliographique~ utilisé~ + dans~ le~ présent~ article~ (fichier~ `#3`) + }, + mimetype=application/x-bibtex + ]% + {#3}% + } + } + } + \__letgut_orig_addbibresource[#2]{#3} + } + \RenewDocumentCommand {\addbibresource} { s O{} m } { + \__letgut_addbibresource:nnn {#1} {#2} {#3} + } +#+end_src + +*** Added acronym definitions file attached to the \pdf +:PROPERTIES: +:CUSTOM_ID: ImplementationMiscellanousAddedbibliographicressourcesattachedtothe\pdf-l4e34ja00pj0 +:END: + +We hack the ~\ac~ and ~\acs~ commands in order to attach the acronym definitions +file to the \pdf{}. + +#+begin_src latex + \bool_if:NT \g__letgut_included_files_attached_bool { + \tl_const:Nn \c__letgut_acronyms_file_attached_tl { + \attachfile[ + description={ + Source~ du~ fichier~ d'acronymes~ utilisé~ dans~ + le~ présent~ article~ + (fichier~ `\c__letgut_acronyms_file_tl.tex`) + }, + mimetype=application/x-tex]% + {\g__letgut_effective_acronyms_file_tl}% + } + \AddToHook{cmd/ac/before}{ + \bool_gset_true:N \g__letgut_acronyms_file_attached_bool + } + \AddToHook{cmd/acs/before}{ + \bool_gset_true:N \g__letgut_acronyms_file_attached_bool + } + } +#+end_src + +*** Added letgut listings language file attached to the \pdf +:PROPERTIES: +:CUSTOM_ID: ImplementationMiscellanousAddedbibliographicressourcesattachedtothe\pdf-l4e34ja00pj0 +:END: + +We hack the ~\ac~ and ~\acs~ commands in order to attach the acronym definitions +file to the \pdf{}. + +#+begin_src latex + \bool_if:NT \g__letgut_included_files_attached_bool { + \tl_const:Nn \c__letgut_lstlanguage_file_attached_tl { + \attachfile[ + description={ + Source~ du~ fichier~ de~ langages~ informatiques~ utilisé~ + dans~ le~ présent~ article~ + (fichier~ `\c__letgut_lstlanguage_file_tl`) + }, + mimetype=application/x-tex]% + {../\c__letgut_lstlanguage_file_tl}% + } + \AddToHook{env/ltx-code/before}{ + \bool_gset_true:N \g__letgut_lstlanguage_file_attached_bool + } + \AddToHook{env/ltx-code-result/before}{ + \bool_gset_true:N \g__letgut_lstlanguage_file_attached_bool + } + \AddToHook{env/ltx-code-external-result/before}{ + \bool_gset_true:N \g__letgut_lstlanguage_file_attached_bool + } + } +#+end_src + +** Listings +:PROPERTIES: +:CUSTOM_ID: ImplementationListings-514h55h0jlj0 +:END: + +We define a style for all the listings which resets all the \TeX{} control +sequences and keywords, and fix some defaults. + +#+begin_src latex + \lstdefinestyle{__letgut_reset_listings_styles}{ + basicstyle=\ttfamily, + breaklines, + language=TeX,% + texcs={},% + language={},% + keywords={},% + keywords=[2]{},% + keywords=[3]{},% + keywords=[4]{},% + keywords=[5]{},% + otherkeywords={},% + alsoletter={},% + alsodigit={},% + escapechar=£, + columns=fullflexible, + keepspaces=true, + upquote=true, + showstringspaces=false, +#+end_src + +If line numbers are asked, they should always have the same layout and not be +selectable (hence the ~\__letgut_unselectable:n~). + +#+begin_src latex + numbersep=\c__letgut_number_sep_dim, + numberstyle=\scriptsize\ttfamily + \color{__letgut_foregroundLinenumber} + \__letgut_unselectable:n, + #+end_src + +Because of a current issue involving \package{parskip} and \package{listings} +(\url{https://github.com/FrankMittelbach/fmitex-parskip/issues/3}), we have to +set the skip below the displayed listings to a (almost) zero length. We do the +same for the above skip. + +#+begin_src latex + aboveskip={0\p@ \@plus 6\p@}, + belowskip={0\p@ \@plus 6\p@}, + } +#+end_src + +We define as short equivalent of ~\lstinline~ the character +\lstDeleteShortInline™\texttt{™} which is unlikely to be used in ordinary text. + +#+begin_src latex +\lstMakeShortInline[breaklines=false]™ +#+end_src + +We start with an empty listings style. + +#+begin_src latex + \lstset{ style=__letgut_reset_listings_styles } + #+end_src + +*** LaTeX listings and examples +:PROPERTIES: +:CUSTOM_ID: ImplementationListingsLaTeXlistingsandexamples-xt4h55h0jlj0 +:END: + +We define the colors for the syntax highlighting of LaTeX listings. + +#+begin_src latex + \colorlet{__letgut_texcs}{blue} + \colorlet{__letgut_comment}{gray} + \colorlet{__letgut_argument_specification_separator}{red} + \colorlet{__letgut_argument_specification}{cyan} + \colorlet{__letgut_mandatory_argument}{purple} + \colorlet{__letgut_environment}{teal} + \colorlet{__letgut_key}{__letgut_mandatory_argument} + \colorlet{__letgut_value}{violet} + \colorlet{__letgut_optional_argument}{__letgut_key} + \colorlet{__letgut_math}{green!50!black} +#+end_src + +We add our own language files taken in account by the \package*{listings}. They +will be considered after the other usual ones, if found. They are searched firstly +in the current directory, secondly in the parent directory, thirdly in the TDS. #+begin_src latex \def\lstlanguagefiles{ - lstlang0.sty, + % lstlang0.sty, lstlang1.sty, lstlang2.sty, lstlang3.sty, ./\c__letgut_lstlanguage_file_tl, ../\c__letgut_lstlanguage_file_tl, - \c__letgut_lstlanguage_file_tl + \c__letgut_lstlanguage_file_tl, } #+end_src @@ -3323,7 +3813,7 @@ We define a listing style specific to LaTeX listings. alsolanguage=[plain]TeX,% alsolanguage=[common]TeX,% alsolanguage=[primitive]TeX,% - alsolanguage=[extLaTeX]TeX,% + alsolanguage=[extendedLaTeX]TeX,% alsolanguage=[classes]TeX,% texcsstyle=*\color{__letgut_texcs}, commentstyle=\color{__letgut_comment}\itshape, @@ -3341,7 +3831,7 @@ order 1. This would force us to do the same in our own language driver file but would ruin our effort to stylize in a special way (in red) other keywords (see ~otherkeywords={...}~) that are stylized as keywords of order 1. Hence, we delete these keywords of order 1 and will add them as keywords of order 2 like -all the environments in our own language driver file (in the ~extLaTeX~ dialect +all the environments in our own language driver file (in the ~extendedLaTeX~ dialect that we load by default). #+begin_src latex @@ -3375,7 +3865,7 @@ For the listings and examples, we rely on \package*{tcolorbox}, and more specifically on some of its libraries. #+begin_src latex - \tcbuselibrary{listings,xparse,breakable,skins,hooks} + \tcbuselibrary{listings,breakable,skins,hooks,documentation} #+end_src We want some common settings for all the ~tcolorbox~es. @@ -3964,6 +4454,7 @@ https://tex.stackexchange.com/a/25396). ^^f0^^f1^^f2^^f3^^f4^^f5^^f6^^f7^^f8^^f9^^fa^^fb^^fc^^fd^^fe^^ff% ^^^^201c^^^^201d% for “ and ” ^^^^215b% for ⅛ + ^^^^2122% for ™ ^^00% } \lst@RestoreCatcodes @@ -3987,7 +4478,7 @@ at its beginning. \file_if_exist:nT {./\c__letgut_local_config_file_tl}{ \@pushfilename \xdef\@currname{\c__letgut_local_config_file_tl} - \file_input:n {./\c__letgut_local_config_file_tl} + \input {./\c__letgut_local_config_file_tl} \@popfilename } #+end_src @@ -4014,7 +4505,7 @@ several purposes: - the books advertisements. #+begin_src latex :tangle ../../../tex/lualatex/letgut/letgut.lbx :exports both -\ProvidesFile{letgut.lbx}[2022-10-03 v0.9.4 letgut localization] +\ProvidesFile{letgut.lbx}[2023-01-14 v0.9.6 letgut localization] \InheritBibliographyExtras{french} \DeclareBibliographyStrings{ inherit = {french}, @@ -4028,7 +4519,7 @@ several purposes: create the corresponding new entry). #+begin_src latex :tangle ../../../tex/lualatex/letgut/letgut.dbx :exports both - \ProvidesFile{letgut.dbx}[2022-10-03 v0.9.4 letgut data model macros] + \ProvidesFile{letgut.dbx}[2023-01-14 v0.9.6 letgut data model macros] \DeclareBibliographyDriver{bookreview}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% @@ -4083,7 +4574,7 @@ several purposes: We provide a specific ~biblatex~ citation style . #+begin_src latex :tangle ../../../tex/lualatex/letgut/letgut.cbx :exports both - \ProvidesFile{letgut.cbx}[2022-10-03 v0.9.4 letgut base citation style] + \ProvidesFile{letgut.cbx}[2023-01-14 v0.9.6 letgut base citation style] \RequireCitationStyle{numeric} #+end_src @@ -4193,6 +4684,14 @@ well... % % permet l'option `detailedtoc`. % % , detailedtoc + % + % % Les fichiers sources sont attachés au PDF si et seulement si la Lettre est + % % à la fois en version pour les lecteurs (option `for-readers' activée par + % % défaut) et en sortie écran (option `screen' activée par défaut). L'option + % % `reverse-files-attachement' inverse ce comportement par défaut. + % + % , reverse-files-attachement + % } \setmainfont{TeX Gyre Schola} % Par exemple @@ -4248,7 +4747,7 @@ well... \hspace*{-1.5cm}% \raisebox{-\height+0.7\baselineskip}{% \begin{minipage}[t]{.6\textwidth}%\vspace{0pt}% - \includegraphics[width=\linewidth]{logo-gut.pdf} + \includegraphics*[width=\linewidth]{logo-gut.pdf} \end{minipage}% }% \hfill% @@ -4701,7 +5200,7 @@ well... :END: #+begin_src latex :tangle ../../../tex/lualatex/letgut/letgut-lstlang.sty :exports both - % \lst@definelanguage[...]{TeX}{% + % \lst@definelanguage[...]{TeX}{% % % Control sequences names % moretexcs={% % },% @@ -4733,7 +5232,659 @@ well... % % alsodigit={},% % % alsoother={},% % sensitive,% - % }[keywords,tex,comments%] + % }[keywords,tex,comments] + + \lst@definelanguage[Scrabble]{TeX}{% + % Control sequences names + moretexcs={% + PlateauScrabble,ScrabblePlaceMot,% + ScrabbleBoard,ScrabblePutWord,% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + EnvScrabble,% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + FR,EN,DE,ES,GR,SP,% + Echelle,Echellelabels,Cadre,Labels,Aide,% + Scale,ScaleLabels,Border,Help,% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + Scrabble% + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[FiraSans]{TeX}{% + % Control sequences names + moretexcs={% + sufigures,firaoldstyle,firalining,firatabular,firaproportional, + firathin,firalight,firaextralight,firaultralight,firamedium,firabook, + firasemibold,firaextrabold,firaheavy,% + }% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + sfdefault,scaled,scale,type1,lining,lf,oldstyle,osf,tabular,t,proportional,% + p,book,medium,mb,semibold,sb,light,l,extralight,ultralight,thin,% + extrabold,heavy,default,% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + FiraSans% + },% + % otherkeywords={}, + alsoletter={1}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[luagcd]{TeX}{% + % Control sequences names + moretexcs={% + luagcdwithsteps,% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + luagcd% + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[maze]{TeX}{% + % Control sequences names + moretexcs={% + maze,% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + maze% + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[animate]{TeX}{% + % Control sequences names + moretexcs={% + multiframe,% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + animateinline, + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + poster,controls,palindrome,bb,rx,% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + first,% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + animate% + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[tikz-mirror-lens]{TeX}{% + % Control sequences names + moretexcs={% + lensSphGaussFixed,% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + tikz-mirror-lens% + },% + % otherkeywords={}, + alsoletter={-}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[jeuxcartes]{TeX}{% + % Control sequences names + moretexcs={% + MainCartesJeu,% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + Eventail,10C,10K,AC,AT,AP,% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + jeuxcartes% + },% + % otherkeywords={}, + alsoletter={0123456789}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[plex-otf]{TeX}{% + % Control sequences names + moretexcs={% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + RM + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + plex-otf% + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[mathtools]{TeX}{% + % Control sequences names + moretexcs={% + mathclap,DeclarePairedDelimiter,% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + % + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[tikz-ext]{TeX}{% + % Control sequences names + moretexcs={% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + distancebetween,% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + tikz-ext% + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[tikzfill]{TeX}{% + % Control sequences names + moretexcs={% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + pattern,hexagon,cycle,color, + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + tikzfill + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[unicodemath]{TeX}{% + % Control sequences names + moretexcs={% + symscr,symbb,symfrak,symsfup,symsfit,symtt,setmathfont,% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + range,mathrm,% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + up,it,bb,bbit,scr,cal,bfcal,frak,tt,sfup ,sfit,bfup,bfit,bfscr,bffrak,% + bfsfup,bfsfit,sym,% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + unicode-math + },% + % otherkeywords={}, + alsoletter={-}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[xcharter-otf]{TeX}{% + % Control sequences names + moretexcs={% + Bbbone,Bbbk,% + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + range + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + xcharter-otf + },% + % otherkeywords={}, + alsoletter={-}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[braille]{TeX}{% + % Control sequences names + moretexcs={% + braille + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + % + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[swungdash]{TeX}{% + % Control sequences names + moretexcs={% + swungdash + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + % + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + + \lst@definelanguage[simples-matrices]{TeX}{% + % Control sequences names + moretexcs={% + matrice + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + b,% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + % + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[customdice]{TeX}{% + % Control sequences names + moretexcs={% + dice + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + violet,yellow + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + % + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments] + + \lst@definelanguage[pingu]{TeX}{% + % Control sequences names + moretexcs={% + pingu + },% + % Keywords of class 1 : keywords that contain other characters + % (since of the same class as the ones specified as 'otherkeywords') + morekeywords={% + },% + % Keywords of class 2 : environments names + morekeywords=[2]{% + },% + % Keywords of class 3 : mandatory arguments (not environments) & + % optional arguments which are keys (in key=value) + morekeywords=[3]{% + left,wing,wave,right,grab,eyes,shiny,cup,% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + },% + % Keywords of class 5 : arguments specifications (after ":" in expl3 + % syntax) + morekeywords=[5]{% + },% + % Keywords of class 6 : current package name (and possibly derived + % packages) + morekeywords=[6]{% + % + },% + % otherkeywords={}, + % alsoletter={}, + % alsodigit={},% + % alsoother={},% + sensitive,% + }[keywords,tex,comments]% \lst@definelanguage[letgut]{TeX}{% % Control sequences names @@ -4742,7 +5893,8 @@ well... package,package*,class,class*,software,software*,file,file*,% foreignloc,latinloc,gutenberg,gut,lettre,lettregut,Cahier,% Cahiers,letgut,letgutcls,knuth,lamport,tugboat,item*,letgutacro,% - separator,alertbox,terminal,inputarticle,lettrenumber,% + separator,alertbox,terminal,inputarticle,lettrenumber,solution,% + rebussolution,% },% % Keywords of class 1 : keywords that contain other characters (since % of the same class as the ones specified as 'otherkeywords') @@ -4751,7 +5903,7 @@ well... % Keywords of class 2 : environments names morekeywords=[2]{% ctannews,ltx-code,ltx-code-result,ltx-code-external-result,% - bookreview,% + bookreview,announcement,rebus,% },% % Keywords of class 3 : mandatory arguments (not environments) & % optional arguments which are keys (in key=value) @@ -4759,7 +5911,7 @@ well... for-authors,for-readers,draft,final,screen,paper,number,date,% pagecolor,allcolorslinks,membership-reminder,editorial,informations,% title,addon,result width,reference,text,title,reviewer,bibkey,% - frontcover,price,result,and,% + frontcover,price,result,and,no,solution,% },% % Keywords of class 4 : values of keys (in key=value) morekeywords=[4]{% @@ -4784,7 +5936,7 @@ well... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % LaTeX texcs and keywords that are missing in `listings` driver file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - \lst@definelanguage[extLaTeX]{TeX}{% + \lst@definelanguage[extendedLaTeX]{TeX}{% % Control sequences names moretexcs={% Huge,LARGE,Large,LoadClass,NewCommandCopy,RequirePackage,% @@ -5343,7 +6495,7 @@ well... % syntax) morekeywords=[5]{% D,N,Nn,NF,NN,Nx,NT,NTF,NNn,NnV,Nnn,Npn,Nnnn,V,c,e,en,f,n,nF,% - nn,nT,nnn,nnF,nnV,nTF,nnnn,nNnF,nNnT,nnVV,o,p,v,w,x,% + nn,nT,nnn,nnF,nnV,nTF,nnnn,nNnF,nNnT,nnVV,o,p,v,w,x,nnTF,% },% % Keywords of class 6 : current package name (and possibly derived % packages) @@ -6006,7 +7158,8 @@ well... \lst@definelanguage[tikz]{TeX}{% % Control sequences names moretexcs={% - usetikzlibrary,draw,node,matrix,fill,foreach,tikz,% + usetikzlibrary,draw,node,matrix,fill,foreach,tikz,pgfmathsetmacro,% + path,% },% % Keywords of class 1 : keywords that contain other characters (since % of the same class as the ones specified as 'otherkeywords') @@ -6020,12 +7173,13 @@ well... % optional arguments which are keys (in key=value) morekeywords=[3]{% pic,rotate,xshift,yshift,every node,inner sep,blend mode,fill,% - fit,circle,anchor,in,count,x,y,matrix,of,math,nodes,above - right,at,--,-|,|-,% + fit,circle,anchor,in,count,x,y,matrix,of,math,nodes,above right,% + at,--,-|,|-,thick,size,angle,circle,through,intersection,of,% + draw,coordinate,shift,and,cycle,cs:A,node,barycentric,% },% % Keywords of class 4 : values of keys (in key=value) morekeywords=[4]{% - multiply,lightgray,base,% + multiply,lightgray,base,red% },% % Keywords of class 5 : arguments specifications (after ":" in expl3 % syntax) @@ -6037,7 +7191,7 @@ well... tikz,% },% % otherkeywords={},% - alsoletter={-| \ },% + alsoletter={-| \ :},% % alsodigit={},% % alsoother={},% sensitive,% @@ -6197,6 +7351,7 @@ well... % optional arguments which are keys (in key=value) morekeywords=[3]{% log-declarations,% + m,r,R,v,b,o,d,O,D,s,t,e,E,% },% % Keywords of class 4 : values of keys (in key=value) morekeywords=[4]{% @@ -6672,7 +7827,7 @@ well... morekeywords=[3]{% Alternate,Annotation,AutoFakeBold,AutoFakeSlant,BoldFeatures,% BoldFont,BoldItalicFeatures,BoldItalicFont,BoldSlantedFeatures,% - BoldSlantedFont,BoldSwashFeatures,BoldSwashFont,CJKShape,% + BoldSlantedFont,BoldSwashFeatures,BoldSwashFont,CJKShape,ItalicFeatures,% CharacterVariant,CharacterWidth,Color,Colour,Contextuals,% Diacritics,Extension,FakeBold,FakeSlant,FakeStretch,Font,FontFace,% Fractions,HyphenChar,IgnoreFontspecFileItalicFeatures,ItalicFont,% @@ -6701,7 +7856,7 @@ well... TeX,Thurd,Titling,Traditional,Unicase,Uppercase,UppercaseOff,% UppercasePetiteCaps,UppercaseSmallCaps,VerticalKana,WordFinal,% WordInitial,ResetAll,c2sc,scmp,sinf,sups,zero,ss06,ss01,% - ss04,-liga,frac,titl,swsh,hist,hlig% + ss04,-liga,frac,titl,swsh,hist,hlig,MatchUppercase,MatchLowercase,% },% % Keywords of class 5 : arguments specifications (after ":" in expl3 % syntax) diff --git a/macros/luatex/latex/pyluatex/pyluatex-interpreter.py b/macros/luatex/latex/pyluatex/pyluatex-interpreter.py index 28ec28e12e..341c2ace04 100644 --- a/macros/luatex/latex/pyluatex/pyluatex-interpreter.py +++ b/macros/luatex/latex/pyluatex/pyluatex-interpreter.py @@ -34,7 +34,30 @@ import re import os import sys +class PyLTTex: + def __init__(self): + self._log_buffer = [] + + def log(self, *objects, sep=' ', end='\n'): + try: + objects = [str(v) for v in objects] + except Exception as exc: + raise RuntimeError( + 'The object to log could not be transformed to a string.', + ) from exc + self._log_buffer.append(sep.join(objects)) + self._log_buffer.append(end) + + def _log_message(self): + msg = ''.join(self._log_buffer) + self._log_buffer = [] + return msg + class Interpreter(InteractiveInterpreter): + def __init__(self): + self.tex = PyLTTex() + super().__init__({'tex': self.tex}) + def execute_repl(self, code, ignore_errors): self.success = True output = '' @@ -60,7 +83,7 @@ class Interpreter(InteractiveInterpreter): output += out.getvalue() if not ignore_errors and not self.success: return False, output - return self.success, output + return self.success, output, self.tex._log_message() def execute(self, code): with StringIO() as out, redirect_stdout(out), redirect_stderr(out): @@ -75,7 +98,7 @@ class Interpreter(InteractiveInterpreter): except: traceback.print_exc() self.success = False - return self.success, out.getvalue() + return self.success, out.getvalue(), self.tex._log_message() def showtraceback(self): super().showtraceback() @@ -95,13 +118,17 @@ class Handler(socketserver.StreamRequestHandler): interpreter = interpreters[data['session']] code = textwrap.dedent(data['code']) if data['repl_mode']: - success, output = interpreter.execute_repl( + success, output, log_msg = interpreter.execute_repl( code, data['ignore_errors'] ) else: - success, output = interpreter.execute(code) - response = { 'success': success, 'output': output } + success, output, log_msg = interpreter.execute(code) + response = { + 'success': success, + 'output': output, + 'log_msg': log_msg + } self.wfile.write((json.dumps(response) + '\n').encode('utf-8')) if __name__ == '__main__': diff --git a/macros/luatex/latex/pyluatex/pyluatex.lua b/macros/luatex/latex/pyluatex/pyluatex.lua index 9f7d5f7936..c12faa5cc8 100644 --- a/macros/luatex/latex/pyluatex/pyluatex.lua +++ b/macros/luatex/latex/pyluatex/pyluatex.lua @@ -118,8 +118,7 @@ end local function request(data) tcp:send(utilities.json.tostring(data) .. "\n") local output = tcp:receive("*l") - local response = utilities.json.tolua(output) - return response.success, response.output + return utilities.json.tolua(output) end local function log_input(code) @@ -152,7 +151,7 @@ function pyluatex.execute(code, auto_print, write, repl_mode, store) if pyluatex.verbose then log_input(full_code) end - local success, output = request( + local resp = request( { session = pyluatex.session, code = full_code, @@ -160,27 +159,29 @@ function pyluatex.execute(code, auto_print, write, repl_mode, store) ignore_errors = pyluatex.ignore_errors } ) - local output_lines = split_lines(output) + local output_lines = split_lines(resp.output) if store then last_code = split_lines(code) last_output = output_lines end - if success or pyluatex.ignore_errors then - if pyluatex.verbose or not success then log_output(output) end + if resp.success or pyluatex.ignore_errors then + if pyluatex.verbose or not resp.success then log_output(resp.output) end if write then tex.print(output_lines) end else if not pyluatex.verbose then log_input(full_code) end - log_output(output) + log_output(resp.output) if write then tex.sprint(err_cmd("Python error (see above)")) end end - return success + if resp.log_msg ~= "" then texio.write(resp.log_msg) end + + return resp.success end function pyluatex.print_env() diff --git a/macros/luatex/latex/pyluatex/pyluatex.pdf b/macros/luatex/latex/pyluatex/pyluatex.pdf index 69fe67558e..bc41fa99e4 100644 Binary files a/macros/luatex/latex/pyluatex/pyluatex.pdf and b/macros/luatex/latex/pyluatex/pyluatex.pdf differ diff --git a/macros/luatex/latex/pyluatex/pyluatex.sty b/macros/luatex/latex/pyluatex/pyluatex.sty index a5adf62973..db5654e6b8 100644 --- a/macros/luatex/latex/pyluatex/pyluatex.sty +++ b/macros/luatex/latex/pyluatex/pyluatex.sty @@ -9,7 +9,7 @@ %% version 2005/12/01 or later. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{pyluatex}[2023/01/03 v0.5.2 Execute Python code on the fly] +\ProvidesPackage{pyluatex}[2023/01/14 v0.6.0 Execute Python code on the fly] \RequirePackage{expl3} \ExplSyntaxOn diff --git a/macros/luatex/latex/pyluatex/pyluatex.tex b/macros/luatex/latex/pyluatex/pyluatex.tex index 12c539d660..4dc0c09e35 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.5.2 (2023/01/03)} +\date{v0.6.0 (2023/01/14)} \begin{document} \maketitle \raggedright @@ -196,6 +196,23 @@ in your environment definition, e.g. {\end{python}} \end{tcblisting} +\subsection{Logging from Python} +\begin{tcblisting}{breakable,listing only, + size=fbox,colframe=black!8,boxrule=3pt,colback=black!8} +tex.log(*objects, sep=' ', end='\n') +\end{tcblisting} +Writes \inlcode|objects| to the TeX log, separated by \inlcode|sep| and followed by \inlcode|end|. +All elements in \inlcode|objects| are converted to strings using \inlcode|str()|. +Both \inlcode|sep| and \inlcode|end| must be strings. + +\textit{Example:} +\begin{tcblisting}{breakable,listing only, + size=fbox,colframe=black!8,boxrule=3pt,colback=black!8} +\begin{python} +tex.log('This text goes to the TeX log.') +\end{python} +\end{tcblisting} + \section{Requirements} \begin{itemize} \item Lua\LaTeX{} -- cgit v1.2.3