diff options
Diffstat (limited to 'macros/luatex/latex/letgut/doc')
-rw-r--r-- | macros/luatex/latex/letgut/doc/CHANGELOG.md | 18 | ||||
-rw-r--r-- | macros/luatex/latex/letgut/doc/letgut-banner-code.pdf | bin | 189834 -> 154150 bytes | |||
-rw-r--r-- | macros/luatex/latex/letgut/doc/letgut-banner-code.tex | 806 | ||||
-rw-r--r-- | macros/luatex/latex/letgut/doc/letgut-code.pdf | bin | 444452 -> 690570 bytes | |||
-rw-r--r-- | macros/luatex/latex/letgut/doc/letgut-code.tex | 3361 | ||||
-rw-r--r-- | macros/luatex/latex/letgut/doc/letgut.pdf | bin | 309776 -> 359872 bytes | |||
-rw-r--r-- | macros/luatex/latex/letgut/doc/letgut.tex | 632 | ||||
-rw-r--r-- | macros/luatex/latex/letgut/doc/listings-conf.tex | 37 | ||||
-rw-r--r-- | macros/luatex/latex/letgut/doc/localconf.tex | 48 |
9 files changed, 475 insertions, 4427 deletions
diff --git a/macros/luatex/latex/letgut/doc/CHANGELOG.md b/macros/luatex/latex/letgut/doc/CHANGELOG.md deleted file mode 100644 index a1090d0052..0000000000 --- a/macros/luatex/latex/letgut/doc/CHANGELOG.md +++ /dev/null @@ -1,18 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic -Versioning](http://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [0.9.1] - 2022-03-22 - -### Changed -File renamed (Karl Berry request) - -## [0.9] - 2022-03-18 - -### Added -First public testing release diff --git a/macros/luatex/latex/letgut/doc/letgut-banner-code.pdf b/macros/luatex/latex/letgut/doc/letgut-banner-code.pdf Binary files differindex 4d8ed77780..e280be97e3 100644 --- a/macros/luatex/latex/letgut/doc/letgut-banner-code.pdf +++ b/macros/luatex/latex/letgut/doc/letgut-banner-code.pdf diff --git a/macros/luatex/latex/letgut/doc/letgut-banner-code.tex b/macros/luatex/latex/letgut/doc/letgut-banner-code.tex deleted file mode 100644 index aab61f0276..0000000000 --- a/macros/luatex/latex/letgut/doc/letgut-banner-code.tex +++ /dev/null @@ -1,806 +0,0 @@ -% Created 2022-03-22 mar. 11:25 -% Intended LaTeX compiler: lualatex -\documentclass{letgut} - \setmainfont{KpRoman} -\setsansfont{KpSans} -\setmonofont[Scale = MatchLowercase]{RobotoMono} -\letgutsetup{editorial=false} -\input{listings-conf} -\author{Association GUTenberg} -\date{\today} -\title{Support for the banner of the newsletter “La Lettre de GUTenberg”} -\begin{document} - - -\section{Identification} -\label{sec:org4c9ba67} - -\begin{lstlisting} -% This is file `letgut.cls', -% generated with the Emacs Org-babel utility. -% -% The original source file is letgut-banner.org -% -% -------------:| --------------------------------------------------- -% letgut-banner:| Package for the banner of the newsletter -% | “La Lettre GUTenberg” -% Author:| Association GUTenberg -% E-mail:| secretariat@gutenberg.eu.org -% License:| Released under the LaTeX Project Public License -% | v1.3c or later -% See:| http://www.latex-project.org/lppl.txt -% -% Copyright (C) 1994-2022 by Association GUTenberg -% <secretariat@gutenberg.eu.org> -% -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License (LPPL), either -% version 1.3c of this license or (at your option) any later -% version. The latest version of this license is in the file: -% -% http://www.latex-project.org/lppl.txt -% -% This work is “maintained” (as per LPPL maintenance status) -% by Association GUTenberg. -\end{lstlisting} - -\section{Implementation} -\label{sec:orgb1ea800} - -These document classes can only be used with \LaTeXe, so we make -sure that an appropriate message is displayed when another \TeX{} -format is used. - -\begin{lstlisting} -\NeedsTeXFormat{LaTeX2e}[2020-10-01] -\end{lstlisting} - -Now, we can announce the package name and its version: - -\begin{lstlisting} -\ProvidesExplPackage{letgut-banner} -{2022-03-22} -{0.9.1} -{ - Package for the banner of the newsletter “La Lettre de GUTenberg” -} -\end{lstlisting} - -\subsection{Packages loaded} -\label{sec:org09b0cd2} - -In order to provide class options, we load the \package{l3keys2e} which provides -\LaTeXe{} option processing using \LaTeX3 keys: - -\begin{lstlisting} -\RequirePackage{l3keys2e} -\end{lstlisting} - -Till the Lua-based color will be added to the core \package{l3color} approach, -we have to rely on \package{xcolor} - -\begin{lstlisting} -\RequirePackage{xcolor} -\end{lstlisting} - -We want the material added to the first page to be not selectable in order to let the -reader who wants to copy the interesting text be able to select it (see below). - -\begin{lstlisting} -\RequirePackage{accsupp} -\end{lstlisting} - -What follows has to be done at this end of the preamble, otherwise the font set -with \lstinline+\setmainfont+ in the preamble isn't taken in account in the banner. - -We define an option for the color of the text in the “L” (that has to be the -same as the page color of the document). - -\begin{lstlisting} -\keys_define:nn { letgut-banner } -{ - , pagecolor .clist_gset:N = \g__letgutbanner_pagecolor_clist - , pagecolor .initial:n = { 1,1,1 } -} -\ProcessKeysOptions { letgut-banner } -\end{lstlisting} - -\begin{lstlisting} -\AddToHook{begindocument}{ -\end{lstlisting} - -\begin{lstlisting} -\cs_generate_variant:Nn \color_fill:nn { nV } -\end{lstlisting} - -\subsection{Declarations} -\label{sec:org61842b5} - -\subsubsection{Dimensions} -\label{sec:org447090b} - -\begin{lstlisting} -\dim_new:N \g__letgutbanner_area_height_dim -\dim_new:N \g__letgutbanner_La_height_dim -\dim_new:N \g__letgutbanner_La_depth_dim -\dim_new:N \g__letgutbanner_La_yoffset_dim -\dim_new:N \g__letgutbanner_banner_vertical_contents_width_dim -\dim_new:N \g__letgutbanner_largest_LETR_box_height_dim -\dim_new:N \g__letgutbanner_between_letters_yoffset_dim -\dim_new:N \g__letgutbanner_between_letters_vertical_space_dim -\dim_new:N \g__letgutbanner_banner_padding_dim -\dim_if_exist:NF \g__letgutbanner_first_page_shrink_dim { - \dim_new:N \g__letgutbanner_first_page_shrink_dim -} -\end{lstlisting} - -\begin{itemize} -\item Dimensions of the page. If the present package is used with the -\class*{letgut}, they are borrowed from it. Otherwise, they are set to default -values. For this, we first generate a variant of \lstinline+\dim_const:Nn+ (see -\url{https://github.com/latex3/latex3/issues/947\#issuecomment-860950569}). -\begin{lstlisting} -\cs_generate_variant:Nn \dim_const:Nn { NV } -\dim_if_exist:NTF \c__letgut_textheight_dim { - \dim_const:NV \c__letgutbanner_textheight_dim - \c__letgut_textheight_dim -}{ - \dim_const:Nn \c__letgutbanner_textheight_dim - { 25cm } -} -\dim_if_exist:NTF \c__letgut_textwidth_dim { - \dim_const:NV \c__letgutbanner_textwidth_dim - \c__letgut_textwidth_dim -}{ - \dim_const:Nn \c__letgutbanner_textwidth_dim - { 14cm } -} -\dim_if_exist:NTF \c__letgut_lmargin_dim { - \dim_const:NV \c__letgutbanner_lmargin_dim - \c__letgut_lmargin_dim -}{ - \dim_const:Nn \c__letgutbanner_lmargin_dim - { 5cm } -} -\dim_if_exist:NTF \c__letgut_tmargin_dim { - \dim_const:NV \c__letgutbanner_tmargin_dim - \c__letgut_tmargin_dim -}{ - \dim_const:Nn \c__letgutbanner_tmargin_dim - { 2.92cm } - % \dim_const:Nn \c__letgutbanner_tmargin_dim - % { 3cm } -} -\dim_if_exist:NTF \c__letgut_head_dim { - \dim_const:NV \c__letgutbanner_head_dim - \c__letgut_head_dim -}{ - \dim_const:Nn \c__letgutbanner_head_dim - { 0.6cm } -} -\dim_if_exist:NTF \c__letgut_headsep_dim { - \dim_const:NV \c__letgutbanner_headsep_dim - \c__letgut_headsep_dim -}{ - \dim_const:Nn \c__letgutbanner_headsep_dim - { 0.82cm } - % \dim_const:Nn \c__letgutbanner_headsep_dim - % { 0.9cm } -} -\dim_if_exist:NTF \c__letgut_marginparwidth_dim { - \dim_const:NV \c__letgutbanner_marginparwidth_dim - \c__letgut_marginparwidth_dim -}{ - \dim_const:Nn \c__letgutbanner_marginparwidth_dim - { 3.74cm } -} -\end{lstlisting} -\item Dimensions of the banner. If the present package is used with the -\class*{letgut}, they are borrowed from it. Otherwise, they are set to -default values. -\begin{itemize} -\item Thickness of the “L”. -\begin{lstlisting} -\dim_if_exist:NTF \c__letgut_banner_thickness_dim { - \dim_const:NV \c__letgutbanner_banner_thickness_dim - \c__letgut_banner_thickness_dim -}{ - \dim_const:Nn \c__letgutbanner_banner_thickness_dim - { 4cm } -} -\end{lstlisting} -\item Height of the “L” (that of the text area plus 3cm). -\begin{lstlisting} -\dim_if_exist:NTF \c__letgut_banner_height_dim { - \dim_const:NV \c__letgutbanner_banner_height_dim - \c__letgut_banner_height_dim -}{ - \dim_const:Nn \c__letgutbanner_banner_height_dim { - \c__letgutbanner_textheight_dim - + - 3cm - } -} -\end{lstlisting} -\item Initial padding of the text embedded in the vertical bar of the “L”. -\begin{lstlisting} -\dim_const:Nn \c__letgutbanner_banner_padding_dim { .25cm } -\end{lstlisting} -\item Width of the “L” (the width (\(w\)) of the text zone plus the width (\(l\)) of -the left margin minus half the difference between the width of the left -margin and the width (\(d\)) of the “L”: \(=w+l-(l-d)/2=w+(l+d)/2\)). -\begin{lstlisting} -\dim_const:Nn \c__letgutbanner_banner_width_dim { - \c__letgutbanner_textwidth_dim - + - ( - \c__letgutbanner_banner_thickness_dim - + - \c__letgutbanner_lmargin_dim - )/2 -} -\end{lstlisting} -\item Initial width of the text embedded in the “L” vertical bar. -\begin{lstlisting} -\dim_const:Nn -\c__letgutbanner_banner_vertical_contents_width_dim { - \c__letgutbanner_banner_thickness_dim - - - 2\c__letgutbanner_banner_padding_dim -} -\end{lstlisting} -\item Width of the text embedded in the horizontal bar of the “L” (of the text -area plus half the difference between that of the left margin and that of -the thickness of the “L”, minus the padding -- and not 2 times the -padding because this text will be stuck to its left “margin”). -\begin{lstlisting} -\dim_const:Nn -\c__letgutbanner_banner_horizontal_contents_width_dim { - \c__letgutbanner_textwidth_dim - - ( - \c__letgutbanner_banner_thickness_dim - - - \c__letgutbanner_lmargin_dim - )/2 - - - \c__letgutbanner_banner_padding_dim -} -\end{lstlisting} -\end{itemize} -\end{itemize} - -\subsubsection{Boxes} -\label{sec:org5711d86} - -New boxes, for each of the letters in the word “LETTRE” (!), and then for the -rest of the content listed in the banner. -\begin{lstlisting} -\box_new:N \g__letgutbanner_L_box -\box_new:N \g__letgutbanner_E_box -\box_new:N \g__letgutbanner_T_box -\box_new:N \g__letgutbanner_R_box -\box_new:N \g__letgutbanner_La_box -\box_new:N \g__letgutbanner_GUTenberg_box -\box_new:N \g__letgutbanner_largest_LETR_box -\box_new:N \g__letgutbanner_g_box -\end{lstlisting} - -\subsubsection{Floating point numbers} -\label{sec:orge5b5c6b} - -\begin{itemize} -\item Minimum percentage of the common height of the letters of the word “LETTRE” -that their line spacing must represent. -\end{itemize} -\begin{lstlisting} -\fp_const:Nn \c__letgutbanner_leading_minimum_percent_fp { 0.15 } -\end{lstlisting} -\begin{itemize} -\item Factor applied to the line spacing between “La” and the 1st letter of -“LETTRE” compared to that between the letters of “LETTRE”. -\end{itemize} -\begin{lstlisting} -\fp_const:Nn \c__letgutbanner_leading_La_factor_fp { 1.5 } -\end{lstlisting} - -\subsection{Application des dimensions de la page} -\label{sec:orgbda0ae2} - -\begin{lstlisting} -\geometry{ - asymmetric, - textheight = \c__letgutbanner_textheight_dim, - textwidth = \c__letgutbanner_textwidth_dim, - lmargin = \c__letgutbanner_lmargin_dim, - tmargin = \c__letgutbanner_tmargin_dim, - head = \c__letgutbanner_head_dim, - headsep = \c__letgutbanner_headsep_dim, - marginparwidth= \c__letgutbanner_marginparwidth_dim, - % showframe, - % verbose, -} -\end{lstlisting} - -\subsection{Filling of the boxes} -\label{sec:orgb3e9382} -\begin{lstlisting} -\hbox_gset:Nn \g__letgutbanner_L_box { \textbf{L} } -\hbox_gset:Nn \g__letgutbanner_E_box { \textbf{E} } -\hbox_gset:Nn \g__letgutbanner_T_box { \textbf{T} } -\hbox_gset:Nn \g__letgutbanner_R_box { \textbf{R} } -\hbox_gset:Nn \g__letgutbanner_La_box { \textbf{\textit{La}} } -\hbox_gset:Nn \g__letgutbanner_GUTenberg_box { - \textbf{\textit{GUTenberg}} -} -\hbox_gset:Nn \g__letgutbanner_g_box { \textbf{g} } -\end{lstlisting} - -\subsection{Computations} -\label{sec:orgdd18dd8} - -Determination of the widths of each of the letter boxes of the word “LETTRE”. -\begin{lstlisting} -\dim_const:Nn \c__letgutbanner_L_width_dim { - \box_wd:N \g__letgutbanner_L_box -} -\dim_const:Nn \c__letgutbanner_E_width_dim { - \box_wd:N \g__letgutbanner_E_box -} -\dim_const:Nn \c__letgutbanner_T_width_dim { - \box_wd:N \g__letgutbanner_T_box -} -\dim_const:Nn \c__letgutbanner_R_width_dim { - \box_wd:N \g__letgutbanner_R_box -} -\end{lstlisting} -Determination of the largest of these widths, stored in the scratch dimension -\lstinline+\g_tmpa_dim+. -\begin{lstlisting} -\dim_gset:Nn \g_tmpa_dim { - \fp_eval:n { - max ( - \c__letgutbanner_L_width_dim, - \c__letgutbanner_E_width_dim, - \c__letgutbanner_T_width_dim, - \c__letgutbanner_R_width_dim, - ) - }pt -} -\end{lstlisting} -Determination of the (1st) box whose width is the largest of all (\lstinline+argmax+, as -it were). -\begin{lstlisting} -\box_gset_eq:NN \g__letgutbanner_largest_LETR_box \dim_case:nnF -{ \g_tmpa_dim } -{ - { \c__letgutbanner_L_width_dim } { \g__letgutbanner_L_box } - { \c__letgutbanner_E_width_dim } { \g__letgutbanner_E_box } - { \c__letgutbanner_T_width_dim } { \g__letgutbanner_T_box } - { \c__letgutbanner_R_width_dim } { \g__letgutbanner_R_box } -} -{ No~ idea! } -\end{lstlisting} -Resize the box containing “GUTenberg” to the width of the text embedded in the -horizontal bar of the “L”. -\begin{lstlisting} -\box_gresize_to_wd:Nn \g__letgutbanner_GUTenberg_box { - \c__letgutbanner_banner_horizontal_contents_width_dim -} -\end{lstlisting} -Determination of the height and depth of the box containing “GUTenberg” resized. -\begin{lstlisting} -\dim_const:Nn \c__letgutbanner_GUTenberg_height_dim { - \box_ht:N \g__letgutbanner_GUTenberg_box -} -\dim_const:Nn \c__letgutbanner_GUTenberg_depth_dim { - \box_dp:N \g__letgutbanner_GUTenberg_box -} -\end{lstlisting} -Determining the size of the vertical offset of the box containing the resized -“GUTenberg”, so that it is vertically centered in the horizontal bar of the “L”: -the box positioned in \(0\) would be at the very bottom of the box containing the -banner so with base line at the bottom the horizontal bar of the “L” so we raise -it first by its depth (\(d\)) and then by half the difference between the heights -(\(H\)) of the horizontal bar of the “L” and (\(h+d\)) total of the box containing -“GUTenberg” resized (\(=d+H/2-(h+d)/2=(H-h+d)/2\)). -\begin{lstlisting} -\dim_const:Nn \c__letgutbanner_GUTenberg_yoffset_dim { - ( - \c__letgutbanner_banner_thickness_dim - - - \c__letgutbanner_GUTenberg_height_dim - + - \c__letgutbanner_GUTenberg_depth_dim - )/2 -} -\end{lstlisting} -Once the height of the zone devoted to “La LETTRE” in the vertical bar of the -“L” has been fixed, the line spacing between the letters of the word “LETTRE” -depends in fact only on the width occupied by the widest of them, by definition -equal to the width allocated to the text embedded in the vertical bar of the -“L”. The latter, stored in \lstinline+\g__letgutbanner_banner_vertical_contents_width_dim+, is -initially fixed: -\begin{lstlisting} -\dim_gset:Nn -\g__letgutbanner_banner_vertical_contents_width_dim -\c__letgutbanner_banner_vertical_contents_width_dim -\end{lstlisting} -but, to avoid this line spacing being too small (or even negative), we test that -it is greater than a certain threshold, equal to a certain minimum percentage of -the height common to the letters of the word “LETTRE”, stored in: - -\lstinline+\c__letgutbanner_leading_minimum_percent_fp+ - -and fixed at 0.15. If this is not the -case, we reduce (by 1pt): - -\lstinline+\g__letgutbanner_banner_vertical_contents_width_dim+ - -and loop until it is the case. -\begin{lstlisting} -\dim_do_until:nNnn { - \g__letgutbanner_between_letters_vertical_space_dim -} -> -{ - \fp_use:N\c__letgutbanner_leading_minimum_percent_fp - \g__letgutbanner_largest_LETR_box_height_dim -}{ -\end{lstlisting} -Resize the largest of these boxes to the width of the text embedded in the “L”. -\begin{lstlisting} -\box_gresize_to_wd:Nn \g__letgutbanner_largest_LETR_box { - \g__letgutbanner_banner_vertical_contents_width_dim -} -\end{lstlisting} -Height of this resized larger box. -\begin{lstlisting} -\dim_gset:Nn \g__letgutbanner_largest_LETR_box_height_dim { - \box_ht:N \g__letgutbanner_largest_LETR_box -} -\end{lstlisting} -Resize the boxes for each of the letters in the word “LETTRE” so that they are -all the same height as the widest of them. -\begin{lstlisting} -\box_gresize_to_ht:Nn \g__letgutbanner_L_box { - \g__letgutbanner_largest_LETR_box_height_dim -} -\box_gresize_to_ht:Nn \g__letgutbanner_E_box { - \g__letgutbanner_largest_LETR_box_height_dim -} -\box_gresize_to_ht:Nn \g__letgutbanner_T_box { - \g__letgutbanner_largest_LETR_box_height_dim -} -\box_gresize_to_ht:Nn \g__letgutbanner_R_box { - \g__letgutbanner_largest_LETR_box_height_dim -} -\end{lstlisting} -Resize the box containing “La” to the width of the text embedded in the “L” -vertical bar. -\begin{lstlisting} -\box_gresize_to_wd:Nn \g__letgutbanner_La_box { - \g__letgutbanner_banner_vertical_contents_width_dim -} -\end{lstlisting} -Determine the height (\(h\)) and depth (\(d\)) of the resized box containing “La”. -\begin{lstlisting} -\dim_gset:Nn \g__letgutbanner_La_height_dim { - \box_ht:N \g__letgutbanner_La_box -} -\dim_gset:Nn \g__letgutbanner_La_depth_dim { - \box_dp:N \g__letgutbanner_La_box -} -\end{lstlisting} -Determining the size of the vertical offset of the resized box containing “La” -so that its top is, relative to the top of the “L”, offset by the same amount as -the bottom of the box containing “GUTenberg” is offset from the bottom of the -“L” (i.e., the distance from the top of the page to the top of “La” and the -distance from the bottom of the page to the baseline of “GUTenberg” are -identical). -\begin{lstlisting} -\dim_gset:Nn \g__letgutbanner_La_yoffset_dim { - \c__letgutbanner_banner_height_dim - - - \c__letgutbanner_GUTenberg_yoffset_dim - - - \g__letgutbanner_La_height_dim - + - \g__letgutbanner_La_depth_dim -} -\end{lstlisting} -For the following, the area containing the letters of the word “LETTRE” aligned -vertically is fixed, defined as follows: -\begin{itemize} -\item its top is the baseline of “La”, -\item its bottom is the baseline of “GUTenberg”. -\end{itemize} -Determination of the height of this area. -\begin{lstlisting} -\dim_gset:Nn \g__letgutbanner_area_height_dim { - \g__letgutbanner_La_yoffset_dim - - - \g__letgutbanner_La_depth_dim - - - \c__letgutbanner_GUTenberg_yoffset_dim -} -\end{lstlisting} -Determining the vertical jump (\(s\)) between the letters in the word “LETTRE” -with the constraints that: -\begin{itemize} -\item the top of the 1st letter (“L”) is \(3e/2\) below the top of the area (where -\(e\) is the common vertical space separating the letters of the word -“LETTRE”), -\item the baseline of the last letter (“E”) is merged with the bottom of the area, -\item this jump must not be less than 20 \% of the common height \(h\) to all these -letters i.e.: - -\lstinline+\g__letgutbanner_largest_LETR_box_height_dim+ - -otherwise the size of the largest of these boxes is reduced to less than the -width of the text embedded in the “L”. -\end{itemize} - -The sum of : -\begin{itemize} -\item the 5 vertical spaces (\(5e\)) between the letters in the word “LETTRE”, -\item the 6 common heights (\(6h\)) to all these letters, -\item \(3e/2\), -\end{itemize} -must equal the height (\(H\)) of the zone. So we have \(H=3e/2+5e+6h\), that is -\(e=2(H-6h)/13\). Once initialized, the vertical jump between the letters is -\(s=e+h\) that is \(s=(2H+h)/13\). Therefore: - -\begin{enumerate} -\item Determine the vertical half-space between the letters. -\begin{lstlisting} -\dim_set:Nn \l_tmpa_dim { - ( - \g__letgutbanner_area_height_dim - - - 6\g__letgutbanner_largest_LETR_box_height_dim - )/13 -} -\end{lstlisting} -\item Vertical space between letters. -\begin{lstlisting} -\dim_gset:Nn \g__letgutbanner_between_letters_vertical_space_dim { - 2\l_tmpa_dim -} -\end{lstlisting} -\item If this space does not check the condition explained above, we reduce: - -\lstinline+\g__letgutbanner_banner_vertical_contents_width_dim+ - -and loop. -\begin{lstlisting} -\dim_gsub:Nn \g__letgutbanner_banner_vertical_contents_width_dim { - 1pt - } -} -\end{lstlisting} -\end{enumerate} -The width allocated to the text embedded in the vertical bar of the “L” may have -been re-evaluated, so the padding (which must be symmetrical) may have changed -as well. -\begin{lstlisting} -\dim_gset:Nn \g__letgutbanner_banner_padding_dim { - ( - \c__letgutbanner_banner_thickness_dim - - - \g__letgutbanner_banner_vertical_contents_width_dim - )/2 -} -\end{lstlisting} -\begin{enumerate} -\item Determination of the vertical offset of the 1st letter (“L”). -\begin{lstlisting} -\dim_const:Nn \c__letgutbanner_first_letter_yoffset_dim { - \g__letgutbanner_La_yoffset_dim - - - \g__letgutbanner_largest_LETR_box_height_dim - - - \fp_use:N \c__letgutbanner_leading_La_factor_fp - \g__letgutbanner_between_letters_vertical_space_dim -} -\end{lstlisting} -\item Determination of the vertical jump between letters. -\begin{lstlisting} -\dim_gset:Nn \g__letgutbanner_between_letters_yoffset_dim { - \g__letgutbanner_between_letters_vertical_space_dim - + - \g__letgutbanner_largest_LETR_box_height_dim -} -\end{lstlisting} -\end{enumerate} -Resize the box containing “g” to the width of the text. -\begin{lstlisting} -\box_gresize_to_wd:Nn \g__letgutbanner_g_box { - \c__letgutbanner_textwidth_dim -} -\end{lstlisting} -Calculates the size by which the height of the text box on the 1st page must be -reduced so that the banner does not encroach on the text. Relative to the top of -the page: -\begin{itemize} -\item the top of the horizontal bar of “L” is at a distance equal to the sum of : -\begin{itemize} -\item the distance between this top of page and the top of the vertical bar of -“L”, equal to the height (\(p\)) of the paper minus the height (\(l\)) of “L” -\end{itemize} -\end{itemize} -\begin{lstlisting} -\dim_gset:Nn \g__letgutbanner_first_page_shrink_dim { - \c__letgutbanner_tmargin_dim - + - \c__letgutbanner_textheight_dim - + - \c__letgutbanner_banner_thickness_dim - - - .5\paperheight - - - .5\c__letgutbanner_banner_height_dim - + - .5\baselineskip -} -\end{lstlisting} -Automatic addition on the 1st page (only) of the banner. -\begin{lstlisting} -\AddToHookNext{shipout/background}{ -\end{lstlisting} -We want the material added to this page to be not selectable in order to let the -reader who wants to copy the interesting text be able to select it. -\begin{lstlisting} -\BeginAccSupp{ActualText={}} -\end{lstlisting} -We put now the big “L” at the right place. -\begin{lstlisting} -\put( -.5\c__letgutbanner_lmargin_dim-.5\c__letgutbanner_banner_thickness_dim -, --.5\paperheight-.5\c__letgutbanner_banner_height_dim -){ - \put(0,0){ - \rule{ - \c__letgutbanner_banner_width_dim - }{ - \c__letgutbanner_banner_thickness_dim - } - } - \put(0,0){ - \rule{ - \c__letgutbanner_banner_thickness_dim - }{ - \c__letgutbanner_banner_height_dim - } - } -\end{lstlisting} -The color should not be systematically white, but should be identical to the one -chosen for the page background. -\begin{lstlisting} - % \color_fill:nV {rgb}{ \g__letgutbanner_pagecolor_clist } - \color[rgb]{ \g__letgutbanner_pagecolor_clist } - \put( - \g__letgutbanner_banner_padding_dim - , - \g__letgutbanner_La_yoffset_dim - ){ - \box_use:N \g__letgutbanner_La_box - } - \put( - \g__letgutbanner_banner_padding_dim - , - \c__letgutbanner_first_letter_yoffset_dim - -0\g__letgutbanner_between_letters_yoffset_dim - ){ - \box_use:N \g__letgutbanner_L_box - } - \put( - \g__letgutbanner_banner_padding_dim - , - \c__letgutbanner_first_letter_yoffset_dim - -1\g__letgutbanner_between_letters_yoffset_dim - ){ - \box_use:N \g__letgutbanner_E_box - } - \put( - \g__letgutbanner_banner_padding_dim - , - \c__letgutbanner_first_letter_yoffset_dim - -2\g__letgutbanner_between_letters_yoffset_dim - ){ - \box_use:N \g__letgutbanner_T_box - } - \put( - \g__letgutbanner_banner_padding_dim - , - \c__letgutbanner_first_letter_yoffset_dim - -3\g__letgutbanner_between_letters_yoffset_dim - ){ - \box_use:N \g__letgutbanner_T_box - } - \put( - \g__letgutbanner_banner_padding_dim - , - \c__letgutbanner_first_letter_yoffset_dim - -4\g__letgutbanner_between_letters_yoffset_dim - ){ - \box_use:N \g__letgutbanner_R_box - } - \put( - \g__letgutbanner_banner_padding_dim - , - \c__letgutbanner_first_letter_yoffset_dim - -5\g__letgutbanner_between_letters_yoffset_dim - ){ - \box_use:N \g__letgutbanner_E_box - } - \put( - \c__letgutbanner_banner_thickness_dim - , - \c__letgutbanner_GUTenberg_yoffset_dim - ){ - \box_use:N \g__letgutbanner_GUTenberg_box - } - % \color_fill:n {black!10} - \color{ black!10 } - \put( - .5\c__letgutbanner_lmargin_dim+.5\c__letgutbanner_banner_thickness_dim - , - .5\paperheight - + - .5\c__letgutbanner_banner_height_dim - - - \c__letgutbanner_tmargin_dim - ){ - \box_move_down:nn {.5\c__letgutbanner_textheight_dim} - {\box_use:N \g__letgutbanner_g_box} - } -} -\end{lstlisting} -We end the part which isn't selectable. -\begin{lstlisting} -\EndAccSupp{} -} -\end{lstlisting} - -We close \lstinline+\AddToHook{begindocument}+. - -\begin{lstlisting} -} -\end{lstlisting} - -If the package is used with another class than \class{letgut}, we reduce the -textheight of the first page of the height of the horizontal bar of the “L”. - -\begin{lstlisting} -\@ifclassloaded{letgut}{ -}{ - \AddToHook{begindocument/end}{% - \enlargethispage{ - - \g__letgutbanner_first_page_shrink_dim - } - \thispagestyle{empty} - } -} -\end{lstlisting} - -\section{Example file (\texttt{letgut-banner-example.tex})} -\label{sec:org4c5e60d} - -\begin{lstlisting} -\documentclass[twoside]{article} -\usepackage{fontspec} -\usepackage[a4paper]{geometry} -\usepackage{fancyhdr} -\usepackage{letgut-banner} -\usepackage{lipsum} -\setmainfont{TeX Gyre Schola} -\fancyhf{} -\fancyhead[RO,LE]{\thepage} -\fancyhead[RE,LO]{Test~\textsf{letgut-banner}} -\pagestyle{fancy} -\begin{document} -\lipsum[1-20] -\end{document} -\end{lstlisting} -\end{document} diff --git a/macros/luatex/latex/letgut/doc/letgut-code.pdf b/macros/luatex/latex/letgut/doc/letgut-code.pdf Binary files differindex 12da2cdac8..57cc0c3ae0 100644 --- a/macros/luatex/latex/letgut/doc/letgut-code.pdf +++ b/macros/luatex/latex/letgut/doc/letgut-code.pdf diff --git a/macros/luatex/latex/letgut/doc/letgut-code.tex b/macros/luatex/latex/letgut/doc/letgut-code.tex deleted file mode 100644 index 672935a5fb..0000000000 --- a/macros/luatex/latex/letgut/doc/letgut-code.tex +++ /dev/null @@ -1,3361 +0,0 @@ -% Created 2022-03-22 mar. 11:24 -% Intended LaTeX compiler: lualatex -\documentclass{letgut} - \setmainfont{KpRoman} -\setsansfont{KpSans} -\setmonofont[Scale = MatchLowercase]{RobotoMono} -\letgutsetup{editorial=false} -\input{listings-conf} -\author{Association GUTenberg} -\date{\today} -\title{Support for the newsletter “La Lettre GUTenberg”} -\begin{document} - - -\section{Identification} -\label{sec:org4c9ba67} - -\begin{lstlisting} -% This is file `letgut.cls', -% generated with the Emacs Org-babel utility. -% -% The original source file is letgut.org -% -% -------:| ---------------------------------------------------- -% letgut:| Class for the newsletter “La Lettre GUTenberg” -% Author:| Association GUTenberg -% E-mail:| secretariat@gutenberg.eu.org -% License:| Released under the LaTeX Project Public License -% | v1.3c or later -% See:| http://www.latex-project.org/lppl.txt -% -% Copyright (C) 1994-2022 by Association GUTenberg -% <secretariat@gutenberg.eu.org> -% -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License (LPPL), either -% version 1.3c of this license or (at your option) any later -% version. The latest version of this license is in the file: -% -% http://www.latex-project.org/lppl.txt -% -% This work is “maintained” (as per LPPL maintenance status) -% by Association GUTenberg. -% -\end{lstlisting} - -\section{Debugging} -\label{sec:org09b0cd2} - -\begin{lstlisting} -% \RequirePackage[ -% , check-declarations -% , enable-debug -% , backend=luatex -% ]{expl3} -\end{lstlisting} - -\section{Implementation} -\label{sec:orga99a9b5} - -These document classes can only be used with \LaTeXe, so we make -sure that an appropriate message is displayed when another \TeX{} -format is used. - -\begin{lstlisting} -\NeedsTeXFormat{LaTeX2e}[2020-10-01] -\end{lstlisting} - -We define some constant token lists immediately useful. - -\begin{lstlisting} -\ExplSyntaxOn -\tl_const:Nn \c__letgut_Lettre_tl { \emph{ Lettre } } -\tl_const:Nn \c__letgut_gutenberg_tl { GUTenberg } -\tl_const:Nn \c__letgut_Lettre_gutenberg_tl { - \c__letgut_Lettre_tl~\c_space_tl \c__letgut_gutenberg_tl -} -\tl_const:Nn \c__letgut_la_lettre_gutenberg_tl { - la~ \c__letgut_Lettre_gutenberg_tl -} -\tl_const:Nn \c__letgut_La_lettre_gutenberg_tl { - \text_titlecase_first:n \c__letgut_la_lettre_gutenberg_tl -} -\ExplSyntaxOff -\end{lstlisting} - -Now, we can announce the class name and its version: - -\begin{lstlisting} -\ProvidesExplClass{letgut} -{2022-03-22} -{0.9.1} -{ - Class~ for~ the~ newsletter~ - “\c__letgut_La_lettre_gutenberg_tl” -} -\end{lstlisting} - -\subsection{Messages} -\label{sec:org447090b} - -We specify the messages come from a class, which is letgut (see -\url{https://github.com/latex3/latex3/issues/887}). - -\begin{lstlisting} -\prop_gput:Nnn \g_msg_module_type_prop { letgut } { Class } -\end{lstlisting} - -Some messages are declared for future use. - -\begin{lstlisting} -\msg_new:nnn{letgut}{Wrong~engine}{ - The~ letgut~ class~ requires~ LuaTeX.\\\\ - You~ must~ change~ your~ typesetting~ engine~ to~ - “lualatex”~ instead~ of~ “latex”~ or~ “pdflatex” - or~ “xelatex”. -} -\msg_new:nnn{letgut}{Existing~command}{ - The~ command~ \c_backslash_str \text_lowercase:n{#1}~ - already~ exists~ and~ has~ not~ be~ overwritten~ by~ - \token_to_str:N \letgutacro{#1}{...}.~ - The~ corresponding~ acronym~ has~ to~ be~ used~ e.g.~ - like~ this:~ - \token_to_str:N \ac{ \text_lowercase:n{#1} }. -} -\msg_new:nnn{letgut}{Not~month~iso~date}{ - The~ supplied~ date~(“#1”)~ isn't~ at~ the~ month~ iso~ - date~ format~ (YYYY-MM):~ it~ will~ be~ printed~ as~ - it~ is. -} -\msg_new:nnn{letgut}{Banner~file~not~provided}{ - No~ `\c__letgut_banner_file_tl.pdf'~ file~ provided:~ - the~ banner~ will~ be~ automatically~ created. -} -\msg_new:nnn{letgut}{Editorial~file~missing}{ - File~`\c__letgut_editorial_file_tl.tex'~missing!~ - The~ editorial~ will~ be~ missing. -} -\msg_new:nnn{letgut}{Informations~file~missing}{ - File~ `\c__letgut_informations_gutenberg_file_tl.tex'~ - missing!~ The~ informations~ about~ - \c__letgut_gutenberg_tl\c_space_tl~ will~ be~ missing. -} -\msg_new:nnn{letgut}{pagecolor~inoperative~with~paper~option}{ - The~ `pagecolor=#1`~ option~ is~ inoperative~ with~ the~ `paper`~ - option:~ the~ color~ of~ the~ page~ will~ remain~ white. -} -\msg_new:nnn{letgut}{frontcover-missing}{ - You~ didn't~ use~ the~ `frontcover`~ option~ for~ the~ - bookreview~ “#1”,~ so~ the~ book~ cover~image~ will~ be~ missing:~ - are~ you~ sure? -} -\msg_new:nnn{letgut}{frontcover-file-not-found}{ - The~ book~ cover~ image~ `#2`~ you~ specified~ via~ the~ - `frontcover`~ option~ for~ the~ bookreview~ “#1”~ cannot~ be~ found. -} -\end{lstlisting} - -\subsection{Engine checking} -\label{sec:org5711d86} - -\begin{lstlisting} -\sys_if_engine_luatex:F { - \msg_fatal:nn{letgut}{Wrong~engine} -} -\end{lstlisting} - -\subsection{Declarations} -\label{sec:orga63e6a8} - -\subsubsection{Booleans} -\label{sec:orge5b5c6b} - -\begin{itemize} -\item For testing the emptyness of the title. -\begin{lstlisting} -\bool_new:N \g__letgut_title_empty_bool -\end{lstlisting} -\item For the paper (or not) output. -\begin{lstlisting} -\bool_new:N \g__letgut_paper_bool -\end{lstlisting} -\item For testing whether we currently are in a footnote or not. -\begin{lstlisting} -\bool_new:N \l__letgut_in_footnote_bool -\end{lstlisting} -\end{itemize} - -\subsubsection{Dimensions} -\label{sec:org61842b5} - -\begin{itemize} -\item Geometry of the document -\begin{lstlisting} -\dim_const:Nn \c__letgut_textheight_dim { 25cm } -\dim_const:Nn \c__letgut_textwidth_dim { 14cm } -\dim_const:Nn \c__letgut_lmargin_dim { 5cm } -\dim_const:Nn \c__letgut_tmargin_dim { 2.92cm } -% \dim_const:Nn \c__letgut_tmargin_dim { 3cm } -\dim_const:Nn \c__letgut_head_dim { 0.6cm } -\dim_const:Nn \c__letgut_headsep_dim { 0.82cm } -% \dim_const:Nn \c__letgut_headsep_dim { 0.9cm } -\dim_const:Nn \c__letgut_marginparwidth_dim { 3.74cm } -\end{lstlisting} -\item Horizontal offset of the headers and the sections titles: -\begin{lstlisting} -\dim_const:Nn \c__letgut_hoffset_dim { 3cm } -\dim_const:Nn \c__letgut_title_hoffset_dim { - -\c__letgut_hoffset_dim -} -\dim_const:Nn \c__letgut_subtitle_hoffset_dim { - \c__letgut_title_hoffset_dim -} -\dim_const:Nn \c__letgut_section_hoffset_dim { - \c__letgut_title_hoffset_dim + 1cm -} -\dim_const:Nn \c__letgut_subsection_hoffset_dim { - \c__letgut_title_hoffset_dim + 1.5cm -} -\dim_const:Nn \c__letgut_subsubsection_hoffset_dim { - \c__letgut_title_hoffset_dim + 2cm -} -\dim_const:Nn \c__letgut_paragraph_hoffset_dim { - \c__letgut_title_hoffset_dim + 2.5cm -} -\dim_const:Nn \c__letgut_subparagraph_hoffset_dim { - \c__letgut_title_hoffset_dim + 3cm -} -\end{lstlisting} -\item Distance between the baseline of the header text and the decorative line: -\begin{lstlisting} -\dim_const:Nn \c__letgut_head_rule_skip_dim { 0.115cm } -\end{lstlisting} -\item Head rule width: -\begin{lstlisting} -\dim_const:Nn \c__letgut_head_rule_width_dim { 0.03cm } -\end{lstlisting} -\item Dimensions of the banner. -\begin{itemize} -\item Thickness of the “L”. -\begin{lstlisting} -\dim_const:Nn \c__letgut_banner_thickness_dim { 4cm } -\end{lstlisting} -\item Height of the “L” (that of the text area plus 3cm). -\begin{lstlisting} -\dim_const:Nn \c__letgut_banner_height_dim { - \c__letgut_textheight_dim - + - 3cm -} -\end{lstlisting} -\end{itemize} -\item Height of the membership reminder box. -\begin{lstlisting} -\dim_new:N \g__letgut_membership_reminder_box_height_dim -\end{lstlisting} -\item Horizontal space for the frontcover in the margin in book reviews. -\begin{lstlisting} -\dim_const:Nn \c__letgut_bookreview_frontcover_margin_sep_dim { - 4mm - } -\end{lstlisting} -\item Dimensions used by the listings and the examples. -\end{itemize} -\begin{lstlisting} -\dim_const:Nn \c__letgut_height_mentions_dim { 5mm } -\dim_const:Nn \c__letgut_from_left_boundingbox_to_text_dim { 5.5mm } -\dim_const:Nn \c__letgut_number_offset_dim { 1mm } -\dim_const:Nn \c__letgut_number_sep_dim { - \c__letgut_from_left_boundingbox_to_text_dim - + - \c__letgut_number_offset_dim -} -\end{lstlisting} - -\subsubsection{Skips (lengths with rubber components)} -\label{sec:orgbda0ae2} - -The following skips, borrowed from the standard classes, are specified in -\lstinline+ex+ unit, which depends on the font used and hence have to be specified -after the class has been loaded; in fact, we postpone this at the end of the -preamble, when the font is specified (thanks to \lstinline+\setmainfont+). - -\begin{lstlisting} -\AddToHook{begindocument/before}{% -\end{lstlisting} - -Before and after: - -\begin{itemize} -\item “titles titles”: -\begin{lstlisting} -\skip_const:Nn \c__letgut_before_title_title_skip -{ - 3.5ex plus 1ex minus .2ex -} -\skip_const:Nn \c__letgut_after_title_title_skip -{ - 2.3ex plus .2ex -} -\end{lstlisting} -\item subtitles titles: -\begin{lstlisting} -\skip_const:Nn \c__letgut_before_subtitle_title_skip -{ - \c__letgut_before_title_title_skip -} -\skip_const:Nn \c__letgut_after_subtitle_title_skip -{ - \c__letgut_after_title_title_skip -} -\end{lstlisting} -\item sections titles: -\begin{lstlisting} -\skip_const:Nn \c__letgut_before_section_title_skip -{ - 3.25ex plus 1ex minus .2ex -} -\skip_const:Nn \c__letgut_after_section_title_skip -{ - 1.5ex plus .2ex -} -\end{lstlisting} -\item subsections titles (identical to the sections ones): -\begin{lstlisting} -\skip_const:Nn \c__letgut_before_subsection_title_skip -{ - \c__letgut_before_section_title_skip -} -\skip_const:Nn \c__letgut_after_subsection_title_skip -{ - \c__letgut_after_section_title_skip -} -\end{lstlisting} -\item paragraphs titles: -\begin{lstlisting} -\skip_const:Nn \c__letgut_before_subsubsection_title_skip -{ - 1.5ex plus .5ex minus .2ex -} -\skip_const:Nn \c__letgut_after_subsubsection_title_skip -{ - 0.75ex plus 0.1ex -} -\end{lstlisting} -\item paragraphs titles (identical to the subsubsection ones): -\begin{lstlisting} -\skip_const:Nn \c__letgut_before_paragraph_title_skip -{ - \c__letgut_before_subsubsection_title_skip -} -\skip_const:Nn \c__letgut_after_paragraph_title_skip -{ - \c__letgut_after_subsubsection_title_skip -} -\end{lstlisting} -\item subparagraphs titles (identical to the paragraph ones): -\begin{lstlisting} -\skip_const:Nn \c__letgut_before_subparagraph_title_skip -{ - \c__letgut_before_paragraph_title_skip -} -\skip_const:Nn \c__letgut_after_subparagraph_title_skip -{ - \c__letgut_after_paragraph_title_skip -} -\end{lstlisting} -\end{itemize} - -We close the \lstinline+\AddToHook{begindocument/before}+ argument. - -\begin{lstlisting} -} -\end{lstlisting} - - -\subsubsection{Integers} -\label{sec:orgb3e9382} -\begin{lstlisting} -\int_new:N \g__letgut_ltx_example_int -\end{lstlisting} - -\subsubsection{Strings} -\label{sec:orgdd18dd8} - -\begin{lstlisting} -\str_new:N \g__letgut_label_ltx_example_str -\str_new:N \g__letgut_callout_label_ltx_example_str -\str_const:Nn \c__letgut_label_ltx_example_str { - __letgut_label_ltx_example -} -\str_const:Nn \c__letgut_callout_label_ltx_example_str { - __letgut_callout_label_ltx_example -} -\end{lstlisting} - -\subsubsection{Token lists} -\label{sec:orgaf6d8ec} - -\begin{enumerate} -\item Constant ones -\label{sec:orgb1ea800} - -\begin{lstlisting} -\tl_const:Nn \c__letgut_cahier_tl { \emph{ Cahier } } -\tl_const:Nn \c__letgut_cahiers_tl { - \c__letgut_cahier_tl \emph{ s } -} -\tl_const:Nn \c__letgut_tugboat_tl { \emph{ TUGboat } } -\tl_const:Nn \c__letgut_banner_file_tl { bandeau } -\tl_const:Nn \c__letgut_editorial_file_tl { editorial } -\tl_const:Nn \c__letgut_informations_gutenberg_file_tl { - informations-gut -} -\tl_const:Nn \c__letgut_acronyms_file_tl { letgut-acronyms } -\tl_const:Nn \c__letgut_local_config_file_tl { localconf } -\tl_const:Nn \c__letgut_contents_name_tl { Sommaire } -\tl_const:Nn \c__letgut_draftwatermark_text_tl { - \textnormal{Brouillon} -} -\tl_const:Nn \c__letgut_membership_reminder_tl { - {\LARGE - \bfseries - Avez-vous~ pensé~ à~ régler~ votre~ cotisation~ ? - % \the\year~ ? - \par - \medskip - } - Si~ vous~ avez~ oublié,~ ce~ n'est~ ni~ trop~ tard~ - ni~ difficile~ : - \par - \url{http://gutenberg.eu.org/?Adherer-en-ligne} - \bool_if:NT \g__letgut_informations_bool { - \file_if_exist:nT - {./\c__letgut_informations_gutenberg_file_tl}{ - \par - Voir~ aussi~ page~ \pageref{letgut_label_adhesions}. - } - } -} -\tl_const:Nn \c__letgut_missing_editorial_tl { - Ne~ pas~ omettre~ l'éditorial~ !\\(à~ faire~ figurer~ - dans~ un~ \file*{\c__letgut_editorial_file_tl.tex}~ - dans~ le~ dossier~ courant) -} -\tl_const:Nn \c__letgut_missing_infomations_tl { - Ne~ pas~ omettre~ les~ informations~ sur~ - \c__letgut_gutenberg_tl{}~ !\\(dans~ un~ - \file*{\c__letgut_informations_gutenberg_file_tl.tex}~ - situé~ dans~ le~ dossier~ courant) -} -\tl_const:Nn \c__letgut_default_alert_box_color_tl { - gray9 -} -\tl_const:Nn \c__letgut_default_allcolors_links_color_tl -{ - teal!60!black -} -\end{lstlisting} - -\item Variables ones -\label{sec:org4c5e60d} - -\begin{lstlisting} -\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 -\end{lstlisting} -\end{enumerate} - -\subsubsection{Comma separated lists} -\label{sec:org158b7a3} - -\begin{lstlisting} -\clist_new:N \g__letgut_pagecolor_clist -\clist_const:Nn \c__letgut_default_pagecolor_screen_clist -{1.0, 0.98, 0.94} -\clist_const:Nn \c__letgut_default_pagecolor_paper_clist -{1, 1, 1} -\end{lstlisting} - -\subsubsection{Sequences} -\label{sec:orgaa04440} - -\begin{lstlisting} -\seq_new:N \l__letgut_first_last_names_items_seq -\end{lstlisting} - -\subsection{Class options} -\label{sec:orgef3017c} - -In order to provide class options, we load the \package{l3keys2e} which provides -\LaTeXe{} option processing using \LaTeX3 keys: - -\begin{lstlisting} -\RequirePackage{l3keys2e} -\end{lstlisting} - -We define the 2 load time options for the target audience: - -\begin{itemize} -\item \lstinline+for-readers+ (the default), for the “normal” “Lettre”, -\item \lstinline+for-authors+, (only) the author(s) of an article of the “Lettre”. -\end{itemize} - -\begin{lstlisting} -\keys_define:nn { letgut } -{ - , 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 -} -\ProcessKeysOptions { letgut } -\end{lstlisting} - -\subsection{Class and package loading} -\label{sec:org464c4b7} - -The \letgutcls{} is based on the \lstinline+article+ class. It is by default two sided -because of the alternating headers, and will by typeset with \lstinline+11pt+ as global -font size. - -\begin{lstlisting} -\LoadClass[twoside,11pt]{article} -\end{lstlisting} - -We now load some packages. - -\begin{itemize} -\item The \letgutcls{} will have to be used with LuaLaTeX. Hence the font selection -package for XeLaTeX and LuaLaTeX. -\begin{lstlisting} -\RequirePackage{fontspec} -\end{lstlisting} -\item For subliminal refinements towards typographical perfection. -\begin{lstlisting} -\RequirePackage[ -, stretch=30 -, shrink=25 -, letterspace=150 -]{microtype} -\end{lstlisting} -\item Help in implementing paragraph layouts where the paragraphs are separated by -a vertical space instead of (or in addition to) indenting them. -\begin{lstlisting} -\RequirePackage{parskip} -\end{lstlisting} -\item Extensive control of page headers and footers in \LaTeXe. -\begin{lstlisting} -\RequirePackage{fancyhdr} -\end{lstlisting} -\item Flexible and complete interface to document dimensions. -\begin{lstlisting} -\RequirePackage[a4paper]{geometry} -\end{lstlisting} -\item Enhanced support for graphics. -\begin{lstlisting} -\RequirePackage{graphicx} -\end{lstlisting} -\item Extending the array and tabular environments. -\begin{lstlisting} -\RequirePackage{array} -\end{lstlisting} -\item Completely customisable TOCs. -\begin{lstlisting} -\RequirePackage{etoc} -\end{lstlisting} -\item Control layout of itemize, enumerate, description, and design our own lists. -\begin{lstlisting} -\RequirePackage{enumitem} -\end{lstlisting} -\item Select alternative section titles. -\begin{lstlisting} -\RequirePackage{titlesec} -\end{lstlisting} -\item Several logos and ornaments. -\begin{lstlisting} -\RequirePackage{fourier-orns} -\end{lstlisting} -\item Control float placement. -\begin{lstlisting} -\RequirePackage[section,above]{placeins} -\end{lstlisting} -\item Sophisticated verbatim text. -\begin{lstlisting} -\RequirePackage{fancyvrb} -\end{lstlisting} -\item Publication quality tables in \LaTeX{}. -\begin{lstlisting} -\RequirePackage{booktabs} -\end{lstlisting} -\item Context sensitive quotation facilities. -\begin{lstlisting} -\RequirePackage{csquotes} -\end{lstlisting} -\item Mathematical tools to use with (and which loads) \package{amsmath}. -\begin{lstlisting} -\RequirePackage[fleqn]{mathtools} -\end{lstlisting} -\item Better accessibility support for PDF files. This package is used because we -want the material added to the background (banner on the first page and draft -watermark) to be not selectable in order to let the reader who wants to copy -the interesting text be able to select it. -\end{itemize} -\begin{lstlisting} -\RequirePackage{accsupp} -\end{lstlisting} -\begin{itemize} -\item A comprehensive (SI) units package. -\begin{lstlisting} -\RequirePackage{siunitx} -\end{lstlisting} -\item A collection of logos with bookmark support. -\begin{lstlisting} -\RequirePackage{hologo} -\end{lstlisting} -\item Driver-independent color extensions. -\begin{lstlisting} -\RequirePackage[table]{xcolor} -\end{lstlisting} -\item Coloured boxes, for \LaTeX{} examples and theorems, etc. -\begin{lstlisting} -\RequirePackage{tcolorbox} -\end{lstlisting} -\item Expandable macros to extract the data from references and allow counter -assignments or calculations. -\begin{lstlisting} -\RequirePackage{refcount} -\end{lstlisting} -\item Select colors with proper WCAG color contrast. -\begin{lstlisting} -\RequirePackage{ninecolors} -\end{lstlisting} -\item Typeset tabulars and arrays with LaTeX3 (for the alert boxes typeset as -simple tabulars). -\begin{lstlisting} -\RequirePackage{tabularray} -\end{lstlisting} -\item Multilingual support for Plain \TeX{} or \LaTeX{}. -\begin{lstlisting} -\RequirePackage[english,french]{babel} -\end{lstlisting} -\item Intelligent page references. -\begin{lstlisting} -\RequirePackage[nospace,french]{varioref} -\end{lstlisting} -\item Macros for Euro sign. -\begin{lstlisting} -\RequirePackage[right]{eurosym} -\end{lstlisting} -\item Typeset source code listings using \LaTeX{}. -\begin{lstlisting} -\RequirePackage{listings} -\end{lstlisting} -\item Modifying the layout of floats. -\begin{lstlisting} -\RequirePackage{floatrow} -\end{lstlisting} -\item Sophisticated Bibliographies in \LaTeX{}. -\begin{lstlisting} -\RequirePackage[ - sorting=none, - datamodel=letgut, - citestyle=letgut -]{biblatex} -\end{lstlisting} -\item Typeset acronyms. -\begin{lstlisting} -\RequirePackage{acro} -\end{lstlisting} -\end{itemize} - -The following packages have to be the last ones loaded. So we ensure this by -loading them just before the begining of the document: -\begin{lstlisting} -\AddToHook{begindocument/before}{ -\end{lstlisting} -\begin{itemize} -\item Extensive support for hypertext in \LaTeX{} -\begin{lstlisting} -\RequirePackage{hyperref} -\end{lstlisting} -\item Adjusting the anchors of captions -\begin{lstlisting} -\RequirePackage[all]{hypcap} -\end{lstlisting} -\item Intelligent cross-referencing -\begin{lstlisting} -\RequirePackage[french]{cleveref} -\end{lstlisting} -\end{itemize} -We close the \lstinline+\AddToHook{begindocument/before}+ argument. -\begin{lstlisting} -} -\end{lstlisting} - -\subsection{Settings for the loaded packages} -\label{sec:orgbefd239} - -\begin{itemize} -\item We switch to the French typographic conventions for \package{siunitx}. -\begin{lstlisting} -\sisetup{ - , locale=FR - , mode=text -} -\end{lstlisting} -\item Concerning floats, we ask: -\begin{itemize} -\item the caption text will be justified, -\item the figures and their captions to be boxed (in order to distiguish them from -the current text), -\item the tables to have their captions above them. -\begin{lstlisting} -\DeclareMarginSet{hangleft}{ - \setfloatmargins{\hskip-\c__letgut_hoffset_dim}{\hfil} -} -\DeclareFloatVCode{__letgut_ruleabove}{ - \par\rule{\hsize}{.8pt}\vskip4pt\par - } -\DeclareFloatVCode{__letgut_rulebelow}{ - \par\vskip2pt\rule{\hsize}{.8pt}\par -} -\DeclareFloatStyle{__letgut_ruled}{ - precode=__letgut_ruleabove, - postcode=__letgut_rulebelow, - % heightadjust=all, - floatwidth=.8\linewidth -} -\floatsetup{objectset=justified} -\floatsetup[figure]{ - style=__letgut_ruled, - margins=hangleft, - capposition=beside, - capbesideposition={top,left}, - floatwidth=0.85\textwidth -} -\floatsetup[table]{capposition=top} -\end{lstlisting} -\end{itemize} -Moreover, the tables will be entitled \enquote{tableau} instead of -\enquote{table}. -\begin{lstlisting} -\renewcommand*\frenchtablename{Tableau} -\end{lstlisting} -\item We fix some defaults for the listings : we define a style for all the listings -which resets all the \TeX{} control sequences/keywords and then load all the -basic (La)\TeX{} dialects of \TeX{}. But we start with a dialect which is missing in -the \package*{listings}. -\begin{lstlisting} -\lstdefinelanguage[classes]{TeX}[LaTeX]{TeX}{% - % Control sequences - moretexcs={% - abovecaptionskip,abstractname,appendix,appendixname, - arraycolsep,arrayrulewidth,author,backmatter,baselinestretch, - belowcaptionskip,bf,bibindent,bibname,bigskipamount, - bottomfraction,brokenpenalty,cal,chapter,chaptermark, - chaptername,clubpenalty,columnsep,columnseprule,contentsname, - date,dblfloatpagefraction,dblfloatsep,dbltextfloatsep, - dbltopfraction,descriptionlabel,displaywidowpenalty, - doublerulesep,evensidemargin,fboxrule,fboxsep,figurename, - floatpagefraction,floatsep,footins,footnoterule,footnotesep, - footnotesize,footskip,frontmatter,headheight,headsep,huge,Huge, - indexname,indexspace,interlinepenalty,intextsep,it,jot, - labelenumi,labelenumii,labelenumiii,labelenumiv,labelitemfont, - labelitemi,labelitemii,labelitemiii,labelitemiv,labelsep, - labelwidth,large,Large,LARGE,leftmargin,leftmargini, - leftmarginii,leftmarginiii,leftmarginiv,leftmarginv, - leftmarginvi,lineskip,listfigurename,listoffigures, - listoftables,listtablename,mainmatter,maketitle,marginparpush, - marginparsep,marginparwidth,maxdepth,medskipamount,mit, - newblock,normallineskip,normalsize,oddsidemargin,paragraph, - paragraphmark,parindent,parskip,part,partname,partopsep, - postdisplaypenalty,predisplaypenalty,refname,rm,sc,scriptsize, - section,sectionmark,sf,sl,small,smallskipamount,subitem, - subparagraph,subparagraphmark,subsection,subsectionmark, - subsubitem,subsubsection,subsubsectionmark,tabbingsep, - tabcolsep,tablename,tableofcontents,textfloatsep,textfraction, - textheight,textwidth,thechapter,theenumi,theenumii,theenumiii, - theenumiv,theequation,theparagraph,thepart,thesection, - thesubparagraph,thesubsection,thesubsubsection,tiny,title, - today,topfraction,topmargin,topskip,tt,widowpenalty, - },% - % 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]{% - abstract,description,figure,quotation,quote,table, - thebibliography,theindex,titlepage,verse% - },% - % 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]{% - a0poster,aalok,aastex631,abntex2,achemso,acmart,acmconf, - active-conf,adfathesis,afparticle,afthesis,aguplus,aiaa-tc, - akklecture,akkscript,akktecdoc,akletter,myletter,ametsoc, - amsart,amsbook,amsdtx,amsldoc,amsproc,aomart,apa,apa6, - apa6e,apa7,arabart,arabbook,arabrep,arabrep1,articleingud, - asaetr,ascelike,asmeconf,asmejour,assignment,aucklandthesis, - bangorcsthesis,bangorexam,barticle,bbook,bletter, - bankstatement,article,book,letter,ltnews,ltxdoc,ltxguide, - minimal,proc,report,slides,source2edoc,basque-book,beamer, - beamerswitch,beaulivre,beilstein,argetabelle,bewerbung, - bgteubner,BHCexam,bitart,bitbook,bjfuthesis,BMSTU-IU8, - bookcover,bookest,bookshelf,br-lex,brandeis-dissertation, - brandeis-problemset,brandeis-thesis,buctcover,buctthesis, - bxjsarticle,bxjsbook,bxjsreport,bxjsslide,cascadilla,cd, - cd-cover,articoletteracdp,letteracdp,cesenaexam,cheatsheet, - chemmacros-manual,chletter,cje,cnbwp,cnltx-doc,codedoc, - colorart,colorbook,combine,cc,ConcProg,confproc,contracard, - courseoutline,coursepaper,cquthesis,csbulletin,csbulobalka, - csbulv1,ctexart,ctexbeamer,ctexbook,ctexrep,ctxdoc,curve, - cv4tw,cweb,idcc,ijdc-v14,ijdc-v9,dinbrief,disser,gost732, - dithesis,droit-fr,dtk,dvdcoll,easybook,ebsthesis,agecon, - ajae,apecon,ecca,erae,itaxpf,jrurstud,njf,oegatb,pocoec, - regstud,worlddev,ecv,einfart,ejpecp,elbioimp,elegantbook, - elegantnote,elegantpaper,elpres,cas-dc,cas-sc,elsarticle, - elteikthesis,emisa,emulateapj,erdc,eskd,eskdgraph,eskdtab, - eskdtext,estcpmm,europasscv,europecv,exam,exam-n,examdesign, - exesheet,extarticle,extbook,extletter,extproc,extreport, - facsimile,factura,fancyhandout,fancyslides,fbithesis,fcavtex, - fdudoc,fduthesis-en,fduthesis,fei,ffslides,fithesis, - fithesis2,fithesis3,fithesis4,flacards,flashcards,frletter, - g-brief,g-brief2,gaceta,gammas,gatech-thesis,gmdocc, - gradstudentresume,grant-afosr,grant-aro,grant-darpa,grant-doe, - grant-nih,grant-nrl,grant-nsf,grant-onr,grant,graphpaper, - gridslides,gsemthesis,guitartabs,gzt,gztarticle,h2020proposal, - hgbarticle,hgbreport,hgbthesis,harnon-cv,hausarbeit-jura, - hcart,hcletter,hcreport,hcslides,hecthese,hepthesis,hitec, - hithesis,hitreport,hitszthesis,hletter,hpsdiss,fsbispit, - huawei,hustthesis,icsv,IEEEconf,IEEEtran,ijmart,ijsra, - image-gallery,IMTEKda,inkpaper,invoice-class,iodhbwm,iscram, - isov2,isodoc,iwhdp,jacow,jlreq,jmlr,jmlrbook,jnuexam,jpsj2, - jura,jurabook,juraovw,juraurtl,kdgcoursetext,kdgmasterthesis, - kdpcover,kerntest,kluwer,knittingpattern,scrartcl,scrarticle, - scrbook,scrdoc,scrletter,scrlttr2,scrreport,scrreprt,komacv, - oblivoir-utf,oblivoir-xl,oblivoir,xoblivoir,ksp-thesis,l3doc, - labbook,leadsheet,leaflet,lebhart,lectures,letgut,lettre,limap, - limecv,lion-msc,lni,lps,lt3graph-packagedoc,ltxdockit, - ltxguidex,abstbook,beletter,flashcard,iagproc,cours,fiche, - matapli,matc3mem,mcmthesis,ltxmdf,medstarbeamer,meetingmins, - memoir,mensa-tex,mentis,metanorma,milog,minimart,minimbook, - mla,mluexercise,mnras,moderncv,modernposter,msu-thesis, - mucproc,mugsthesis,muling,musuos,muthesis,third-rep,mwart, - mwbk,mwrep,mycv,nature,ncc,nccproc,sibjnm,nddiss2e, - ndsu-thesis,newlfm,nih,nihbiosketch,njurepo,nlctdoc,nostarch, - nrc1,nrc2,artikel1,artikel2,artikel3,boek,boek3,brief, - rapport1,rapport3,nwejm,nwejmart,octavo,onrannual, - oup-authoring-template,journal,paper,papertex,pbsheet,pecha, - petiteannonce,philosophersimprint,pittetd,pkuthss,plari,play, - postcards,powerdot,FUpowerdot,ppr-prv,pracjourn,pressrelease, - proposal,reporting,dfgproposal,dfgreporting,euproposal, - eureporting,prosper,protocol,prtec,upmgr,wkmgr,pst-doc, - ptptex,qcm,quantumarticle,qyxf-book,ReadableCV,recipe, - RecipeBook,recipecard,refart,refrep,resphilosophica,revtex4-2, - revtex4,revtex4-1,rtklage,ryersonSGSThesis,ryethesis,sageep, - sapthesis,schuleab,schulein,schuleit,schulekl,schuleub, - schuleue,schullsg,schullzk,schulma-ab,schulma-gutachten, - schulma-klausur,schulma-komp,schulma-mdlprf,schulma-praes, - schwalbe,sciposter,screenplay,scrjrnl,sdapsclassic,sduthesis, - seminar,semproc,sesamanuel,seuthesix,sffms,cassete,etiketka, - shtthesis,caesar_book,sides,simplecv,simplivre,skbarticle, - skbbeamer,skbbook,skblncsbeamer,skblncsppt,skbmoderncv,skdoc, - skeyval-testclass,skrapport,smfart,smfbook,SPhdThesis,spie, - sr-vorl,sslides,stage,standalone,usthesis,hwexam,mikoslides, - omdoc,smglom,subfiles,suftesi,sugconf,tabriz-thesis,talk, - tcldoc,tclldoc,powersem,thesis-ekf,thesis-gwu,thuthesis, - tikz-kalender,tikzposter,tlc-article,TOPletter,toptesi, - tudabeamer,tudaexercise,tudaleaflet,tudaletter,tudaposter, - tudapub,tudasciposter,tudscrartcl,tudscrbook,tudscrdoc, - tudscrmanual,tudscrposter,tudscrreprt,tufte-book,tufte-handout, - ltugboat,ltugproc,tui,turabian,turabian-researchpaper, - turabian-thesis,my-thesis,ua-thesis,uafthesis, - uantwerpenbamathesis,uantwerpencoursetext,uantwerpenexam, - uantwerpenletter,uantwerpenphdthesis,uantwerpenreport, - ucalgmthesis,ucbthesis,ucdavisthesis,ucsmonograph,ucthesis, - udesoftec,uebungsblatt,uestcthesis,uhhassignment,uiucredborder, - uiucthesis,ulthese,legislation,umich-thesis,umthesis, - unam-thesis,unifith,unitn-bimrep,univie-ling-expose, - univie-ling-paper,univie-ling-thesis,univie-ling-wlg, - unizgklasa,uothesis,UoWthesis,upmethodology-document,URbeamer, - URletter,uspatent,ut-thesis,utexasthesis,uwmslide,uwthesis, - verifica,webquiz,willowtreebook,withargs-packagedoc, - wsemclassic,xduthesis,xebaposter,xmuthesis,xsim-manual, - yaletter,yathesis,ycbook,ydoc,york-thesis, - },% - otherkeywords={},% - alsoletter={0123456789-},% - alsodigit={},% - sensitive% -}[keywords,tex,comments]% -\end{lstlisting} - -\begin{lstlisting} -\lstdefinestyle{__letgut_all_reset}{ - basicstyle=\ttfamily, - language=TeX,% - texcs={},% - keywords={},% - keywords=[2]{},% - keywords=[3]{},% - keywords=[4]{},% - keywords=[5]{},% - otherkeywords={},% - alsoletter={},% - alsodigit={},% - alsolanguage=[AlLaTeX]TeX,% - alsolanguage=[LaTeX]TeX,% - alsolanguage=[plain]TeX,% - alsolanguage=[common]TeX,% - alsolanguage=[primitive]TeX,% - alsolanguage=[classes]TeX,% -\end{lstlisting} -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 zero length. -\begin{lstlisting} -belowskip=0pt, -} -\lstset{ - style=__letgut_all_reset -} -\end{lstlisting} -This style is applied automatically at the beginning of each \lstinline+\input+ -file. Hence, the keywords defined in a previous file (by loading some -peticular (La)\TeX{} dialects, i.e. control sequences and keywords specific to -some class or packages) won't interfere with the ones of the current file. -\begin{lstlisting} -\AddToHook{cmd/input/before}{ - \lstset{% - style=__letgut_all_reset,% - } -} -\end{lstlisting} -\item The \lstinline+\printbibliography+ command is redefined in order its \lstinline+heading+ is by -default set to \lstinline+subbibliography+. -\begin{lstlisting} -\NewCommandCopy{\__letgut_old_printbibliography}{ - \printbibliography -} -\RenewDocumentCommand {\printbibliography} { O{} } { - \phantomsection - \__letgut_old_printbibliography[#1] -} -\end{lstlisting} - For printing the bibliography, we define two new bibheadings for the -structure levels \lstinline+\title+ and \lstinline+\subtitle+. -\begin{lstlisting} -\defbibheading{title}[\refname]{% - \title{#1}} -\defbibheading{subtitle}[\refname]{% - \subtitle{#1}} -\end{lstlisting} -\item The acronyms will be typset in footnote, with small caps shape. When they are -(English) foreign, it will be specified and the translation will be added. -\begin{lstlisting} -\acsetup{ - first-style=footnote, - format/short = {\scshape}, - format/foreign = {\em}, - foreign/display, - locale/format = {\upshape}, - locale/display, -} -\end{lstlisting} - Moreover, we redefine the private macro \lstinline+\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). -\begin{lstlisting} -\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 -} -\end{lstlisting} - -The following settings for packages that have to be the last ones loaded are -also done just before the begining of the document. -\end{itemize} - -\begin{lstlisting} -\AddToHook{begindocument/before}{ -\end{lstlisting} - -\begin{itemize} -\item We want the hyperlinks to be as unobtrusive as possible. -\begin{lstlisting} -\bool_if:NTF \g__letgut_paper_bool { - \hypersetup{draft} -}{ - \hypersetup{% - colorlinks,% - allcolors={letgut_allcolors_links},% - }% -} -\end{lstlisting} - -A preset of acronyms is input (if found). -\begin{lstlisting} -\file_if_exist:nT {\c__letgut_acronyms_file_tl}{ - \file_input:n {\c__letgut_acronyms_file_tl} -} -\end{lstlisting} - -\item Depending on some chosen class options, some packages have to be loaded, -notably before \package*{hyperref} is loaded, and actions are taken -accordingly. -\begin{itemize} -\item If the `draft` mode (default) is on, we load the \package*{lua-typo} which -highlights typographical flaws with LuaLaTeX. For the moment, - -the \package*{lua-typo} isn't loaded since the `luacolor` -package it loads - -currently does not work well in \lstinline+shipout/background+ (see -\url{https://github.com/ho-tex/luacolor/issues/4}). -\begin{lstlisting} -% % \bool_if:NF \g__letgut_paper_bool { -\bool_if:NT \g__letgut_draft_bool { - % \RequirePackage[All]{lua-typo} - \AddToHook{shipout/background} - { - \__letgut_unselectable:n { - \put(0.5\paperwidth,-0.5\paperheight) - { - \Huge -\end{lstlisting} -Currently, we can't use \package{l3color}'s \lstinline+\color_fill:n+\footnote{See \url{https://github.com/ho-tex/luacolor/issues/4\#issuecomment-848774260}.} -and we have to rely on \package{xcolor}'s \lstinline+\color+. -\begin{lstlisting} -% \color_fill:n {black!10} -\color{black!10} -\hbox_set:Nn \l_tmpa_box { - \fontsize{0.25\paperwidth}{0.3\paperwidth} - \selectfont - \c__letgut_draftwatermark_text_tl -} -\hbox_set:Nn \l_tmpb_box { - \hbox_overlap_center:n { - \box_use:N \l_tmpa_box - } -} -\end{lstlisting} -The draft watermak is rotated in order to be parallely slanted to the first -diagonal of the page (angle \(=\arctan(\text{paper height}/\text{paper - width})\)). -\begin{lstlisting} -\box_rotate:Nn \l_tmpb_box { - \fp_eval:n { - atand ( - \dim_to_fp:n {\paperheight} - / - \dim_to_fp:n {\paperwidth} - ) - } -} -\box_use:N \l_tmpb_box -} -} -} -\end{lstlisting} - Moreover, we want all the overfull boxes to be shown (as with -\lstinline+draft+ option of the standard classes). -\begin{lstlisting} -\setlength\overfullrule{5pt} -} -% % } -\end{lstlisting} -\end{itemize} -\end{itemize} - -We close the \lstinline+\AddToHook{begindocument/before}+ argument. - -\begin{lstlisting} -} -\end{lstlisting} - -\subsection{Date handling} -\label{sec:org5c102e6} - -\begin{lstlisting} -\int_new:N \g__letgut_date_month_int -\int_new:N \g__letgut_date_year_int - -\int_gset:Nn \g__letgut_date_month_int {\the\month} -\int_gset:Nn \g__letgut_date_year_int {\the\year} - -\tl_new:N \g__letgut_date_month_tl -\tl_new:N \g__letgut_date_tl - -\cs_new_protected:Npn \__letgut_date_parse:n #1 -{ - \__letgut_if_is_iso_date:nTF {#1} - { - \__letgut_date_parse:www #1 \q_stop - }{ - \msg_term:nnn{letgut}{Not~month~iso~date}{#1} - \tl_gset:Nn \g__letgut_date_tl { #1 } - } -} - -\prg_new_protected_conditional:Npnn -\__letgut_if_is_iso_date:n #1 { T, F, TF } -{ - \regex_match:nnTF { ^\d{4}-(\d{1,2}) } {#1} - { \prg_return_true: } - { \prg_return_false: } -} - -\prg_new_protected_conditional:Npnn -\__letgut_if_is_int:n #1 { T, F, TF } -{ - \regex_match:nnTF { ^[\+\-]?[\d]+$ } {#1} - { \prg_return_true: } - { \prg_return_false: } -} - -\cs_new_protected:Npn \__letgut_month_name:n #1 -{ - % \text_titlecase_first:n { - \int_case:nnF - { #1 } - { - { 1 }{ janvier } - { 2 }{ février } - { 3 }{ mars } - { 4 }{ avril } - { 5 }{ mai } - { 6 }{ juin } - { 7 }{ juillet } - { 8 }{ août } - { 9 }{ septembre } - { 10 }{ octobre } - { 11 }{ novembre } - { 12 }{ décembre } - } - { Month~ Error! } - % } -} - -\cs_new_protected:Npn \__letgut_date_parse:www #1-#2 -\q_stop -{ - \int_compare:nTF - { - \the\year <= #1 <= \the\year+1 -\end{lstlisting} - -\begin{lstlisting} -}{ - \int_gset:Nn \g__letgut_date_year_int {#1} -}{ - \int_gset:Nn \g__letgut_date_year_int {\the\year} -} -\__letgut_if_is_int:nTF {#2} -{ - \int_compare:nTF - { - 1 <= #2 <= 12 -\end{lstlisting} - -\begin{lstlisting} - } - {\int_gset:Nn \g__letgut_date_month_int {#2}} - {\int_gset:Nn \g__letgut_date_month_int {\the\month}} - }{ - \int_gset:Nn \g__letgut_date_month_int {\the\month} - } - \tl_gset:Nn \g__letgut_date_month_tl { - \__letgut_month_name:n { \g__letgut_date_month_int } - } - \tl_gset:Nn \g__letgut_date_tl { - \tl_use:N \g__letgut_date_month_tl - \c_space_tl - \int_use:N \g__letgut_date_year_int - } -} -\end{lstlisting} - -\subsection{Page color default settings} -\label{sec:orgbdbe3de} - -By default, the page color will be the one linked to the \lstinline+screen+ option. - -\begin{lstlisting} -\pagecolor[rgb]{\c__letgut_default_pagecolor_screen_clist} -\clist_set_eq:NN \g__letgut_pagecolor_clist - \c__letgut_default_pagecolor_screen_clist -\end{lstlisting} - -\subsection{Options} -\label{sec:orgc4ef889} - -These options look to need to be specified rather at the end (throws an error if -defined before the \lstinline+\__letgut_date_parse:n+'s definition): - -\begin{itemize} -\item \lstinline+number+ for the number of the issue, -\item \lstinline+date+ for the date of the issue, either empty (hence the current (month) -date) or at the format \lstinline+YYYY-MM+ or as free input, -\item \lstinline+pagecolor+ (relevant only with the (default) \lstinline+screen+ load time option) for -a color of the page other than the default one, -\item \lstinline+membership-reminder+ that typesets a membership reminder on the first page, -\end{itemize} - -\begin{lstlisting} -\keys_define:nn { letgut/setup } -{ - , draft .bool_gset:N = \g__letgut_draft_bool - , draft .initial:n = { true } - , draft .default:n = { true } - , final .bool_gset_inverse:N = \g__letgut_draft_bool - , number .int_gset:N = \g__letgut_number_int - , date .code:n = { \__letgut_date_parse:n { #1 } } - , date .initial:x = {\the\year-\the\month} - , paper .code:n = { - \bool_gset_true:N \g__letgut_paper_bool - \pagecolor[rgb]{\c__letgut_default_pagecolor_paper_clist} - \clist_set_eq:NN \g__letgut_pagecolor_clist - \c__letgut_default_pagecolor_paper_clist - } - , screen .bool_gset_inverse:N = \g__letgut_paper_bool - , pagecolor .initial:V - = \c__letgut_default_pagecolor_screen_clist - , pagecolor .code:n = { - \definecolor{letgut_pagecolor}{rgb}{#1} - \AddToHook{begindocument/before} - { - \bool_if:NTF \g__letgut_paper_bool { - \msg_warning:nnn{letgut}{ - pagecolor~inoperative~with~paper~option - }{#1} - }{ - \clist_gset:Nn \g__letgut_pagecolor_clist { #1 } - \pagecolor[rgb]{#1} - } - } - } - , allcolorslinks .code:n = { - \colorlet{letgut_allcolors_links}{#1}} - , allcolorslinks .initial:V - = \c__letgut_default_allcolors_links_color_tl - , membership-reminder .bool_gset:N - = \g__letgut_membership_reminder_bool - , membership-reminder .initial:n = { true } - , editorial .bool_gset:N = \g__letgut_editorial_bool - , editorial .initial:n = { true } - , informations .bool_gset:N = \g__letgut_informations_bool - , informations .initial:n = { true } -} -\end{lstlisting} - -\subsection{Headers} -\label{sec:org0244c68} - -We now define the headers. - -\begin{itemize} -\item The distance between the baseline of the header text and the decorative line -in the header is made a little bit bigger. -\begin{lstlisting} -\renewcommand{\headruleskip}{ - \c__letgut_head_rule_skip_dim -} -\end{lstlisting} -\item The decorative line width in the header is made a little bit bigger. -\begin{lstlisting} -\renewcommand{\headrulewidth}{ - \c__letgut_head_rule_width_dim -} -\end{lstlisting} -\item The headers alternate between even and odd pages. -\begin{lstlisting} -\fancyhf{} -\fancyhead[RO,LE]{\thepage} -\fancyhead[RE,LO]{\g__letgut_mark_tl} -\end{lstlisting} -\item The headers are left offset -\begin{lstlisting} -\fancyheadoffset[L]{\c__letgut_hoffset_dim} -\end{lstlisting} -\item We load the default \package{fancyhdr}'s page style -\begin{lstlisting} -\pagestyle{fancy} -\end{lstlisting} -\end{itemize} - -\subsection{Marginal notes} -\label{sec:org56c8ec1} -We want the marginal notes to be in the left margin. - -\begin{lstlisting} -\reversemarginpar -\end{lstlisting} - -\subsection{Table of contents} -\label{sec:org861e968} - -The table of contents is customized: - -\begin{itemize} -\item only the titles of the articles are shown (but the bookmarks have their natural depth): -\end{itemize} -\begin{lstlisting} -\etocsetnexttocdepth{0} -\end{lstlisting} -\begin{itemize} -\item layout: -\begin{lstlisting} -\etocsetstyle {section} -{} -{\leavevmode\leftskip 2cm\relax} -{\normalsize% - \etocname~\dotfill~\etocpage\par -} -{} -\end{lstlisting} -\item its title is dropped: -\end{itemize} -\begin{lstlisting} -\renewcommand*\frenchcontentsname{} -\end{lstlisting} - -\subsection{Geometry of the document} -\label{sec:org282c9ab} - -\begin{lstlisting} -\geometry{ - asymmetric, - textheight=\c__letgut_textheight_dim, - textwidth=\c__letgut_textwidth_dim, - lmargin=\c__letgut_lmargin_dim, - tmargin=\c__letgut_tmargin_dim, - head=\c__letgut_head_dim, - headsep=\c__letgut_headsep_dim, - marginparwidth=\c__letgut_marginparwidth_dim, - % verbose, - % showframe -} -\end{lstlisting} - -\subsection{Alert box} -\label{sec:org1d5f02b} - -\begin{lstlisting} -\cs_new_protected:Nn \__letgut_alert_box:nn -{ - \noindent - \begin{tblr}{ - width=\linewidth, - rowspec={Q[c,m,#1]}, - colspec={| -\end{lstlisting} - -\begin{lstlisting} - >{\bfseries}X| - }, - vlines, - hlines, - rowsep=2.5mm, - colsep=2.5mm - } - #2 - \end{tblr} - \skip_vertical:N \c_zero_dim -} -\end{lstlisting} - -\subsection{“Title” and marks} -\label{sec:org7f25fee} - -We redefine \lstinline+\@title+ in order to make it empty. Hence we can later test if -the \lstinline+\title+ has been populated by the user (thanks to \lstinline+\title+) and, if so, -we will (automatically) display on the first page and headers the provided -title instead of the number and the date (see below). -\begin{lstlisting} -\tl_gclear:N \@title -\end{lstlisting} - -At the end of preamble, we put the \lstinline+\@title+ (empty or populated by the -user) into \lstinline+\g__letgut_@title_str+ for later tests. -\begin{lstlisting} -\AddToHook{begindocument/before} -{ - \str_set_eq:NN \g__letgut_@title_str \@title -\end{lstlisting} - -The number is added only if it is - -\(>0\). - -\begin{lstlisting} -\tl_gset:Nn \g__letgut_title_tl { - \int_compare:nNnT - \g__letgut_number_int -\end{lstlisting} - -\begin{lstlisting} - > \c_zero_int - {numéro~ \int_use:N\g__letgut_number_int{}~ --~ } - \g__letgut_date_tl - } - \str_if_empty:NTF \g__letgut_@title_str { - \tl_gset:Nn \g__letgut_mark_tl { - \textit{\c__letgut_La_lettre_gutenberg_tl} - } - }{ - \tl_gset:Nn \g__letgut_mark_tl { - \g__letgut_@title_str - } - } - \tl_gput_right:Nn \g__letgut_mark_tl { - ,~\g__letgut_title_tl - } -} -\end{lstlisting} - -\subsection{First page handling} -\label{sec:org30496fe} - -The first page is special as it should automatically contain certain elements: -\begin{itemize} -\item the banner, -\item either the number and the date of the issue, or a given title, -\item the table of contents, -\item the editorial, -\item the membership reminder. -\end{itemize} - -The first page is inserted only is the target audience is the readers of the -Lettre. - -\begin{lstlisting} -\bool_if:NT \g__letgut_for_readers_bool { -\end{lstlisting} - -\begin{lstlisting} -\file_if_exist:nTF {\c__letgut_banner_file_tl.pdf}{ - \AddToHookNext{shipout/background} - { - \begin{picture}(0,0) - \put(-2cm,-25.275cm){ - \includegraphics[scale=0.96]{ - \c__letgut_banner_file_tl.pdf - } - } - \end{picture} - } -}{ -\end{lstlisting} - -The \lstinline+pagecolor+ option is possibly set (with \lstinline+\AddToHook{begindocument/before}+) -and the page color chosen has to be used for the letters of the banner so the -following code has to be postponed after the former (hence here -\lstinline+\AddToHook{begindocument}+ and with \lstinline+\AddToHook{begindocument/before}+). - -\begin{lstlisting} - \msg_term:nn{letgut}{Banner~file~not~provided} - \RequirePackage[pagecolor={\g__letgut_pagecolor_clist}]{ - letgut-banner - } -} -\end{lstlisting} - -Here starts what is automatically added at the beginning of the document. - -\begin{lstlisting} -\AddToHook{begindocument/end} -{ -\end{lstlisting} - -\begin{itemize} -\item If a membership reminder is asked, we create an (alert) box containing the -corresponding text and reduce the textheight of this page of the height of -this box. -\begin{lstlisting} -\bool_if:NT \g__letgut_membership_reminder_bool { - \box_new:N \g__letgut_membership_reminder_box - \vbox_gset:Nn \g__letgut_membership_reminder_box { - \alertbox []{ \c__letgut_membership_reminder_tl } - } - \dim_gset:Nn - \g__letgut_membership_reminder_box_height_dim { - \box_ht:N \g__letgut_membership_reminder_box - } - \enlargethispage{ - - \g__letgut_membership_reminder_box_height_dim - } -} -\end{lstlisting} -\item We want the text on the first page to not encroach on the horizontal bar of -the banner. -\begin{lstlisting} -\dim_const:Nn \c__letgut_first_page_shrink_dim { - \c__letgut_banner_thickness_dim - + - \c__letgut_tmargin_dim - + - \c__letgut_textheight_dim - - - .5\paperheight - - - .5\c__letgut_banner_height_dim -} -\enlargethispage{ - - \c__letgut_first_page_shrink_dim -} -\enlargethispage{ - - \baselineskip -} -\end{lstlisting} -\item If the user has specified a title, we make a (our own) title and use it and -the possibly provided author(s) for the metadata of the PDF; otherwise we -display the number and the date of the newsletter. -\begin{lstlisting} -\str_if_empty:NTF \g__letgut_@title_str { - \bool_gset_true:N \g__letgut_title_empty_bool - \begin{flushright} - \Huge - \text_titlecase_first:n { \g__letgut_title_tl } - \end{flushright} - \hypersetup{ - pdftitle={ - \c__letgut_Lettre_gutenberg_tl - \int_compare:nNnT - \g__letgut_number_int -\end{lstlisting} -\end{itemize} - -\begin{lstlisting} - > \c_zero_int - { - \c_space_tl~ \int_use:N \g__letgut_number_int - } - }, - pdfauthor={ - Association~ - \c__letgut_gutenberg_tl - \c_space_tl - (éditeur) - }, - } - \vspace*{1cm} -}{ - \hypersetup{ - pdftitle={\g__letgut_@title_str} - } - \tl_if_empty:NF \@author { - \hypersetup{ - pdfauthor={\@author} - } - } -\end{lstlisting} -Here, we insert the title, but don't rely on \lstinline+\maketitle+ because it -lets to \lstinline+\relax+ the command \lstinline+\title+ which is used later as new sectionning -levels for the titles of the articles of the Lettre. So we emulate the -intersting part of the \lstinline+\maketitle+ command (borrowed from \file{article.cls}). -\begin{lstlisting} -\null -\vskip 2em% -\begin{center}% - \let \footnote \thanks - {\LARGE \@title \par}% - \vskip 1.5em% - {\large - \lineskip .5em% - \begin{tabular}[t]{c}% - \@author - \end{tabular}\par}% - \vskip 1em% - {\large \@date}% -\end{center}% -\par -\vskip 1.5em -} -\end{lstlisting} -\begin{itemize} -\item No headers on the first page. This has to be inserted after the previous -(customized) \lstinline+\maketitle+ since this command inserts a \lstinline+\newpage+ which would -ruin the effort of \lstinline+\thispagestyle{empty}+ if inserted before. -\begin{lstlisting} -\thispagestyle{empty} -\end{lstlisting} -\item The table of contents is automatically added and has a bookmark entry. -\begin{lstlisting} -\pdfbookmark[1]{ - \c__letgut_contents_name_tl -}{ - \c__letgut_contents_name_tl -} -\tableofcontents -\end{lstlisting} -Should a title be displayed, the table of contents would be added after it, -followed by a new page (otherwise, if \lstinline+\title+ used after \lstinline+\begin{document}+ -sees its title on the front page, it will overflow onto the banner). -\begin{lstlisting} -\bool_if:NTF \g__letgut_title_empty_bool { - \vspace*{1.5cm} -}{ - \newpage -} -\end{lstlisting} -\item Conditionally to the fact the \lstinline+editorial+ option is not set to \lstinline+false+: if the -\file*{editorial.tex} of the editorial is found, its content is input and -has a bookmark entry; otherwise, a warning is displayed. -\begin{lstlisting} -\bool_if:NTF \g__letgut_editorial_bool { - \file_if_exist:nTF {./\c__letgut_editorial_file_tl}{ - \RenewDocumentCommand\author{ m } { - \__letgut_author:n { #1 } - } - \pdfbookmark[1]{Éditorial}{ - \c__letgut_editorial_file_tl - } - \file_input:n {./\c__letgut_editorial_file_tl} - % % \int_set:N \l_tmpa_int {\pagenumber} - % % \int_compare:nNnT \l_tmpa_int = 1 { \newpage } -\end{lstlisting} -\end{itemize} - -\begin{lstlisting} - % \if\count{\pagenumber}>1 - % \else - % \newpage - % \fi - }{ - \msg_warning:nn{letgut}{Editorial~file~missing} - \alertbox{ \c__letgut_missing_editorial_tl } - \newpage - } -}{ - % \newpage -} -\end{lstlisting} - -We close the \lstinline+\AddToHook{begindocument/end}+ argument. - -\begin{lstlisting} -} -\end{lstlisting} - -Membership reminder. - -\begin{lstlisting} -\AddToHook{begindocument}{ - \bool_if:NT \g__letgut_membership_reminder_bool { - \AddToHookNext{shipout/background} - { - \put(1in,-1in){ - \put( - \oddsidemargin, - - \topmargin - - \headheight - - \headsep - - \textheight - + \c__letgut_first_page_shrink_dim - + .5\baselineskip - ){ - \box_use:N \g__letgut_membership_reminder_box - } - } - } - } -} -\end{lstlisting} - -\subsection{Last page handling} -\label{sec:org4d6bc37} - -The last page is special: it should automatically contain some informations about -\gutenberg. - -\begin{lstlisting} -\AddToHook{enddocument} -{ -\end{lstlisting} -Conditionally to the fact the \lstinline+informations+ option is not set to \lstinline+false+: if the -\file*{informations-gut.tex} which contains the informations about -\gutenberg. Otherwise, a warning is displayed. -\begin{lstlisting} -\bool_if:NT \g__letgut_informations_bool { - \clearpage - \phantomsection - \file_if_exist:nTF - {./\c__letgut_informations_gutenberg_file_tl}{ - \file_input:n {./\c__letgut_informations_gutenberg_file_tl} - }{ - \msg_warning:nn{letgut}{Informations~file~missing} - \alertbox{ \c__letgut_missing_infomations_tl } - } -} -\end{lstlisting} - -We close the \lstinline+\AddToHook{enddocument}+ argument. - -\begin{lstlisting} -} -\end{lstlisting} - -We close the boolean which tests whether the target audience is the readers or -the author(s) of the “Lettre”. - -\begin{lstlisting} -} -\end{lstlisting} - -\subsection{Sections, subsections, etc.} -\label{sec:org4d2fa9d} - -\subsubsection{Numbering} -\label{sec:orge3d86f9} -We want all the sections to be unnumbered. - -\begin{lstlisting} -\setcounter{secnumdepth}{-10} -\end{lstlisting} - -\subsubsection{Format} -\label{sec:org36330f3} - -\begin{itemize} -\item We create the new level \lstinline+\title+ for the titles of the articles. They are -displayed uppercased. -\begin{lstlisting} -\AddToHook{begindocument/before}{% - \titleclass{\title}{straight}[\part] - \titleformat{\title}{ - \normalfont - \LARGE - \bfseries - \text_uppercase:n - }{}{1em}{ - \aldineleft\c_space_tl - }{} - \etocsetlevel{title}{0} - \def\toclevel@title{0}% - \etocsetstyle {title} - {} - { - \leavevmode\leftskip 2cm\relax - } - {\mdseries\normalsize - \etocname - \nobreak\leaders\hbox~ to~ 1ex{\hss.}\hfill - \etocpage - \par} - {} -\end{lstlisting} -\item We also create the new level \lstinline+\subtitle+ for the subtitles of the -articles. They are dispayed uppercased (but in a smaller size than \lstinline+\title+). -\begin{lstlisting} -\titleclass{\subtitle}{straight}[\title] -\titleformat{\subtitle}{ - \normalfont - \Large - \bfseries - \text_uppercase:n -}{}{1em}{}{} -\etocsetlevel{subtitle}{1} -\def\toclevel@subtitle{1}% -\def\toclevel@subtitle{1} -\end{lstlisting} -\item By default (that is when \lstinline+\subtitle+ is not used), the toc levels of the -sections, subsections, etc. are set to \lstinline+1+, \lstinline+2+, etc. But, when \lstinline+\subtitle+ is -used, since this level has toc level \lstinline+1+, the toc levels of the sections, -subsections, etc. have to be set to \lstinline+2+, \lstinline+3+, etc. And this has to be reset -each time \lstinline+\title+ and \lstinline+\subtitle+ are used. -\begin{lstlisting} -\AddToHook{cmd/title/before}{ - \etocsetlevel{section}{1} - \def\toclevel@section{1}% - \etocsetlevel{subsection}{2} - \def\toclevel@subsection{2}% - \etocsetlevel{subsubsection}{3} - \def\toclevel@subsubsection{3}% - \etocsetlevel{paragraph}{4} - \def\toclevel@paragraph{4}% - \etocsetlevel{subparagraph}{5} - \def\toclevel@subparagraph{5}% -} -\AddToHook{cmd/subtitle/before}{ - \etocsetlevel{section}{2} - \def\toclevel@section{2}% - \etocsetlevel{subsection}{3} - \def\toclevel@subsection{3}% - \etocsetlevel{subsubsection}{4} - \def\toclevel@subsubsection{4}% - \etocsetlevel{paragraph}{5} - \def\toclevel@paragraph{5}% - \etocsetlevel{subparagraph}{6} - \def\toclevel@subparagraph{6}% -} -\end{lstlisting} - -\begin{itemize} -\item The (sub)paragraphs have the usual format, except that they are not -“runin” (\package{titlesec}'s package's terminology). -\end{itemize} -\begin{lstlisting} - \titleformat{\paragraph}{ - \normalfont - \normalsize - \bfseries - }{\theparagraph}{1em}{} - \titleformat{\subparagraph}{ - \normalfont - \normalsize - \bfseries - }{\thesubparagraph}{1em}{} -} -\end{lstlisting} -\item We modify the spacing, mainly by shifting the titles in the left margin (the -rest is borrowed from the standard classes). -\begin{lstlisting} -\titlespacing*{\title} -{\c__letgut_title_hoffset_dim} -{\c__letgut_before_title_title_skip} -{\c__letgut_after_title_title_skip} -\titlespacing*{\subtitle} -{\c__letgut_subtitle_hoffset_dim} -{\c__letgut_before_subtitle_title_skip} -{\c__letgut_after_subtitle_title_skip} -\titlespacing*{\section} -{\c__letgut_section_hoffset_dim} -{\c__letgut_before_section_title_skip} -{\c__letgut_after_section_title_skip} -\titlespacing*{\subsection} -{\c__letgut_subsection_hoffset_dim} -{\c__letgut_before_subsection_title_skip} -{\c__letgut_after_subsection_title_skip} -\titlespacing*{\subsubsection} -{\c__letgut_subsubsection_hoffset_dim} -{\c__letgut_before_subsubsection_title_skip} -{\c__letgut_after_subsubsection_title_skip} -\titlespacing*{\paragraph} -{\c__letgut_paragraph_hoffset_dim} -{\c__letgut_before_paragraph_title_skip} -{\c__letgut_after_paragraph_title_skip} -\titlespacing*{\subparagraph} -{\c__letgut_subparagraph_hoffset_dim} -{\c__letgut_before_subparagraph_title_skip} -{\c__letgut_after_subparagraph_title_skip} -\end{lstlisting} -\end{itemize} - -\subsection{Document commands} -\label{sec:orga7db03b} - -\subsubsection{Setup} -\label{sec:org35e852f} - -We define the command that lets us specify the newsletter setup. - -\begin{lstlisting} -\NewDocumentCommand \letgutsetup { m } { - \keys_set:nn { letgut/setup } { #1 } -} -\end{lstlisting} - -\subsubsection{For the rubric dedicated to new stuffs appeared on \acs{ctan}} -\label{sec:orga18e077} - -\begin{itemize} -\item We create a new type of list, dedicated to the new stuffs (classes, packages, -etc.) on CTAN and similar to a description list (except the label provided in -the optional argument of \lstinline+\item+ is automatically an argument of the -\lstinline+\package+ command). -\begin{lstlisting} -\cs_new_protected:Nn \__letgut_ctan_news_item:n { - \package{#1}~: -} -\newlist{ctannews}{description}{1} -\setlist[ctannews]{format=\__letgut_ctan_news_item:n} -\end{lstlisting} -The stuffs created by French speaking people are highlighted in a special -way and, for this, a starred variant of the \lstinline+\item+ command is provided. We -insert a systematic \lstinline+\phantomsection+ in order the cross-references to such -items are correct. -\begin{lstlisting} -\cs_new_protected:Npn \__letgut_item:nn #1 #2 -{ - \tl_if_empty:nTF {#2} - { - \__letgut_old_item - }{ - \__letgut_old_item[#2] - } - \phantomsection - \IfBooleanT {#1}{ - \mbox{}\marginpar[\mbox{}\hfill\francophony]{} - } -} -\NewCommandCopy{\__letgut_old_item}{\item} -\RenewDocumentCommand {\item} { s O{} } { - \__letgut_item:nn {#1}{#2} -} -\end{lstlisting} -\end{itemize} -\begin{itemize} -\item Command that inserts the \enquote{francophony} logo. -\begin{lstlisting} -\NewDocumentCommand {\francophony} { } { - \raisebox{-1.5pt}{ - \includegraphics[width=\f@size pt]{ - letgut-francophony-icon - } - } -} -\end{lstlisting} -\end{itemize} - -\subsubsection{Persons and authors} -\label{sec:org73bd77f} - -For both persons and authors, the argument of: -\begin{itemize} -\item a single individual is given as: -\begin{itemize} -\item \meta{Last name}, \meta{First name} -\item and possibly \meta{Last name}, \meta{First name}, \meta{Title} -\end{itemize} -\item multiple individuals, the schemes for each of the individuals are the same of -a single one, separated by a semicolon. -\end{itemize} - -\begin{lstlisting} -\NewDocumentCommand {\person} { m } { - \__letgut_process_list:n {#1} -} -\cs_new_protected:Npn \__letgut_author:n #1 -{ - \nopagebreak - \begin{flushright} - \__letgut_process_list:n {#1} - \end{flushright} -} -\AddToHook{begindocument/end}{% - \RenewDocumentCommand\author{ m } { - \__letgut_author:n { #1 } - } -} -\end{lstlisting} - -In the following \lstinline+\__letgut_titlecase_name+ control sequence, we parse last and -first names, splitting and unsplitting them at spaces and dashes (\lstinline+-+) with -titlecasing in between. - -\begin{lstlisting} -\cs_new_protected:Npn \__letgut_titlecase_name:n #1 -{ - \seq_set_split:Nnn \l_tmpa_seq { - } {#1} - \seq_set_map_x:NNn \l_tmpb_seq \l_tmpa_seq { - \text_titlecase_first:n{ \text_lowercase:n {##1} } - } - \tl_set:Nx \l_tmpa_tl {\seq_use:Nn \l_tmpb_seq {-}} - \seq_clear:N \l_tmpa_seq - \seq_set_split:NnV \l_tmpa_seq { ~ } { \l_tmpa_tl } - \seq_set_map_x:NNn \l_tmpb_seq \l_tmpa_seq { - \text_titlecase_first:n{##1} - } - \seq_use:Nn \l_tmpb_seq {~} -} -\end{lstlisting} - -The following control sequence splits a semi-colon separated list and each item -is splitted as a comma separated list. - -\begin{lstlisting} -\cs_new_protected:Nn \__letgut_person_last_name:n -{ - {\scshape \__letgut_titlecase_name:n {#1}} -} -\cs_new_protected:Nn \__letgut_person_first_name_last_name:nn -{ - \__letgut_titlecase_name:n {#1} - \c_space_tl - \__letgut_person_last_name:n {#2} -} -\cs_new_protected:Nn -\__letgut_person_first_name_last_name_title:nnn -{ - \__letgut_person_first_name_last_name:nn {#1} {#2} - \c_space_tl - (#3) -} -\seq_new:N \l__letgut_items_seq -\cs_new_protected:Npn \__letgut_process_list:n #1 -{ - \seq_clear:N \l__letgut_items_seq - \seq_set_split:Nnn \l_tmpa_seq {and} {#1} - \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 - \seq_pop_left:NN \l_tmpb_seq \l_letgut_first_name_tl - \seq_pop_left:NN \l_tmpb_seq \l_letgut_title_tl - \seq_put_right:Nx \l__letgut_items_seq { - \quark_if_no_value:NTF \l_letgut_first_name_tl { - \__letgut_person_last_name:n { - \l_letgut_last_name_tl - } - }{ - \quark_if_no_value:NTF \l_letgut_title_tl { - \__letgut_person_first_name_last_name:nn - {\l_letgut_first_name_tl} - {\l_letgut_last_name_tl} - }{ - \__letgut_person_first_name_last_name_title:nnn - {\l_letgut_first_name_tl} - {\l_letgut_last_name_tl} - {\l_letgut_title_tl} - } - } - } - } - \seq_use:Nnnn \l__letgut_items_seq { - \c_space_tl \str_use:N \& \c_space_tl - } { ,~ } { \c_space_tl \str_use:N \& \c_space_tl } -} -\end{lstlisting} - -\subsubsection{Horizontal rule} -\label{sec:orgc866c8e} - -\begin{lstlisting} -\NewDocumentCommand {\separator} { } { - \par - \skip_vertical:N 1em - \hrule - \skip_vertical:N 1em -} -\end{lstlisting} - -\subsubsection{Alert boxes} -\label{sec:org7e6600e} - -\begin{lstlisting} -\colorlet {letgut_default_alert_box_color} { - \c__letgut_default_alert_box_color_tl -} -\NewDocumentCommand \alertbox { - O{letgut_default_alert_box_color} +m -} { - \__letgut_alert_box:nn { #1 }{ #2 } -} -\end{lstlisting} - -\subsubsection{Typesetting of packages, classes, files and softwares.} -\label{sec:orgaf32b00} - -The \lstinline+\c__letgut_httpsprefix_tl+ comes from: - -\url{https://github.com/latex3/hyperref/issues/188\#issuecomment-826302843}. - -\begin{lstlisting} -\tl_const:Nx \c__letgut_httpsprefix_tl -{https\char_generate:nn{58}{12}//} -\end{lstlisting} -We define the font switches dediacted to each of packages and classes -(\TeX{} stuff), files and softwares. -\begin{lstlisting} -\tl_new:N \l__letgut__tex_stuff_font_switch_tl -\tl_new:N \l__letgut_files_font_switch_tl -\tl_new:N \l__letgut_softwares_font_switch_tl -\tl_set:Nn \l__letgut__tex_stuff_font_switch_tl {\sffamily} -\tl_set:Nn \l__letgut_files_font_switch_tl {\ttfamily} -\tl_set:Nn \l__letgut_softwares_font_switch_tl {\ttfamily} -\end{lstlisting} - -\begin{lstlisting} -\cs_new_protected:Nn \__letgut_tex_stuff:nn -{ - \IfNoValueTF {#1} - { - \href{ - \c__letgut_httpsprefix_tl ctan.org/pkg/#2 - }{ - {\l__letgut__tex_stuff_font_switch_tl #2} - } - }{ - \tl_if_empty:nTF {#1} - { - {\l__letgut__tex_stuff_font_switch_tl #2} - }{ - \href{#1}{{\l__letgut__tex_stuff_font_switch_tl #2}} - } - } -} -\cs_new_protected:Nn \__letgut_software:nn -{ - \tl_if_empty:nTF {#1} - { - {\l__letgut_softwares_font_switch_tl #2} - }{ - \href{#1}{{\l__letgut_softwares_font_switch_tl #2}} - } -} -\cs_new_protected:Nn \__letgut_file:n -{ - {\l__letgut_files_font_switch_tl #1} -} -\NewDocumentCommand{\package}{ s o m O{package} } { - \IfBooleanT{#1}{ - #4 - \c_space_tl - } - \__letgut_tex_stuff:nn {#2}{#3} -} -\NewDocumentCommand{\class}{ s o m O{classe} } { - \IfBooleanT{#1}{ - #4 - \c_space_tl - } - \__letgut_tex_stuff:nn {#2}{#3} -} -\NewDocumentCommand{\file}{ s m O{fichier} } { - \IfBooleanT{#1}{ - #3 - \c_space_tl - } - \__letgut_file:n {#2} -} -\NewDocumentCommand {\software} { s O{} m O{logiciel} } { - \IfBooleanT{#1}{ - #4 - \c_space_tl - } - \__letgut_software:nn {#2}{#3} -} -\end{lstlisting} - -\subsubsection{Names, etc.} -\label{sec:org45141b1} - -\begin{lstlisting} - \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 { \letgut } { } { - \class{letgut} - } - \NewExpandableDocumentCommand { \letgutcls } { } { - \class*{letgut} - } - \NewExpandableDocumentCommand { \tugboat } { } { - \c__letgut_tugboat_tl - } - \NewExpandableDocumentCommand { \knuth } { } { - \person{Knuth, Donald~ E.} - } - \NewExpandableDocumentCommand { \lamport } { } { - \person{Lamport, Leslie} - } -\end{lstlisting} - -\subsubsection{Foreign locutions} -\label{sec:org32f4b23} - -\begin{lstlisting} -\cs_new_protected:Npn \__letgut_emphasis:n #1 -{ - \emph{#1} -} -\NewDocumentCommand { \foreignloc } { m } { - \__letgut_emphasis:n {#1} -} -\NewDocumentCommand { \latinloc } { m } { - \__letgut_emphasis:n {#1} -} -\end{lstlisting} - -\subsubsection{Bookmarks handling} -\label{sec:org2ee5370} - -We disabling some commands when their arguments have to go to bookmarks. - -\begin{lstlisting} -\AddToHook{begindocument/end}{ - \pdfstringdefDisableCommands{ - \def\person#1{#1} - \def\author#1{#1} - \def\package#1{#1} - % \def\package*#1{package~#1} - \def\class#1{#1} - % \def\class*#1{classe~#1} - \def\file#1{#1} - % \def\file*#1{fichier~#1} - \def\software#1{#1} - % \def\software*#1{logiciel~#1} - \def\foreignloc#1{#1} - \def\lettre{Lettre} - \def\gutenberg{GUTenberg} - \def\gut{\gutenberg} - \def\lettregut{\lettre\c_space_tl\gutenberg} - \def\Cahier{Cahier} - \def\Cahiers{\Cahier s} - \def\letgut{letgut} - \def\letgutcls{classe~ letgut} - \def\knuth{Donald~ E.~ Knuth} - \def\lamport{Leslie~ Lamport} - \def\latinloc#1{#1} - } -} -\end{lstlisting} - -\subsubsection{Acronyms} -\label{sec:orgd329484} - -The following command let us define acronyms. The arguments are as follows: -\begin{itemize} -\item \lstinline+#1+: optional argument that let us override the default settings of this -command, -\item \lstinline+#2+: the uppercase version of both the id and the short form of the acronym, -\item \lstinline+#3+: the long form (in French if \#4 has \lstinline+-NoValue-+, in English otherwise), -\item \lstinline+#4+: the French translation of an English acronym. -\end{itemize} - -\begin{lstlisting} -\cs_new_protected:Nn \__letgut_acronym:nnnn -{ - \AddToHook{begindocument/before}{ - \IfValueTF {#4}{ - \tl_if_empty:nTF {#4}{ - \exp_args:Nx \DeclareAcronym{\text_lowercase:n {#2}}{ - short = \text_lowercase:n {#2}, - sort= #2, - long = {\emph{#3}}, - extra-long = {anglais}, - pdfstring = #2, - short-acc = #2, - #1 - } - }{ - \exp_args:Nx \DeclareAcronym{\text_lowercase:n {#2}}{ - short = \text_lowercase:n {#2}, - sort= #2, - long = {#4}, - foreign = {#3}, - foreign-babel = english, - foreign-locale = anglais, - pdfstring = #2, - short-acc = #2, - #1 - } - } - }{ - \exp_args:Nx \DeclareAcronym{\text_lowercase:n {#2}}{ - short = \text_lowercase:n {#2}, - sort= #2, - long = {#3}, - pdfstring = #2, - short-acc = #2, - #1 - } - } -\end{lstlisting} -The ⟨id⟩ of the acronym will automatically be the name of a public command -(\lstinline+\+⟨id⟩) acting as \lstinline+\ac{id}+. -\begin{lstlisting} -\exp_after:wN \cs_if_exist:cT { \text_lowercase:n {#2} } { - \msg_note:nnn{letgut}{Existing~command}{#2} -} -\exp_args:Nc \ProvideDocumentCommand -{ \text_lowercase:n {#2} } { s } { - \IfBooleanTF {##1}{ - \exp_args:Nx \acs { \text_lowercase:n {#2} } - }{ - \exp_args:Nx \ac { \text_lowercase:n { #2 } } - } -} -\end{lstlisting} -We want the command \lstinline+\+⟨id⟩ to work also in bookmarks (the resulting string will -be the uppercased acronym). -\begin{lstlisting} -\pdfstringdefDisableCommands - { - \exp_after:wN - \def\cs:w \text_lowercase:n {#2} \cs_end: { #2 } - } -} -} -\end{lstlisting} - -The first occurrences of the acronyms will be displayed in their short forms, -with the long ones in footnotes. But what about acronyms whom first occurrences -arise within footnotes? We want the to be displayed as their short forms -followed by their the long form in parentheses. For this, we have to add -a boolean at the beginning (and reversed at the end) of the \lstinline+\footnote+ command -to know whether we currently are in a footnote or not and display the acronym -accordingly. - -\begin{lstlisting} -\NewCommandCopy{\__letgut_old_footnote}{\footnote} -\RenewDocumentCommand {\footnote} { m }{ - \bool_set_true:N \l__letgut_in_footnote_bool - \__letgut_old_footnote { #1 } - \bool_set_false:N \l__letgut_in_footnote_bool -} -\end{lstlisting} -We change a bit both the \lstinline+footnote+ acro template, the \lstinline+description+ list -template, and the macro which prints the locale. -\begin{lstlisting} -\DeclareAcroProperty{extra-foreign} -\DeclareAcroProperty{extra-long} -\RenewAcroTemplate {footnote} -{ - \acrowrite {short} - \acroiffirstT - { -\end{lstlisting} -If we are in a footnote, first occurrences of the acronyms are displayed -as “short (long)”. Otherwise, they are displayed as “short\footnote{long}”. -\begin{lstlisting} - \bool_if:NTF \l__letgut_in_footnote_bool { - \space - ( - \acroifT {alt} { \acrotranslate {or} ~ \acrowrite {alt} ~ } - \acroifT {foreign} { \acrowrite {foreign} :~ } - \acrowrite {long} - \acrogroupcite - ) - }{ - \acfootnote - { - \acroifT {alt} { - \acrotranslate {or} ~ \acrowrite {alt} :~ - } - \acroifT {foreign} { \acrowrite {foreign} } - \acrowrite {long} - \acroifT {extra-long} { ~ [\acrowrite {extra-long}] } - \acroifT {extra-foreign} { - \c_space_tl [\acrowrite {extra-foreign}] - } - \acrogroupcite - } - } - } - } - \RenewAcroTemplate[list]{description}{% - \acroheading - \acropreamble - \begin{description} - \acronymsmapF{% - \item[\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}] - \acroifT{foreign}{ - \acrowrite{foreign}\acroifT{extra}{, } - }% - \acroifT{extra}{\acrowrite{extra}}% - \acroifanyT{foreign,extra}{\acspace (}% - \acrowrite{list}% - \acroifT {extra-foreign} { - , \c_space_tl \acrowrite {extra-foreign} - } - \acroifanyT{foreign,extra}{)}% - \acropagefill - \acropages - {\acrotranslate{page}\nobreakspace} - {\acrotranslate{pages}\nobreakspace}% - } - {\item\AcroRerun} - \end{description} -} -% #1: id -% #2: property -% #3: text -\cs_set_protected:Npn \acro_locale:nnn #1#2#3 - { - \acro_if_foreign:nTF {#2} - { - \acro_if_locale:nnTF {#1} {#2} - { - \__acro_foreign_language:en - { \str_lowercase:e { - \acro_property_get:nn {#1} {foreign-babel} - } - } - {#3} - \bool_if:NTF \l__acro_list_bool - { \bool_if:NT \l__acro_list_show_locale_bool } - { \bool_if:NT \l__acro_show_locale_bool } - { - { - \l__acro_locale_format_tl - { - \acro_property_if_set:nnTF {#1} { - foreign-locale - } - { - \acspace - [ - \acro_property_get:nn {#1} { - foreign-locale - } - ] - }{ - \baselanguage - { - \acro_property_get:nn {#1} { - foreign-babel - } - } - } - } - } - :~ - } - } - {#3} - } - {#3} - } -\end{lstlisting} -Now, the document command that let the user create acronyms. -\begin{lstlisting} -\NewDocumentCommand{\letgutacro}{ O{} m m o } -{ - \__letgut_acronym:nnnn {#1} {#2} {#3} {#4} -} -\end{lstlisting} -For printing the acronyms, we define two new heading templates for the structure -levels \lstinline+\title+ and \lstinline+\subtitle+. -\begin{lstlisting} -\NewAcroTemplate[heading] {title} - { \title { \acrolistname } } -\NewAcroTemplate[heading] {subtitle} - { \subtitle { \acrolistname } } -\end{lstlisting} -We make \lstinline+\letgutacro+ available only in the preamble part of the document -(otherwise, no warning from \package{acro} but only the long form of the acronym -is printed when used for the first time with \lstinline+\ac+). -\begin{lstlisting} -\@onlypreamble\letgutacro -\end{lstlisting} - -\subsection{Bibliography} -\label{sec:orgc523238} - -We want the \lstinline+\citeauthor+ command to display, not only the last, but the -full name of the authors. - -\begin{lstlisting} -\NewCommandCopy{\__letgut_old_citeauthor}{ - \citeauthor -} -\RenewDocumentCommand {\citeauthor} { O{} O{} m } { - \AtNextCite{\DeclareNameAlias{labelname}{given-family}} - \__letgut_old_citeauthor[#1][#2]{#3} -} -\end{lstlisting} - -\subsection{Book reviews} -\label{sec:org2fd9b20} - -\begin{lstlisting} -\tl_new:N \g__letgut_bookreview_frontcover_tl -\tl_new:N \g__letgut_bookreview_bibkey_tl -\end{lstlisting} -The keys options are created. -\begin{lstlisting} -\keys_define:nn { letgut/bookreview } -{ - title .tl_gset:N = \g__letgut_bookreview_title_tl, - frontcover .tl_gset:N = \g__letgut_bookreview_frontcover_tl, - bibkey .tl_gset:N = \g__letgut_bookreview_bibkey_tl, - reviewer .tl_gset:N = \g__letgut_bookreview_reviewer_tl, - price .tl_gset:N = \g__letgut_bookreview_price_tl, -\end{lstlisting} - -All these options, when used, must receive a value. - -\begin{lstlisting} - title .value_required:n = true, - frontcover .value_required:n = true, - bibkey .value_required:n = true, - reviewer .value_required:n = true, -} -\end{lstlisting} - -We create the new environment for the book reviews. - -\begin{lstlisting} -\cs_generate_variant:Nn \msg_warning:nnn { nnV } -\cs_generate_variant:Nn \msg_error:nnnn { nnVV } -\NewDocumentEnvironment{bookreview}{ m } -{ - \keys_set:nn { letgut/bookreview } { #1 } - \section{\g__letgut_bookreview_title_tl} - \tl_if_empty:NTF \g__letgut_bookreview_frontcover_tl { - \msg_warning:nnV{letgut}{frontcover-missing}{ - \g__letgut_bookreview_title_tl - } - }{ -\end{lstlisting} - -We check if the front cover file is available against the list of accepted -extensions of the \lstinline+graphicx+ package. - -\begin{lstlisting} - \clist_map_inline:Nn \Gin@extensions { - \file_if_exist:nT{\g__letgut_bookreview_frontcover_tl##1}{ - \bool_set_true:N \l_tmpa_bool - \clist_map_break: - } - } - \bool_if:NTF \l_tmpa_bool { - \marginpar{ - \hspace*{\c__letgut_bookreview_frontcover_margin_sep_dim} - % \raggedleft - \raisebox{-\totalheight}{ - \fbox{ - \includegraphics[width=-\c__letgut_title_hoffset_dim]{ - \g__letgut_bookreview_frontcover_tl - } - } - } - } - }{ - \msg_error:nnVV - {letgut} - {frontcover-file-not-found} - {\g__letgut_bookreview_title_tl} - {\g__letgut_bookreview_frontcover_tl} - } - } - \noindent - \textsf{\fullcite{\g__letgut_bookreview_bibkey_tl}} - \tl_if_empty:NF \g__letgut_bookreview_price_tl{ - .\c_space_tl\EUR{\g__letgut_bookreview_price_tl} - } - \par -}{ - \exp_args:NV \author{\g__letgut_bookreview_reviewer_tl} -} -\end{lstlisting} - -\subsection{Miscellanous} -\label{sec:org00f0870} - -\begin{itemize} -\item We specify the possible hyphenations of \enquote{\gutenberg}. -\end{itemize} -\begin{lstlisting} -\hyphenation{GUT-enberg} -\end{lstlisting} - -\subsubsection{Non selectable text} -\label{sec:org4c4b60b} - -We create a control sequence that makes its argument not selectable in the -PDF. This will be used notably for the line numbers of the listings and the -watermarks. -\begin{lstlisting} -\cs_new_protected:Npn \__letgut_unselectable:n #1 -{ - \BeginAccSupp{ActualText={}}#1\EndAccSupp{} -} -\end{lstlisting} - -\subsubsection{Typesetting of code, etc.} -\label{sec:org61c4abd} - -We provide a \lstinline+\meta+ macro that (poorly) mimics the one of the -\package*{doc}. It is added at the very end of the preamble since other -package that provide a better definition of this macro may have been loaded -(e.g. \package{tcolorbox}). -\begin{lstlisting} -\colorlet {__letgut_meta} { - brown -} -\cs_new_protected:Nn \__letgut_meta:nn -{ - \bgroup - \normalfont - \ttfamily - \itshape - \textcolor{#1}{$\langle$#2$\rangle$} - \egroup -} -\AddToHook{begindocument/before}{ - \ProvideDocumentCommand{\meta}{ O{__letgut_meta} m } { - \__letgut_meta:nn {#1}{#2} - } -} -\end{lstlisting} - -\subsection{\LaTeX{} listings and examples} -\label{sec:org371597a} - -We first define some colors used in the listings and examples. - -\begin{lstlisting} -\definecolor{__letgut_backgroundCode}{cmyk}{0,0,0,0.04} -\definecolor{__letgut_borderCode}{cmyk}{0,0,0,0.2} -\definecolor{__letgut_foregroundLinenumber}{cmyk}{0,0,0,0.5} -\definecolor{__letgut_foregroundMention}{cmyk}{0,0,0,0} -\definecolor{__letgut_backgroundResult}{cmyk}{0,0,0,0} -\end{lstlisting} - -We now define the colors for the syntax highlighting and define the style of our -listings. - -\begin{lstlisting} -\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} -\lstset{% - texcsstyle=*\color{__letgut_texcs}, - commentstyle=\color{__letgut_comment}\itshape, - keywordstyle= \color{__letgut_argument-specification-separator}, - keywordstyle={[2]\color{__letgut_environment}}, - keywordstyle={[3]\color{__letgut_key}}, - keywordstyle={[4]\color{__letgut_value}}, - keywordstyle={[5]\color{__letgut_argument-specification}}, - keywordstyle={[6]\color{__letgut_key}}, - escapechar=£, - literate=*% - {\\\\}{{{\color{__letgut_texcs}\textbackslash\textbackslash}}}{2}% - {\\[}{{\textcolor{__letgut_math}{\textbackslash[}}}{2}% - {\\]}{{\textcolor{__letgut_math}{\textbackslash]}}}{2}% - {$}{{\textcolor{__letgut_math}{\$}}}{1}%$ -} -\end{lstlisting} - -For the listings and examples, we rely on \package*{tcolorbox}, and more -specifically on some of its libraries. - -\begin{lstlisting} -\tcbuselibrary{listings,xparse,breakable,skins} -\end{lstlisting} - -The functions: - -\begin{itemize} -\item \lstinline+\__letgut_code_result_mention_box:n+ draws the mentions “code” and “résultat” -in the codes boxes and the possible corresponding results boxes, -\item \lstinline+\__letgut_title_code_result_box:n+ for the title of codes and the results -boxes: “Exemple” followed by the number of the example and, if a \lstinline+title addon+ -option is provided, the specified title addon. -\end{itemize} - -\begin{lstlisting} -\cs_new_protected:Npn \__letgut_code_result_mention_box:nn #1 #2 -{ - \node[ - minimum~ width=1cm, - minimum~ height=\c__letgut_height_mentions_dim, - outer~ sep=auto, - anchor=north~ east, - fill=__letgut_borderCode - ]~ at~ (#1) - { - \itshape - \small - \color{__letgut_foregroundMention} - \__letgut_unselectable:n {#2} - }; -} -\cs_new_protected:Npn \__letgut_title_code_result_box:n #1 -{ - Exemple~ \thetcbcounter - \tl_if_empty:NF {#1} { \hypersetup{hidelinks} \c_space_tl :~#1 } -} -\cs_new_protected:Nn \__letgut_on_callout_page:nn -{ - \tl_set:Nn \l_tmpa_int {\getpagerefnumber{#1}} - \tl_set:Nn \l_tmpb_int {\thepage} - \int_compare:nNnF {\l_tmpa_int} = {\l_tmpb_int} - {#2} -} -\end{lstlisting} - -We define the style of the codes and the results boxes. - -\begin{lstlisting} -\tl_set:Nn \l__letgut_reference_text_tl { - Cf.~\vref{\g__letgut_label_ltx_example_str}. -} -\tcbset{ - __letgut_code/.style={ - listing~ options={ - % style=tcblatex, - numbers=left, - numbersep=\c__letgut_number_sep_dim, -\end{lstlisting} -We want the line numbers to not be selectable, hence the \lstinline+\__letgut_unselectable:n+:. -\begin{lstlisting} -numberstyle= - \scriptsize - \ttfamily - \color{__letgut_foregroundLinenumber} - \__letgut_unselectable:n, -}, -every~ float=\raggedleft, -colback=__letgut_backgroundCode, -breakable, -sharp~ corners, -boxrule=0.25mm, -colframe=__letgut_borderCode, -sidebyside~ align=top~ seam, -toprule~ at~ break=0mm, -bottomrule~ at~ break=0mm, -colbacktitle=__letgut_borderCode, -fonttitle=\sffamily\bfseries, -before~ title={ - \tl_set:Nn \l__letgut__tex_stuff_font_switch_tl {\rmfamily} -}, -\end{lstlisting} -We define a custom \package*{tcolorbox}'s \lstinline+title addon+ option that let us -specify an addon to the title which will added after the automatically -generated title “Exemple \meta{number}”. -\begin{lstlisting} -title~ addon/.store~ in=\l__letgut_title_addon_tl, -title=\__letgut_title_code_result_box:n {\l__letgut_title_addon_tl}, -\end{lstlisting} -We define a custom \package*{tcolorbox}'s \lstinline+reference text+ option that let us -override the text of the reference for the examples with code and result side by -side that are floating and not being of their call out pages. -\begin{lstlisting} -reference~ text/.code={ - \tl_set:Nn \l__letgut_reference_text_tl {##1} -}, -\end{lstlisting} -We define a custom \package*{tcolorbox}'s \lstinline+result width+ option that let us -specify the width of the result which is \lstinline+\linewidth+ by default. -\begin{lstlisting} -result~ width/.store~ in=\l__letgut_result_width_dim, -result~ width=\linewidth, -}, -__letgut_code_result/.style={ - __letgut_code={#1}, - bicolor, - colbacklower=__letgut_backgroundResult, - segmentation~ at~ break=false, - top=\c__letgut_height_mentions_dim, - middle=\c__letgut_height_mentions_dim, -\end{lstlisting} -We want the side by side code/result examples to automatically be floating. -\begin{lstlisting} -sidebyside@true/.code={% - \tcb@sidebysidetrue% - \tcb@isbreakablefalse% - \pgfkeysalso{floatplacement=ht}% - \pgfkeysalso{float}% - \pgfkeysalso{label={\g__letgut_label_ltx_example_str}}% - \tl_set:Nx \l_tmpa_tl { - \getpagerefnumber { - \g__letgut_callout_label_ltx_example_str - } - } - \tl_set:Nx \l_tmpb_tl { - \getpagerefnumber { - \g__letgut_label_ltx_example_str - } - } - \tl_if_eq:NNF \l_tmpa_tl \l_tmpb_tl - { - \l__letgut_reference_text_tl - \tl_set:Nn \l__letgut_reference_text_tl { - Cf.~\vref{\g__letgut_label_ltx_example_str}. - } - \pgfkeysalso{ - drop~ shadow=black, - grow~ to~ left~ by=4cm, - boxed~ title~ style={sharp~ corners}, - } - \pgfkeysalso{after~ title~ app=\c_space_tl (cf.~page~\thepage)} - } -},% -overlay={ - \iftcb@sidebyside - \__letgut_code_result_mention_box:nn {segmentation.north} {code} - \__letgut_code_result_mention_box:nn {interior.north~ east} {résultat} - \else - \ifcase\tcbsegmentstate - % 0 = Box contains only an upper part - \__letgut_code_result_mention_box:nn {interior.north~ east} {code} - \or% - % 1 = Box contains an upper and a lower part - \__letgut_code_result_mention_box:nn {interior.north~ east} {code -\end{lstlisting} - -\begin{lstlisting} - \int_compare:nNnT {\thetcbbreakpart} > {1} {~(suite)} -} -\__letgut_code_result_mention_box:nn { - [yshift=.1mm]segmentation.east -} {résultat} -\else% -% 2 = Box contains only a lower part -\__letgut_code_result_mention_box:nn {interior.north~ east} {résultat -\end{lstlisting} - -\begin{lstlisting} -\int_compare:nNnT {\thetcbbreakpart} > {1} {~(suite)} -} -\fi -\fi -}, -}, -} -\end{lstlisting} - -The \package*{tcolorbox} listings defined below make use of -\package*{cleveref}'s features. But, since the latter package is loaded -\lstinline+\AddToHook{begindocument/before}+, the same is needed for these listings. - -\begin{lstlisting} -\AddToHook{begindocument/before}{ -\end{lstlisting} - -We now define the environments that let us display: - -\begin{enumerate} -\item only \LaTeX{} code: -\end{enumerate} -\begin{lstlisting} -\DeclareTCBListing[ - auto~ counter, - crefname={exemple}{exemples} -]{ltx-code}{ !O{} }{% - __letgut_code, - listing~ only, - #1% -} -\end{lstlisting} -\begin{enumerate} -\item both \LaTeX{} code and its result: -\begin{enumerate} -\item ordinary: -\end{enumerate} -\end{enumerate} -\begin{lstlisting} -\DeclareTCBListing[ - use~ counter~ from=ltx-code, - crefname={exemple}{exemples} -]{ltx-code-result}{ !O{} }{% - __letgut_code_result, - #1% -} -\end{lstlisting} -\begin{enumerate} -\item with the result obtained externally: -\end{enumerate} -\begin{lstlisting} -\DeclareTCBListing[ - use~ counter~ from=ltx-code, - crefname={exemple}{exemples} -]{ltx-code-external-result}{ O{} m }{% - __letgut_code_result, - listing~ and~ comment, - image~ comment={width=\l__letgut_result_width_dim}{#2}, - center~ lower, - #1% -} -\end{lstlisting} - -\begin{lstlisting} -} -\end{lstlisting} - -The examples with code and result side by side will be floating but we want the -ones being of their call out pages to have before and after them a reduced -vertical glue (\lstinline+\g__letgut_reduced_intextsep_dim+). Hence we store the original -glue (\lstinline+\intextsep+) in a custom one (\lstinline+\g__letgut_orig_intextsep_dim+) in order -to retrieve the original skip for floats other than these ones. - -\begin{lstlisting} -\skip_const:Nn \c__letgut_orig_intextsep_skip {\intextsep} -\skip_const:Nn \c__letgut_reduced_intextsep_skip { - 4\p@ \@plus .667\p@ \@minus .667\p@ -} -\end{lstlisting} - -We now use hooks in order to\ldots{} - -\begin{lstlisting} -\AddToHook{env/ltx-code-result/before}{ - \int_gincr:N \g__letgut_ltx_example_int - \str_set:Nx \g__letgut_label_ltx_example_str { - \c__letgut_label_ltx_example_str- - \int_use:N \g__letgut_ltx_example_int - } - \str_set:Nx \g__letgut_callout_label_ltx_example_str { - \c__letgut_callout_label_ltx_example_str- - \int_use:N \g__letgut_ltx_example_int - } - \label{\g__letgut_callout_label_ltx_example_str} - \tl_set:Nx \l_tmpa_tl { - \getpagerefnumber { - \g__letgut_callout_label_ltx_example_str - } - } - \tl_set:Nx \l_tmpb_tl { - \getpagerefnumber { - \g__letgut_label_ltx_example_str - } - } - \tl_if_eq:NNF \l_tmpa_tl \l_tmpb_tl - { - \skip_set_eq:NN \intextsep \c__letgut_reduced_intextsep_skip - } -} -\end{lstlisting} - -\subsection{Local config file} -\label{sec:org562c2a3} - -Each issue of the Lettre requires certain local configurations: configuration -dedicated to the issue in question, particular packages used in the articles, -specific configurations of the \package*{listings}, etc. In order to not clutter -the main \file*{.tex} of the Lettre, a local configuration file named -\file{localconf.tex}, if present in the current directory, is automatically -included at the end of the end of the preamble. And since this file is input in -the current category régime (\lstinline+\ExplSyntaxOn+), a \lstinline+\ExplSyntaxOff+ is -automatically inserted at its beginning. - -\begin{lstlisting} -\file_if_exist:nT {./\c__letgut_local_config_file_tl}{ - \AddToHook { file/before/./\c__letgut_local_config_file_tl } { - \ExplSyntaxOff - } - \file_input:n {./\c__letgut_local_config_file_tl} -} -\end{lstlisting} - -We don't want the book review entry types to be listed in the bibliography -(they appears only thanks to the \lstinline+bookreview+ environment). - -\begin{lstlisting} -\ExecuteBibliographyOptions[bookreview]{skipbib,skiplab} -\end{lstlisting} - -\begin{lstlisting} -\endinput -\end{lstlisting} - -\section{(biblatex) Data model} -\label{sec:org14731c9} - -We give the (\package{biblatex}) data model that enriches the default one for -several purposes: -\begin{itemize} -\item the books reviews, -\item the books advertisements. -\end{itemize} - -\begin{lstlisting} -\ProvidesFile{letgut.lbx}[2022-03-22 v0.9.1 letgut localization] -\InheritBibliographyExtras{french} -\DeclareBibliographyStrings{ - inherit = {french}, - number = {{\no}{\no}}, - volume = {{volume}{vol\adddot}}, - volumes = {{volumes}{vol\adddot}}, -} -\end{lstlisting} - -We create the new bibliography driver \lstinline+bookreview+ (that seems to -create the corresponding new entry). - -\begin{lstlisting} -\ProvidesFile{letgut.dbx}[2022-03-22 v0.9.1 letgut data model macros] -\DeclareBibliographyDriver{bookreview}{% - \usebibmacro{bibindex}% - \usebibmacro{begentry}% - \usebibmacro{author/editor+others/translator+others}% - \setunit{\printdelim{nametitledelim}} - \newblock - \usebibmacro{maintitle+title}% - \newunit - \printlist{language}% - \newunit\newblock - \usebibmacro{byauthor}% - \newunit\newblock - \usebibmacro{byeditor+others}% - \newunit\newblock - \printfield{edition}% - \newunit - \iffieldundef{maintitle} - {\printfield{volume}% - \printfield{part}} - {}% - \newunit - \printfield{volumes}% - \newunit\newblock - \usebibmacro{series+number}% - \newunit\newblock - \printfield{note}% - \newunit\newblock - \usebibmacro{publisher+location+date}% - \newunit\newblock - \usebibmacro{chapter+pages}% - \newunit - \printfield{pagetotal}% - \newunit\newblock - \iftoggle{bbx:isbn} - {\printfield{isbn}} - {}% - \newunit\newblock - \usebibmacro{doi+eprint+url}% - \newunit\newblock - \usebibmacro{addendum+pubstate}% - \setunit{\bibpagerefpunct}\newblock - \usebibmacro{pageref}% - \newunit\newblock - \iftoggle{bbx:related} - {\usebibmacro{related:init}% - \usebibmacro{related}} - {}% - \finentrypunct - \usebibmacro{finentry}} -\end{lstlisting} - -We provide a specific \lstinline+biblatex+ citation style . - -\begin{lstlisting} -\ProvidesFile{letgut.cbx}[2022-03-22 v0.9.1 letgut base citation style] -\RequireCitationStyle{numeric} -\end{lstlisting} - -The books reviewed have their titles not only emphasized, but in bold face as -well\ldots{} - -\begin{lstlisting} -\DeclareFieldFormat[bookreview]{title}{\textbf{\emph{#1}}} -\end{lstlisting} - -\ldots{} but not their subtitles. - -\begin{lstlisting} -\renewbibmacro*{title}{% - \ifboolexpr{ - test {\iffieldundef{title}} - and - test {\iffieldundef{subtitle}} - } - {} - {\printtext[title]{% - \printfield[titlecase]{title}% - \setunit{\subtitlepunct}}% - \printfield[emph]{subtitle}% - \newunit}% - \printfield{titleaddon}} -\end{lstlisting} - -\section{Provided files} -\label{sec:org59fbe1b} - -\subsection{Example file of an issue of the newsletter} -\label{sec:org4b9a54d} - -\begin{lstlisting} -\documentclass{letgut} - -\letgutsetup{ - % % Option booléenne pour la version finale de la Lettre. - % % L'option contraire`draft` (par défaut) affiche - % % « Brouillon » en filigrane et actionne le package - % % `lua-typo`. - % - % , final - % - % % Option coloriant le fond de la page d'une couleur - % % par défaut (`1.0, 0.98, 0.94` en « rgb ») mais - % % modifiable au moyen de l'option `pagecolor` ci-dessous. - % - % , paper - % - % % Numéro de la Lettre - % - , number=44 - % - % % Date de la Lettre. Celle-ci est déduite de la - % % date du jour, mais peut être spécifiée sous la forme - % % AAAA-MM (avec garde-fous) ou librement - % % (p. ex. `date=Printemps 2021`). - % - % , date=2025-16 - % - % % Couleur de la page, à spécifier selon le modèle « rgb ». - % - % , pagecolor={1.0, 0.1, 0.94} - % - % % Couleur des hyperliens, à spécifier selon le modèle - % % « named ». - % - % , allcolorslinks=cyan - % - % % Un (r)appel à cotisation est automatiquement ajouté - % % en 1re page. Si on ne le souhaite pas, il suffit de - % % passer l'option `membership-reminder=false`. - % - % , membership-reminder=false - % - % % Si un fichier `editorial.tex`, on s'en doute censé - % % contenir l'éditorial, est présent dans le répertoire - % % courant, son contenu est automatiquement ajouté en - % % 1re page. Si un tel fichier est absent du répertoire - % % courant, une alerte est affichée à la place, sauf si, - % % parce qu'on ne souhaite pas d'éditorial, on passe - % % l'option `editorial=false`. - % - % , editorial=false - % - % % Les informations concernant GUTenberg, si elles - % % figurent dans un fichier `informations-gut.tex` - % % présent dans le répertoire courant, sont - % % automatiquement ajoutées en dernière page. - % % Si on ne souhaite pas que figurent ces - % % informations, il suffit de passer l'option - % % `informations=false`. - % - % , informations=false -} - -\setmainfont{TeX Gyre Schola} % Par exemple - -\usepackage[maths=both]{duckuments} -\usepackage{mwe} - -% \addbibresource{biblio.bib} - -\begin{document} -\duckument -\end{document} - -%%% Local Variables: -%%% mode: latex -%%% TeX-engine: luatex -%%% TeX-master: t -%%% End: -\end{lstlisting} - -\subsection{Example of an editorial} -\label{sec:orgf79a2c2} - -\begin{lstlisting} -Ceci est un intéressant éditorial de la \lettregut{} -dans lequel on peut causer de l'\ag{} et du \ca{} -de l'association. Il peut aussi y être question du \ctan. - -\lipsum[1-5] - -\begin{figure}[ht] - \centering - \includegraphics[width=.7\linewidth]{example-image} - \caption{Ducks ?} - \label{fig:ducks} -\end{figure} - -\lipsum[6-10] -\end{lstlisting} - -\subsection{Informations about \gutenberg} -\label{sec:orgcc0dfe6} - -\begin{lstlisting} -\enlargethispage{1.5cm} -\small -\vspace*{-1cm} -\hspace*{-1.5cm}% -\raisebox{-\height+0.7\baselineskip}{% - \begin{minipage}[t]{.6\textwidth}%\vspace{0pt}% - \includegraphics[width=\linewidth]{logo-gut.pdf} - \end{minipage}% -}% -\hfill% -\begin{minipage}[t]{.4\textwidth}%\vspace{0pt}% - \footnotesize\raggedleft% - Association \gut{}\\ - 15 rue des Halles -- \textsc{bp} 74\\ - 75001 Paris\\ - France\\ - \nolinkurl{secretariat@gutenberg.eu.org} -\end{minipage}% - -\begin{description} -\item[Site internet :] \url{https://www.gutenberg.eu.org/} -\item[\Cahiers{} :] \url{http://cahiers.gutenberg.eu.org/} -\item[Problèmes techniques :] - \leavevmode - \begin{description} - \item[la liste \texttt{gut} :] - \url{https://www.gutenberg.eu.org/-Listes-de-diffusion-} - \item[le site \TeX nique de questions et réponses :] - \url{https://texnique.fr/} - \item[la foire aux questions :] - \url{https://faq.gutenberg.eu.org} - \end{description} -\end{description} -% -\alertbox{% - Cette association est la vôtre: faites-nous part de - vos idées, de vos envies, de vos préoccupations - à l'adresse \nolinkurl{secretariat@gutenberg.eu.org}.% -} - -% \section[Association GUTenberg (tout sur l')] -% {Adhésion à l'association} -\title{Adhésion à l'association} -\label{letgut_label_adhesions} - -\begin{itemize} -\item % Adhésions et abonnements - Les adhésions sont à renouveler en début d'année - pour l'année civile. - % \item Il n'y a pas de lettre de rappel, chaque membre - % doit faire son renouvellement annuel; %\hspace*{1em} - % merci de renvoyer spontanément le bulletin ci-dessous - % en début d'année. -\item Les administrations peuvent joindre un bon de commande - revêtu de la signature de la personne responsable ; - les étudiants doivent joindre un justificatif. - % \item Si vous souhaitez que vos coordonnées restent - % confidentielles, merci de le signaler. -\end{itemize} - -\section{Tarifs \the\year} - -Les membres de \gut\ peuvent adhérer à l'association -internationale, le \acf{tug}, et recevoir son bulletin -\emph{\acs{tug}boat} à un tarif préférentiel : -\begin{description} -\item[tarif normal :] \EUR{65} (au lieu de 85~\$) -\item[tarif étudiant :] \EUR{40} (au lieu de 55~\$) -\end{description} -% (\EUR{49,50}, étudiants et demandeurs d'emploi : -% \EUR{29}, au lieu de 85\$ et % 65\$). Voir -% \url{% -% https://www.gutenberg.eu.org/?Adherer-a-l-association% -% }. - -\footnotesize -\begin{center} - \begin{tabular}{lr} - \toprule - \textbf{Type d'adhésion} & \textbf{Prix} \\ - \midrule - Membre individuel & \EUR{30} \\ - Membre individuel + adhésion \acs{tug} & \EUR{95} \\ - Membre individuel étudiant/demandeur d'emploi & \EUR{15} \\ - Membre individuel étudiant + adhésion \acs{tug} & \EUR{55} \\ - Association d'étudiants & \EUR{65} \\ - Organisme à but non lucratif & \EUR{130} \\ - Organisme à but lucratif & \EUR{229} \\ - \bottomrule - \end{tabular} -\end{center} - -\section{Règlements} - -Les règlements peuvent s'effectuer par : -\begin{itemize} -\item \textbf{virement bancaire}% - \footnote{Nous vous remercions de \textbf{privilégier} - le \textbf{virement bancaire}.\label{fn:1}} (IBAN : - FR76 1870 7000 3003 0191 3568 475)% - \leavevmode - - \alertbox{% - Veillez à bien \emph{indiquer vos nom et prénom} - dans les références du virement !% - } -\item Paypal\footnotemark[\value{footnote}] : - \url{https://www.gutenberg.eu.org/?Adherer-en-ligne} -\item bulletin et chèque\footnotemark[\value{footnote}] : - \url{https://www.gutenberg.eu.org/?Adherer-a-l-association} -\end{itemize} - -\vfill - -\begin{center} - \begin{tblr}{ - width=.75\linewidth, - colspec={ - % < (Just not to disturb the parentheses - % balancing detection of my editor.) - >{\bfseries}r@{ }X - }, - vline{1,3}={solid}, - hline{1,7}={solid}, - rowsep=0mm, - row{1} = {abovesep+=.25cm}, - row{2} = {belowsep+=.125cm}, - row{6} = {belowsep+=.25cm}, - % colsep=2.5mm, - } - \SetCell[c=2]{c} \emph{La \lettregut}\\ - \SetCell[c=2]{c} \mdseries Bulletin irrégulomestriel - de l'association \gut\\ - Directeur de la publication : - & \person{Bideault, Patrick} \\ - Comité de rédaction : - & {Patrick \bsc{Bideault}, Denis \bsc{Bitouzé}, \\ - Céline \bsc{Chevalier} \& Maxime \bsc{Chupin}} \\ - Adresse de la rédaction : & - { - Association \gut\\ - 15 rue des Halles -- \textsc{bp} 74\\ - 75001 Paris - } - \\ - \acs{issn} : & 2742-6149 (version numérique) - \end{tblr} -\end{center} -\vfill -\mbox{} -\clearpage - -%%% Local Variables: -%%% mode: latex -%%% End: -\end{lstlisting} -\end{document}
\ No newline at end of file diff --git a/macros/luatex/latex/letgut/doc/letgut.pdf b/macros/luatex/latex/letgut/doc/letgut.pdf Binary files differindex e0d2740a0b..7ba16a98b7 100644 --- a/macros/luatex/latex/letgut/doc/letgut.pdf +++ b/macros/luatex/latex/letgut/doc/letgut.pdf diff --git a/macros/luatex/latex/letgut/doc/letgut.tex b/macros/luatex/latex/letgut/doc/letgut.tex index f782959e7c..ba12072910 100644 --- a/macros/luatex/latex/letgut/doc/letgut.tex +++ b/macros/luatex/latex/letgut/doc/letgut.tex @@ -15,27 +15,6 @@ % ,final } -\lstset{ - language=TeX,% - alsolanguage=[geometry]TeX,% - alsolanguage=[LaTeX]TeX,% - alsolanguage=[plain]TeX,% - alsolanguage=[common]TeX,% - alsolanguage=[primitive]TeX,% - alsolanguage=[xcolor]TeX,% - alsolanguage=[listings]TeX,% - alsolanguage=[biblatex]TeX,% - alsolanguage=[hyperref]TeX,% - alsolanguage=[extLaTeX]TeX,% - alsolanguage=[letgut]TeX,% - alsolanguage=[hologo]TeX,% - alsolanguage=[acro]TeX,% - alsolanguage=[tcolorbox]TeX,% - alsolanguage=[csquotes]TeX,% - alsolanguage=[varioref]TeX,% - alsolanguage=[babel-french]TeX,% -} - % Bibliographie \addbibresource{letgut.bib} @@ -88,7 +67,7 @@ } \author{Association GUTenberg} \date{% - Version 0.9.1 en date du \today% + Version 0.9.2 en date du \today% \texorpdfstring{% \\ \url{https://framagit.org/gutenberg/classe-lettre-gut}% @@ -101,6 +80,23 @@ % \makeindex[title=Index des concepts,extout=pdx,extin=pnd,columnseprule] \begin{document} +\syntaxhl{% + LaTeX,% + acro,% + babel-french,% + biblatex,% + biolinum,% + % classes,% + csquotes,% + % graphicx,% + hologo,% + hyperref,% + letgut,% + listings,% + tcolorbox,% + varioref,% +} + \title{Introduction} \label{sec:introduction} L'association \gutenberg{} publie la \lettregut{}, son bulletin irrégulomestriel, @@ -144,20 +140,33 @@ risque de perturber une installation de \hologo{(La)TeX} déjà existante. \section{Options} \label{sec:options} -La \letgutcls{} fournit deux types d'\meta{options} : - -\begin{description} -\item[\foreignloc{load-time} :] à spécifier \emph{exclusivement} au chargement - de la classe, selon la syntaxe usuelle - ×\documentclass[×\meta{options}×]{letgut}× -\item[\emph{non} \foreignloc{load-time} :] à spécifier \emph{exclusivement} en - argument de la commande dédiée \refCom{letgutsetup}. -\end{description} +\subsection{Spécification} +\label{sec:specification} + +Les options de la \letgutcls{} peuvent être spécifiées de deux façons : +\begin{enumerate} +\item en argument de la commande dédiée \refCom{letgutsetup} ; +\item à la compilation, au moyen de la commande (à lancer dans un terminal) : +\begingroup +\lstset{basicstyle=\ttfamily\small} +\terminal{lualatex '\PassOptionsToClass{£\meta{options}£}{letgut} \input{£\meta{fichier}£}'}{} +\endgroup +\end{enumerate} + +\begin{dbwarning}{Options de \letgut{} : pas en argument optionnel + de \docAuxCommand{documentclass}}{} + On évitera de passer les options de la \letgutcls{} en argument optionnel de + la commande \docAuxCommand{documentclass} et ce, de sorte à éviter les + conflits d'options avec les différents packages chargés. +\end{dbwarning} -\subsection{Options \foreignloc{load-time}} -\label{sec:fore-time-meta} +\begin{docCommand}{letgutsetup}{\marg{options}} + \index{configuration}% + Cette commande permet de spécifier les \meta{options} de la \letgutcls{}. +\end{docCommand} -Ces options, au nombre de deux, sont \enquote{contraires} l'une de l'autre. +\subsection{Liste des options} +\label{sec:liste-des-options} \begin{docKeys} { @@ -189,16 +198,6 @@ Ces options, au nombre de deux, sont \enquote{contraires} l'une de l'autre. \end{itemize} \end{docKeys} -\subsection{Options non \foreignloc{load-time}} -\label{sec:emphn-fore-time} - -\begin{docCommand}{letgutsetup}{\marg{options}} - \index{configuration}% - Cette commande permet de spécifier les \meta{options} \emph{non} \foreignloc{load-time} de la \letgutcls{}. -\end{docCommand} - -Ces \meta{options} sont les suivantes : - \begin{docKeys} { { @@ -269,7 +268,7 @@ Ces \meta{options} sont les suivantes : \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} @@ -280,7 +279,7 @@ Ces \meta{options} sont les suivantes : \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} } @@ -311,19 +310,37 @@ Ces \meta{options} sont les suivantes : \begin{docKey}{editorial}{}{\valinitdef[\docValue*{true}][\docValue*{true}]} Cette clé booléenne importe automatiquement en tout début de la \lettre{} (néanmoins après le titre et le sommaire) le \file*{editorial.tex} contenant - l'éditorial. Si aucun \file*{editorial.tex} n'est trouvé dans le répertoire - courant, un avertissement est émis lors de la compilation et une boîte - d'alerte est affichée en 1\iere{} page. + l'éditorial. Si aucun \file*{editorial.tex} n'est trouvé, un avertissement est + émis lors de la compilation et une boîte d'alerte est affichée en 1\iere{} + page. \end{docKey} \begin{docKey}{informations}{}{\valinitdef[\docValue*{true}][\docValue*{true}]} Cette clé booléenne importe automatiquement en dernière page de la \lettre{} le \file*{informations-gut.tex} contenant toutes les informations sur - \gut{}. Si aucun \file*{informations-gut.tex} n'est trouvé dans le - répertoire courant, un avertissement est émis lors de la compilation et une - boîte d'alerte est affichée en dernière page. + \gut{}. Si aucun \file*{informations-gut.tex} n'est trouvé, un avertissement + est émis lors de la compilation et une boîte d'alerte est affichée en dernière + page. \end{docKey} +\begin{docKey}{detailedtoc}{}{\valinitdef[\docValue*{false}][\docValue*{true}]} + Par défaut, la table des matières automatiquement insérée en début de document + a pour niveau de profondeur celui des titres (saisis via la \refCom{title}), + et seulement les titres des articles. La clé booléenne \refKey{detailedtoc} + 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{}. +\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} + \section{Titre et titres courants} \label{sec:titre} Si la commande \docAuxCommand{title}\marg{titre} est @@ -344,7 +361,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 \lstinline+\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} @@ -354,6 +371,26 @@ Si la commande \docAuxCommand{title}\marg{titre} est l'est en sous-main par la classe. \end{dbwarning} +\section{Importation d'articles} +\label{sec:import-dart} + +\begin{dbwarning}{Importation de fichiers d'articles}{} + Si le contenu d'un article est stocké dans un \meta{fichier enfant}\file{.tex}, + on l'importera dans un fichier parent recourant à la \letgutcls{} : + \begin{itemize} + \item \emph{non pas} au moyen de la commande ordinaire \docAuxCommand{input} ; + \item \emph{mais} au moyen de la commande \refCom{inputarticle}. + \end{itemize} +\end{dbwarning} + +\begin{docCommand}{inputarticle}{\marg{fichier enfant}} + Cette commande permet d'importer le contenu d'un article stocké dans un + \meta{fichier enfant}\file{.tex}. + + En plus de l'importation proprement dite, cette commande procède à un certain + nombre de réinitialisations. +\end{docCommand} + \section{Structuration} \label{sec:structuration} @@ -401,13 +438,10 @@ Si la commande \docAuxCommand{title}\marg{titre} est \package{csquotes}, chargés en sous-main par la \letgutcls{}. \end{dbremark} -\bgroup -\lstset{deletekeywords=[3]{section,nameref}} -\begin{ltx-code-result}[title addon=références croisées aux rubriques] +\begin{ltx-code-result}[title addon=références croisées aux rubriques,listing options app={deletekeywords={[3]{nameref,section}}}] On lira avec intérêt la section \enquote{\nameref{sec:acronymes}} \vpageref{sec:acronymes}. \end{ltx-code-result} -\egroup \section[Personnes et auteurs]{Noms de personnes et d'auteurs d'articles} \label{sec:sign-des-articl} @@ -448,46 +482,33 @@ On lira avec intérêt la section \enquote{\nameref{sec:acronymes}} \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} + \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é - \lstinline+and+. + ⅛and⅛. \end{itemize} \end{description} \end{docCommands} Indépendamment de la casse utilisée en entrée, pour chaque \meta{nom} et -\meta{prénom} : -\begin{itemize} -\item chacune des initiales et des premières lettres après un espace ou un tiret - est affiché en grande capitale ; -\item le reste est affiché en : - \begin{itemize} - \item petites capitales pour un \meta{nom} ; - \item bas de casse pour un \meta{prénom}. - \end{itemize} -\end{itemize} +\meta{prénom}, chacune des initiales et des premières lettres après un espace ou +un tiret est affiché en grande capitale. \begin{ltx-code-result}[title addon=personnes] On peut dire merci à \person{Knuth, Donald E., dieu and Lamport, Leslie} ! \end{ltx-code-result} -\bgroup -\lstset{deletekeywords=[3]{author},deletekeywords=[4]{TeX,},deletekeywords=[5]{e}} -\begin{ltx-code-result}[title addon=auteur] +\begin{ltx-code-result}[title addon=auteur,listing options app={deletekeywords={[3]{author}}}] \begin{displayquote} % Fourni par `csquotes' chargé par `letgut' Wait, wait, I never said that. \author{knuth, dONALD e.} \end{displayquote} \end{ltx-code-result} - % The \TeX{} family of programs seems to be nice and healthy - % as it continues to approach perfection. -\egroup \section{Aide à la saisie et homogénéisation de la mise en forme} \label{sec:aide-la-saisie} @@ -537,16 +558,13 @@ faciliter la saisie et à en homogénéiser la mise en forme. défaut, est respectivement \enquote{package} et \enquote{classe}. \end{docCommands} -\bgroup -\lstset{deletekeywords=[4]{tables,}} -\begin{ltx-code-result}[title addon=packages et classes] +\begin{ltx-code-result}[title addon=packages et classes,listing options app={deletekeywords={[4]{tables}}}] La \class*{letgut} s'appuie entre autres sur le \package*{etoc} (qui permet de personnaliser les tables des matières). Une des classes s'appuyant sur le \package*[]{etoc} est -\class[https://framagit.org/gutenberg/classe-lettre-gut]{letgut}. +\class[https://framagit.org/gutenberg/letgut/]{letgut}. \end{ltx-code-result} -\egroup \begin{docCommands} { @@ -582,14 +600,11 @@ Une des classes s'appuyant sur le \package*[]{etoc} est \enquote{fichier}. \end{docCommands} -\bgroup -\lstset{deletekeywords=[3]{file,plus,l}} -\begin{ltx-code-result}[title addon=logiciels et fichiers] +\begin{ltx-code-result}[title addon=logiciels et fichiers,listing options app={deletekeywords={[3]{file,plus,l,tex}}}] Le \file*{test.tex} a été ouvert dans le \software*[https://www.gnu.org/software/emacs/]{Emacs}, plus précisément dans \software*{Emacs}[l'éditeur de texte]. \end{ltx-code-result} -\egroup \begin{dbwarning}{Commandes pas toutes bienvenues en \docAuxCommand{title} et \docAuxCommand{subtitle}}{} @@ -606,13 +621,10 @@ précisément dans \software*{Emacs}[l'éditeur de texte]. Cette commande est conçue pour afficher une \meta{locution} latine. \end{docCommand} -\bgroup -\lstset{deletekeywords=[3]{options}} -\begin{ltx-code-result}[title addon=locutions étrangères] -Ce ne sont pas toutes des \foreignloc{load-time options} : -\latinloc{errare humanum est} ! +\begin{ltx-code-result}[title addon=locutions étrangères,listing options app={deletekeywords={[3]{options}}}] +Attention aux \foreignloc{load-time options} ! +Mais... \latinloc{errare humanum est}. \end{ltx-code-result} -\egroup \subsection{Termes et expressions} \label{sec:termes} @@ -623,13 +635,19 @@ Ce ne sont pas toutes des \foreignloc{load-time options} : { doc name = gut }, { doc name = lettre }, { doc name = lettregut }, - { doc name = Cahier }, - { doc name = Cahiers }, + { doc name = cahier }, + { doc name = cahiers }, + { doc name = cahiergut }, + { doc name = cahiersgut }, { doc name = letgut }, { doc name = letgutcls }, { doc name = knuth }, { doc name = lamport }, + { doc name = tl }, { doc name = tugboat }, + { doc name = linux }, + { doc name = macos }, + { doc name = windows }, } % Ce que ces commandes affichent est répertorié dans le \vref{tab:raccourcis}. @@ -639,17 +657,23 @@ Ce ne sont pas toutes des \foreignloc{load-time options} : \centering \begin{tabular}{ll} \toprule - \refCom{gutenberg} & \gutenberg \\ - \refCom{gut} & \gut \\ - \refCom{lettre} & \lettre \\ - \refCom{lettregut} & \lettregut \\ - \refCom{Cahier} & \Cahier \\ - \refCom{Cahiers} & \Cahiers \\ \midrule - \refCom{letgut} & \letgut \\ - \refCom{letgutcls} & \letgutcls \\ \midrule - \refCom{knuth} & \knuth \\ - \refCom{lamport} & \lamport \\ - \refCom{tugboat} & \tugboat \\ \bottomrule + \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 \end{tabular} \caption{Effet des commandes de raccourcis} \label{tab:raccourcis} @@ -672,9 +696,56 @@ de \docAuxCommand{section}% (préfixe pas en grandes capitales). \end{dbwarning} -\section{Exemples de codes \hologo{(La)TeX}, possiblement avec résultats} +\subsection{Touches de clavier} +\label{sec:touches-de-clavier} + +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 +la saisie pour toutes les touches des diacritiques utilisés en français. + +\begin{ltx-code-result}[title addon=touches de clavier] +% De base (échantillon) : +\LKey{A} \LKey{Z} \LKey{0} \LKey{9} + +\LKeyF{1} \LKeyF{12} + +\LKeyCtrl \LKeyAlt \LKeyAltGr \LKeyShift \LKeyEnter \LKeyTab + +\LKeyCtrlX{A} \LKeyShiftX{A} \LKeyAltX{A} \LKeyAltGrX{A} + +\LKeyAt \LKeyScreenUp \LKeyScreenDown \LKeyCommand \LKeyOptionKey + +\LMouseN \LMouseL \LMouseM \LMouseR + +\LKey{exclam} \LKey{numbersign} \LKey{percent} \LKey{backslash} + +% Ajoutés par la classe `letgut` +\LKey{à} \LKey{À} \LKey{â} \LKey{Â} \LKey{é} \LKey{É} +\LKey{è} \LKey{È} \LKey{ê} \LKey{Ê} \LKey{ë} \LKey{Ë} +\LKey{î} \LKey{Î} \LKey{ï} \LKey{Ï} +\LKey{ô} \LKey{Ô} +\LKey{ù} \LKey{Ù} \LKey{û} \LKey{Û} \LKey{ü} \LKey{Ü} +\LKey{ÿ} \LKey{Ÿ} \LKey{ç} \LKey{Ç} +\end{ltx-code-result} + +\begin{dbwarning}{Touche de clavier du symbole € manquant}{} + La touche de clavier du symbole € n'est pas fournie par le + \package*{biolinum}. +\end{dbwarning} + +\section{Codes informatiques} +\label{sec:code-informatique} + +Cette section est consacrée aux outils spécifiques à la \letgutcls{} permettant +de faire figurer du code informatique dans la \lettre{}. + +\subsection{Codes \hologo{(La)TeX}} \label{sec:exemples-de-codes} +\subsubsection{Exemples de codes \hologo{(La)TeX}, possiblement avec résultats} +\label{sec:listings-} + Afin de présenter aisément et de façon homogène les exemples de codes \hologo{(La)TeX}, possiblement avec leurs résultats, la \letgutcls{} fournit les environnements \enquote{verbatim} suivants. @@ -719,7 +790,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 \lstinline+sidebyside+ est + \item l'un à gauche de l'autre si l'option ⅛sidebyside⅛ est employée. \end{itemize} \end{enumerate} @@ -727,7 +798,7 @@ environnements \enquote{verbatim} suivants. \begin{dbwarning}{Exemples de codes avec résultats : possiblement flottants}{exemples-flottants} - Si l'option \lstinline+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} @@ -752,7 +823,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 \lstinline+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 @@ -760,14 +831,11 @@ 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 - \lstinline+sidebyside+ ; + ⅛sidebyside⅛ ; \item de supprimer les numéros de ligne au moyen de l'option -\bgroup -\lstset{deletekeywords=[3]{none},morekeywords=[4]{none},morekeywords=[3]{listing}} \begin{ltx-code} listing options={numbers=none} \end{ltx-code} -\egroup \end{itemize} \item trois spécifiques à ces environnements : \begin{docKey*}{title addon}{=\meta{supplément au titre}}{\valinitdef} @@ -785,7 +853,7 @@ listing options={numbers=none} \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 \lstinline+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} @@ -795,17 +863,193 @@ 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 \lstinline+sidebyside+. + être passée \emph{avant} l'option ⅛sidebyside⅛. \end{dbwarning} \end{docKey*} \end{itemize} -\begin{dbwarning}{Caractère d'échappement}{} +\subsubsection{Coloration syntaxique} +\label{sec:coloration} + +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 + \package*{listings} ; +\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⅛. +\end{dbwarning} + +Il est néanmoins possible de spécifier d'autres langages et dialectes au moyen +de la commande \refCom{syntaxhl} suivante, à insérer avant le début de l'exemple +de code concerné. + +\begin{docCommands}[ +doc name = syntaxhl, +doc parameter = \marg{liste de dialectes}, +] +{ + { }, + { doc parameter = \oarg{langage}\marg{liste de dialectes} }, +} +Cette comande permet de spécifier : +\begin{itemize} +\item un \meta{langage} (par défaut \hologo{TeX}) ; +\item une \meta{liste de dialectes}, séparés par des virgules ; +\end{itemize} +auxquels on souhaite que s'applique la coloration syntaxique. +\end{docCommands} + +\begin{dbwarning}{Dialectes colorés syntaxiquement seulement si définis}{} + Ceci suppose que ces langages et dialectes sont définis (et saisis selon la + syntaxe du \package*{listings}) dans le \file*{letgut-lstlang.sty} situé : + \begin{itemize} + \item soit dans le dossier de la \lettre{} en cours ; + \item soit dans le dossier parent de celui de la \lettre{} en cours ; + \item soit dans un dossier de la \tds{} + \end{itemize} +\end{dbwarning} + +Pour le langage \hologo{TeX}, ces dialectes sont essentiellement les classes et +les packages \hologo{(La)TeX} et un exemple de déclaration de tel dialecte est +fourni section~\enquote{\nameref{sec:exemple-de-decl}}, +\vpageref{sec:exemple-de-decl}. + +\subsection{Entrées et sorties dans un terminal} +\label{sec:entrees-sorties} + +Afin de présenter aisément et de façon homogène des exemples de commandes +entrées et éventuellement de leurs sorties correspondantes, la \letgutcls{} +fournit la commande à arguments \enquote{verbatim} suivante. + +\begin{docCommand}{terminal}{\oarg{prompt}\oarg{options}\marg{stdin}\marg{stdout}} + % + Cette commande affiche les codes en entrée (\meta{stdin}) et en sortie + (\meta{stdout}), chacun des deux étant possiblement vide. + + Le \meta{prompt}, ou \enquote{invite de commande}, est par défaut le symbole + \texttt{\$} affiché en rouge. + + 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, + aussi, les commandes \docAuxCommand{DeclareTCBListing} et assimilées + fournies par la bibliothèque \lstinline+xparse+ de ce package.}. +\end{docCommand} + +Ainsi le code suivant : +\begingroup +\lstset{basicstyle=\ttfamily\scriptsize} +\begin{ltx-code}[listing options app={% + deletekeywords={[3]{latex,width,height,string,label,by,example,system,tex}},% + deletetexcs={edef,rlap,smash,expandafter,string}% +}] +\terminal{time rg foobar -g "*.sty" "/home/bitouze/texlive/2022"}{ +/home/bitouze/texlive/2022/texmf-dist/tex/latex/skeyval/skeyval.sty +445:% \usepackage[option1,option2]{foobar} +447:% \expandafter\show\csname foobar.sty.poxkeys\endcsname + +/home/bitouze/texlive/2022/texmf-dist/tex/latex/thmtools/thm-restate.sty +197:%%% support for keyval-style: restate=foobar + +/home/bitouze/texlive/2022/texmf-dist/tex/latex/pinlabel/pinlabel.sty +284:\edef\foobar{[width=\@p@swidth sp,height=\@p@sheight sp]{\@p@dffile}}% +286:\@message{\string\@includegraphics@\foobar}% +287:\rlap{\smash{\expandafter\@includegraphics@\foobar}}% + +/home/bitouze/texlive/2022/texmf-dist/tex/latex/theoremref/theoremref.sty +129: its label by ``\thlabel{foobar}''. For example, + +/home/bitouze/texlive/2022/texmf-dist/tex/latex/qrbill/qrbill.sty +12:%% Marei Peischl (peiTeX) and Alex Antener (foobar LLC). +rg -g 0,25s user 0,23s system 320% cpu 0,150 total +} +\end{ltx-code} + +donne-t-il : + +\terminal{time rg foobar -g "*.sty" "/home/bitouze/texlive/2022"}{ +/home/bitouze/texlive/2022/texmf-dist/tex/latex/skeyval/skeyval.sty +445:% \usepackage[option1,option2]{foobar} +447:% \expandafter\show\csname foobar.sty.poxkeys\endcsname + +/home/bitouze/texlive/2022/texmf-dist/tex/latex/thmtools/thm-restate.sty +197:%%% support for keyval-style: restate=foobar + +/home/bitouze/texlive/2022/texmf-dist/tex/latex/pinlabel/pinlabel.sty +284:\edef\foobar{[width=\@p@swidth sp,height=\@p@sheight sp]{\@p@dffile}}% +286:\@message{\string\@includegraphics@\foobar}% +287:\rlap{\smash{\expandafter\@includegraphics@\foobar}}% + +/home/bitouze/texlive/2022/texmf-dist/tex/latex/theoremref/theoremref.sty +129: its label by ``\thlabel{foobar}''. For example, + +/home/bitouze/texlive/2022/texmf-dist/tex/latex/qrbill/qrbill.sty +12:%% Marei Peischl (peiTeX) and Alex Antener (foobar LLC). +rg -g 0,25s user 0,23s system 320% cpu 0,150 total +} +\endgroup + +\subsection{Caractères d'échappement et de raccourci pour les + extraits de code} +\label{sec:caract-dech-et} + +\begin{dbwarning}{Caractère d'échappement des listings}{} \lstset{escapechar=}% - La \letgutcls{} définit ×£× comme caractère d'échappement dans \LaTeX{} au - sein d'un code \LaTeX{}. + La \letgutcls{} définit ⅛£⅛ comme caractère d'échappement dans \LaTeX{} au + sein d'un listing. \end{dbwarning} +Au besoin, on pourra désactiver ce caractère actif au moyen de +\begin{ltx-code} +\lstset{escapechar=} +\end{ltx-code} + +\begin{dbwarning}{Équivalent court de \docAuxCommand{lstinline}}{} + Les extraits de code peuvent être saisis au moyen de la commande + \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 + ordinaire.}. +\end{dbwarning} + +Autrement dit, la \letgutcls{} contient l'instruction\footnote{À peu + de choses près.} : + \lstDeleteShortInline⅛ +\begin{ltx-code} +\lstMakeShortInline£\texttt{⅛}£ +\end{ltx-code} + + Au besoin, on pourra désactiver ce caractère actif au moyen de : +\begin{ltx-code} +\lstDeleteShortInline£\texttt{⅛}£ +\end{ltx-code} + +\begin{dbremark}{Obtention du caractère \texttt{⅛}}{} +Le caractère % +\texttt{⅛} % +s'obtient : +\begin{itemize} +\item sous \linux{} : \LKeyShiftAltGrX{2}\footnote{Touche \LKey{2} 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}. +\end{itemize} +\end{dbremark} + \lstMakeShortInline⅛% + \section{Nouveautés apparues sur le \ctan} \label{sec:rubr-cons-aux} @@ -840,18 +1084,15 @@ suivante. automatiquement situé en regard dans la marge, les signale comme telles. \end{docCommands} -\bgroup -\lstset{deletekeywords=[3]{l},deletekeywords=[6]{hologo,matapli}} -\begin{ltx-code-external-result}[title addon=nouveautés]{exemple-nouveautes} +\begin{ltx-code-external-result}[title addon=nouveautés,listing options app={deletekeywords={[6]{hologo,matapli}}}]{exemple-nouveautes} \begin{ctannews} -\item[nl-interval] vise à simplifier le processus de représentation - graphique des intervalles de l'axe réel. +\item[nl-interval] vise à simplifier le processus de + représentation graphique des intervalles de l'axe réel. \item*[matapli] classe \hologo{LaTeX} destinée à la composition de la revue Matapli (conçue par \person{Chupin, Maxime}, secrétaire adjoint de \gutenberg{}). \end{ctannews} \end{ltx-code-external-result} -\egroup \begin{docCommand}{francophony}{} Cette commande affiche le logo de la francophonie, ainsi : \francophony. @@ -930,10 +1171,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 @@ -942,7 +1183,7 @@ commande dédiée \refCom{letgutacro}. Sauf si elle existe déjà, auquel cas la création d'une telle commande est silencieusement escamotée. Ainsi par exemple, l'acronyme % - \lstinline!\\letgutacro[...]\{TIKZ\}\{...\}[...]! + \lstinline+\\letgutacro[...]\{TIKZ\}\{...\}[...]+ % fourni par \letgut{} (cf. \vpageref{liste-acronymes}) ne surcharge-t-il pas la commande \docAuxCommand{tikz} fournie notamment par le @@ -951,8 +1192,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 @@ -980,9 +1221,7 @@ En outre : Ainsi, avec les définitions suivantes en préambule : -\bgroup -\lstset{deletekeywords={and},deletekeywords=[3]{and,emph,n,german},deletekeywords=[4]{and,TeX}} -\begin{ltx-code}[title addon=définition d'acronymes,drop lifted shadow] +\begin{ltx-code}[title addon=définition d'acronymes,listing options app={deletekeywords={[3]{TeX,LaTeX,emph,n,no}}}] % Acronyme français \letgutacro{LD}{\LaTeX{} dépendant} @@ -1013,13 +1252,10 @@ Ainsi, avec les définitions suivantes en préambule : {Ti\emph{k}Z ist \emph{kein} Zeichenprogramm} [Ti\emph{k}Z \emph{n'}est \emph{pas} un programme de dessin] \end{ltx-code} -\egroup a-t-on : -\bgroup -\lstset{deletekeywords=[3]{cd,tikz,on},deletekeywords=[4]{on},deletekeywords=[6]{cd}} -\begin{ltx-code-result}[title addon=utilisation d'acronymes] +\begin{ltx-code-result}[title addon=utilisation d'acronymes,listing options app={deletekeywords={cd},deletekeywords={[3]{cd,tikz,LaTeX,on}},deletekeywords={[6]{cd}},deletekeywords={itemize},morekeywords={[2]{itemize}}}] On dispose désormais pour \enquote{\LaTeX{} dépendant} d'un acronyme qu'on peut utiliser par exemple \begin{itemize} @@ -1035,28 +1271,21 @@ On peut également employer les acronymes : \item \ac{tikz}, \ac{tikz}. % Noter le non emploi de `\tikz' \end{itemize} \end{ltx-code-result} -\egroup Les noms des commandes sous-jacentes ne doivent contenir que des lettres, mais celles-ci peuvent être accentuées. Ainsi, avec la définition suivante en préambule : -\bgroup -\lstset{deletekeywords=[3]{and}} \begin{ltx-code}[title addon=définition d'acronyme avec lettres accentuées,drop lifted shadow] \letgutacro{CPGÉ}{Classes Préparatoires aux Grandes Écoles} \end{ltx-code} -\egroup a-t-on : -\bgroup -\lstset{deletekeywords=[3]{l}} -\begin{ltx-code-result}[title addon=utilisation d'acronyme avec lettres accentuées] +\begin{ltx-code-result}[title addon=utilisation d'acronyme avec lettres accentuées,listing options app={deletekeywords={[3]{l}}}] On peut également employer l'acronyme \cpgé{}, \cpgé{}. \end{ltx-code-result} -\egroup La \letgutcls{} fournit un \file*{letgut-acronyms.tex} dans lequel sont définis plusieurs acronymes anglais et français, directement utilisables. Ceux-ci sont @@ -1091,8 +1320,6 @@ insère un filet horizontal. \end{itemize} \end{docCommand} -\bgroup -\lstset{deletekeywords=[5]{en}} \begin{ltx-code-result}[title addon=boîtes d'alertes] \alertbox{% Adhérez, adhérez, il en restera toujours quelque chose !% @@ -1103,7 +1330,6 @@ insère un filet horizontal. Il en restera toujours quelque chose...% } \end{ltx-code-result} -\egroup \section{Fichier local de configuration} \label{sec:fichier-local-de} @@ -1188,13 +1414,7 @@ Ensuite, par exemple depuis un dossier où se trouve un \file*{mon-fichier.tex} % }% }) : -% \begin{listingshell} -% docker run --rm -it -v $(pwd):/workdir danteev/texlive lualatex mon-fichier -% \end{listingshell} - -\begin{listingshell} -docker run -i --rm --name latex -v "$PWD":/usr/src/app -w /usr/src/app registry.gitlab.com/islandoftex/images/texlive:latest-with-cache lualatex mon-fichier -\end{listingshell} +\terminal{docker run -i --rm --name latex -v "$PWD":/usr/src/app -w /usr/src/app registry.gitlab.com/islandoftex/images/texlive:latest-with-cache lualatex mon-fichier}{}%$ La toute première fois, cela provoque le téléchargement de plusieurs fichiers, dont celui assez lourd de l'image d'une version allégée de la \tl{}~2021 @@ -1220,9 +1440,7 @@ pour pouvoir compiler au moyen de seulement\footnote{En lançant préalablement \lstinline[language=bash]+source ~/.bashrc+ (ou assimilé) afin de pouvoir en bénéficier dans un terminal déjà ouvert.} : -\begin{listingshell} -docker-latexmk-lua mon-fichier -\end{listingshell} +\terminal{docker-latexmk-lua mon-fichier}{} \title{Packages chargés par \letgut{}} \label{sec:packages-charges-par} @@ -1280,7 +1498,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] \lstinline+\renewcommand*\frenchtablename{Tableau}+. + \item[Configuration] ⅛\renewcommand*\frenchtablename{Tableau}⅛. \end{description} \item[varioref] références de pages intelligentes. \begin{description} @@ -1320,11 +1538,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=}\lstinline|\scshape| ; - \item \docAuxKey*{format/foreign=}\lstinline|\em| ; + \item \docAuxKey*{format/short=}⅛\scshape⅛ ; + \item \docAuxKey*{format/foreign=}⅛\em⅛ ; \item \docAuxKey*{foreign/display} ; \item \docAuxKey*{locale/display} ; - \item \docAuxKey*{locale/format=}\lstinline|\upshape|. + \item \docAuxKey*{locale/format=}⅛\upshape⅛. \end{itemize} \end{description} \item[hyperref] prise en charge étendue de l'hypertexte. @@ -1384,6 +1602,100 @@ dressons ci-après la liste en les regroupant selon ces deux catégories. \item[letgut-banner] bannière de la 1\iere{} page de la \lettre{}. \end{ctannews} +\section{Exemple de déclaration de dialecte du langage \hologo{TeX}} +\label{sec:exemple-de-decl} + +Nous fournissons ci-dessous un exemple de déclaration de dialecte (ici le +package \hologo{(La)TeX} \package{graphicx}) du langage \hologo{TeX} +(cf. section~\enquote{\nameref{sec:coloration}}, \vpageref{sec:coloration}). + +\begin{ltx-code}[listing options app={deletekeywords={[3]{ + ,draft + ,final + ,setpagesize + ,dvips + ,dvipdfm + ,dvipdfmx + ,xetex + ,pdftex + ,dvipsone + ,dviwindo + ,textures + ,vtex + ,alt + ,width + ,height + ,totalheight + ,scale + ,clip + ,draft + ,type + ,command + ,page +}}}, +listing options app={deletekeywords={[4]{ + ,draft + ,final + ,dvips + ,dvipdfm + ,dvipdfmx + ,xetex + ,pdftex + ,luatex + ,vtex + ,scale + ,true + ,false +}}}] +\lst@definelanguage[graphicx]{TeX}[LaTeX]{TeX}{% + % Control sequences names + moretexcs={% + DeclareGraphicsExtensions,DeclareGraphicsRule,graphicspath,% + includegraphics*,includegraphics,reflectbox,resizebox*,% + resizebox,rotatebox,scalebox,% + },% + % 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]{% + draft,final,hiresbb,demo,setpagesize,nosetpagesize,dvips,xdvi,% + dvipdf,dvipdfm,dvipdfmx,xetex,pdftex,luatex,dvisvgm,dvipsone,% + dviwindo,emtex,dviwin,oztex,textures,pctexps,pctexwin,pctexhp,% + pctex32,truetex,tcidvi,vtex,debugshow,hiderotate,hidescale,% + alt,% + % + bb,bbllx,bblly,bburx,bbury,natwidth,natheight,hiresbb,pagebox,% + viewport,trim,angle,origin,width,height,totalheight,% + keepaspectratio,scale,clip,type,ext,read,command,quiet,page,% + interpolate,decodearray,origin,x,y,units,% + },% + % Keywords of class 4 : values of keys (in key=value) + morekeywords=[4]{% + mediabox,cropbox,bleedbox,trimbox,artbox,true,false,% + },% + % 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]{% + graphicx,% + },% + % otherkeywords={},% + alsoletter={23},% + % alsodigit={},% + sensitive,% +}[keywords,tex,comments]% +\end{ltx-code} + \printacronyms[ , heading=title % , template=longtable diff --git a/macros/luatex/latex/letgut/doc/listings-conf.tex b/macros/luatex/latex/letgut/doc/listings-conf.tex index dd58a10716..99ac8206f4 100644 --- a/macros/luatex/latex/letgut/doc/listings-conf.tex +++ b/macros/luatex/latex/letgut/doc/listings-conf.tex @@ -1,40 +1,7 @@ -\lstset{ - backgroundcolor=\color{__letgut_backgroundCode}, - rulecolor=\color{__letgut_borderCode}, - frame=single, - aboveskip=\medskipamount, - breaklines=false, -} - -\lstset{ - language=TeX,% - alsolanguage=[geometry]TeX,% - alsolanguage=[LaTeX]TeX,% - alsolanguage=[plain]TeX,% - alsolanguage=[common]TeX,% - alsolanguage=[primitive]TeX,% - alsolanguage=[classes]TeX,% - alsolanguage=[xcolor]TeX,% - alsolanguage=[listings]TeX,% - alsolanguage=[biblatex]TeX,% - alsolanguage=[hyperref]TeX,% - alsolanguage=[xparse]TeX,% - alsolanguage=[lthooks]TeX,% - alsolanguage=[extLaTeX]TeX,% - alsolanguage=[letgut]TeX,% - alsolanguage=[hologo]TeX,% - alsolanguage=[acro]TeX,% - alsolanguage=[tcolorbox]TeX,% - alsolanguage=[graphicx]TeX,% - alsolanguage=[csquotes]TeX,% - alsolanguage=[varioref]TeX,% - alsolanguage=[babel-french]TeX,% - alsolanguage=[l3keys2e]TeX,% - alsolanguage=[expl3]TeX,% -} - % We need to disable `escapechar=£' enabled by the class in order to avoid this % to make a mess in the listing which contains it. \lstset{ escapechar=,% } +% Strangely, we can't rely on \syntaxhl{expl3}. To be checked! +\lstset{alsolanguage=[expl3]TeX} diff --git a/macros/luatex/latex/letgut/doc/localconf.tex b/macros/luatex/latex/letgut/doc/localconf.tex index d7834205ee..32eab1c21e 100644 --- a/macros/luatex/latex/letgut/doc/localconf.tex +++ b/macros/luatex/latex/letgut/doc/localconf.tex @@ -22,26 +22,9 @@ \let\/\relax% } -\makeatletter -\lst@InputCatcodes -\def\lst@DefEC{% - \lst@CCECUse \lst@ProcessLetter - ^^80^^81^^82^^83^^84^^85^^86^^87^^88^^89^^8a^^8b^^8c^^8d^^8e^^8f% - ^^90^^91^^92^^93^^94^^95^^96^^97^^98^^99^^9a^^9b^^9c^^9d^^9e^^9f% - ^^a0^^a1^^a2^^a3^^a4^^a5^^a6^^a7^^a8^^a9^^aa^^ab^^ac^^ad^^ae^^af% - ^^b0^^b1^^b2^^b3^^b4^^b5^^b6^^b7^^b8^^b9^^ba^^bb^^bc^^bd^^be^^bf% - ^^c0^^c1^^c2^^c3^^c4^^c5^^c6^^c7^^c8^^c9^^ca^^cb^^cc^^cd^^ce^^cf% - ^^d0^^d1^^d2^^d3^^d4^^d5^^d6^^d7^^d8^^d9^^da^^db^^dc^^dd^^de^^df% - ^^e0^^e1^^e2^^e3^^e4^^e5^^e6^^e7^^e8^^e9^^ea^^eb^^ec^^ed^^ee^^ef% - ^^f0^^f1^^f2^^f3^^f4^^f5^^f6^^f7^^f8^^f9^^fa^^fb^^fc^^fd^^fe^^ff% - ^^^^201c^^^^201d% nouveaux pour “ et ” - ^^00} -\lst@RestoreCatcodes -\makeatother - \ExplSyntaxOn -\lstMakeShortInline× +\lstset{style=__letgut_latex_listings_style} \lstdefinelanguage{extrabash}{% morekeywords={% @@ -78,35 +61,6 @@ keywords~ bold=false }% -\DeclareTotalTCBox{\commandshell}{ v }{ commandshell}{#1} -\newtcblisting{listingshell}[1][]{% - % colback=black, - % colupper=white, - colback=white, - colupper=black, - colframe=yellow!75!black, - breakable, - listing~ only, - listing~ options={% - style=tcblatex, - language=bash, - alsolanguage=extrabash,% - basicstyle=\footnotesize\ttfamily, - escapeinside={(*@}{@*)}, - upquote=true, - showstringspaces=false - }, - every~ listing~ line={% - \textcolor{red}{% - \small\ttfamily\bfseries% - \BeginAccSupp{method=plain,ActualText={}} - \$~ - \EndAccSupp{}% - } - }, - #1 -} - \renewcommand*{\tcbdocnew}[1]{ \scriptsize\sffamily\textcolor{green!50!black}{\bfseries Nouv. :} #1} |