\documentclass[10pt,a4paper]{report}
\usepackage[height=250mm,width=183mm]{geometry}
\usepackage{fancyvrb,amsmath}
\usepackage[upright]{fourier}




\makeatletter
\newcommand{\executGiacmp}[1]{
\immediate\write18{giac  <#1 } }
\makeatother

\begin{VerbatimOut}{XCASipp.cxx}
Ipp(L):={
u:=L[0];vp:=L[1];a:=L[2];b:=L[3];
u:=unapply(u,x);
vp:=unapply(vp,x);
up:=fonction_derivee(u);
v:=unapply(int(vp(x),x),x);
I:="\\ensuremath{\\begin{cases} u(x)="+latex(u(x))+"\\qquad u'(x)="+latex(simplifier(up(x)))+" \\\\ v'(x)="+latex(vp(x))+"\\qquad v(x)="+latex(simplifier(v(x)))+"
     \\end{cases}
      \\qquad
     I=\\displaystyle \\int_{"+a+"}^{"+b+"}"+latex(u(x))+"\\times "+latex(vp(x))+"dx=\\Big["+
        latex(simplifier(u(x)*v(x)))+"\\Big]_{"+a+"}^{"+b+
               "}-\\int_{"+a+"}^{"+b+"}"+latex(simplifier(up(x)))+"\\times "+latex(simplifier(v(x)))+"dx="+
                latex(simplifier(int(u(x)*vp(x),x,a,b))) +" } ";
}:;
\end{VerbatimOut}




\begin{VerbatimOut}{XCASipp.giac}
maple_mode(0);
read("XCASipp.cxx");
Sortie:=fopen("XCASipp.tex");
donnees:=read("XCASipp.user");
Resultat:=cat("Ipp(",donnees);
Resultat:=cat(Resultat,");");
Resultat:=expr(Resultat);
fprint(Sortie,Unquoted,Resultat);
fclose(Sortie);
\end{VerbatimOut}




\newenvironment{ipp}
{\VerbatimEnvironment\begin{VerbatimOut}{XCASipp.user}}
{\end{VerbatimOut}
           \executGiacmp{XCASipp.giac}

\input{XCASipp}
}


%%%%%%%%%%%%%%%%%%%%%
%%%% fin du préambule
%%%%%%%%%%%%%%%%%%%%%



\begin{document}

%% on rentre dans l'ordre u, v', a, b

\begin{ipp}
x,exp(x),1,7
\end{ipp}


\vspace{1cm}

\begin{ipp}
x,exp(x),1,t
\end{ipp}


\vspace{1cm}



\begin{ipp}
ln(x),1,1,t
\end{ipp}

\begin{ipp}

\end{ipp}

\end{document}
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
