\documentclass[12pt,a4paper]{article} \usepackage[latin1]{inputenc} \usepackage[frenchb]{babel} \usepackage{amsmath} \usepackage[margin=2.5cm]{geometry} \usepackage[garamond]{mathdesign} \renewcommand{\ttdefault}{lmtt} \usepackage{graphicx} \usepackage{xcolor} \usepackage{framed} \usepackage{listings} \parindent0pt \definecolor{gris}{gray}{0.95} \newenvironment{gbar}{% \def\FrameCommand{{\color[HTML]{DC143C}\vrule width 3pt}\colorbox{gris}}% \MakeFramed {\advance\hsize-\width \FrameRestore}}% {\endMakeFramed} \newcommand{\xcas}{{\bfseries\texttt{Xcas}}} \newcommand{\MarqueCommandeGiac}[1]{% \color[HTML]{8B7500}$\rightarrow$} \newcommand{\MarqueBlocGiac}[1]{% \color[HTML]{8B7500}} \newcommand{\MarqueLaTeXGiac}{% \color[HTML]{08868B}} \newcommand{\InscriptionFigureGiac}[1]{% \begin{center} \includegraphics[width=0.7\linewidth]{#1} \end{center}} \pagestyle{empty} \lstdefinelanguage{xcas} {morekeywords={size,mid,format,series,tan,sin,partfrac}, moredelim=[s][\color[HTML]{6F6F8F}]{(}{)}, sensitive=false, } \lstset{% numbers=none, % pas de numéro de ligne language=xcas, % pour avoir les mots-clé dans un format à part keywordstyle=\color[HTML]{706000}\ttfamily\bfseries, basicstyle=\color[HTML]{9B8550}\ttfamily, commentstyle=\normalfont\scriptsize\slshape, % style des commentaires breaklines=true % le plus important -> passe à la ligne ! } \begin{document} \section*{Commandes groupées} Pour inscrire du code giac sur plusieurs lignes il suffit d'insérer celles-ci entre \verb+.g:+ et \verb+.end+ en début de ligne. \begin{gbar} \begin{verbatim} .g: CaracSimiD(s) := { local a, solu; a := coeff(s,z,1); solu := csolve(s=z,z); return ("Le rapport est " + simplifier(abs(a)) + " L'angle a pour mesure principale " + simplifier(arg(a)) + if(size(solu) == 0){" Il n'y a pas d'invariant" } else {" Le point invariant a pour affixe " + solu[0] } ) }:; .end \end{verbatim} \end{gbar} Voici donc une macro de \textsc{Guillaume Connan} pour déterminer les caractéristiques d'une similitude directe. %@Commande-1 {\MarqueBlocGiac{1} \begin{verbatim} CaracSimiD(s) := { local a, solu; a := coeff(s,z,1); solu := csolve(s=z,z); return ("Le rapport est " + simplifier(abs(a)) + " L'angle a pour mesure principale " + simplifier(arg(a)) + if(size(solu) == 0){" Il n'y a pas d'invariant" } else {" Le point invariant a pour affixe " + solu[0] } ) }:; \end{verbatim} } Et un appel: %@Commande-2 {\MarqueCommandeGiac{2} \verb|CaracSimiD(-i*z+2+2*i)|} \begin{verbatim} Le rapport est 1 L'angle a pour mesure principale -1/2*pi Le point invariant a pour affixe 2\end{verbatim} La coloration du bloc (\texttt{verbatim} par défaut) est assurée par la commande \verb+\MarqueBlocGiac+ (\textit{cf.} source). Avec le paramètre \texttt{commande} positionné à \texttt{listing} le bloc sera déposé dans un environnement \texttt{lstlisting}. \end{document}