1
\documentclass[12]{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage[french]{babel} 



\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage[french]{babel} 
\usepackage[top=3cm, bottom=3cm, left=3cm, right=3cm]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{framed,  etoolbox}
  \colorlet{framecolor}{VioletRed4}
    \colorlet{shadecolor}{LavenderBlush2!60}
\usepackage{thmtools} %

\makeatletter
\define@key{thmdef}{frame}[{}]{%
 \thmt@trytwice{}{%
 \RequirePackage{framed}%
 \RequirePackage{thm-patch}%
    \def\FrameCommand{\fcolorbox{framecolor}{shadecolor}}
 \addtotheorempreheadhook[\thmt@envname]{%
 \begin{framed}}%
 \addtotheorempostfoothook[\thmt@envname]{\end{framed}}%
 }%
}
\makeatother

\declaretheorem[numberwithin=section, frame]{definition}
\declaretheorem[frame, sharenumber=definition]{proposition}
\AtBeginEnvironment{proposition}{\colorlet{framecolor}{DarkSeaGreen4}
    \colorlet{shadecolor}{Yellow1!15}}





\newcommand{\myarrow}[1][1cm]{\mathrel{%
   \hbox{\rule[\dimexpr\fontdimen22\textfont2-.2pt\relax]{#1}{.4pt}}%
   \mkern-4mu\hbox{\usefont{U}{lasy}{m}{n}\symbol{41}}}}

\makeatletter

\setbox0\hbox{$\xdef\scriptratio{\strip@pt\dimexpr
    \numexpr(\sf@size*65536)/\f@size sp}$}

\newcommand{\myscriptarrow}[1][1cm]{{%
    \hbox{\rule[\scriptratio\dimexpr\fontdimen22\textfont2-.2pt\relax]
               {\scriptratio\dimexpr#1\relax}{\scriptratio\dimexpr.4pt\relax}}%
   \mkern-4mu\hbox{\let\f@size\sf@size\usefont{U}{lasy}{m}{n}\symbol{41}}}}

\makeatother







\begin{document}
\section{Arithmérique}
\subsection{12}
le but de ce chapitre

    \begin{definition}
        Soit f:$G \rightarrow G$ une application linéaire alors:\\
    $$\forall x,y\in G,\ f(x)=f(y)\implies x=y$$
    \end{definition}

    \begin{proposition}
        Soit $f:G \myarrow[.7cm]G$ une application linéaire alors:\\
    $$\forall x,y\in G,\ f(x)=f(y)\iff x=y$$
    \end{proposition}

\end{document}
Sebastiano
  • 54,118
mohammed
  • 151
  • 1
    Off-topic: (a) 12 is not a recognized option of the article document class. I assume you meant to write 12pt. (b) Don't load packages more than once. (c) To cut down on code clutter, do replace \usepackage[top=3cm, bottom=3cm, left=3cm, right=3cm]{geometry} with \usepackage[margin=3cm]{geometry}. – Mico Sep 25 '19 at 22:47

1 Answers1

2

Something how this? You can compare your code with what I entered to understand the answer. Sorry for the speed with which I write to you.

Addendum: Thank you very much for the suggestion of @Mico (see the comment).

enter image description here

\documentclass[12pt]{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[top=3cm, bottom=3cm, left=3cm, right=3cm]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{framed, etoolbox}
\colorlet{framecolor}{VioletRed4}
\colorlet{shadecolor}{LavenderBlush2!60}
\usepackage{thmtools} %
\usepackage{titlesec}%%%%%% <---------addendum
\titleformat{\section}%%%%%% <---------addendum
{\color{magenta}\normalfont\Large\bfseries}%%%%%% <---------addendum
{\color{magenta}\thesection}{1.5em}{}%%%%%% <---------addendum
\makeatletter
\define@key{thmdef}{frame}[{}]{%
 \thmt@trytwice{}{%
 \RequirePackage{framed}%
 \RequirePackage{thm-patch}%
    \def\FrameCommand{\fcolorbox{framecolor}{shadecolor}}
 \addtotheorempreheadhook[\thmt@envname]{%
 \begin{framed}}%
 \addtotheorempostfoothook[\thmt@envname]{\end{framed}}%
 }%
}
\makeatother

\declaretheorem[numberwithin=section, frame]{definition}
\declaretheorem[frame, sharenumber=definition]{proposition}
\AtBeginEnvironment{proposition}{\colorlet{framecolor}{DarkSeaGreen4}
    \colorlet{shadecolor}{Yellow1!15}}

\newcommand{\myarrow}[1][1cm]{\mathrel{%
   \hbox{\rule[\dimexpr\fontdimen22\textfont2-.2pt\relax]{#1}{.4pt}}%
   \mkern-4mu\hbox{\usefont{U}{lasy}{m}{n}\symbol{41}}}}

\makeatletter

\setbox0\hbox{$\xdef\scriptratio{\strip@pt\dimexpr
    \numexpr(\sf@size*65536)/\f@size sp}$}

\newcommand{\myscriptarrow}[1][1cm]{{%
    \hbox{\rule[\scriptratio\dimexpr\fontdimen22\textfont2-.2pt\relax]
               {\scriptratio\dimexpr#1\relax}{\scriptratio\dimexpr.4pt\relax}}%
   \mkern-4mu\hbox{\let\f@size\sf@size\usefont{U}{lasy}{m}{n}\symbol{41}}}}

\makeatother


\begin{document}
\section{Arithmérique}
\subsection{12}
le but de ce chapitre

    \begin{definition}
    Soit $f\colon G \rightarrow G$ une application linéaire alors:\\%%%%%% <---------edit
   \[\forall x,y\in G,\ f(x)=f(y)\implies x=y\]
    \end{definition}
   \begin{proposition}
        Soit $f\colon G \myarrow[.7cm]G$ une application linéaire alors:\\%%%%%% <---------edit
    \[\forall x,y\in G,\ f(x)=f(y)\iff x=y\]
    \end{proposition}

\end{document}

Addendum (2): There is another possibility: to use the @Bernard's comment.

\documentclass[12pt]{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{amsthm}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[top=3cm, bottom=3cm, left=3cm, right=3cm]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{framed, etoolbox}
\colorlet{framecolor}{VioletRed4}
\colorlet{shadecolor}{LavenderBlush2!60}
\usepackage{thmtools} %
\usepackage{titlesec}%%%%%% <---------addendum
\titleformat*{\section}{\color{magenta}\Large\bfseries} %%%%%% <---------@Bernard's comment
\makeatletter
\define@key{thmdef}{frame}[{}]{%
 \thmt@trytwice{}{%
 \RequirePackage{framed}%
 \RequirePackage{thm-patch}%
    \def\FrameCommand{\fcolorbox{framecolor}{shadecolor}}
 \addtotheorempreheadhook[\thmt@envname]{%
 \begin{framed}}%
 \addtotheorempostfoothook[\thmt@envname]{\end{framed}}%
 }%
}
\makeatother

\declaretheorem[numberwithin=section, frame]{definition}
\declaretheorem[frame, sharenumber=definition]{proposition}
\AtBeginEnvironment{proposition}{\colorlet{framecolor}{DarkSeaGreen4}
    \colorlet{shadecolor}{Yellow1!15}}

\newcommand{\myarrow}[1][1cm]{\mathrel{%
   \hbox{\rule[\dimexpr\fontdimen22\textfont2-.2pt\relax]{#1}{.4pt}}%
   \mkern-4mu\hbox{\usefont{U}{lasy}{m}{n}\symbol{41}}}}

\makeatletter

\setbox0\hbox{$\xdef\scriptratio{\strip@pt\dimexpr
    \numexpr(\sf@size*65536)/\f@size sp}$}

\newcommand{\myscriptarrow}[1][1cm]{{%
    \hbox{\rule[\scriptratio\dimexpr\fontdimen22\textfont2-.2pt\relax]
               {\scriptratio\dimexpr#1\relax}{\scriptratio\dimexpr.4pt\relax}}%
   \mkern-4mu\hbox{\let\f@size\sf@size\usefont{U}{lasy}{m}{n}\symbol{41}}}}

\makeatother


\begin{document}
\section{Arithmérique}
\subsection{12}
le but de ce chapitre

    \begin{definition}
    Soit $f\colon G \rightarrow G$ une application linéaire alors:\\%%%%%% <---------edit
   \[\forall x,y\in G,\ f(x)=f(y)\implies x=y\]
    \end{definition}
   \begin{proposition}
        Soit $f\colon G \myarrow[.7cm]G$ une application linéaire alors:\\%%%%%% <---------edit
    \[\forall x,y\in G,\ f(x)=f(y)\iff x=y\]
    \end{proposition}

\end{document}
Sebastiano
  • 54,118
  • 1
    +1. Small suggestion: change f:$G \rightarrow G$ to $f\colon G \rightarrow G$, and $f:G \myarrow[.7cm]G$ to $f\colon G \myarrow[.7cm]G$. Also, the explicit line break directives after alors: are not needed. Optional: change \usepackage[top=3cm, bottom=3cm, left=3cm, right=3cm]{geometry} to \usepackage[margin=3cm]{geometry}. – Mico Sep 25 '19 at 22:41
  • @Sebastiano, what is the commande that must I use it? – mohammed Sep 25 '19 at 22:44
  • @mohammed Please see the last edit into code: addendum + edit with the symbols %%%%% <--------. – Sebastiano Sep 25 '19 at 22:47
  • @Sebastiano: \titleformat*{\section}{\color{magenta}\Large\bfseries} does the same job,and is easier to understand for someone who ùay not know very well the package in use. Do you think that ‘Arithmérique’ denotes D. Trump's way of doing fake arithmetic? ;o) – Bernard Sep 25 '19 at 22:55
  • @Bernard Ahahahah. Now edit again the code with your suggestion. – Sebastiano Sep 25 '19 at 22:56
  • 1
    @Sebastiano, The solution was successful – mohammed Sep 25 '19 at 22:58