\documentclass[11pt,a4paper]{article} \usepackage{amsfonts,amsmath,amssymb,amsthm} \usepackage[utf8]{inputenc} \usepackage{fontenc} \usepackage[french]{babel} \usepackage{mathptmx} \usepackage{fancybox} \usepackage{graphicx} \usepackage{ifthen} \usepackage{tikz} \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, urlcolor=blue, pdftitle={Exo7 - Exercices de mathématiques}, pdfauthor={Exo7} } \usepackage{geometry} \geometry{top=2cm, bottom=2cm, left=2cm, right=2cm} % Modified to extract number of stars and title \newcommand{\exercice}[1]{% \def\exoargs{#1}% \expandafter\parseexoargs\exoargs,,,,,\@nil% } \def\parseexoargs#1,#2,#3,#4,#5,#6\@nil{% \def\exoref{#1}% \def\exoauthor{#2}% \def\exodate{#3}% \def\exostars{#4}% \def\exotitle{#5}% } \newcommand{\finexercice}{} \newcommand{\noindication}{} \newcommand{\nocorrection}{} \newcounter{exo} \newcommand{\currentexonum}{} % mémoire temporaire % Modified to include variable number of stars and optional title \newcommand{\enonce}[2]{% \refstepcounter{exo}% \edef\currentexonum{\theexo}% \hypertarget{exo7:\exoref}{}\label{exo7:\exoref}% {\bf Exercice \arabic{exo}}~\printStars{\exostars}\ \ \ifthenelse{\equal{\exotitle}{}}{#2}{\textbf{\exotitle} -- #2}\vspace{1mm}\hrule\vspace{1mm}% } % Command to print stars using TikZ foreach \newcommand{\printStars}[1]{% \foreach \i in {1,...,#1} {% \includegraphics[height=1em]{Icone_etoile.png}% }% } \newcommand{\finenonce}[1]{% \ifthenelse{\equal{\ref{ind7:#1}}{\ref{bidon}}\and\equal{\ref{cor7:#1}}{\ref{bidon}}}{}{\par{\footnotesize \ifthenelse{\equal{\ref{ind7:#1}}{\ref{bidon}}}{}{\hyperlink{ind7:#1}{\texttt{Indication} $\blacktriangledown$}\qquad} \ifthenelse{\equal{\ref{cor7:#1}}{\ref{bidon}}}{}{\hyperlink{cor7:#1}{\texttt{Correction} $\blacktriangledown$}}}}% \hfill{\scriptsize\texttt{[#1]}}\vspace{1mm}\hrule\vspace*{7mm}% } \newcommand{\indication}[1]{\hypertarget{ind7:#1}{}\label{ind7:#1}{\bf Indication pour \hyperlink{exo7:#1}{l'exercice \currentexonum $\blacktriangle$}}\vspace{1mm}\hrule\vspace{1mm}} \newcommand{\finindication}{\vspace{1mm}\hrule\vspace*{7mm}} \newcommand{\correction}[1]{\hypertarget{cor7:#1}{}\label{cor7:#1}{\bf Correction de \hyperlink{exo7:#1}{l'exercice \currentexonum $\blacktriangle$}}\vspace{1mm}\hrule\vspace{1mm}} \newcommand{\fincorrection}{\vspace{1mm}\hrule\vspace*{7mm}} \newcommand{\finenonces}{\newpage} \newcommand{\finindications}{\newpage} \newcommand{\fiche}[1]{} \newcommand{\finfiche}{} \newcommand{\addcommand}[1]{} % End of preamble \usepackage{graphics} \usepackage[all]{xy} \begin{document} \exercice{000001, bodin, 1998/09/01, 3, Titre de l'exercice} \enonce{000001}{} Enoncé de l'exercice.. \finenonce{000001} \finexercice \newpage \indication{000001} Indication de l'exercice.. \finindication \newpage \correction{000001} Correction de l'exercice.. \fincorrection \end{document}