\documentclass[12pt,a4paper]{article}
\usepackage{amsfonts,amsmath,amssymb,graphicx,amsthm}
\usepackage{tikz,tkz-tab,moreverb} % tableau de signe moreverb not needed
\usetikzlibrary{arrows}
\usepackage[francais]{babel}
\usepackage{pifont} %bouni
\usepackage[latin1]{inputenc}
\usepackage{verbatim}
\usepackage{color}
\usepackage[final]{pdfpages} %pour inserer une page pdf
\usepackage{fancyhdr} % pagestyle
%---- Dimensions des marges ---
\usepackage{geometry}
\geometry{left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm}
%\usepackage{setspace}
%\onehalfspacing
%----New Structure Exercice -----
\newtheoremstyle{sboxexc}% name of the style to be used
{\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape}% name of font to use in the body of the theorem
{0pt}%  of space to indent
{}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
\newcounter{counter}
\setcounter{counter}{1}
\theoremstyle{sboxexc}
\newcommand{\optionaltext}{}
\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont}
%\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont $\:$} %Return to line with itemize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{sfaxlogo}{RGB}{127,176,206}
\colorlet{sfaxblue}{sfaxlogo!70!black!60!blue}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%begin entete%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Faculté des Sciences Economiques et Gestion de Mahdia
{
{\noindent
\small{\textbf{Université de xxxxxxxxx} }             % Université
\hfill A.U. : 2020-2021 \\                 % année
}{\noindent
\small{ {\large{F}}aculté des {\large{S}}ciences {\large{\'E}}conomiques et de {\large{G}}estion de {\large{M}}xxxxx   }            % institut
\hfill \textbf{Module : xxxxxxxx} \\    % section et module
}
{\noindent
\small{\textbf{Département des xxxxxxxxxxx}   }           % Université
\hfill \ding{43} Section : xxxxx}              % année
%------------------------------------------------------
\vspace{-0.4cm}
\begin{center}
\end{center}
%--------------------------end entete----------------------------------------------------
\end{document}


I want to insert a picture

• Is it a header (for every page) or only the heading for the first page of the document? Nov 23, 2020 at 11:36
• @Bernard It is only for the first page Professor Nov 23, 2020 at 11:50

I'd use a big top aligned two-row tabular to contain the whole header.

The first row has three nested center aligned tabulars, for the left part, the image and the right part.

The second row has the “Série” box.

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{graphicx}
\usepackage{pifont}
%---- Dimensions des marges ---
\usepackage{geometry}
\geometry{left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm,showframe}

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%begin entete%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%Faculté des Sciences Economiques et Gestion de Mahdia

\noindent
\begin{tabular}[t]{@{}c@{}}
\makebox[\textwidth][s]{%
\small
\begin{tabular}{@{}l@{}}
\textbf{Université de xxxxxxxxx} \\
{\large F}aculté des {\large S}ciences {\large \'E}conomiques
et de {\large G}estion de {\large M}xxxxx \\
\textbf{Département des xxxxxxxxxxx}
\end{tabular}\hfill
\begin{tabular}{@{}c@{}}
\includegraphics[height=3\normalbaselineskip]{example-image}
\end{tabular}\hfill
\begin{tabular}{@{}r@{}}
A.U. : 2020-2021 \\
\vphantom{\large \'E}\textbf{Module : xxxxxxxx} \\
\ding{43} Section : xxxxx
\end{tabular}%
}% end of top row
\\[4ex]
\end{tabular}
%--------------------------end entete----------------------------------------------------

\end{document}


The showframe option is just for showing the page margins, remove it from the production version.

• Thank you Professor but I cannot compilate your codes Nov 23, 2020 at 14:41
• @Schüler Possibly the é? Nov 23, 2020 at 14:47
• He shows me that the problem is here }% end of top row Nov 23, 2020 at 15:37
• @Schüler I have no problem; what's the error message? Nov 23, 2020 at 15:39
• Now when I add  \usepackage[latin1]{inputenc} it works . Thanks Nov 23, 2020 at 15:41

I would do it with a tabular*{\linewidth}}{@{\extracolsep{\fill}}lcr@{}} environment,and adjusting by hand the position of the logo.

Unrelated The ‘francais’ option for babel-french is obsolete. Use french instead. Also, you don't have to load inputenc if you have a comparatively recent version of latex: tf8 is now the default, and you can type directly É, instead of \'E. Also, don't forget to load the T1 font encoding for a correct hyphenation.

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,graphicx,amsthm}
\usepackage{tikz,tkz-tab} % tableau de signe moreverb not needed,moreverb
\usetikzlibrary{arrows}
\usepackage[french]{babel}
\usepackage{pifont} %bouni
\usepackage{verbatim}
\usepackage{color}
\usepackage[final]{pdfpages} %pour inserer une page pdf
\usepackage{fancyhdr} % pagestyle
%---- Dimensions des marges ---
\usepackage{geometry}
\geometry{left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm}
%\usepackage{setspace}
%\onehalfspacing
%----New Structure Exercice -----
\newtheoremstyle{sboxexc}% name of the style to be used
{\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape}% name of font to use in the body of the theorem
{0pt}% of space to indent
{}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
\newcounter{counter}
\setcounter{counter}{1}
\theoremstyle{sboxexc}
\newcommand{\optionaltext}{}
\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont}
%\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont $\:$} %Return to line with itemize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{sfaxlogo}{RGB}{127,176,206}
\colorlet{sfaxblue}{sfaxlogo!70!black!60!blue}

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%begin entete%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Faculté des Sciences Economiques et Gestion de Mahdia
{\centering\small \begin{tabular*}{\linewidth} {@{\extracolsep{\fill}}lcr@{}}
\textbf{Université de xxxxxxxxx} & & A.U. : 2020-2021 \\ % année
{\large F}aculté des {\large S}ciences {\large É}conomiques et de {\large G}estion de {\large M}xxxxx & \raisebox{-0.4\height}[0pt][0pt]{\includegraphics[scale=0.3]{zwinkern}}& \textbf{Module : xxxxxxxx}\\
\textbf{Département des xxxxxxxxxxx} & & \ding{43} Section : xxxxx
\end{tabular*}}
%--------------------------end entete----------------------------------------------------

\begin{center}
\end{center}

\end{document}


It is not difficult to do if you use the package xcoffin.

https://ctan.org/pkg/xcoffins?lang=en

Try this code. To see how this works see

Align text both horizontally and vertically

The logo is 3 baselines high to match both texts. It can be scrolled horizontally (or vertically) by adding an offset (now set to 5pt). Note that the correct alignment of the text lines will not change by changing the position or the size of the logo since they all are independent boxes.

\documentclass[12pt,a4paper]{article}
\usepackage{amsfonts,amsmath,amssymb,graphicx,amsthm}
\usepackage{tikz,tkz-tab,moreverb} % tableau de signe moreverb not needed
\usetikzlibrary{arrows}
\usepackage[francais]{babel}
\usepackage{pifont} %bouni
%\usepackage[latin1]{inputenc}
\usepackage{verbatim}
\usepackage{color}
\usepackage[final]{pdfpages} %pour inserer une page pdf
\usepackage{fancyhdr} % pagestyle
%---- Dimensions des marges ---
\usepackage{geometry}
\geometry{left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm}
%\usepackage{setspace}
%\onehalfspacing
%----New Structure Exercice -----
\newtheoremstyle{sboxexc}% name of the style to be used
{\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape}% name of font to use in the body of the theorem
{0pt}%  of space to indent
{}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
\newcounter{counter}
\setcounter{counter}{1}
\theoremstyle{sboxexc}
\newcommand{\optionaltext}{}
\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont}
%\newcommand{\exo}[2][]{\renewcommand{\optionaltext}{#2}\begin{Exc}\normalfont $\:$} %Return to line with itemize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{sfaxlogo}{RGB}{127,176,206}
\colorlet{sfaxblue}{sfaxlogo!70!black!60!blue}

\NewCoffin\Framex
\NewCoffin\LeftUniv
\NewCoffin\Logox
\NewCoffin\RightMod

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%begin entete%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Faculté des Sciences Economiques et Gestion de Mahdia
%   \SetVerticalCoffin\Framex{\textwidth}{\phantom{x}} % an empty box \textwidth wide
\SetHorizontalCoffin\Framex{} % an empty box \

\SetVerticalCoffin\LeftUniv{0.6\textwidth}{%
\noindent
\small{\textbf{Université de xxxxxxxxx} } \newline   % Université
\small{ {\large{F}}aculté des {\large{S}}ciences {\large{\'E}}conomiques et de {\large{G}}estion de {\large{M}}xxxxx }   % institut
\small{\textbf{Département des xxxxxxxxxxx}   } % Université
}

\SetVerticalCoffin\Logox{0.15\textwidth}{\includegraphics[height=3\baselineskip, keepaspectratio]{example-grid-100x100pt}}

\SetVerticalCoffin\RightMod{0.25\textwidth}{%
\raggedleft
A.U. : 2020-2021
\textbf{Module : xxxxxxxx}    % section et module
\ding{43} Section : xxxxx            % année
}

\JoinCoffins*\Framex[l,vc]\LeftUniv[l,vc]
\JoinCoffins*\Framex[\LeftUniv-r,\LeftUniv-vc]\Logox[l,vc](5pt,0pt)  % X Y offsets. Use to displace the logo <--->
\JoinCoffins\Framex[r,vc]\RightMod[r,vc](\textwidth,0pt)

\noindent\TypesetCoffin\Framex

%{\noindent
%      \small{\textbf{Université de xxxxxxxxx} }             % Université
%      \hfill A.U. : 2020-2021 \\                 % année
%}{\noindent
%    \small{ {\large{F}}aculté des {\large{S}}ciences {\large{\'E}}conomiques et de {\large{G}}estion de {\large{M}}xxxxx   }            % institut
%      \hfill \textbf{Module : xxxxxxxx} \\    % section et module
%}
%{\noindent
%      \small{\textbf{Département des xxxxxxxxxxx}   }           % Université
%      \hfill \ding{43} Section : xxxxx}              % année
%------------------------------------------------------
%\vspace{-0.4cm}
\begin{center}