This commit is contained in:
2018-10-04 22:32:37 +02:00
parent 4b53e6a1c9
commit c6deffed18
5 changed files with 261 additions and 179 deletions

View File

@@ -2,195 +2,163 @@
%%%
%%% Classe : cours_devoir.cls
%%% Version : 1.0
%%% Date : 01/04/17
%%% Date : 03/10/18
%%% Auteur : Jeff LANCE
%%%
%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cours_devoir}[2016/11/09 Document de devoir, V1.0]
\ProvidesClass{cours_devoir}[2018/10/03 Devoirs, V1.0]
%
%
% INIT
%
%
\LoadClassWithOptions{scrartcl}
%\LoadClass[a4paper, 12pt, DIV=24]{scrartcl}
%
%
% PACKAGES
%
%
% Others
\RequirePackage{xkeyval}
%-- PARENT CLASS
\LoadClass[a4paper, 11pt]{article}
%---------------
%-- PACKAGES CALLS
%%% PERSO %%%
% Own packages. Those contains some global settings and definitions.
\RequirePackage{commun}
\RequirePackage{couleurs}
\RequirePackage{shortcuts}
%%%%%%%%%%%%%
%%% AUTRES %%%
% Output
\RequirePackage{comment}
% Layout
\RequirePackage{geometry}
\RequirePackage{fancyhdr}
\RequirePackage[footsepline, plainfootsepline]{scrlayer-scrpage}
\RequirePackage{titling}
\RequirePackage{titlesec}
\RequirePackage{pageslts}
\RequirePackage{enumitem}
\RequirePackage{environ}
%%%%%%%%%%%%%%
%-----------------
\RequirePackage[]{hyperref}
\makeatletter
%
%
% OPTIONS
%
%
%-- SETTINGS
%%% PATHS %%%
\graphicspath{{images/}}
%%%%%%%%%%%%%
\DeclareOptionX{type}[ds]{%
\def\type{#1}%
}
\ExecuteOptions{a4paper, DIV=24}
\ExecuteOptionsX{type}
\ProcessOptionsX
%%% METAPOST %%%
%
%
% FIXES
%
%
% Fix error from KOMA-Script scrartcl class.
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
%
%
% SETTINGS
%
%
% metapost
\ifpdf
\DeclareGraphicsRule{*}{mps}{*}{}
\fi
%%%%%%%%%%%%%%%%
%%% TikZ %%%
% tkz
\usetkzobj{all} % on charge tous les objets
%%%%%%%%%%%%
% sizing of the page
\geometry{a4paper, includeheadfoot, hmargin=.7cm, vmargin=.5cm, head=14.5pt}
%%% PAGE %%%
\geometry{a4paper, hmargin=.8cm, vmargin=2cm, centering, nofoot, headheight=1cm, layoutvoffset=.5cm}
%%%%%%%%%%%%
% title, header and footer
\ihead[]{}
\chead[]{}
\ohead[]{}
\ifoot[]{}
\cfoot[]{}
\ofoot[]{}
% KOMA-Script version (preferred)
%%% TITRE, EN-TÊTE, PIED,... %%%
\thispagestyle{fancy}
\pagestyle{empty}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.0pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SECTIONS %%%
\titlelabel{\textbf{\thetitle}}
\titleformat{\section}[runin]{\rmfamily\bfseries\large}{\thesection}{.5em}{}[\\]
\titleformat{\subsection}[runin]{\rmfamily\bfseries\normal}{\thesubsection)}{.5em}{}[\\]
%%%%%%%%%%%%%%%%
%%% LISTS %%%
\setlist[enumerate,1]{label=\textbf{\arabic*.},
font=\sffamily,
leftmargin=1.2em,
noitemsep,resume}
\setlist[enumerate,2]{label=\textbf{\alph*)},
font=\sffamily,
leftmargin=1.2em,
noitemsep
}
\setlist[enumerate,3]{label={\textcircled{\small\Alph*}},
font=\sffamily,
leftmargin=1.2em,
noitemsep
}
%%%%%%%%%%%%%
%%% MDFRAMED %%%
% global options
\mdfsetup{
frametitlealignment=\raggedright,%
innerbottommargin=2em,%
\ifthenelse{ \equal{\type}{ds} }{
\cohead[\textbf{MATHÉMATIQUES}\\\textbf{Devoir surveillé}]{\textbf{MATHÉMATIQUES}\\\textbf{Devoir surveillé}}
\lohead[NOM :\\Prénom :]{NOM :\\Prénom :}
\rohead[Le \@date]{Le \@date}
\cehead[]{}
\lehead[]{}
\rehead[]{}
}{
\ifthenelse{ \equal{\type}{dm} }{
\cohead[\textbf{MATHÉMATIQUES}\\\textbf{Devoir maison}]{\textbf{MATHÉMATIQUES}\\\textbf{Devoir maison}}
\lohead[NOM :\\Prénom :]{NOM :\\Prénom :}
\rohead[Le \@date]{Le \@date}
\cehead[]{}
\lehead[]{}
\rehead[]{}
}{
}
}
% styles
\tikzset{
symbol/.style={
rectangle, draw=white,
fill=white, scale=1,
overlay
}
}
\cofoot*{}
\pagestyle{scrheadings}
\setkomafont{pagehead}{\normalfont}
\setkomafont{pagefoot}{\normalfont}
% idea: a shadowed square frame with a light bulb icon at upper left
\mdfdefinestyle{tips}{%
linecolor=white,linewidth=1pt,%
tikzsetting={draw=black,dotted,line width=1pt},%
leftmargin=0,rightmargin=0,%
innertopmargin=0em,innerbottommargin=0.5em,%
innerleftmargin=1em,innerrightmargin=.5em,%
skipabove=0,skipbelow=0,%
frametitlerule=false,%
frametitlebackgroundcolor=white!0,%innertopmargin=\topskip,%
frametitleaboveskip=0,frametitlebelowskip=0
nobreak=true,%
xcolor,%
hidealllines=false, %leftline=true, % topline=true, bottomline=true,%
% shadow=true,%
% backgroundcolor=gray!40,% FOR TEST ONLY
firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faLightbulbO };
},%
secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faLightbulbO };
},%
middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faLightbulbO };
},%
singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,-.4)+1.0*(0,\y1)$)
node[symbol] { \faLightbulbO };
},%
}
\mdtheorem[style=tips, theoremseparator={}, theoremspace={}]{tips}{}
\RenewDocumentEnvironment{tips}{ o } {%begin
\begin{tips*}
}{%end
\end{tips*}
}
%%%%%%%%%%%%%%%%
%-----------
% paths
\graphicspath{{images/}}
%-- OWN COMMANDS
%% \lHead{TEXT}
%% partie gauche du titre
%\NewDocumentCommand \lHead { g } {
% \fancyhead[LO]{#1\\}
% \fancyhead[LE]{}
%}
%
%% \cHead{TEXT}
%% partie centrale du titre
%\NewDocumentCommand \cHead { g } {
% \fancyhead[CO]{\textbf{MATHÉMATIQUES}\\#1\\}
% \fancyhead[CE]{}
%}
%
%% \rHead{TEXT}
%% partie droite du titre
%\NewDocumentCommand \rHead { g } {
% \fancyhead[RO]{#1\\}
% \fancyhead[RE]{}
%}
% MACROS
%
%
% \headrule
% affiche un trait de séparation netre le titre et le contenu du document
%\NewDocumentCommand \headrule { } {
% \renewcommand{\headrulewidth}{1.0pt}
%}
% lists
\newlist{questions}{enumerate}{2}
\setlist[questions]{labelindent=0em, leftmargin=*, labelsep=0.5em}
\setlist[questions, 1]{label=\textbf{\arabic*.}}
\setlist[questions, 2]{label=\textbf{\alph*)}}
%---------------
\newlist{questionsl}{enumerate*}{1}
\setlist*[questionsl]{label=\textbf{\alph*)}}
\setlist[enumerate, 1]{label=\textbf{\arabic*.}, leftmargin=*, labelsep=.5em}
\setlist[enumerate, 2]{label=\textbf{\alph*)}}
\setlist[description]{font=\sffamily\bfseries}
%
\NewDocumentCommand \turnpage{ }{
\rofoot[\textit{Tourner la page, svp} \faHandORight]{\textit{Tourner la page, svp} \faHandORight}
}
\makeatother