%%% Copyright (C) 2015-2024 Vincent Goulet %%% %%% Ce fichier fait partie du projet %%% «Rédaction avec LaTeX» %%% https://gitlab.com/vigou3/formation-latex-ul %%% %%% Cette création est mise à disposition sous licence %%% Attribution-Partage dans les mêmes conditions 4.0 %%% International de Creative Commons. %%% https://creativecommons.org/licenses/by-sa/4.0/ \documentclass[letterpaper,11pt,x11names,english,french]{memoir} \usepackage{natbib} \usepackage{babel} \usepackage[autolanguage]{numprint} \usepackage{amsmath,amsthm} \usepackage[shortlabels]{enumitem} \usepackage{graphicx} \usepackage{manfnt} % \mantriangleright (puce) \usepackage{dirtree} % arbre pour exercice sur \include \usepackage{metalogo} % logo de \XeLaTeX \usepackage{mflogo} % logo de Metafont \usepackage{relsize} % \smaller et al. \usepackage{fontawesome5} % plusieurs icônes \usepackage{awesomebox} % boites info, important, etc. \usepackage{applekeys} % touches Mac \usepackage{answers} % exercices et solutions \usepackage{listings} % code informatique \usepackage[absolute]{textpos} % disposition d'images \usepackage{ifthen} % exécution conditionnelle \usepackage{soul} % base pour boites autour des caractères %%% ============================= %%% Informations de publication %%% ============================= \title{Rédaction avec \LaTeX} \author{Vincent Goulet} \renewcommand{\year}{2024} \renewcommand{\month}{03} \newcommand{\ctanurl}{https://ctan.org/pkg/formation-latex-ul} \newcommand{\reposurl}{https://gitlab.com/vigou3/formation-latex-ul} %%% =================== %%% Style du document %%% =================== %% Polices de caractères \usepackage{fontspec} \usepackage{unicode-math} \defaultfontfeatures { Scale = 0.92 } \setmainfont{Lucida Bright OT} [ Ligatures = TeX, Numbers = OldStyle ] \setmathfont{Lucida Bright Math OT} \setmonofont{Lucida Grande Mono DK} \setsansfont{FiraSans} [ Extension = .otf, UprightFont = *-Book, ItalicFont = *-BookItalic, BoldFont = *-SemiBold, BoldItalicFont = *-SemiBoldItalic, Scale = 0.95, Numbers = OldStyle ] \newfontfamily\fullcaps{FiraSans} [ Extension = .otf, UprightFont = *-Book, Scale = 0.95, Numbers = Uppercase ] \usepackage[babel=true]{microtype} \usepackage{icomma} %% Polices additionnelles pour le chapitre trucs et astuces \newfontfamily\CM[Ligatures=TeX]{cmunrm.otf} % Computer Modern \newfontfamily\Times{texgyretermes-regular.otf} % Times \newfontfamily\Palatino{texgyrepagella-regular.otf} % Palatino \newfontfamily\Bookman{texgyrebonum-regular.otf} % Bookman \newfontfamily\NewCent{texgyreschola-regular.otf} % New Cent. Sch. \newfontfamily\Charter{XCharter-Roman.otf} % Charter \newfontfamily\Helvet{texgyreheros-regular.otf} % Helvetica %% Couleurs \usepackage{xcolor} \definecolor{comments}{rgb}{0.5,0.55,0.6} % commentaires \definecolor{link}{rgb}{0,0.4,0.6} % liens internes \definecolor{url}{rgb}{0.6,0,0} % liens externes \definecolor{citation}{rgb}{0,0.5,0} % citations \definecolor{ULlinkcolor}{rgb}{0,0,0.3} % de ulthese.cls \definecolor{rouge}{rgb}{0.90,0,0.1} % rouge bandeau UL \definecolor{or}{rgb}{1,0.8,0} % or bandeau UL %% Hyperliens \usepackage{hyperref} \hypersetup{% pdfauthor = \theauthor, pdftitle = {Rédaction avec LaTeX}, colorlinks = {true}, linktocpage = {true}, urlcolor = {url}, linkcolor = {link}, citecolor = {citation}, pdfpagemode = {UseOutlines}, pdfstartview = {Fit}} \setlength{\XeTeXLinkMargin}{1pt} %% Affichage de la table des matières du PDF \usepackage{bookmark} \bookmarksetup{% open = true, depth = 3, numbered = true} %% Étiquettes de \autoref (redéfinitions compatibles avec babel). %% Attention! Les % à la fin des lignes sont importants sinon des %% blancs apparaissent dès que la commande \selectlanguage est %% utilisée, notamment dans la bibliographie. \addto\extrasfrench{% \def\subsectionautorefname{section}% \def\figureautorefname{figure}% \def\tableautorefname{tableau}% \def\exempleautorefname{exemple}% \def\exerciceautorefname{exercice}% \def\appendixautorefname{annexe}% } %% Table des matières et al. (inspiré de classicthesis.sty) \renewcommand{\cftchapterleader}{\hspace{1.5em}} \renewcommand{\cftchapterafterpnum}{\cftparfillskip} \renewcommand{\cftsectionleader}{\hspace{1.5em}} \renewcommand{\cftsectionafterpnum}{\cftparfillskip} \renewcommand{\cfttableleader}{\hspace{1.5em}} \renewcommand{\cfttableafterpnum}{\cftparfillskip} \renewcommand{\cftfigureleader}{\hspace{1.5em}} \renewcommand{\cftfigureafterpnum}{\cftparfillskip} \setlength{\cftfigurenumwidth}{3.2em} %% Titres des chapitres \chapterstyle{hangnum} \renewcommand{\chaptitlefont}{\normalfont\Huge\sffamily\bfseries\raggedright} %% Marges, entêtes et pieds de page \setlength{\marginparsep}{7mm} \setlength{\marginparwidth}{20mm} \setlength{\headwidth}{\textwidth} \addtolength{\headwidth}{\marginparsep} \addtolength{\headwidth}{\marginparwidth} \addtolength{\marginparwidth}{15mm} % plus d'espace pour titres de documentation %% Titres des sections et sous-sections \setsecheadstyle{\normalfont\Large\sffamily\bfseries\raggedright} \setsubsecheadstyle{\normalfont\large\sffamily\bfseries\raggedright} \maxsecnumdepth{subsection} \setsecnumdepth{subsection} %% Listes. Paramétrage avec enumitem. \setlist[enumerate]{leftmargin=*,align=left} \setlist[enumerate,2]{label=\alph*),labelsep=*,leftmargin=1.5em} \setlist[enumerate,3]{label=\roman*),labelsep=*,leftmargin=1.5em,align=right} \setlist[itemize]{leftmargin=*,align=left} %% Paramétrage de babel \frenchbsetup{% StandardItemizeEnv=true, % format standard des listes ThinSpaceInFrenchNumbers=true, % espace fine dans les nombres ItemLabeli=\mantriangleright, % puce premier niveau ItemLabelii=\textendash, % puce second niveau og=«, fg=» % caractères « et » sont les guillemets } \addto\captionsfrench{\def\figurename{{\scshape Fig.}}} \addto\captionsfrench{\def\tablename{{\scshape Tab.}}} \addto\captionsfrench{\def\listfigurename{Liste des figures}} %% Sections de code source \lstloadlanguages{[LaTeX]TeX} \lstset{language=[LaTeX]TeX, basicstyle=\ttfamily\NoAutoSpacing, keywordstyle=\mdseries, commentstyle=\color{comments}\slshape, emphstyle=\bfseries, escapeinside=`', extendedchars=true, showstringspaces=false, backgroundcolor=\color{LightYellow1}, frame=leftline, framerule=2pt, framesep=5pt, xleftmargin=7.4pt } %%% ========================= %%% Nouveaux environnements %%% ========================= %% Exemples \theoremstyle{definition} \newtheorem{exemple}{Exemple}[chapter] %% Exercices et réponses \Newassociation{sol}{solution}{solutions} \newcounter{exercice}[chapter] \renewcommand{\theexercice}{\thechapter.\arabic{exercice}} \newenvironment{exercice}[1][]{% \begin{list}{}{% \refstepcounter{exercice} \ifthenelse{\equal{#1}{nosol}}{% \renewcommand{\makelabel}{\bfseries\theexercice}}{% \hypertarget{ex:\theexercice}{} \Writetofile{solutions}{\protect\hypertarget{sol:\theexercice}{}} \renewcommand{\makelabel}{% \bfseries\protect\hyperlink{sol:\theexercice}{\theexercice}}} \settowidth{\labelwidth}{\bfseries\theexercice} \setlength{\leftmargin}{\labelwidth} \addtolength{\leftmargin}{\labelsep} \setlist[enumerate,1]{label=\alph*),labelsep=*,leftmargin=1.5em} \setlist[enumerate,2]{label=\roman*),labelsep=0.5em,align=right}} \item} {\end{list}} \renewenvironment{solution}[1]{% \begin{list}{}{% \renewcommand{\makelabel}{% \bfseries\protect\hyperlink{ex:#1}{#1}} \settowidth{\labelwidth}{\bfseries #1} \setlength{\leftmargin}{\labelwidth} \addtolength{\leftmargin}{\labelsep} \setlist[enumerate,1]{label=\alph*),labelsep=*,leftmargin=1.5em} \setlist[enumerate,2]{label=\roman*),labelsep=0.5em,align=right}} \item} {\end{list}} %% Corriger un bogue dans answers apparu dans TeX Live 2020. %% https://tex.stackexchange.com/a/537873 \makeatletter \renewcommand{\Writetofile}[2]{% \@bsphack \Iffileundefined{#1}{}{% \Ifopen{#1}{% {% \begingroup % \let\protect\string %%% <----- removed \Ifanswerfiles{% \protected@iwrite{\@nameuse{#1@file}}{\afterassignment\let@protect@string}{#2}% }{}% \endgroup }% }{}% }% \@esphack } \def\let@protect@string{\let\protect\string} \makeatother %% Démo de code LaTeX. Le code de 'texample' et 'eqxample' est %% repris de amsldoc.tex avec des petits ajustements. \newenvironment{demo}{% \begin{trivlist}\item}{% \end{trivlist}} \newenvironment{texample}[1][0.5\linewidth]{% \noindent\begin{minipage}{#1}% \def\producing{\end{minipage}\hfill\begin{minipage}{\dimexpr0.97\linewidth-#1}% \hbox\bgroup\kern-.2pt% \vbox\bgroup\parindent0pt\relax % The 3pt is to cancel the -\lineskip from \displ@y \abovedisplayskip3pt \abovedisplayshortskip\abovedisplayskip \belowdisplayskip0pt \belowdisplayshortskip\belowdisplayskip \noindent} }{% \par % Ensure that a lonely \[\] structure doesn't take up width less than % \hsize. \hrule height0pt width\hsize \egroup\kern-.2pt\egroup \end{minipage}% \par } \newenvironment{eqxample}{% \noindent\begin{minipage}{.5\columnwidth}% \def\producing{\end{minipage}\hfill\begin{minipage}{.45\columnwidth}% \hbox\bgroup\kern-.2pt\vrule width.2pt% \vbox\bgroup\parindent0pt\relax % The 3pt is to cancel the -\lineskip from \displ@y \abovedisplayskip3pt \abovedisplayshortskip\abovedisplayskip \belowdisplayskip0pt \belowdisplayshortskip\belowdisplayskip \noindent} }{% \par % Ensure that a lonely \[\] structure doesn't take up width less than % \hsize. \hrule height0pt width\hsize \egroup\vrule width.2pt\kern-.2pt\egroup \end{minipage}% \par } %% Un exemple du chapitre Trucs et astuces nécessite des %% environnements 'lstlisting' imbriqués, ce que ne digère pas %% LaTeX. La ruse consiste à définir un environnement équivalent qui %% porte simplement un autre nom. \lstnewenvironment{vglisting}{\lstset{deletetexcs={int,include}}}{} %% Exemples de notices bibliographiques \newenvironment{bibexample}[1][\linewidth]{% \begin{minipage}[t]{#1}% \begin{trivlist}} {\end{trivlist}\end{minipage}} %%% ======= %%% Index %%% ======= \renewcommand{\preindexhook}{% Cet index contient des références aux commandes et environnements {\LaTeX}, ainsi qu'aux noms de paquetages et de classes. % Le premier numéro indique habituellement, mais pas toujours, la page où un concept est introduit, défini ou expliqué.% \vskip\onelineskip} \lstset{language=[AlLaTeX]TeX, morekeywords={align,align*,aligned,bmatrix,cases,equation*,% figure,gather,lstlisting,multline,quote,split,% table,tabular,tabularx}, deletekeywords={document}, % répéter dans deletetexcs moretexcs={toprule,midrule,bottomrule,% includegraphics,reflectbox,resizebox,rotatebox,scalebox,% includepdf,frenchfigurename,frenchtablename,% newsubfloat,subcaption,% bm,dfrac,tfrac,iint,text,mathcal,mathbb,eqref,symbf,% citet,citep,citeauthor,citeyear,% setmainfont,setsansfont,setmonofont,setmathfont,% color,textcolor,definecolor,colorlet,hypersetup}, deletetexcs={document,documentclass,usepackage,begin,end,LaTeX,TeX,% normalfont,bfseries,textbf,itshape,scshape,sffamily,ttfamily,texttt,% emph,small,Huge,raggedright,% hfill,def,a,b,c,d,em,i,j,l,r,t}, index=[1][keywords], % environnements indexstyle=[1]\ixenv, index=[2][texcs], % commandes indexstyle=[2]\ixcmd} \newcommand{\ixenv}[1]{\index{#1 env@\Pe{#1}}% \index{environnement!#1@\Pe{#1}}} \newcommand{\ixcmd}[1]{\index{#1@\string\cs{#1}}} \makeindex %%% ===================== %%% Nouvelles commandes %%% ===================== %% Noms de fonctions, code, environnement, etc. \newcommand{\code}[1]{\texttt{#1}} \newcommand{\fichier}[1]{\texttt{#1}} \newcommand{\class}[1]{\textsf{#1}\index{#1 class@\textsf{#1}}% \index{classe!#1}} \newcommand{\pkg}[1]{\textbf{#1}\index{#1 pkg@\textbf{#1}}% \index{paquetage!#1}} \newcommand{\Pe}[1]{\code{#1}} % tiré de la doc de memoir \newcommand{\Ie}[1]{\Pe{#1}\ixenv{#1}} % idem \newcommand{\mat}[1]{\symbf{#1}} % en mode mathématique %% Modification de commandes tirées de memoir.cls servant à afficher %% des noms de commandes. %% - \cmdprint est modifiée pour que le nom de la commande ne soit %% pas en italique; %% - \cmd est modifiée pour utiliser @ comme séparateur dans \index %% et pour utiliser \cs plutôt que \cmdprint pour afficher le nom de %% la commande (afin d'obtenir le même format d'entrée d'index %% qu'avec \ixcmd ci-dessus); %% - \pixbsbs et \pixabang servent respectivement à afficher et %% indexer \\ et \! ; %% - \pixbar sert à afficher et indexer \| avec un hack pour %% contourner un problème d'insertion de l'hyperlien vers le %% numéro de page: l'entrée est triée sur le symbole [ plutôt que %% sur |. \renewcommand{\cmdprint}[1]{\textup{\texttt{\string#1}}} \makeatletter \renewcommand{\cmd}[1]{\cmdprint{#1}% \index{\expandafter\@gobble\string#1@\string\cs{\expandafter\@gobble\string#1}}} \makeatother \newcommand*{\pixbsbs}{\cmdprint{\\}\index{"\ @\string\cs{}\bs}} \newcommand*{\pixabang}{\cmdprint{\!}\index{"!@\string\cs{}\texttt{"!}}} \newcommand*{\pixbar}{\cmdprint{\|}\index{[@\string\cs{}\texttt{\textbar}}} %% Boite additionnelle (basée sur awesomebox.sty) pour liens vers %% des vidéos \newcommand{\videobox}[1]{% \awesomebox{\aweboxrulewidth}{\faYoutube}{url}{#1}} %% Hyperlien avec symbole de lien externe juste après \newcommand{\link}[2]{\href{#1}{#2~\smaller\faExternalLink*}} %% Lien vers documentation dans la marge %% usage: \doc[documentation]{nom_fichier}{url} \newcommand{\doc}[3][documentation]{\link{#3}{#1}% \ifthenelse{\equal{#2}{}}{}{\marginpar% [\hfill\faBookmark~\fichier{#2}]% {\faBookmark~\fichier{#2}}}} %% Suppression de l'hyperlien \newcommand{\nolink}[1]{\begin{NoHyper}#1\end{NoHyper}} %% Identification de la licence CC BY-SA. \newcommand{\ccbysa}{\mbox{% \faCreativeCommons\kern0.1em% \faCreativeCommonsBy\kern0.1em% \faCreativeCommonsSa}~\faCopyright[regular]\relax} %% Lien vers Gitlab dans la page de notices \newcommand{\viewsource}[1]{% \href{#1}{\faGitlab\ Voir sur Gitlab}} %% Pour le tableau des commandes d'espacement en mode mathématique. %% Pris de la doc de amsmath. \newcommand{\lspx}{\mathord{\dashv\mkern-3mu}} \newcommand{\rspx}{\mathord{\mkern-2mu\vdash}} \newcommand{\spx}[1]{$\lspx #1\rspx$} %% Logo BIBTeX; tiré de https://bit.ly/1RQqUnG \newcommand{\BibTeX}{\rmfamily B\kern-.05em{\scshape i\kern-.025em b}\kern-.08em \TeX} %%% ==================================================== %%% Affichage d'entrées de bibliographie dans le texte %%% ==================================================== %% Le chapitre sur les bibliographies contient des références %% bibliographiques dans le texte. C'est le paquetage bibentry, %% livré avec natbib, qui permet d'afficher de telles références %% avec \bibentry. Cependant, le paquetage définit les commandes %% \urlprefix et \doi qui entrent en conflit avec celles du style %% bibliographique francais.bst utilisé par le document. J'insère %% donc ici une version légèrement modifiée du code paquetage qui ne %% définit pas les commandes mentionnées précédemment. \makeatletter \newif\ifBR@star \newcommand\nobibliography{\@ifstar{\BR@nobib{}}{\BR@nobib}} \newcommand\BR@nobib[1]{% \ifx\relax#1\relax\global\BR@startrue\else\global\BR@starfalse\fi \begingroup \ifBR@star\@fileswfalse\fi \renewenvironment{thebibliography}[1]{% \usecounter{enumiv}% \renewcommand\item[1][]{% \ifx\relax####1\relax\stepcounter\@listctr\fi}% \ifBR@star \newcommand\BR@bibitem[2][]{}\else \let\BR@bibitem=\bibitem\fi \let\bibitem=\BR@b@bibitem}{}% \let\@biblabel\@gobble \bibliography{#1}\endgroup \ifx\relax#1\relax\global\BR@startrue\else\global\BR@starfalse\fi} \newcommand\BR@b@bibitem[2][]{\ifx\relax#1\relax\BR@bibitem{#2}% \else \BR@bibitem[#1]{#2}\fi \BR@c@bibitem{#2}} \def\BR@c@bibitem#1 #2 \par{{\let\protect\@unexpandable@protect \expandafter \gdef\csname BR@r@#1\@extra@b@citeb\endcsname {\BR@nodot#2\relax.\relax\relax}}} \def\BR@nodot#1.\relax#2\relax{#1} \newcommand\bibentry[1]{\nocite{#1}{\frenchspacing \hyper@natanchorstart{#1\@extra@b@citeb}% \@nameuse{BR@r@#1\@extra@b@citeb}\hyper@natanchorend}} \providecommand\@extra@b@citeb{} \providecommand\hyper@natanchorstart[1]{} \providecommand\hyper@natanchorend{} \AtBeginDocument{\let\BR@bib\bibliography \def\bibliography{\global\BR@starfalse\BR@bib}} \AtBeginDocument{% \providecommand*{\urlprefix}{} } \makeatother %% Lors de l'affichage des références, certaines commandes de %% francaisbst.tex sont requises. Le fichier est donc chargé dès %% maintenant. \input{francaisbst.tex} %% Enfin, il faut définir dès maintenant la commande \enquote qui %% est autrement insérée dans le fichier .bbl par francais.bst. \let\enquote\frquote %%% ======= %%% Varia %%% ======= %% Style de la bibliographie \bibliographystyle{francais} %% Longueurs pour la composition des pages couvertures avant et %% arrière. \newlength{\banderougewidth} \newlength{\banderougeheight} \newlength{\bandeorwidth} \newlength{\bandeorheight} \newlength{\imageheight} \newlength{\logoheight} \newlength{\gapwidth} % \includeonly{} \begin{document} \frontmatter %% Page couverture avant. \pagestyle{empty} \input{couverture-avant} \null\cleardoublepage % cf. section 2.2 textpos.pdf %% Page de copyright \include{notices} \clearpage %% Corps du document \pagestyle{companion} \include{introduction} \cleartorecto \tableofcontents \cleartorecto \listoftables \cleartorecto \listoffigures \mainmatter \include{presentation} \include{bases} \include{organisation} \include{apparence} \include{boites} \include{tableaux+figures} \include{mathematiques} \include{bibliographie} \include{commandes} \include{trucs+astuces} \appendix \include{ulthese} % éléments spécifiques à ulthese \include{solutions} \bibliography{formation-latex-ul} \cleardoublepage \printindex \cleartoverso \input{colophon} \cleartoverso %% Page couverture arrière. \pagestyle{empty} \input{couverture-arriere} \end{document} %%% Local Variables: %%% mode: latex %%% TeX-engine: xetex %%% TeX-master: t %%% coding: utf-8 %%% End: