Historique des modifications [retour]
cliquez ici pour masquer/afficher la révision 7

07 Oct '17, 21:51

touhami's gravatar image

touhami
10.0k410

Voici une solution. La liste des labels réutilisés se trouve dans un fichier `.labels` de la forme ********* multiple utilisation de label : `foo` ligne 72 de fichier texniqueAQ.tex ligne 11 de fichier fichier2 ligne 13 de fichier fichier2 ligne 17 de fichier fichier2 ligne 20 de fichier fichier2 ligne 7 de fichier fichier1.tex ligne 9 de fichier fichier1.tex ligne 13 de fichier fichier1.tex ligne 15 de fichier fichier1.tex ligne 77 de fichier texniqueAQ.tex ligne 79 de fichier texniqueAQ.tex ********* multiple utilisation de label : `foo1` ligne 81 de fichier texniqueAQ.tex La commande `\label` a été redéfinie pour détecter les labels *homonymes* et la commande `\InputIfFileExists` pour récupérer le nom de fichier courant. **Utilisation** Créer un fichier `multilabels.tex` \newcommand*{\mtlistlabels}{} \newwrite\mtlabels \immediate\openout\mtlabels=\jobname.labels \newcounter{mt} \expandafter\xdef\csname mtmput0\endcsname{\jobname} \makeatletter \long\def \InputIfFileExists#1#2{% \IfFileExists{#1}% {\stepcounter{mt}% \expandafter\xdef\csname mtmput\themt\endcsname{#1}% #2\@addtofilelist{#1}\@@input \@filef@und \addtocounter{mt}{-1}}} \def\label#1{% \@ifundefined{mtlabel#1}{% \expandafter\gdef\csname mtlabel#1\endcsname{*********^^J% multiple utilisation de label : `#1` ^^J}}{% \@ifundefined{mtmtlabel#1}{% \expandafter\gdef\csname mtmtlabel#1\endcsname{}% \g@addto@macro\mtlistlabels{\csname mtlabel#1\endcsname^^J}}{}% \expandafter\xdef\csname mtlabel#1\endcsname{\csname mtlabel#1\endcsname ligne \the\inputlineno\space de fichier \csname mtmput\themt\endcsname^^J}}} \makeatother \AtEndDocument{% \immediate\write\mtlabels{\mtlistlabels} \errmessage{Commande `\string\label' a été redéfinie, cette compilation n'est pas finale}} **Remarque** En cas d'un seule fichier, i.e. si on n'utilise pas des commande `\include` ou `\input` on peut simplifier le code, et le fichier `multilabels.tex` devient \newcommand*{\mtlistlabels}{} \newwrite\mtlabels \immediate\openout\mtlabels=\jobname.labels \makeatletter \def\label#1{% \@ifundefined{mtlabel#1}{% \expandafter\gdef\csname mtlabel#1\endcsname{*********^^J% multiple utilisation de label : `#1` ^^J}}{% \@ifundefined{mtmtlabel#1}{% \expandafter\gdef\csname mtmtlabel#1\endcsname{}% \g@addto@macro\mtlistlabels{\csname mtlabel#1\endcsname^^J}}{}% \expandafter\xdef\csname mtlabel#1\endcsname{\csname mtlabel#1\endcsname ligne \the\inputlineno^^J}}} \makeatother \AtEndDocument{% \immediate\write\mtlabels{\mtlistlabels} \errmessage{Commande `\string\label' a été redéfinie, cette compilation n'est pas finale}} Maintenant il suffit d'ajouter la ligne `\input{multilabels.tex}` **après** `\begin{document}`. **Remarque** pour la compilation finale supprimer ou décommenter la ligne `\input{multilabels.tex}`. **ECM** \documentclass{article} \begin{document} \input{multilabels.tex} \section{foo} \label{foo} \section{foo} \label{foo} \section{foo1} \label{foo1} \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} \label{foo1} \end{document} **EMC avec `input` et `include`** \documentclass{article} \begin{filecontents}{fichier1.tex} \input{fichier2} \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} \end{filecontents} \begin{filecontents}{fichier2.tex} bla bla bla bla bla bla \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} bla bla \section{foo2} \label{foo} bla bla \section{foo2} \label{foo} \section{foo1} \end{filecontents} \begin{document} \input{multilabels.tex} \section{foo} \label{foo} \section{foo} \label{foo} \section{foo1} \label{foo1} \include{fichier1} \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} \label{foo1} \end{document}
cliquez ici pour masquer/afficher la révision 6

07 Oct '17, 11:54

touhami's gravatar image

touhami
10.0k410

Voici une solution. La liste des labels réutilisés se trouve dans un fichier `.labels` de la forme ********* multiple utilisation de label : `foo` ligne 72 de fichier texniqueAQ.tex ligne 11 de fichier fichier2 ligne 13 de fichier fichier2 ligne 17 de fichier fichier2 ligne 20 de fichier fichier2 ligne 7 de fichier fichier1.tex ligne 9 de fichier fichier1.tex ligne 13 de fichier fichier1.tex ligne 15 de fichier fichier1.tex ligne 77 de fichier texniqueAQ.tex ligne 79 de fichier texniqueAQ.tex ********* multiple utilisation de label : `foo1` ligne 81 de fichier texniqueAQ.tex La commande `\label` a été redéfinie pour détecter les labels *homonymes* et la commande `\InputIfFileExists` pour récupérer le nom de fichier courant. **Utilisation** Créer un fichier `multilabels.tex` \newcommand*{\mtlistlabels}{} \newwrite\mtlabels \immediate\openout\mtlabels=\jobname.labels \newcounter{mt} \expandafter\xdef\csname mtmput0\endcsname{\jobname} \makeatletter \long\def \InputIfFileExists#1#2{% \IfFileExists{#1}% {\stepcounter{mt}% \expandafter\xdef\csname mtmput\themt\endcsname{#1}% #2\@addtofilelist{#1}\@@input \@filef@und \addtocounter{mt}{-1}}} \def\label#1{% \@ifundefined{mtlabel#1}{% \expandafter\gdef\csname mtlabel#1\endcsname{*********^^J% multiple utilisation de label : `#1` ^^J}}{% \@ifundefined{mtmtlabel#1}{% \expandafter\gdef\csname mtmtlabel#1\endcsname{}% \g@addto@macro\mtlistlabels{\csname mtlabel#1\endcsname^^J}}{}% \expandafter\xdef\csname mtlabel#1\endcsname{\csname mtlabel#1\endcsname ligne \the\inputlineno\space de fichier \csname mtmput\themt\endcsname^^J}}} \makeatother \AtEndDocument{% \immediate\write\mtlabels{\mtlistlabels} \errmessage{Commande `\string\label' a été redéfinie, cette compilation n'est pas finale}} **Remarque** En cas d'un seule fichier, i.e. si on n'utilise pas des commande `\include` ou `\input` on peut simplifier le code, et le fichier `multilabels.tex` devient \newcommand*{\mtlistlabels}{} \newwrite\mtlabels \immediate\openout\mtlabels=\jobname.labels \makeatletter \def\label#1{% \@ifundefined{mtlabel#1}{% \expandafter\gdef\csname mtlabel#1\endcsname{*********^^J% multiple utilisation de label : `#1` ^^J}}{% \@ifundefined{mtmtlabel#1}{% \expandafter\gdef\csname mtmtlabel#1\endcsname{}% \g@addto@macro\mtlistlabels{\csname mtlabel#1\endcsname^^J}}{}% \expandafter\xdef\csname mtlabel#1\endcsname{\csname mtlabel#1\endcsname ligne \the\inputlineno^^J}}} \makeatother \AtEndDocument{% \immediate\write\mtlabels{\mtlistlabels} \errmessage{Commande `\string\label' a été redéfinie, cette compilation n'est pas finale}} Maintenant il suffit d'ajouter la ligne `\input{multilabels.tex}` après **après** `\begin{document}`. **Remarque** pour la compilation finale supprimer ou décommenter la ligne `\input{multilabels.tex}`. **ECM** \documentclass{article} \begin{document} \section{foo} \label{foo} \section{foo} \label{foo} \section{foo1} \label{foo1} \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} \label{foo1} \end{document} **EMC avec `\input` `input` et `\include`** `include`** \documentclass{article} \begin{filecontents}{fichier1.tex} \input{fichier2} \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} \end{filecontents} \begin{filecontents}{fichier2.tex} bla bla bla bla bla bla \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} bla bla \section{foo2} \label{foo} bla bla \section{foo2} \label{foo} \section{foo1} \end{filecontents} \begin{document} \section{foo} \label{foo} \section{foo} \label{foo} \section{foo1} \label{foo1} \include{fichier1} \section{foo2} \label{foo} \section{foo2} \label{foo} \section{foo1} \label{foo1} \end{document}
cliquez ici pour masquer/afficher la révision 5

07 Oct '17, 11:53

touhami's gravatar image

touhami
10.0k410

cliquez ici pour masquer/afficher la révision 4

29 Sep '17, 19:47

touhami's gravatar image

touhami
10.0k410

cliquez ici pour masquer/afficher la révision 3

29 Sep '17, 16:15

touhami's gravatar image

touhami
10.0k410

cliquez ici pour masquer/afficher la révision 2

29 Sep '17, 13:58

touhami's gravatar image

touhami
10.0k410

cliquez ici pour masquer/afficher la révision 1

29 Sep '17, 13:53

touhami's gravatar image

touhami
10.0k410

C'est votre première visite ici ? Consultez la FAQ !

×