summaryrefslogtreecommitdiff
path: root/info/guide-latex-fr/Chapitres/configuration.tex
blob: 9e92cf826c1bd2703cc124147881992385e21120 (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
% Réglages package "epigraph"
\setlength{\epigraphwidth}{0.8\textwidth} % Valeur par défaut : 0.4\textwidth
\renewcommand{\textflush}{flushepinormal}


%%% RACCOURCIS %%%
\newcommand{\version}{3.8}

% Générique
\newcommand{\Windows}{\texttt{Windows}}
\newcommand{\Linux}{\texttt{Linux}}
\newcommand{\Apple}{\texttt{Apple}}
\newcommand{\LinkedIn}{\texttt{LinkedIn}}
\newcommand{\Paint}{\texttt{Paint}}
\newcommand{\GIMP}{\texttt{GIMP}}
\newcommand{\Inkscape}{\texttt{Inkscape}}

% LaTeX (hologo)
\newcommand{\BibTeX}{\hologo{BibTeX}}
\newcommand{\LuaLaTeX}{\hologo{LuaLaTeX}}
\newcommand{\METAFONT}{\hologo{METAFONT}}
\newcommand{\MiKTeX}{\hologo{MiKTeX}}
\newcommand{\pdfLaTeX}{\hologo{pdfLaTeX}}
\newcommand{\pdfTeX}{\hologo{pdfTeX}}
\newcommand{\XeLaTeX}{\hologo{XeLaTeX}}

% LaTeX (custom)
\newcommand{\KaTeX}{Ka\TeX{}}
\newcommand{\Texmaker}{\texttt{Texmaker}}
\newcommand{\TikZ}{Ti\textit{k}Z}
\newcommand{\Beamer}{\texttt{Beamer}}

% Icônes
\newcommand{\folder}{\textcolor[RGB]{255,231,157}{\faFolder}}

%%% FIN RACCOURCIS %%%


%%% COULEURS %%%

% Page de garde et mind map
\definecolor{BlueFR}{RGB}{0,35,149}
\definecolor{RedFR}{RGB}{237,41,57}
\definecolor{NewOrange}{RGB}{247,111,43}
\definecolor{Gold}{RGB}{255,215,0}

% Aperçu Texmaker (Aide_LaTeX1.png) -- Hred = Red - Hyellow = Gold
\definecolor{Horange}{RGB}{255,156,0}
\definecolor{Hgreen}{RGB}{0,167,0}
\definecolor{Hblue}{RGB}{0,234,255}
\definecolor{Hpurple}{RGB}{169,15,219}

% Signature
\definecolor{lightningcyan}{RGB}{59,195,235}

%%% FIN COULEURS %%%


%%% TABLEAUX %%%

% Tableau bilan
\newenvironment{tableaubilan}[4]{
	\begin{longtable}{p{#1}p{#2}}
	% Définition des headers & footers du longtable
	{\hspace*{\fill}\textsc{#3}\hspace*{\fill}} & {\hspace*{\fill}\textsc{#4}\hspace*{\fill}} \\ \midrule
	\endhead
	\multicolumn{2}{r}{\textit{(suite sur la page suivante)}} \\
	\endfoot
	\multicolumn{2}{@{\hrulefill}c@{\hrulefill}}{\raisebox{-3pt}{~~\textsc{Fin du tableau}~~}}
	\endlastfoot
}{\end{longtable}}

%%% FIN TABLEAUX %%%


%%% BOÎTES %%%

% "Boîtes" -- Package tcolorbox
% Boîtes types
\newtcolorbox{boitetype}[4][]{enhanced, breakable, before upper = {\parindent17.6pt}, beforeafter skip = \baselineskip, colframe = #3, colback = #4, boxrule = 2pt, arc = 4mm, fonttitle = \bfseries, title = {#2}, coltitle = black, #1} % before upper = alinéa dans boîte

\newtcolorbox{boitecointype}[7][]{%
cornerrulewidth/.store in = {\tcbcornerrulewidth},
cornerrulewidth = #7,
topcornercolor/.store in = {\tcbtopcornercolor},
topcornercolor = #3,
bottomcornercolor/.store in = {\tcbbottomcornercolor},
bottomcornercolor = #4,
enhanced, breakable, before upper = {\parindent17.6pt}, beforeafter skip = \baselineskip, sharp corners, boxrule = 0pt, colback = #5, title = {#2}, fonttitle = \bfseries, coltitle = black, colbacktitle = #6, underlay unbroken = {
	\draw[\tcbtopcornercolor, line width = \tcbcornerrulewidth] ([xshift = -\tcbcornerrulewidth/2]frame.west) -- ([shift = {(-\tcbcornerrulewidth/2,\tcbcornerrulewidth/2)}]frame.north west) -- ([yshift = \tcbcornerrulewidth/2]frame.north);
	\draw[\tcbtopcornercolor, line width = \tcbcornerrulewidth] ([xshift = \tcbcornerrulewidth/2]frame.east) -- ([shift = {(\tcbcornerrulewidth/2,-\tcbcornerrulewidth/2)}]frame.south east) -- ([yshift = -\tcbcornerrulewidth/2]frame.south);
}, underlay first = {
	\draw[\tcbtopcornercolor, line width = \tcbcornerrulewidth] ([xshift = -\tcbcornerrulewidth/2]frame.west) -- ([shift = {(-\tcbcornerrulewidth/2,\tcbcornerrulewidth/2)}]frame.north west) -- ([yshift = \tcbcornerrulewidth/2]frame.north);
}, underlay last = {
	\draw[\tcbtopcornercolor, line width = \tcbcornerrulewidth] ([xshift = \tcbcornerrulewidth/2]frame.east) -- ([shift = {(\tcbcornerrulewidth/2,-\tcbcornerrulewidth/2)}]frame.south east) -- ([yshift = -\tcbcornerrulewidth/2]frame.south);
}, #1}


% Construction des autres boîtes en fonction d'une boîte type
\newenvironment{boite}[3][]{\begin{boitetype}[#1]{#2}{#3}{white}}{\end{boitetype}}
\newenvironment{boitecoin}[3][]{\begin{boitecointype}[#1]{#2}{#3}{#3}{#3!5!white}{#3!50}{2pt}}{\end{boitecointype}}

\newenvironment{regles}[2][]{\begin{boitetype}[sharp corners, boxrule = 3pt, coltitle = white, #1]{#2}{BrickRed}{Goldenrod}}{\end{boitetype}}
\newenvironment{definition}[2][]{\begin{boitecoin}[#1]{#2}{Green}}{\end{boitecoin}}
\newenvironment{conseil}[2][]{\begin{boitetype}[#1]{#2}{cyan}{cyan!40}}{\end{boitetype}}
\newenvironment{attention}[2][]{\begin{boitetype}[left = 6mm, coltitle = white, sharp corners = west, underlay = {%
	\path[fill = yellow!50!black] (frame.south west) rectangle node[white] {\huge\bfseries{}!} ([xshift = 4mm]frame.north west);
}, drop fuzzy shadow, #1]{#2}{yellow!20!black}{yellow!50}}{\end{boitetype}} % Nouvelle boîte "attention" -- Inspiration : boîte "marker" (code source guide tcolorbox)


%%% --- Explications --- %%%

% Ne fonctionne pas : \newenvironment{code}[2][]{\begin{boitecodetype}[#1]{#2}{LimeGreen}{LimeGreen!5!white}{LimeGreen!50}{2pt}{TeX}}{\end{boitecodetype}}

% Boite type avec listings impossible --> problème lors de l'appel du nouvel environnement 
% (en gros, avec une couche supplémentaire \newenvironment, listings n'arrive pas à bien détecter le début et la fin de l'environnement donc erreur)

% Solution :
% Utilisation de styles (commandes propres à tcolorbox & listings) pour recenser les options à utiliser
% Création ensuite de 3 environnements (distincts et non imbriqués) mais avec appel de ces commandes 
% ==> gain de lignes et généralisation possible

%%% --- FIN Explications --- %%%

% Stockage de 2 variables principales (plus propre)
% Autre solution : utiliser le code source tcolorbox (tcbcol@frame : couleur définie par colback)
% Attention : breakable non appliqué si "listing side text" (pas de coupure)
% ==> faire des "petits" bouts de code
\tcbset{
codemainoptions/.style = {
	maincolor/.store in = {\tcbmaincol},
	maincolor = LimeGreen,
	rulewidth/.store in = {\tcbrulewidth},
	rulewidth = 2pt,
	enhanced, breakable, beforeafter skip = \baselineskip, sharp corners, boxrule = \tcbrulewidth, colframe = \tcbmaincol, colback = \tcbmaincol!15, drop fuzzy shadow, colbacktitle = \tcbmaincol!50, coltitle = black, fonttitle = \bfseries, title = {#1},
	attach boxed title to top center = {yshift = -\tcbrulewidth/2-\tcboxedtitleheight/2, yshifttext = -\tcboxedtitleheight/2}, boxed title style = {boxrule = \tcbrulewidth, frame code = {
		\path[tcb fill frame] ([xshift = -3mm]frame.west) -- (frame.north west) -- (frame.north east) -- ([xshift = 3mm]frame.east) -- (frame.south east) -- (frame.south west) -- cycle;}, interior code = {
		\path[tcb fill interior] ([xshift = -2mm]interior.west) -- (interior.north west) -- (interior.north east) -- ([xshift = 2mm]interior.east) -- (interior.south east) -- (interior.south west) -- cycle;}}
}
}

%%% FIN BOÎTES %%%


%%% MISE EN FORME CODE LATEX %%%

\lstdefinestyle{mainlststyle}{
	language = {[LaTeX]TeX},	
	% Styles
	style = tcblatex,
	texcsstyle = *\color{cyan!65!black},
	commentstyle = \color{gray},
	inputencoding = utf8,
	% Options
	tabsize = 4, % Taille indentation
	columns = flexible, % Eviter espaces superflus lors copier-coller
	keepspaces = true,
	breaklines = true, % Retour à la ligne si code trop long
	breakatwhitespace = false,
	showspaces = false,
	showtabs = false,
	showstringspaces = false,
	upquote = true, % Apostrophes droites
	xleftmargin = 20pt, % Espace avec la marge
	numbers = left, 
	numbersep = 5pt, % Espace entre les numéros de ligne et le code
	numberstyle = \ttfamily\footnotesize\color{OrangeRed}\noncopynumber
}

% Hack pour ne pas sélectionner les numéros de ligne (code)
\newcommand{\noncopynumber}[1]{
	\BeginAccSupp{method = escape, ActualText = {}}
	#1
	\EndAccSupp{}
}

% N.B. : #2 = titre de la boite
\newtcblisting{code}[2][]{codemainoptions = {#2}, listing options = {style = mainlststyle}, listing only, #1}

\newtcblisting{codedisplay}[2][]{codemainoptions = {#2}, listing options = {style = mainlststyle}, listing side text, righthand ratio = 0.4, sidebyside gap = 13mm, bicolor, colbacklower = white, #1}

% compilable listing ==> compiler "main.tex" avec "-shell-escape"
\newtcblisting{coderesult}[2][]{codemainoptions = {#2}, listing options = {style = mainlststyle}, listing and comment, bicolor, colbacklower = white, compilable listing, run pdflatex, pdf comment, freeze pdf, comment style = {raster columns = 2, drop lifted shadow}, #1}

% Boîte spéciale code TikZ
% 1ère idée : nouvelle boîte brute avec listing and comment (comment = {\resizebox{\linewidth}{!}{\tcbuselistingtext}} -- \tcbuse... = contenu de la boîte soit code TikZ)
% 2nde idée : se contenter d'un "listing and text" avec structure boîte "codedisplay"
\newtcblisting{codetikz}[2][]{codemainoptions = {#2}, listing options = {style = mainlststyle}, listing and text, bicolor, colbacklower = white, #1}

%%% FIN MISE EN FORME CODE LATEX %%%