summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/fascicules/guide/content/ch4_nouveau_chapitre.tex
blob: f2c4bbc0f8702e9e91229ef29544abd3dcfbf16c (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
\chapter{Comment je crée un nouveau chapitre}

\backgroundimage{img/vieuxlivres}
\thispagestyle{chapterpage}

\newpage

<<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. 

-- Pas de panique, on y arrive !>>

\section{Modifier la structure}

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).


\begin{figure}[h]
\begin{forest}
      for tree={
        font=\ttfamily,
        grow'=0,
        child anchor=west,
        parent anchor=south,
        anchor=west,
        calign=first,
        inner xsep=7pt,
        edge path={
          \noexpand\path [draw, \forestoption{edge}]
          (!u.south west) +(7.5pt,0) |- (.child anchor) pic {folder} \forestoption{edge label};
        },
        % style for your file node 
        file/.style={edge path={\noexpand\path [draw, \forestoption{edge}]
          (!u.south west) +(7.5pt,0) |- (.child anchor) \forestoption{edge label};},
          inner xsep=2pt,font=\small\ttfamily
                     },
        before typesetting nodes={
          if n=1
            {insert before={[,phantom]}}
            {}
        },
        fit=band,
        before computing xy={l=15pt},
      }  
    [manuels
      [commons]
      [S5
      [manuel.tex,file]
      [ch1\textunderscore premier\textunderscore chapitre]
%        [chapitre.tex,file]
%        [cours.tex,file]
%        [content
%           [
%           crs.tex,file
%           ]
%           [
%           act.tex,file
%           ]
%           [
%           exos.tex,file
%           ]
%        ]
%        [img]
      [ch2\textunderscore second\textunderscore chapitre]
      [ch3\textunderscore troisieme\textunderscore chapitre]
      [ch4\textunderscore mon\textunderscore chapitre
       [content]
       [img]
      ]
      ]
    ]
 \end{forest}
\caption{Ajout du répertoire \texttt{mon\textunderscore chapitre}} 
\end{figure}

Ensuite, dans le fichier \texttt{manuel.tex}, j'ajoute une ligne \verb!\subimport{./ch4_mon_chapitre/}{chapitre}!.

\section{Créer le fichier chapitre.tex }


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).

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.

Le reste du fichier peut être recopié tel quel.

\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}}
\end{tcbinputlisting}

Enfin, on crée les fichiers \texttt{crs.tex}, \texttt{exos.tex}
et \texttt{act.tex} dans le répertoire \texttt{content}.

\begin{figure}[h]
\begin{forest}
      for tree={
        font=\ttfamily,
        grow'=0,
        child anchor=west,
        parent anchor=south,
        anchor=west,
        calign=first,
        inner xsep=7pt,
        edge path={
          \noexpand\path [draw, \forestoption{edge}]
          (!u.south west) +(7.5pt,0) |- (.child anchor) pic {folder} \forestoption{edge label};
        },
        % style for your file node 
        file/.style={edge path={\noexpand\path [draw, \forestoption{edge}]
          (!u.south west) +(7.5pt,0) |- (.child anchor) \forestoption{edge label};},
          inner xsep=2pt,font=\small\ttfamily
                     },
        before typesetting nodes={
          if n=1
            {insert before={[,phantom]}}
            {}
        },
        fit=band,
        before computing xy={l=15pt},
      }  
    [manuels
      [commons]
      [S5
      [manuel.tex,file]
      [ch1\textunderscore premier\textunderscore chapitre]
%        [chapitre.tex,file]
%        [cours.tex,file]
%        [content
%           [
%           crs.tex,file
%           ]
%           [
%           act.tex,file
%           ]
%           [
%           exos.tex,file
%           ]
%        ]
%        [img]
      [ch2\textunderscore second\textunderscore chapitre]
      [ch3\textunderscore troisieme\textunderscore chapitre]
      [ch4\textunderscore mon\textunderscore chapitre
       [chapitre.tex,file]
       [content
        [act.tex,file]
        [crs.tex,file]
        [exos.tex,file]
       ]
       [img
         [mon\textunderscore image\textunderscore .jpg,file]
       ]
      ]
      ]
    ]
 \end{forest}
\caption{Ajout du répertoire \texttt{mon\textunderscore chapitre}} 
\end{figure}

\section{Le contenu des fichiers act, crs.tex et exos.tex}

\begin{tcbinputlisting}{colback=red!5!white,colframe=red!75!black,listing only,listing file={ch4_mon_chapitre/content/act.tex},title=act.tex}
\end{tcbinputlisting}

\begin{tcbinputlisting}{colback=red!5!white,colframe=red!75!black,listing only,listing file={ch4_mon_chapitre/content/crs.tex},title=crs.tex}
\end{tcbinputlisting}


\begin{tcbinputlisting}{colback=red!5!white,colframe=red!75!black,listing only,listing file={ch4_mon_chapitre/content/exos.tex},title=exos.tex}
\end{tcbinputlisting}

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.

\begin{figure}[h]
\begin{forest}
      for tree={
        font=\ttfamily,
        grow'=0,
        child anchor=west,
        parent anchor=south,
        anchor=west,
        calign=first,
        inner xsep=7pt,
        edge path={
          \noexpand\path [draw, \forestoption{edge}]
          (!u.south west) +(7.5pt,0) |- (.child anchor) pic {folder} \forestoption{edge label};
        },
        % style for your file node 
        file/.style={edge path={\noexpand\path [draw, \forestoption{edge}]
          (!u.south west) +(7.5pt,0) |- (.child anchor) \forestoption{edge label};},
          inner xsep=2pt,font=\small\ttfamily
                     },
        before typesetting nodes={
          if n=1
            {insert before={[,phantom]}}
            {}
        },
        fit=band,
        before computing xy={l=15pt},
      }  
      [ch4\textunderscore mon\textunderscore chapitre
       [chapitre.tex,file]
       [content
        [act.tex,file]
        [act1\textunderscore introduction\textunderscore notion.tex,file]
        [act2\textunderscore TP\textunderscore alogorithmique.tex,file]
        [crs1\textunderscore definitions.tex,file]
        [crs2\textunderscore theoremes.tex,file]
        [crs.tex,file]
        [exos.tex,file]
        [exos1\textunderscore faciles.tex,file]
        [exos2\textunderscore moyens.tex,file]
       ]
       [img
         [mon\textunderscore image\textunderscore .jpg,file]
       ]
      ]
 \end{forest}
\caption{Ajout du répertoire \texttt{mon\textunderscore chapitre}} 
\end{figure}


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.