%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% One big LaTeX template to :
%%  * import all packages,
%%  * define many macros (from many other files),
%%
%% It is designed to make articles
%%  (\documentclass[french, a4paper, 10pt]{article})
%% and Beamer slides (with naereenbeamer.sty)
%%
%% by Lilian Besson, (C) 2014 - v2.1 2023/04/06
%%  http://lbesson.bitbucket.org/
%%  mailto:Lilian.BESSON[@]crans[.]org
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Permission is granted to freely use, copy, and distribute
%% without restriction. Permission is also granted to distribute
%% modified versions and incorporate into your own macro packages
%% if a brief acknowledgement is given.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{naereen}[2023/04/06 v2.1 Naereen Package]
\message{<Naereen LaTeX2e Package. Ask to naereen AT crans DOT org for any problem.>}
%%
%% Packages
%% --------
%% hyperref, multicol, fancyhdr, geometry are NOT imported.
%% do it your self in your .tex AFTER \usepackage{naereen}

\RequirePackageWithOptions{babel}
\usepackage[french]{babel}
%\usepackage[english]{babel}
%\usepackage{babel}

%% Well understand input, and nice output
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[T1]{fontenc}

%% NEW: a small hack.
%% If Using French
\@ifpackagewith{babel}{french}{
	%% Extra stuff to do if naereen was loaded with the French option
	\frenchspacing{}
	%% Else
}{
	%% Extra stuff to do otherwise (English option or none)
	% \newcommand{\sub}[1]{\textsubscript{#1}}
	% \newcommand{\up}[1]{\textsuperscript{#1}}
%% EndIf
}

% For japanese, see http://tex.stackexchange.com/questions/15516/how-to-write-japanese-with-latex
% Starts a japanese paragraph with "\begin{CJK}{UTF8}{min}" and ends it with "\end{CJK}"
%\usepackage{CJKutf8}
% For better french support
\usepackage{textcomp}

% From docutils generated .tex files
\usepackage{fixltx2e} % LaTeX patches, \textsubscript
\usepackage{cmap} % fix search and cut-and-paste in Acrobat
\usepackage{ifthen}
\usepackage{longtable,ltcaption,array}
\setlength{\extrarowheight}{2pt}
\newlength{\DUtablewidth} % internal use in tables
\usepackage{tabularx}

%% AMS maths and others
\usepackage{amsmath}
%\usepackage[tbtags]{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
%% \usepackage{enumerate,amssymb}
\usepackage{amssymb}

\usepackage{fancyvrb}
\usepackage{makeidx}
% Use the right quotes (depending of the language of babel)
\usepackage[babel=true]{csquotes}
%% Colors
\usepackage{xcolor}
\usepackage{color} %[usenames,dvipsnames,pdftex]
\usepackage{float}

\usepackage{url} % Allows url with \url{http://truc.machin/ok?r=yes}
%% Figures and effects
\usepackage{framed}
%%\usepackage{subfigure}
\usepackage{multicol}
\usepackage{wrapfig}
\usepackage{lastpage}
%% Source code
\usepackage{moreverb}
\usepackage{listings}
\usepackage[french,algoruled,lined,linesnumbered]{algorithm2e}  % https://en.wikibooks.org/wiki/LaTeX/Algorithms#Typesetting_using_the_algorithm2e_package
%\usepackage{caption}
\usepackage[hypcap]{caption}
\usepackage{subcaption}

%\usepackage[nottoc, notlof, notlot]{tocbibind}
%\usepackage[clearempty]{titlesec}

\usepackage{ifpdf} % Allows the \ifpdf \fi block
\usepackage{ifxetex} % Allows the \ifxetex \fi block
\usepackage{ifluatex} % Allows the \ifluatex \fi block
%% Effects
\usepackage{array}
\usepackage{microtype}
% Pour le mode BlackBoard généralisé (cf. http://forum.mathematex.net/latex-f6/fonction-indicatrice-et-page-de-garde-t6973.html)
\usepackage{bbm,bm}

\ifluatex
\usepackage{mathtools}
%\usepackage{unicode-math} % Bold math symbols
%\usepackage{libertine} % Used to have a problem with Renderer=Basic for ligatures
%\setmathfont{TeX Gyre Pagella Math}
%\setmathfont[BoldFont=TeX Gyre Pagella Bold,range=\mathit/{latin,Latin,greek,Greek,num}]{TeX Gyre Pagella Italic} % TeX Gyre Pagella has no bold by default
%\setmathfont[range=\setminus]{Asana Math}
%\setmonofont[Scale=MatchLowercase]{DejaVu Sans Mono}
\usepackage{microtype} % Better handling of horizontal space
\fi

% TODO:
\usepackage{palatino}              % Use the Palatino font % XXX remove if it is ugly ?

% Custom package for the better footnote symbols
% http://ctan.org/pkg/footmisc
% \usepackage[perpage,para,symbol*]{footmisc}
\usepackage[bottom]{footmisc}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TiKZ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Graphism with TiKZ (add there additional TiKZ libraries)
%\usepackage{tikz}
%	\usetikzlibrary{shapes, matrix, arrows, decorations.pathmorphing, fadings, shapes.geometric, calc}

	%% Custom TiKZ macros
%	\tikzset{every picture/.style={execute at begin picture={
%	   \shorthandoff{:;!?};}
%	}}

%% \usepackage[upright]{fourier}

%% Magic!
\usepackage{relsize}
\usepackage{setspace}
%\usepackage[small,compact]{titlesec}
%\usepackage{titlesec}
\usepackage{stmaryrd}

\usepackage{microtype}
%% Disables ligatures (like ff or fi printed with special caracters)
%\DisableLigatures{encoding = *, family = *}

%% Customize lists and enumerates (Source: http://www.xm1math.net/doculatex/listes.html)
\usepackage{enumitem}
% \usepackage{enumerate} %% FIXME

% \usepackage[pdftex]{graphicx}
\usepackage{graphicx}

%% Include the bibliography in the Tables of Content. FIXME
%\usepackage[nottoc, notlof, notlot, numbib]{tocbibind}

%%%%%%%%%%%%%%%%%%%%%%%%%%% begin mathlig %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%
	% mathlig.tex
	%
	% (c) 2001 Jules Bean <jules@jellybean.co.uk>
	% Permission is granted to freely use, copy, and distribute
	% without restriction. Permission is also granted to distribute
	% modified versions and incorporate into your own macro packages
	% if a brief acknowledgement is given.
	%
	% Version 1.0  11 May 2001

	% Define 'mathmode' ligatures, as in
	%
	%\mathlig{->}{\rightarrow}
	%\mathlig{<-}{\leftarrow}
	%\mathlig{<->}{\leftrightarrow}
	%
	% Works even if they have common prefixes (takes the longest match,
	% then backtracks).
	%
	% Can be used to create ligatures even if the second
	% and subsequent characters have weird catcodes, but I don't recommend
	% it.

	\count255\catcode`@
	\catcode`@=11
	\chardef\mathlig@atcode\count255

	% Let or def an 'active' version of a token.  Thanks to Donald
	% Arseneau and groups.google.com
	\def\actively#1#2{\begingroup\uccode`\~=`#2\relax\uppercase{\endgroup#1~}}
	% Eat the next token, and then pass control to mathlig@next@cmd
	\def\mathlig@gobble{\afterassignment\mathlig@next@cmd\let\mathlig@next= }
	% Used to delimit delimited arguments, and ifx tests for emptyness.
	\def\mathlig@delim{\mathlig@delim}
	% Some macros to help dealing with 'computed names' (csnames).
	% Just like def, but first parameter is evaluated as a csname
	\def\mathlig@defcs#1{\expandafter\def\csname#1\endcsname}
	% A version of \let <normal cs><computed cs>
	\def\mathlig@let@cs#1#2{\expandafter\let\expandafter#1\csname#2\endcsname}
	% Maintain a 'list' of tokens as a macro which expands to them
	\def\mathlig@appendcs#1#2{\expandafter\edef\csname#1\endcsname{\csname#1\endcsname#2}}

	% The main externally visible macro.
	% Defines '#1' as a 'ligature' to expand to #2
	% First uses \mathlig@checklig to make sure that all initial segments of
	% #1 as set up as ligatures.
	% Then sets the ligature #1 to expand to #2.
	\def\mathlig#1#2{\mathlig@checklig#1\mathlig@end\mathlig@defcs{mathlig@back@#1}{#2}\ignorespaces}

	% All the @check macros should be idempotent: they set up the definitions
	% only if it hasn't already been done.

	%Check #1#2 can be a ligature:
	% Check #1 is math-active.
	% If not, save the mathcode, set the macros #1
	%Now check the suffix tables with \checkrest
	\def\mathlig@checklig#1#2\mathlig@end{%
	 \expandafter\ifx\csname mathlig@forw@#1\endcsname\relax
	 \expandafter\mathchardef\csname mathlig@back@#1\endcsname=\mathcode`#1%
	 \mathcode`#1"8000\actively\def#1{\csname mathlig@look@#1\endcsname}%
	 \mathlig@dolig#1\mathlig@delim
	\fi
	\mathlig@checksuffix#1#2\mathlig@end
	}

	%Two-part macro.
	%Check suffix tables. If #2 is empty, no suffix!
	%Otherwise, we make sure #2 is a valid suffix for #1,
	%then recurse for #3 on #1#2
	\def\mathlig@checksuffix#1#2\mathlig@end{%
	\ifx\mathlig@delim#2\mathlig@delim\relax\else\mathlig@checksuffix@{#1}#2\mathlig@end\fi
	}
	\def\mathlig@checksuffix@#1#2#3\mathlig@end{%
	\expandafter\ifx\csname mathlig@forw@#1#2\endcsname\relax\mathlig@dosuffix{#1}{#2}\fi
	\mathlig@checksuffix{#1#2}#3\mathlig@end
	}

	% The do macros should not be called more than once for a given ligature.

	% Add #2 to the list of valid suffixes for #1
	% Then make the ligature for #1#2 one which only backtracks, for now
	\def\mathlig@dosuffix#1#2{%
	\mathlig@appendcs{mathlig@toks@#1}{#2}%
	\mathlig@dolig{#1}{#2}\mathlig@delim
	}

	% Setup #1#2 so that ligatures beginning #1#2 work.
	% Such ligatures will look at what's coming next (in case
	% of a longer ligature) and, failing that,
	% backtrack to just #1

	\def\mathlig@dolig#1#2\mathlig@delim{%
	%The look macro just \futurelets what's coming up and
	%then passes control to forw
	 \mathlig@defcs{mathlig@look@#1#2}{%
	 \mathlig@let@cs\mathlig@next{mathlig@forw@#1#2}\futurelet\mathlig@next@tok\mathlig@next}%
	%The forw macro uses chck to try all possible suffixes, passing control
	%either to one of those, or to the back macro
	 \mathlig@defcs{mathlig@forw@#1#2}{%
	  \mathlig@let@cs\mathlig@next{mathlig@back@#1#2}%
	  \mathlig@let@cs\checker{mathlig@chck@#1#2}%
	  \mathlig@let@cs\mathligtoks{mathlig@toks@#1#2}%
	  \expandafter\ifx\expandafter\mathlig@delim\mathligtoks\mathlig@delim\relax\else
	  \expandafter\checker\mathligtoks\mathlig@delim\fi
	  \mathlig@next
	 }%
	%The toks macro just stores the suffixes
	 \mathlig@defcs{mathlig@toks@#1#2}{}%
	%The chk macro goes through the suffixes one by one
	%tail recursing until it runs out, or finds one.
	 \mathlig@defcs{mathlig@chck@#1#2}##1##2\mathlig@delim{%
	  %\message{Lig so far '#1#2', checking for '##1'}%
	  \ifx\mathlig@next@tok##1%
	   \mathlig@let@cs\mathlig@next@cmd{mathlig@look@#1#2##1}\let\mathlig@next\mathlig@gobble
	  \fi
	  \ifx\mathlig@delim##2\mathlig@delim\relax\else
	   \csname mathlig@chck@#1#2\endcsname##2\mathlig@delim
	  \fi
	 }%
	%
	% The back macro, defined only if this is a ligature of at least
	% two characters, is a default fallback: go back to the previous char.
	% (If this is a ligature of only one character, the mathcode will have
	% been saved and set as the fallback elsewhere)
	 \ifx\mathlig@delim#2\mathlig@delim\else
	  \mathlig@defcs{mathlig@back@#1#2}{\csname mathlig@back@#1\endcsname #2}%
	 \fi
	}%

	\catcode`@\mathlig@atcode
%%%%%%%%%%%%%%%%%%%%%%%%%%% end mathlig %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Last magic stuff
\usepackage{xspace}
\usepackage{mathabx}

%% Multiple footnote (see http://tex.stackexchange.com/a/58028)
\usepackage{scrextend}
% \usepackage{cleveref}[2012/02/15]% v0.18.4;
% \crefformat{footnote}{#2\footnotemark[#1]#3}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Options.
\pagenumbering{arabic}
\setcounter{tocdepth}{4}
%% Disable if writting not in French.
\frenchspacing

% BibTeX style (default: alpha) : cf http://nodonn.tipido.net/bibstyle.php
\bibliographystyle{alpha}

\setlength{\parskip}{0.2\baselineskip}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define some standard ``theorem'' types. From Paul Taylor's QED.sty
\def\DefineStandardTheorems{%
	%
	% First set up uniform numbering in LaTeX;
	% don't use this in plain TeX because this usage of \newcommand is not
	% supported and we have already done by hand what it would do in LaTeX,
	% viz to define the macro \theResult and the count \c@Result.
	\relax\ifx\@@thm\undefined
		\newtheorem{result}{Result}[section]%
	%        \@addtoreset{Result}{section}%
	%        \ifx\chapter\undefined\else\@addtoreset{result}{chapter}\fi
	\fi
	%
	\let\theUnnumbered\relax\countdef\c@Unnumbered255 \def\p@Unnumbered{}%
	%
%	\def\mkthm##1##2{\newtheorem{##1}{##2}[section]}%
	\def\mkthm##1##2{\newtheorem{##1}{##2}}%
	%
	\mkthm{conjecture}{Conjecture}%
	\mkthm{conjectures}{Conjectures}%
	\mkthm{convention}{Convention}%
	\mkthm{conventions}{Conventions}%
%	\mkthm{corollary}{Corollary}%
	\mkthm{corollaries}{Corollaries}%
	\mkthm{counterexample}{Counterexample}%
	\mkthm{counterexamples}{Counterexamples}%
	\mkthm{definition}{Définition}%
	\mkthm{definitions}{Définitions}%
	\mkthm{exampl}{Exemple}%
	\mkthm{exemple}{Exemple}%
	\mkthm{exemples}{Exemples}%
	\mkthm{lemma}{Lemma}%
	\mkthm{lemmas}{Lemmas}%
	\mkthm{demoEn}{Proof}%
	\mkthm{nb}{NB}%
	\mkthm{notation}{Notation}%
	\mkthm{notations}{Notations}%
	%\mkthm{note}{Note}%
	\mkthm{proposition}{Proposition}%
	\mkthm{propositions}{Propositions}%
	\mkthm{remark}{Remarque}%
	\mkthm{remarks}{Remarques}%
	\mkthm{theorem}{Théorème}%
	\mkthm{theorems}{Théorèmes}%
	\mkthm{thesis}{Thèse}%
	\mkthm{theses}{Thèses}%
	%% Mine, in French.
	\mkthm{lem}{Lemme}%
%	\mkthm{rule}{Rule}%
%	\mkthm{lemr}{Rule}%
	\mkthm{prop}{Proposition}%
	\mkthm{theo}{Théorème}%
	\mkthm{coro}{Corollaire}%
	\mkthm{demo}{Preuve}%
	\mkthm{defn}{Définition}%
	\mkthm{nota}{Notation}%
	\mkthm{conj}{Conjecture}%
	\mkthm{remarque}{Remarque}%
	\mkthm{exmp}{Exemple}%
	\mkthm{case}{Cas}%
	\mkthm{mynote}{Note}%
	\mkthm{conc}{Conclusion}%
%	\mkthm{example}{Example}%
%	\mkthm{question}{Question}%
%	\mkthm{theorem}{Theorem}%
%	\mkthm{definition}{Definition}%
%	\mkthm{problem}{Problem}%
}

%% To have the enumeration follow from your section or subsection heading,
%% you must use the amsmath package or use AMS class documents. Then enter
%%\numberwithin{equation}{section}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Code embedding.

%% Custom color for code embedding.
\definecolor{dkgreen}{rgb}{0,0.4,0}    % Define a new color rgb(0, 102, 0)
\definecolor{gray}{rgb}{0.5,0.5,0.5}    % Define a new color rgb(127, 127, 127)
\definecolor{mauve}{rgb}{0.58,0,0.82}    % Define a new color rgb(147, 0, 209)
\definecolor{darkgreen}{rgb}{0.00,0.70,0.00}    % Define a new color rgb(0,178,0)

\lstset{ %
	backgroundcolor=\color{white},  % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}
	basicstyle=\ttfamily, % \texttt\small,              % the size of the fonts that are used for the code, FIXME \ttfamily
	breakatwhitespace=false,        % sets if automatic breaks should only happen at whitespace
	breaklines=true,                % sets automatic line breaking
	captionpos=b,                   % sets the caption-position to bottom
	commentstyle=\small\color{dkgreen},   % comment style
	%  deletekeywords={...},          % if you want to delete keywords from the given language
	%  escapeinside={\%*}{*)},        % if you want to add LaTeX within your code
	%  extendedchar=true,             % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
	frame=single,                   % adds a frame around the code
	keywordstyle=\small\color{blue},      % keyword style
	language=python,                % the language of the code
	fontadjust=false,
	% if you want to add more keywords to the set
	%  morekeywords={define,domain,objects,init,goal,problem,action,parameters,precondition,effect,types,requirements,strips,typing},
	numbers=left,                   % where to put the line-numbers; possible values are (none, left, right)
	numbersep=5pt,                  % how far the line-numbers are from the code
	numberstyle=\tiny\color{gray},  % the style that is used for the line-numbers
	rulecolor=\color{black},        % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
	showspaces=false,               % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
	showstringspaces=false,         % underline spaces within strings only
	showtabs=false,                 % show tabs within strings adding particular underscores
	stepnumber=1,                   % the step between two line-numbers. If it's 1, each line will be numbered
	stringstyle=\small\color{mauve},      % string literal style
	tabsize=2,                      % sets default tabsize to 2 spaces
	prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},	% pour la fin des lignes.
	aboveskip={1.5\baselineskip},
	%title=\lstname                  % show the filename of files included with \lstinputlisting; also try caption instead of title
	%  title=\tiny{File \textcolor{blue}{\url{\lstname}}}          % show the filename of files included with \lstinputlisting; also try caption instead of title
	%% FIXME title !
}


\usepackage{tcolorbox}
\tcbuselibrary{minted,breakable,xparse,skins}

\definecolor{bg}{gray}{0.95}
\DeclareTCBListing{mintedbox}{O{}m!O{}}{%
  breakable=true,
  listing engine=minted,
  listing only,
  minted language=#2,
  minted style=default,
  minted options={%
    linenos,
    gobble=0,
    breaklines=true,
    breakafter=,,
    fontsize=\small,
    numbersep=8pt,
    #1},
  boxsep=0pt,
  left skip=0pt,
  right skip=0pt,
  left=25pt,
  right=0pt,
  top=3pt,
  bottom=3pt,
  arc=5pt,
  leftrule=0pt,
  rightrule=0pt,
  bottomrule=2pt,
  toprule=2pt,
  colback=bg,
  colframe=orange!70,
  enhanced,
  overlay={%
    \begin{tcbclipinterior}
    \fill[orange!20!white] (frame.south west) rectangle ([xshift=20pt]frame.north west);
    \end{tcbclipinterior}},
  #3}

%% From https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings#Customizing_captions
% \DeclareCaptionFont{white}{ \color{white} }
% \DeclareCaptionFormat{listing}{
%   \colorbox[cmyk]{0.43, 0.35, 0.35, 0.01}{
%     \parbox{\textwidth}{\hspace{15pt}#1#2#3}
%   }
% }
% \captionsetup[lstlisting]{format=listing, labelfont=white, textfont=white, singlelinecheck=false, font={bf,footnotesize} } %, margin=5pt

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% From superquack.sty, and custom commands.

	\newcommand{\p}[1]{\ensuremath{\mathsf{#1}}} % predicate font
	\newcommand{\m}[1]{\ensuremath{\mathit{#1}}} % math font

	\newcommand{\emp}{\p{emp}}

	%% floats
	\floatstyle{plain}
		\newfloat{figure}{tp}{los}
		\floatname{figure}{Figure}
		\renewcommand{\topfraction}{0.9}
		\renewcommand{\bottomfraction}{0.3}
		\renewcommand{\textfraction}{0.07}
		\renewcommand{\floatpagefraction}{0.9}
		\renewcommand{\dblfloatpagefraction}{0.9}
		\setcounter{topnumber}{2}
		\setcounter{bottomnumber}{2}
		\setcounter{totalnumber}{4}     % 2 may work better
		\setcounter{dbltopnumber}{2}    % for 2-column pages
		\renewcommand{\dbltopfraction}{0.9}	% fit big float above 2-col. text

	% squeeeeeeeeeze
	\addtolength{\textfloatsep}{-10pt}
	\addtolength{\dbltextfloatsep}{-10pt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% common.sty
	% Write a label above something, e.g. an arrow
	\newcommand{\stacklabel}[1]{\stackrel{\smash{\scriptscriptstyle
	      #1}}}

	%% Quantifiers
%	\newcommand{\E}[1]{\exists #1.\,}
%	\newcommand{\V}[1]{\forall #1.\,}
	\newcommand{\E}[0]{\exists}
	\newcommand{\V}[0]{\forall}
	\newcommand{\grandO}[0]{\mathcal{O}}
	\newcommand{\petitO}[0]{\mathcal{o}}

	%% Sets
	\newcommand{\N}{\mathbb{N}}
	\newcommand{\R}{\mathbb{R}}
	\newcommand{\Rn}{\mathbb{R}^n}
	\newcommand{\MnR}{\mathbb{M}_n(\mathbb{R})}
	\newcommand{\C}{\mathbb{C}}
	\newcommand{\Cn}{\mathbb{C}^n}
	\newcommand{\MnC}{\mathbb{M}_n(\mathbb{C})}
	\newcommand{\Mn}[1]{\mathbb{M}_n(#1)}
	\newcommand{\Q}{\mathbb{Q}}
	\newcommand{\proba}{\mathbb{P}}
	\newcommand{\Z}{\mathbb{Z}}
	\newcommand{\D}{\mathbb{D}}
	\newcommand{\K}{\mathbb{K}}
	\newcommand{\Pset}{\mathcal P}
	\renewcommand{\epsilon}{\varepsilon}

	%% By Vijay
	\newcommand{\IR}{\mathbb{R}}
	\newcommand{\IF}{\mathbb{F}}
	\newcommand{\IQ}{\mathbb{Q}}
	\newcommand{\IZ}{\mathbb{Z}}
	\newcommand{\IN}{\mathbb{N}}
	%%\renewcommand{\mod}{\mathrm{mod }}

	\newcommand{\dom}{\mathit{dom}}
	\newcommand{\set}[1]{\ensuremath{\mathsf{#1}}}
	\newcommand{\form}{\mathsf}

	\newcommand{\repl}[2]{[#1<-#2]}
	\newcommand{\exch}[2]{[#1<->#2]}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Some others macros
% Clicable urls (blue, red, green)
\newcommand{\urlb}[1]{\textcolor{blue}{\url{#1}}}
\newcommand{\urlr}[1]{\textcolor{red}{\url{#1}}}
\newcommand{\urlg}[1]{\textcolor{dkgreen}{\url{#1}}}

%% To embed code,
% \includecode{language}{begin}{end}{uri}
% and @uri must be RELATIVE to the .tex
\newcommand{\includecode}[4]{\lstinputlisting[title={\small{Extern file \textcolor{blue}{\url{{#4}}} \textit{(lines {#2} to {#3}).}}}, language={#1}, firstline={#2}, lastline={#3}]{#4}}

%% To embed code, previously colored with pygmentize
% \pygmentize{label}{caption}{file}
% and @file must be RELATIVE to the .sty, WITHOUT extension
% @file.tex HAVE TO BE PRESENT
\newcommand{\pygmentize}[3]{
 \begin{figure}[H]\caption{#2}\label{#1}
     \small{ \input{#3.tex} }
 \end{figure}}

\newcommand{\pygmentizeCustom}[4]{
 \begin{figure}[H]\caption{#2}\label{#1}
     \begin{#4}
      \input{#3.tex}
     \end{#4}
 \end{figure}}

\newcommand{\pygmentizeframed}[3]{
 \begin{figure}[H]\caption{#2}\label{#1}
  \begin{framed}
     \small{ \input{#3.tex} }
  \end{framed}
 \end{figure}}

%% A demo, ending by a #
\newenvironment{demoBox}{\begin{demo}
}{
$\Box$
\end{demo}}

%% A conclusion, framed
\newenvironment{concl}{\begin{framed}
\textit{Conclusion}:}{
\end{framed}}

%% Some enumerate environments
\newenvironment{arab}{\begin{enumerate}[label=(\arabic*)]}{\end{enumerate}}
\newenvironment{roma}{\begin{enumerate}[label=(\roman*)]}{\end{enumerate}}
\newenvironment{Roma}{\begin{enumerate}[label=(\Roman*)]}{\end{enumerate}}
\newenvironment{enumalph}{\begin{enumerate}[label=(\alph*)]}{\end{enumerate}}
\newenvironment{enumAlph}{\begin{enumerate}[label=(\Alph*)]}{\end{enumerate}}

%% Useful shortcuts.
\newcommand{\ssi}{\textbf{ssi}~}
\renewcommand{\iff}{\textbf{iff}~}

\newcommand{\ie}[0]{\emph{i.e.}~}
\newcommand{\ev}[0]{\emph{e.v.}~}
\newcommand{\eg}[0]{\emph{e.g.}~}

\renewcommand{\it}[1]{\textit{#1}}
\renewcommand{\tt}[1]{\texttt{#1}}
\renewcommand{\bf}[1]{\textbf{#1}}
\renewcommand{\sc}[1]{\textsc{#1}}
\newcommand{\un}[1]{\underline{#1}}

\newcommand{\todo}[1]{\begin{framed}
{\hspace{-1.5em}\color{red} \textbf{TODO} : #1\hspace{-0.5em}}
\end{framed}}

\usepackage{manfnt}

%% Include prooftrees to have proofs in déduction naturelle (MPI 2023/2024)
% \usepackage{prooftrees}
\usepackage{bussproofs} %% TODO: active celui là pour les docs de Joshua Peignier
% %-------------------------------------------------------------------------------
% \usepackage{ebproof}      %% TODO: active celui là pour les docs de Éric Détrez
% \def\axiome#1{\hypo{}\infer1[ax]{#1}}
% \def\introEt#1{\infer2[$\land_i$]{#1}}
% \def\elimEt#1{\infer1[$\land_e$]{#1}}
% \def\introOu#1{\infer1[$\lor_i$]{#1}}
% \def\elimOu#1{\infer3[$\lor_e$]{#1}}
% \def\introDonc#1{\infer1[$\to_i$]{#1}}
% \def\elimDonc#1{\infer2[$\to_e$]{#1}}
% \def\introNon#1{\infer1[$\neg_i$]{#1}}
% \def\elimNon#1{\infer2[$\neg_e$]{#1}}
% \def\elimFaux#1{\infer1[$\bot_e$]{#1}}
% \def\tiersE#1{\hypo{}\infer1[te]{#1}}
% \def\doubleNon#1{\infer1[$\neg\neg_e$]{#1}}
% \def\absurde#1{\infer1[raa]{#1}}
% \def\introTout#1{\infer1[$\forall_i$]{#1}}
% \def\elimTout#1{\infer1[$\forall_e$]{#1}}
% \def\introUn#1{\infer1[$\exists_i$]{#1}}
% \def\elimUn#1{\infer2[$\exists_e$]{#1}}
% \def\monotone#1{\infer1[aff]{#1}}
% \def\renomme#1{\infer1[$\rho$]{#1}}
%-------------------------------------------------------------------------------

%% Make At Letter part (what does this mean exactly ?)
\makeatletter
% Pour mettre du texte en indice, même sans utiliser Babel:French et son \up
	\DeclareRobustCommand*\textsubscript[1]{%
	  \@textsubscript{\selectfont#1}}
	\def\@textsubscript#1{%
	  {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
% Pour mettre du texte en exposant, même sans utiliser Babel:French et son \up
	\DeclareRobustCommand*\textsuperscript[1]{%
	  \@textsuperscript{\selectfont#1}}
	\def\@textsuperscript#1{%
	  {\m@th\ensuremath{^{\mbox{\fontsize\sf@size\z@#1}}}}}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Specialized math shortcuts
\newcommand{\exo}[1]{
	\subsection*{Partie {#1}}
}
\newcommand{\qu}[1]{
	\subsubsection*{Question {#1}}
}
\newcommand{\sq}[1]{
	\subsubsubsection*{{#1}}
}

\newcommand{\inv}[1]{\frac{1}{#1}}

\newcommand{\e}[0]{\mathrm{e}}
\newcommand{\dx}[0]{\mathrm{d}x}
\newcommand{\dy}[0]{\mathrm{d}y}
\newcommand{\dz}[0]{\mathrm{d}z}
\newcommand{\dt}[0]{\mathrm{d}t}

%% Hyperbolic functions
\newcommand{\arccosh}[0]{\mathop{\mathrm{arccosh}}}
\newcommand{\arcsinh}[0]{\mathop{\mathrm{arcsinh}}}
\newcommand{\arctanh}[0]{\mathop{\mathrm{arctanh}}}
%\newcommand{\cosh}{\mathop{\mathrm{\cosh}}}
%\newcommand{\sinh}{\mathop{\mathrm{\sinh}}}
%\newcommand{\tanh}{\mathop{\mathrm{\arctanh}}}

%% Arg max and Arg min
\newcommand{\argmax}[0]{\mathop{\mathrm{argmax}}}
\newcommand{\argmin}[0]{\mathop{\mathrm{argmin}}}

%% Add \limits to sum, limit, product
\renewcommand{\lim}[0]{\mathop{\mathrm{lim}}\limits}
%% \renewcommand{\sum}[0]{\mathop{\large \Sigma}\limits}
%% \renewcommand{\prod}[0]{\mathop{\large \Pi}\limits}
%% \everymath{\displaystyle}
\renewcommand{\inf}[0]{\mathop{\mathrm{inf}}\limits}
\renewcommand{\sup}[0]{\mathop{\mathrm{sup}}\limits}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% this is like defining stuff after the \begin{document}
\AtBeginDocument{
%% changing the name of some titles.
% \addto\captionsenglish{%
  \renewcommand{\contentsname}{Summary}%
  \renewcommand{\abstractname}{Executive Summary}%
  \renewcommand{\refname}{Bibliography}%
  \renewcommand{\listfigurename}{List of figures}%
  \renewcommand{\listtablename}{List of tables}%
% }
 \addto\captionsfrench{% ref: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=latexwords
  \renewcommand{\contentsname}{Sommaire}%
  \renewcommand{\abstractname}{Résumé}%
  \renewcommand{\refname}{Bibliographie}%
  \renewcommand{\listfigurename}{Liste des figures}%
  \renewcommand{\listtablename}{Liste des tableaux}%
 }

  \DefineStandardTheorems{}

  % Docutils tables
  \setlength{\DUtablewidth}{0.85\linewidth}

  %% ligatures
  % to be safe, use only characters from the following list:
  % ` " ' ~ ! ? @ * ( ) [ ] < > - + = | : ; . , / 0 1 2 3 4 5 6 7 8 9
  % each lig must be defined after all ligs it prefixes
  % 3 chars
  % 2 chars
%  \mathlig{|,}{\mathbin{\downarrow}}
%  \mathlig{|'}{\mathbin{\uparrow}}
  % 1 char  WARNING: change standard spacing
  %% common.sty
  \mathlig{<==>}{\mathrel{\Longleftrightarrow}} % equivalence
  \mathlig{--->}{\mathrel{\longrightarrow}} % transitions
  % 3 chars
%  \mathlig{::=}{\mathrel{\Coloneqq}}
  \mathlig{-->}{\mathrel{\rightarrow}} % set function space
  \mathlig{->>}{\mathrel{\leadsto}} % \leadsto
  \mathlig{<->}{\mathrel{\leftrightarrow}}
  \mathlig{-|}{\dashv}
  \mathlig{--`}{\mathrel{\rightharpoonup}} % partial function
  \mathlig{===}{\mathrel{\equiv}} % syntactic equality
  \mathlig{=/=}{\mathrel{\not\equiv}} % not syntactic equality
  \mathlig{|/-}{\nvdash} % not entailment
  \mathlig{|/=}{\nvDash} % not forces
  \mathlig{<=>}{\mathrel{\Leftrightarrow}} % equivalence of expressions
  \mathlig{==>}{\mathrel{\Rightarrow}} % meta implication
  \mathlig{|||}{\mathrel{|}} % grammar
  \mathlig{-|-}{\mathrel{\mathrlap{\dashv} \hspace{5pt} \vdash}} % entails
  % 2 chars
  \mathlig{==}{\mathrel{\stackrel{\smash{\scriptscriptstyle\mathrm{def}}}{=}}}
  \mathlig{/|}{\mathbin{\wedge}} % additive conjunction
  \mathlig{|/}{\mathbin{\vee}} % additive disjunction
  \mathlig{/=}{\mathrel{\neq}} % non-equality expression
  \mathlig{<=}{\leq} % less than or equal expression
  \mathlig{<<}{\ll} % really less than expression
  \mathlig{>=}{\geq} % more than or equal expression
  \mathlig{>>}{\gg} % really more than expression
  \mathlig{|-}{\mathrel{\vdash}} % entails
  \mathlig{|=}{\vDash} % models
  \mathlig{|>}{\vartriangleright}
  \mathlig{<|}{\vartriangleleft}
  \mathlig{[|}{\llbracket} % open double bracket
  \mathlig{|]}{\rrbracket} % close double bracket
  \mathlig{->}{\mathord{\rightarrow}} % field dereference
  \mathlig{<-}{\mathord{\leftarrow}} % assignement
  %% seplog.sty
%   \mathlig{--*}{\mathrel{\magicwand}}
%   \mathlig{--o}{\mathrel{\septraction}}
  \mathlig{|->}{\mathrel{\mapsto}} % tight points-to
  \mathlig{||-}{\mathbin{\Vdash}}
%   \mathlig{**}{\mathbin{\ocon}}
  %\mathlig{*}{\mathbin{\scon}}
  %% maths one (new!)
  \mathlig{||}{\|}
  \mathlig{..}{\dots}
  \mathlig{oo}{\infty}
}

%% BEGIN of docutils.sty
% providelength (provide a length variable and set default, if it is new)
\providecommand*{\DUprovidelength}[2]{
  \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
}

% docinfo (width of docinfo table)
\DUprovidelength{\DUdocinfowidth}{0.9\textwidth}

% fieldlist environment
\ifthenelse{\isundefined{\DUfieldlist}}{
  \newenvironment{DUfieldlist}%
    {\quote\description}
    {\enddescription\endquote}
}{}

% transition (break, fancybreak, anonymous section)
\providecommand*{\DUtransition}[1][class-arg]{%
  \hspace*{\fill}\hrulefill\hspace*{\fill}
  \vskip 0.5\baselineskip
}
%% Horizontal Lines
\providecommand*{\hr}[1][class-arg]{%
  \hspace*{\fill}\hrulefill\hspace*{\fill}
  \vskip 0.5\baselineskip
}

%% END of docutils.sty

%% END of naereen.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
