| 1 |
\chapter{Comment je crée un nouveau chapitre} |
| 2 |
|
| 3 |
\backgroundimage{img/vieuxlivres} |
| 4 |
\thispagestyle{chapterpage} |
| 5 |
|
| 6 |
\newpage |
| 7 |
|
| 8 |
<<OK, tout \c{c}à, c'est bien beau, j'ai compris le principe. Mais je ne vois pas bien comment m'y prendre si je souhaite ajouter un chapitre. |
| 9 |
|
| 10 |
-- Pas de panique, on y arrive !>> |
| 11 |
|
| 12 |
\section{Modifier la structure} |
| 13 |
|
| 14 |
On ajoute un répertoire (ou dossier) pour ce nouveau chapitre. Attention, avec \LaTeX, le nom d'un fichier ou d'un répertoire ne doit pas contenir d'espaces. On peut utiliser un <<tiret bas>> (\textunderscore ) à la place. Et en même temps, j'ajoute aussi les répertoires \texttt{img} (pour les images) et \texttt{content} (pour le contenu). |
| 15 |
|
| 16 |
|
| 17 |
\begin{figure}[h] |
| 18 |
\begin{forest} |
| 19 |
for tree={ |
| 20 |
font=\ttfamily, |
| 21 |
grow'=0, |
| 22 |
child anchor=west, |
| 23 |
parent anchor=south, |
| 24 |
anchor=west, |
| 25 |
calign=first, |
| 26 |
inner xsep=7pt, |
| 27 |
edge path={ |
| 28 |
\noexpand\path [draw, \forestoption{edge}] |
| 29 |
(!u.south west) +(7.5pt,0) |- (.child anchor) pic {folder} \forestoption{edge label}; |
| 30 |
}, |
| 31 |
% style for your file node |
| 32 |
file/.style={edge path={\noexpand\path [draw, \forestoption{edge}] |
| 33 |
(!u.south west) +(7.5pt,0) |- (.child anchor) \forestoption{edge label};}, |
| 34 |
inner xsep=2pt,font=\small\ttfamily |
| 35 |
}, |
| 36 |
before typesetting nodes={ |
| 37 |
if n=1 |
| 38 |
{insert before={[,phantom]}} |
| 39 |
{} |
| 40 |
}, |
| 41 |
fit=band, |
| 42 |
before computing xy={l=15pt}, |
| 43 |
} |
| 44 |
[manuels |
| 45 |
[commons] |
| 46 |
[S5 |
| 47 |
[manuel.tex,file] |
| 48 |
[ch1\textunderscore premier\textunderscore chapitre] |
| 49 |
% [chapitre.tex,file] |
| 50 |
% [cours.tex,file] |
| 51 |
% [content |
| 52 |
% [ |
| 53 |
% crs.tex,file |
| 54 |
% ] |
| 55 |
% [ |
| 56 |
% act.tex,file |
| 57 |
% ] |
| 58 |
% [ |
| 59 |
% exos.tex,file |
| 60 |
% ] |
| 61 |
% ] |
| 62 |
% [img] |
| 63 |
[ch2\textunderscore second\textunderscore chapitre] |
| 64 |
[ch3\textunderscore troisieme\textunderscore chapitre] |
| 65 |
[ch4\textunderscore mon\textunderscore chapitre |
| 66 |
[content] |
| 67 |
[img] |
| 68 |
] |
| 69 |
] |
| 70 |
] |
| 71 |
\end{forest} |
| 72 |
\caption{Ajout du répertoire \texttt{mon\textunderscore chapitre}} |
| 73 |
\end{figure} |
| 74 |
|
| 75 |
Ensuite, dans le fichier \texttt{manuel.tex}, j'ajoute une ligne \verb!\subimport{./ch4_mon_chapitre/}{chapitre}!. |
| 76 |
|
| 77 |
\section{Créer le fichier chapitre.tex } |
| 78 |
|
| 79 |
|
| 80 |
Voici le fichier \texttt{chapitre.tex} qu'il faut créer. Dans la ligne 1, on trouve le titre du chapitre ainsi qu'un titre résumé (optionnel). |
| 81 |
|
| 82 |
Les lignes 4 et 5 définissent l'image d'illustration de la première page du chapitre. L'image doit être au format jpeg ou png. |
| 83 |
|
| 84 |
Le reste du fichier peut être recopié tel quel. |
| 85 |
|
| 86 |
\begin{tcbinputlisting}{listing options={style=tcblatex,numbers=left,numberstyle=\tiny\color{red!75!black}},colback=red!5!white,colframe=red!75!black,listing only,listing file={ch4_mon_chapitre/chapitre.tex}} |
| 87 |
\end{tcbinputlisting} |
| 88 |
|
| 89 |
Enfin, on crée les fichiers \texttt{crs.tex}, \texttt{exos.tex} |
| 90 |
et \texttt{act.tex} dans le répertoire \texttt{content}. |
| 91 |
|
| 92 |
\begin{figure}[h] |
| 93 |
\begin{forest} |
| 94 |
for tree={ |
| 95 |
font=\ttfamily, |
| 96 |
grow'=0, |
| 97 |
child anchor=west, |
| 98 |
parent anchor=south, |
| 99 |
anchor=west, |
| 100 |
calign=first, |
| 101 |
inner xsep=7pt, |
| 102 |
edge path={ |
| 103 |
\noexpand\path [draw, \forestoption{edge}] |
| 104 |
(!u.south west) +(7.5pt,0) |- (.child anchor) pic {folder} \forestoption{edge label}; |
| 105 |
}, |
| 106 |
% style for your file node |
| 107 |
file/.style={edge path={\noexpand\path [draw, \forestoption{edge}] |
| 108 |
(!u.south west) +(7.5pt,0) |- (.child anchor) \forestoption{edge label};}, |
| 109 |
inner xsep=2pt,font=\small\ttfamily |
| 110 |
}, |
| 111 |
before typesetting nodes={ |
| 112 |
if n=1 |
| 113 |
{insert before={[,phantom]}} |
| 114 |
{} |
| 115 |
}, |
| 116 |
fit=band, |
| 117 |
before computing xy={l=15pt}, |
| 118 |
} |
| 119 |
[manuels |
| 120 |
[commons] |
| 121 |
[S5 |
| 122 |
[manuel.tex,file] |
| 123 |
[ch1\textunderscore premier\textunderscore chapitre] |
| 124 |
% [chapitre.tex,file] |
| 125 |
% [cours.tex,file] |
| 126 |
% [content |
| 127 |
% [ |
| 128 |
% crs.tex,file |
| 129 |
% ] |
| 130 |
% [ |
| 131 |
% act.tex,file |
| 132 |
% ] |
| 133 |
% [ |
| 134 |
% exos.tex,file |
| 135 |
% ] |
| 136 |
% ] |
| 137 |
% [img] |
| 138 |
[ch2\textunderscore second\textunderscore chapitre] |
| 139 |
[ch3\textunderscore troisieme\textunderscore chapitre] |
| 140 |
[ch4\textunderscore mon\textunderscore chapitre |
| 141 |
[chapitre.tex,file] |
| 142 |
[content |
| 143 |
[act.tex,file] |
| 144 |
[crs.tex,file] |
| 145 |
[exos.tex,file] |
| 146 |
] |
| 147 |
[img |
| 148 |
[mon\textunderscore image\textunderscore .jpg,file] |
| 149 |
] |
| 150 |
] |
| 151 |
] |
| 152 |
] |
| 153 |
\end{forest} |
| 154 |
\caption{Ajout du répertoire \texttt{mon\textunderscore chapitre}} |
| 155 |
\end{figure} |
| 156 |
|
| 157 |
\section{Le contenu des fichiers act, crs.tex et exos.tex} |
| 158 |
|
| 159 |
\begin{tcbinputlisting}{colback=red!5!white,colframe=red!75!black,listing only,listing file={ch4_mon_chapitre/content/act.tex},title=act.tex} |
| 160 |
\end{tcbinputlisting} |
| 161 |
|
| 162 |
\begin{tcbinputlisting}{colback=red!5!white,colframe=red!75!black,listing only,listing file={ch4_mon_chapitre/content/crs.tex},title=crs.tex} |
| 163 |
\end{tcbinputlisting} |
| 164 |
|
| 165 |
|
| 166 |
\begin{tcbinputlisting}{colback=red!5!white,colframe=red!75!black,listing only,listing file={ch4_mon_chapitre/content/exos.tex},title=exos.tex} |
| 167 |
\end{tcbinputlisting} |
| 168 |
|
| 169 |
A nouveau, c'est un peu décevant, ces fichiers ne contiennent que des appels vers d'autre fichiers. On pourrait très bien décider d'y mettre directement les contenu. |
| 170 |
|
| 171 |
\begin{figure}[h] |
| 172 |
\begin{forest} |
| 173 |
for tree={ |
| 174 |
font=\ttfamily, |
| 175 |
grow'=0, |
| 176 |
child anchor=west, |
| 177 |
parent anchor=south, |
| 178 |
anchor=west, |
| 179 |
calign=first, |
| 180 |
inner xsep=7pt, |
| 181 |
edge path={ |
| 182 |
\noexpand\path [draw, \forestoption{edge}] |
| 183 |
(!u.south west) +(7.5pt,0) |- (.child anchor) pic {folder} \forestoption{edge label}; |
| 184 |
}, |
| 185 |
% style for your file node |
| 186 |
file/.style={edge path={\noexpand\path [draw, \forestoption{edge}] |
| 187 |
(!u.south west) +(7.5pt,0) |- (.child anchor) \forestoption{edge label};}, |
| 188 |
inner xsep=2pt,font=\small\ttfamily |
| 189 |
}, |
| 190 |
before typesetting nodes={ |
| 191 |
if n=1 |
| 192 |
{insert before={[,phantom]}} |
| 193 |
{} |
| 194 |
}, |
| 195 |
fit=band, |
| 196 |
before computing xy={l=15pt}, |
| 197 |
} |
| 198 |
[ch4\textunderscore mon\textunderscore chapitre |
| 199 |
[chapitre.tex,file] |
| 200 |
[content |
| 201 |
[act.tex,file] |
| 202 |
[act1\textunderscore introduction\textunderscore notion.tex,file] |
| 203 |
[act2\textunderscore TP\textunderscore alogorithmique.tex,file] |
| 204 |
[crs1\textunderscore definitions.tex,file] |
| 205 |
[crs2\textunderscore theoremes.tex,file] |
| 206 |
[crs.tex,file] |
| 207 |
[exos.tex,file] |
| 208 |
[exos1\textunderscore faciles.tex,file] |
| 209 |
[exos2\textunderscore moyens.tex,file] |
| 210 |
] |
| 211 |
[img |
| 212 |
[mon\textunderscore image\textunderscore .jpg,file] |
| 213 |
] |
| 214 |
] |
| 215 |
\end{forest} |
| 216 |
\caption{Ajout du répertoire \texttt{mon\textunderscore chapitre}} |
| 217 |
\end{figure} |
| 218 |
|
| 219 |
|
| 220 |
Pour les contenus de ces différents fichiers, on peut se reporter au \cref{structure}, notamment à la section\ref{partie_exos} pour les exercices et à la section \ref{partie_activite} pour les activités. Le cours fera l'objet d'un chapitre supplémentaire. |