\ProvidesFile{chapterref.sty} \ProvidesPackage{chapterref} \RequirePackage{ifthen} % La commande \label écrit dans le fichier *.aux % - le nom du label % - le numéro correspondant (qui ne contient pas le chapitre) % - le numéro de la page % - le numéro du chapitre \def\label#1{\@bsphack \protected@write\@auxout{}% {\string\newlabel{#1}{{\@currentlabel}{\thepage}{\thechapter}}}% \@esphack} \def\ref#1{\expandafter\@setref\csname r@#1\endcsname\myref@firstofthree{#1}} \def\pageref#1{\expandafter\@setref\csname r@#1\endcsname \@secondofthree{#1}} % Les commandes \myref@firstofthree et \myref@secondofthree prennent % un argument, de la forme {{a}{b}{c}}. Dans le cas où c est égal au % numéro du chapitre courrant, elles renvoient a (respectivement b), % dans le cas contraire, elles renvoient c.a (respectivement c.b). \def\myref@firstofthree#1#2#3{% \ifthenelse{\equal{\thechapter}{#3}}{#1}{#3.#1}} \def\@secondofthree#1#2#3{#2} % % Pour cela, il faut bien évidemment que le numéro du chapitre % n'apparaisse pas dans le numéro des équations... % %\renewcommand \thepart {\@Roman\c@part} \renewcommand \thechapter {\my@Roman\c@chapter} %% J'ai un gros problème : la commande \@Roman utilise \uppercase et %% cette commande \uppercase apparait en toutes lettres dans le %% fichier *.aux et la commande \ifthen{\equal{...}{...}} ne %% s'apperçoit pas qu'il s'agit de la même chose... %% Je me sens donc contraint de définir un ersatz de cette commande... %% %% L'idéal serait donc une commande \expand lorsque l'on écrit dans le %% fichier *.aux \def\my@Roman#1{\ifcase #1 0\or I\or II\or III\or IV\or V\or VI\or VII\or VIII\or IX\or X\else\@latex@error{La commande \protect\my@Roman n'est qu'un immonde bidouillage, elle n'accepte pas les numéros supérieurs à 10}\fi} \renewcommand \thesection {\@arabic\c@section} \renewcommand \thesubsection {\thesection.\@arabic\c@subsection} \renewcommand \thesubsubsection{\thesubsection .\@arabic\c@subsubsection} \renewcommand \theparagraph {\thesubsubsection.\@arabic\c@paragraph} \renewcommand \thesubparagraph {\theparagraph.\@arabic\c@subparagraph} \renewcommand \theequation {\@arabic\c@equation} \renewcommand \thefigure {\@arabic\c@figure} \renewcommand \thetable {\@arabic\c@table} %%% %%% Incompatibilités avec French. %%% % Le fichier french.,sty est tellement agréable à lire et facile à % comprendre que je ne sais pas ce que les deux lignes suivantes % font. %\@gG{l}{label}{}{1} %\@gG{r}{ref}{/}{1} %\@gG{pr}{pageref}{/}{1} %\@gG{nl}{newlabel}{}{1}