-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tex
executable file
·235 lines (210 loc) · 8.47 KB
/
main.tex
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
\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[paper=a4paper,bottom=2cm,top=2cm,inner=4cm,outer=2cm]{geometry}
\usepackage[french]{babel}
\usepackage[pagestyles]{titlesec}
\usepackage{tcolorbox}
\usepackage{color}
\usepackage{tikz}
\usepackage{pstricks}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{color}
\usepackage{listings}
\usepackage{calc}
\usepackage{lipsum}
\usepackage{minitoc}
\usepackage{hyperref}
\settitlemarks{part,chapter}
%\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
% \node[shape=circle,draw,inner sep=2pt](char){#1};
%}
\newcommand{\X}{\phantom{X}}
\newcommand{\circled}[1]{
\begin{tikzpicture}[baseline, every node/.style={minimum size=8mm, anchor=base}]
\path node at (0,0) [shape=circle, fill=black!10] (0,0) {\X}
node at (1,0) [shape=circle, fill=black!35] (0,0) {\X}
node at (2,0) [shape=circle, fill=black!60] (0,0) {#1}
node at (3,0) [shape=circle, fill=black!35] (0,0) {\X}
node at (4,0) [shape=circle, fill=black!10] (0,0) {\X};
\end{tikzpicture}
}\newcommand{\circledinv}[1]{%
\begin{tikzpicture}[baseline, every node/.style={minimum size=8mm, anchor=base}]
\path%
node at (0,0) [shape=circle, fill=black!10,minimum size=13mm] (0,0) {\X}
node at (0,0) [shape=circle, fill=black!20,minimum size=12mm] (0,0) {\X}
node at (0,0) [shape=circle, fill=black!40,minimum size=11mm] (0,0) {\X}
node at (0,0) [shape=circle, fill=black!60,minimum size=10mm] (0,0) {#1} ;
\end{tikzpicture}
}
\DeclareRobustCommand{\bul}{%
\begin{tikzpicture}[baseline={(current bounding box.south)}]
\fill [black!40,anchor=base,baseline] circle (1mm);
\end{tikzpicture}
}
%}\newcommand*\circled[1]{\textcircled{\raisebox{-0.9pt}{#1}}
%}
%\newcommand*\circled[1]{{\fontspec[Ligature=Discretionary]{Junicode}[[#1]]}}
%\newpagestyle{main}{
% \sethead[][\large\bsc{Partie \parttitle}][] %even
% {}{\large\bsc{\chaptertitle}}{} %odd
% \setfoot[\bf\textit{\bsc{A bosser}}][\circled{\emph{\thepage}}][A votre service] %even
% {\emph{Exos-Corigés}}{\circled{\emph{\thepage}}}{\emph{La voie du succes}} %odd
%}
\newpagestyle{main}{
\sethead[][\large\bsc{Partie \parttitle}][] %even
{}{\large\bsc{\chaptertitle}}{} %odd
\setfoot[\parttitle~\bul~\chaptertitle][\circled{\bf{\textcolor{white}{\thepage}}}][Even right] %even
{Odd left}{\circled{\bf{\textcolor{white}{\thepage}}}}{\parttitle~\bul~\chaptertitle} %odd
}
\pagestyle{main}
\headrule
\setheadrule{0.4pt}
%\setfootrule{0.4pt}
\titleformat{\part}[display] {\normalfont\huge\bfseries}{\centering\Huge\partname}{20pt}{\thispagestyle{empty}\centering\Huge \setcounter{chapter}{0}}
\titleformat{\chapter}[display] {\normalfont\huge\bfseries}{}{20pt}{\thispagestyle{empty}\vspace{8\baselineskip}\centering\Huge\bsc}[\newpage\hbox{}
\vspace*{\fill}
\thispagestyle{empty}
\newpage]
\titleformat{name=\chapter,numberless}[display] {\normalfont\huge\bfseries}{}{20pt}{\thispagestyle{empty}\centering\Huge\bsc}
\renewcommand{\cleardoublepage}{
\clearpage\ifodd\thepage\else
\hbox{}
\vspace*{\fill}
\thispagestyle{empty}
\newpage
\fi
}
\relpenalty=99999
\binoppenalty=99999
%the listings settings
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{%
language=C, % the language of the code
basicstyle=\ttfamily\footnotesize, % the size of the fonts that are used for the code
numbers=left, % where to put the line-numbers
numberstyle=\tiny\color{gray}, % the style that is used for the line-numbers
stepnumber=1, % the step between two line-numbers. If it's 1, each line
% will be numbered
numbersep=5pt, % how far the line-numbers are from the code
backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
frame=single, % adds a frame around the code
rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. commens (green here))
tabsize=4, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
%title=\lstname, % show the filename of files included with \lstinputlisting;
%also try caption instead of title
keywordstyle=\color{blue}, % keyword style
commentstyle=\color{dkgreen}, % comment style
stringstyle=\color{green}, % string literal style
escapeinside={\%*}{*)}, % if you want to add a comment within your code
morekeywords={*,...} % if you want to add more keywords to the set
}
%the tcolorbox settings
\tcbuselibrary{skins,xparse,breakable}
\usetikzlibrary{patterns}
\newcounter{counterexo}
\numberwithin{counterexo}{section}
\newcommand*{\addcor}{
}
%\immediate\newwrite\exocor
%\immediate\openout\exocor=corrections.tex
\NewTotalTColorBox{\solution}{mm}{%
breakable,
enhanced,
fonttitle=\bfseries,
width=\linewidth-6pt,
enlarge top by=3pt,
enlarge bottom by=3pt,
enlarge left by=3pt,
enlarge right by=3pt,
boxrule=0pt,top=1mm,bottom=1mm,
colframe=black!50,
colbacktitle=black!5,
coltitle=black,
colback=white,
borderline={0.5pt}{-0.5pt}{black!30},
borderline={1pt}{-3pt}{black!75},
% varwidth boxed title
title={Exercice~\ref{#1:exercise@#2} page~\pageref{#1:exercise@#2}},
phantomlabel={#1:solution@#2},
%attach title to upper=\par,
}{\input{solutions/#1/exercise-#2.tex}}
\newenvironment{Exolist}[1]
{
\newcommand{\cor}{\tcblower}
\NewTColorBox[use counter=counterexo]{exercise}{+O{}}{%
enhanced,
enhanced jigsaw,opacityback=0.35,
breakable,
before skip=2mm,
after skip=2mm,
colback=white,
colbacktitle=black!15,
colframe=black!50,
boxrule=0.2mm,
%overlay unbroken and first={\path[left color=tcbcolback!60!black,right color=tcbcolback!60!black, middle color=tcbcolback!80!black] ([xshift=-0.2mm,yshift=-1.02cm]frame.north east) -- ++(-1,1) -- ++(-0.5,0) -- ++(1.5,-1.5) -- cycle;},
attach boxed title to top left={xshift=1cm,yshift*=1mm-\tcboxedtitleheight},
%varwidth boxed title*=-3cm,
boxed title style={
frame code={ \path[fill=tcbcolback!90] ([yshift=-1mm,xshift=-1mm]frame.north west) arc[start angle=0,end angle=180,radius=1mm] ([yshift=-1mm,xshift=1mm]frame.north east) arc[start angle=180,end angle=0,radius=1mm]; \path[left color=tcbcolback!60!black,right color=tcbcolback!60!black, middle color=tcbcolback!80!black] ([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east) [rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east) -- (frame.south east) -- (frame.south west) -- ([xshift=-1mm,yshift=-1mm]frame.north west) [sharp corners]-- cycle; },
interior engine=empty, },
fonttitle=\bfseries,
title={Exercice~\arabic{\tcbcounter}},
label={#1:exercise@\thetcbcounter},
% attach title to upper=\quad,
after upper={\par\hfill\textcolor{black!90}%
{\itshape Solution page~\pageref{#1:solution@\thetcbcounter}}
},
lowerbox=ignored, %Ignore the lower box, the solution will be printed on another page
savelowerto=solutions/#1/exercise-\thetcbcounter.tex, %Save the solution to a file
record={\string\solution{#1}{\thetcbcounter}}, %Record the solution of the current exercise commad into the 'corrections.tex' file
##1
}
\tcbset{nosol/.style={no recording,after upper=,overlay unbroken and first=}}
\tcbset{from/.style={before upper={\par\textcolor{black!90} {\textbf{\itshape Source: ##1}}\par}}}
\tcbrecord{\string\chapter{\chaptertitle}} %Record the title of the chapter to the 'corrections.tex' file
}
{
}
%my amsmath command
\newcommand{\mbb}[1]
{\ensuremath{\mathbb{#1}}}
\newcommand{\mcal}[1]
{\ensuremath{\mathcal{#1}}}
\tcbstartrecording[corrections.tex]
\begin{document}
\doparttoc
\tableofcontents
\part{Enoncés}
\parttoc
\chapter{Algebre}
\begin{Exolist}{algebre}
\input{algebre.tex}
\end{Exolist}
\chapter{Analyse}
\begin{Exolist}{analyse}
\input{analyse.tex}
\end{Exolist}
\chapter{Informatique}
\begin{Exolist}{informatique}
\input{informatique.tex}
\end{Exolist}
\chapter{Physique}
\begin{Exolist}{physique}
\input{physique.tex}
\end{Exolist}
\tcbstoprecording
\part{Corrigés}
\parttoc
\input{corrections.tex}
\end{document}