summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/letgut/doc/localconf.tex
blob: af0c9ecd5eee440a2d96da9b4c7064160f1e15e0 (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
% Pour de jolies icônes
\usepackage{fontawesome5}

% Pour l'index
\usepackage[imakeidx]{xindex}
\makeindex
\indexsetup{level=\title,toclevel=title,firstpagestyle=fancy}

% Commande sans laquelle les numéros de pages de l'index ne seraient pas des
% hyperliens
\DeclareHookRule{env/document/begin}{xindex}{before}{hyperref}

% La librairie suivante doit nécessairement être chargée après `imakeidx`
\tcbuselibrary{%
  documentation,theorems%
}

% Nous voulons que la commande \meta, fournie par la librairie `documentation'
% du package `tcolorbox' affiche son argument en fonte à châsse fixe, en couleur
% et sans correction d'italique.
\AddToHook{cmd/meta@font@select/after}{%
  \ttfamily%
  \color{brown}%
  \let\/\relax%
}

\ExplSyntaxOn

\lstset{style=__letgut_latex_listings_style}

\lstdefinelanguage{extrabash}{%
  morekeywords={%
    docker,docker-pdflatex,docker-lualatex
  },%
  alsoletter={-},%
  sensitive%
}

\tcbset{%
  doclang/environment~ content=contenu~ de~ l'environnement,%
  doclang/color=~ (couleur),%
  doclang/colors=Couleurs,%
  doclang/environments=Environnements,%
  doclang/keys=Clés,%
  doclang/values=Valeurs,%
  doclang/pageshort=p.,%
  documentation~ listing~ style=dbtex,%
  color~ command=__letgut_texcs,%
  color~ environment=__letgut_environment,%
  color~ key=__letgut_key,%
  color~ value=__letgut_value,%
  doc~ head={interior~ style={fill,color=yellow!20!white}},%
  % index~ format=pgfchapter,%
  index~ format=off,%
  index~ colorize,%
  index~ annotate=false,%
  enhanced,%
  % listing~ style=dbtex,%
  % every~ box/.style={documentation~ listing~ style=dbtex},%
  % index~ actual={},%
  % doc~ left~ indent=-15mm,%
  % doc~ right~ indent=-15mm+2em
  keywords~ bold=false
}%

% Redéfinition de commande pour que les mentions des nouveautés et mises à jour
% ne dépassent pas dans la marge
\renewcommand{\tcbdocmarginnote}[2][]{%
  \marginnote{%
    \begin{tcolorbox}[enhanced~ jigsaw,size=fbox,boxrule=1pt,leftrule=0pt,rightrule=0pt,
      arc=0pt,outer~ arc=1pt,boxsep=1pt,top=1pt,bottom=1pt,
      nobeforeafter,width=\c__letgut_hoffset_dim-\marginparsep,
      colframe=red!50!white,colback=red!25!yellow!5!white,fontupper=\scriptsize,
      if~ odd~ page~ or~ oneside={flushright~ upper}{flushleft~ upper},
      doc@marginnote,#1]#2\end{tcolorbox}}}

\renewcommand*{\tcbdocnew}[1]{
  \scriptsize\sffamily\textcolor{green!50!black}{\bfseries
Nouv. :~} #1}
\renewcommand*{\tcbdocupdated}[1]{\scriptsize\sffamily\textcolor{blue!75!black}{\bfseries
\textsc{m.-à-j.} :~} #1}
%

\NewDocumentCommand \valinit { o }
{
  % valeurs~ :~
  init.~
  {
    \em
    \IfNoValueTF {#1}
    { vide }
    { #1 }
  }
}

\NewDocumentCommand \valdef { o }
{
  par~ déf.~
  {
    \em
    \IfNoValueTF {#1}
    { aucune }
    {  #1 }
  }
}

\NewDocumentCommand{\valinitdef}{ O{} o } {
  \tl_if_blank:nTF {#1}
  {
    \valinit,~ \valdef[#2]
  }
  {
    \valinit[#1],~ \valdef[#2]
  }
}

\tcbset{dbtcb/.style={%
    breakable,
    fonttitle=\bfseries,
    enlarge~ top~ by=1mm,
    separator~ sign~ dash,
    label~ separator=-,
    before~ title={%
      \hypersetup{hidelinks}%
      \tcbset{%
        color~ definition=white,
        color~ hyperlink=white,
      }%
    },%
    keywords~ bold=false,
  }%
}%

\AddToHook{begindocument/before}{
  \newtcbtheorem[list~inside=dbwarninglist,crefname={avertissement}{avertissements}]{dbwarning}{Avertissement}{%
    colback=red!5!white,
    colframe=red!75!black,
    dbtcb
  }{wa}
  \newtcbtheorem[list~inside=dbremarklist,crefname={remarque}{remarques}]{dbremark}{Remarque}{%
    colback=blue!5!white,
    colframe=blue!75!black,
    dbtcb
  }{rq}
}
%
\ExplSyntaxOff

% Nous voulons que les notes marginales soient toujours dans la marge de
% gauche :
\makeatletter
\patchcmd{\@mn@@@marginnote}{\begingroup}{\begingroup\@twosidefalse}{}{\fail}
\reversemarginpar
\makeatother


%%% Local Variables:
%%% mode: latex
%%% TeX-engine: luatex
%%% TeX-master: letgut
%%% End: