1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
|
% Created 2024-03-07 Thu 14:19
% 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{Readme file}
\label{sec:org4c9ba67}
\begin{lstlisting}
-------:| ---------------------------------------------------
letgut:| Package for the banner of the newsletter
| "La Lettre de 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:org4c5e60d}
\subsection{Identification}
\label{sec:org09b0cd2}
\begin{lstlisting}
This is file `letgut-banner.sty,
generated with the Emacs Org-babel utility.
The original source file is letgut-banner.org
%%
\end{lstlisting}
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-17}
{0.9}
{
Package for the banner of the newsletter "La Lettre de GUTenberg"
}
\end{lstlisting}
\subsection{Packages loaded}
\label{sec:org447090b}
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:orgbda0ae2}
\subsubsection{Dimensions}
\label{sec:org5711d86}
\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:orge5b5c6b}
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:org61842b5}
\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:orgb3e9382}
\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:orgdd18dd8}
\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:orgb1ea800}
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:orgaf6d8ec}
\end{document}
|