summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/lualatex/letgut/letgut-banner.org
blob: 44fa5fdec9b9f862feb9f9f79f19c767123266ad (plain)
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
796
797
798
799
800
801
802
803
804
# Hey, Emacs!  This is a -*- mode: org -*- file!

#+TITLE:     Support for the banner of the newsletter “La Lettre de GUTenberg”
#+AUTHOR:    Association GUTenberg
#+EMAIL:     secretariat@gutenberg.eu.org
#+DESCRIPTION: ...
#+KEYWORDS:  ...
#+LANGUAGE:  en
#+OPTIONS:   num:t toc:nil title:nil

#+LATEX_COMPILER: lualatex

#+LaTeX_CLASS: letgut
#+LaTeX_HEADER: \setmainfont{KpRoman}
#+LaTeX_HEADER: \setsansfont{KpSans}
#+LaTeX_HEADER: \setmonofont[Scale = MatchLowercase]{RobotoMono}
#+LaTeX_HEADER: \letgutsetup{editorial=false}
#+LaTeX_HEADER: \input{listings-conf}
# #+LaTeX_HEADER: \input{codehigh-conf}
# #+LaTeX_HEADER: \letgutsetup{editorial=false,final}

#+PROPERTY: header-args :padline no :tangle letgut-banner.sty :exports both :noweb yes :eval always
#+export_file_name: letgut-banner-code

* Readme file :noexport:

#+begin_src markdown :tangle README.md :exports none
  letgut-banner - Support for the banner of the newsletter
                  “La Lettre de GUTenberg”
  =============================================================

  About
  -------
  This package automatically draw the banner of the newsletter “La Lettre de
  GUTenberg” with the current main font.

  Release
  -------
  2022-03-18 v0.9

  Development
  -----------
  Follow development, submit issues, and suggest improvements at
  https://framagit.org/gutenberg/classe-lettre-gut.
#+end_src

* Identification

#+begin_src latex
% 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_src

* Implementation

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_src latex
\NeedsTeXFormat{LaTeX2e}[2020-10-01]
#+end_src

Now, we can announce the package name and its version:

#+begin_src latex
\ProvidesExplPackage{letgut-banner}
{2022-03-18}
{0.9}
{
  Package for the banner of the newsletter “La Lettre de GUTenberg”
}
#+end_src

** Packages loaded

In order to provide class options, we load the \package{l3keys2e} which provides
\LaTeXe{} option processing using \LaTeX3 keys:

  #+begin_src  latex
\RequirePackage{l3keys2e}
  #+end_src

Till the Lua-based color will be  added to the core \package{l3color} approach,
we have to rely on \package{xcolor}

#+begin_src latex
\RequirePackage{xcolor}
#+end_src

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_src latex
\RequirePackage{accsupp}
#+end_src

What follows has to be done at this end of the preamble, otherwise the font set
with ~\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_src latex
  \keys_define:nn { letgut-banner }
  {
    , pagecolor .clist_gset:N = \g__letgutbanner_pagecolor_clist
    , pagecolor .initial:n = { 1,1,1 }
  }
  \ProcessKeysOptions { letgut-banner }
#+end_src

#+begin_src latex
\AddToHook{begindocument}{
#+end_src

#+begin_src latex
  \cs_generate_variant:Nn \color_fill:nn { nV }
#+end_src

** Declarations

*** Dimensions

   #+begin_src latex
     \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_src

- 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 ~\dim_const:Nn~ (see
  https://github.com/latex3/latex3/issues/947#issuecomment-860950569).
   #+begin_src latex
     \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_src
- 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.
  - Thickness of the “L”.
      #+begin_src latex
        \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_src
  - Height of the “L” (that of the text area plus 3cm).
      #+begin_src latex
        \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_src
  - Initial padding of the text embedded in the vertical bar of the “L”.
      #+begin_src latex
      \dim_const:Nn \c__letgutbanner_banner_padding_dim  { .25cm }
      #+end_src
  - 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_src latex
        \dim_const:Nn \c__letgutbanner_banner_width_dim  {
          \c__letgutbanner_textwidth_dim
          +
          (
          \c__letgutbanner_banner_thickness_dim
          +
          \c__letgutbanner_lmargin_dim
          )/2
        }
      #+end_src
  - Initial width of the text embedded in the “L” vertical bar.
      #+begin_src latex
        \dim_const:Nn
        \c__letgutbanner_banner_vertical_contents_width_dim {
          \c__letgutbanner_banner_thickness_dim
          -
          2\c__letgutbanner_banner_padding_dim
        }
      #+end_src
  - 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_src latex
        \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_src

*** Boxes

New boxes, for each of the letters in the word “LETTRE” (!), and then for the
rest of the content listed in the banner.
#+begin_src latex
\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_src

*** Floating point numbers

- Minimum percentage of the common height of the letters of the word “LETTRE”
  that their line spacing must represent.
#+begin_src latex
\fp_const:Nn \c__letgutbanner_leading_minimum_percent_fp { 0.15 }
#+end_src
- Factor applied to the line spacing between “La” and the 1st letter of
  “LETTRE” compared to that between the letters of “LETTRE”.
#+begin_src latex
\fp_const:Nn \c__letgutbanner_leading_La_factor_fp { 1.5 }
#+end_src

** Application des dimensions de la page

#+begin_src latex
  \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_src

** Filling of the boxes
#+begin_src latex
  \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_src

** Computations

Determination of the widths of each of the letter boxes of the word “LETTRE”.
#+begin_src latex
  \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_src
Determination of the largest of these widths, stored in the scratch dimension
~\g_tmpa_dim~.
#+begin_src latex
\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_src
Determination of the (1st) box whose width is the largest of all (~argmax~, as
it were).
#+begin_src latex
\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_src
Resize the box containing “GUTenberg” to the width of the text embedded in the
horizontal bar of the “L”.
#+begin_src latex
  \box_gresize_to_wd:Nn \g__letgutbanner_GUTenberg_box {
    \c__letgutbanner_banner_horizontal_contents_width_dim
  }
#+end_src
Determination of the height and depth of the box containing “GUTenberg” resized.
#+begin_src latex
  \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_src
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_src latex
  \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_src
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 ~\g__letgutbanner_banner_vertical_contents_width_dim~, is
initially fixed:
#+begin_src latex
  \dim_gset:Nn
  \g__letgutbanner_banner_vertical_contents_width_dim
  \c__letgutbanner_banner_vertical_contents_width_dim
#+end_src
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:

~\c__letgutbanner_leading_minimum_percent_fp~

and fixed at 0.15. If this is not the
case, we reduce (by 1pt):

~\g__letgutbanner_banner_vertical_contents_width_dim~

and loop until it is the case.
#+begin_src latex
  \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_src
Resize the largest of these boxes to the width of the text embedded in the “L”.
#+begin_src latex
  \box_gresize_to_wd:Nn \g__letgutbanner_largest_LETR_box {
    \g__letgutbanner_banner_vertical_contents_width_dim
  }
#+end_src
Height of this resized larger box.
#+begin_src latex
  \dim_gset:Nn \g__letgutbanner_largest_LETR_box_height_dim {
    \box_ht:N \g__letgutbanner_largest_LETR_box
  }
#+end_src
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_src latex
  \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_src
Resize the box containing “La” to the width of the text embedded in the “L”
vertical bar.
#+begin_src latex
  \box_gresize_to_wd:Nn \g__letgutbanner_La_box {
    \g__letgutbanner_banner_vertical_contents_width_dim
  }
#+end_src
Determine the height ($h$) and depth ($d$) of the resized box containing “La”.
#+begin_src latex
  \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_src
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_src latex
  \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_src
For the following, the area containing the letters of the word “LETTRE” aligned
vertically is fixed, defined as follows:
  - its top is the baseline of “La”,
  - its bottom is the baseline of “GUTenberg”.
Determination of the height of this area.
#+begin_src latex
  \dim_gset:Nn \g__letgutbanner_area_height_dim {
    \g__letgutbanner_La_yoffset_dim
    -
    \g__letgutbanner_La_depth_dim
    -
    \c__letgutbanner_GUTenberg_yoffset_dim
  }
#+end_src
Determining the vertical jump ($s$) between the letters in the word “LETTRE”
with the constraints that:
  - 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”),
  - the baseline of the last letter (“E”) is merged with the bottom of the area,
  - this jump must not be less than 20 % of the common height $h$ to all these
    letters i.e.:

    ~\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”.

The sum of :
  - the 5 vertical spaces ($5e$) between the letters in the word “LETTRE”,
  - the 6 common heights ($6h$) to all these letters,
  - $3e/2$,
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:

1. Determine the vertical half-space between the letters.
   #+begin_src latex
     \dim_set:Nn \l_tmpa_dim {
       (
       \g__letgutbanner_area_height_dim
       -
       6\g__letgutbanner_largest_LETR_box_height_dim
       )/13
     }
   #+end_src
2. Vertical space between letters.
   #+begin_src latex
     \dim_gset:Nn \g__letgutbanner_between_letters_vertical_space_dim {
       2\l_tmpa_dim
     }
   #+end_src
3. If this space does not check the condition explained above, we reduce:

   ~\g__letgutbanner_banner_vertical_contents_width_dim~

   and loop.
   #+begin_src latex
     \dim_gsub:Nn \g__letgutbanner_banner_vertical_contents_width_dim {
       1pt
       }
     }
   #+end_src
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_src latex
   \dim_gset:Nn \g__letgutbanner_banner_padding_dim {
     (
     \c__letgutbanner_banner_thickness_dim
     -
     \g__letgutbanner_banner_vertical_contents_width_dim
     )/2
   }
   #+end_src
4. Determination of the vertical offset of the 1st letter (“L”).
   #+begin_src latex
     \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_src
5. Determination of the vertical jump between letters.
   #+begin_src latex
     \dim_gset:Nn \g__letgutbanner_between_letters_yoffset_dim {
       \g__letgutbanner_between_letters_vertical_space_dim
       +
       \g__letgutbanner_largest_LETR_box_height_dim
     }
   #+end_src
Resize the box containing “g” to the width of the text.
#+begin_src latex
    \box_gresize_to_wd:Nn \g__letgutbanner_g_box {
      \c__letgutbanner_textwidth_dim
    }
#+end_src
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:
  - the top of the horizontal bar of “L” is at a distance equal to the sum of :
    - 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”
#+begin_src latex
  \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_src
Automatic addition on the 1st page (only) of the banner.
#+begin_src latex
\AddToHookNext{shipout/background}{
#+end_src
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_src latex
  \BeginAccSupp{ActualText={}}
#+end_src
We put now the big “L” at the right place.
#+begin_src latex
  \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_src
The color should not be systematically white, but should be identical to the one
chosen for the page background.
#+begin_src latex
  % \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_src
  We end the part which isn't selectable.
  #+begin_src latex
  \EndAccSupp{}
  }
#+end_src

We close ~\AddToHook{begindocument}~.

#+begin_src latex
}
#+end_src

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_src latex
\@ifclassloaded{letgut}{
}{
  \AddToHook{begindocument/end}{%
    \enlargethispage{
      - \g__letgutbanner_first_page_shrink_dim
    }
    \thispagestyle{empty}
  }
}
#+end_src

* Example file (=letgut-banner-example.tex=)

#+begin_src latex :tangle letgut-banner-example.tex :exports both
  \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_src