%!TEX pdflatex
\documentclass[a4paper,12pt,french]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{ProfLycee}
\usepackage{babel}
\NewDocumentCommand\DrawOpenRightHook{ m m }{
\draw[red,thick] ({#1 + 0.1}, {#2 + 0.025}) -- (#1,#2 + 0.025) -- (#1,#2 - 0.025) -- ({#1 + 0.1}, {#2 - 0.025});
}
\defKV[fctrepart]{%
Couleur=\def\FctRepartColor{#1},%
Epaisseur=\def\FctRepartThickness{#1},%
}
\setKVdefault[fctrepart]{%
Couleur=red,%
Epaisseur=semithick
}
\NewDocumentCommand\FonctionRepartTikz{ O{} m }{%
\restoreKV[fctrepart]%
\setKV[fctrepart]{#1}%
\setsepchar[.]{/.,}%
\readlist*\ListeFonctRepart{#2}%
\def\NbPortions{\ListeFonctRepartlen}
\foreach \i in {1,2,...,\ListeFonctRepartlen}
{%
\IfStrEq{\ListeFonctRepart[\i,2]}{*}%
{\def\valxdeb{\xmin}}%
{%
\itemtomacro\ListeFonctRepart[\i,2]\valxdeb%
\DrawOpenRightHook{\ListeFonctRepart[\i,2]}{\ListeFonctRepart[\i,1]}%
}%
\IfStrEq{\ListeFonctRepart[\i,3]}{*}%
{\def\valxfin{\xmax}}%
{%
\itemtomacro\ListeFonctRepart[\i,3]\valxfin%
\DrawOpenRightHook{\ListeFonctRepart[\i,3]}{\ListeFonctRepart[\i,1]}%
}%
\draw[very thick,red] ({\valxdeb},{\ListeFonctRepart[\i,1]})--({\valxfin},{\ListeFonctRepart[\i,1]}) ;
}%
}
\begin{document}
\begin{PresentationCode}{}
\begin{tikzpicture}[y=4cm,xmin=-2,xmax=10,ymin=-0.1,ymax=1.1]
\AxesTikz \AxexTikz{0,2,4,6,8}
\foreach \y in {1/3,1/2,2/3,1}
{\draw[thick] (2pt,{\y})--++(-4pt,0) node[left] {\ConversionFraction{\y}} ;}
\FonctionRepartTikz{0,*,0 / {1/3},0,2 / {1/2},2,4 / {2/3},4,6 / 1,6,*}
\end{tikzpicture}
\end{PresentationCode}
\end{document}