4
1

Plutôt que de voir mes illustrations numérotées de la première à la dernière (1, 2, 3 etc.) par l'environnement figure, j'aimerais qu'elles soient numérotées par sections (1.1, 1.2, 2.1, 2.2, 2.3, 3.1 etc.).

Comment obtenir cela ?

Posée 22 Sep '18, 22:17

Pathe's gravatar image

Pathe ♦♦
7.6k50210252
Taux d'acceptation : 55%

Modifiée 22 Sep '18, 22:22


Il suffit de redéfinir le format d'affichage du compteur des figures.

Première option — avec l'extension chngcntr :

Ouvrir dans l'éditeur Overleaf
\documentclass{article}
\usepackage{chngcntr}
\counterwithin{figure}{section}
\begin{document}
\section{titre}
\begin{figure}
\caption{titre}
\end{figure}
\begin{figure}
\caption{titre}
\end{figure}
\section{titre}
\begin{figure}
\caption{titre}
\end{figure}
\begin{figure}
\caption{titre}
\end{figure}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Seconde option — en redéfinissant la commande figure comme suit :

Ouvrir dans l'éditeur Overleaf
\renewcommand{\thefigure}{\thesection.\arabic{figure}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

mais il faut réinitialiser le compteur figure à chaque appel de \section, comme cela :

Ouvrir dans l'éditeur Overleaf
\makeatletter
\@addtoreset{figure}{section}
\makeatother
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Lien permanent

Publiée 23 Sep '18, 01:06

pluton's gravatar image

pluton
1.2k22937
Taux d'acceptation : 34%

Modifiée 24 Sep '18, 23:24

Pathe's gravatar image

Pathe ♦♦
7.6k50210252

1

Il me semble que la commande \counterwithin est maintenant incorporée aux dernières version du noyau latex, de sorte qu'on n'a plus besoin de l'extension  chngcntr.

(23 Sep '18, 02:40) Bernard Bernard's gravatar image
1

@Bernard Avec Texlive 2016, il faut charger l'extension. Ça a peut-être changé depuis.

(23 Sep '18, 03:50) pluton pluton's gravatar image

@Bernard : plus besoin du package chngctr, pourquoi pas ? Mais je ne suis guère plus avancé.

(24 Sep '18, 15:35) Pathe ♦♦ Pathe's gravatar image

@Pathe Comment ça "guère plus avancé" ?

(24 Sep '18, 17:27) pluton pluton's gravatar image

J'ai une TeX Live à jour : dois-je utiliser le package chngctr ?

(24 Sep '18, 21:35) Pathe ♦♦ Pathe's gravatar image
1

@Pathe décommenter la ligne \usepackage{chngcntr} et si ça ne marche pas alors ton TeX live n'est pas très à jour ;-)

(24 Sep '18, 22:19) touhami touhami's gravatar image

J'ai accepté la réponse (j'ai utilisé la seconde option, qui fonctionne parfaitement).

(24 Sep '18, 23:20) Pathe ♦♦ Pathe's gravatar image

@Pathe mais pourquoi ? c'est exactement ce qu'il fait la commande \counterwithin. Autrement dit \counterwithin{figure}{section} est maintenant la solution (officielle) LaTeX et pas besoin de \usepackage{chngcntr}.

(24 Sep '18, 23:52) touhami touhami's gravatar image

@touhami : euh… je ne comprends pas votre commentaire. J’ai utilisé la redéfinition de la commande « figure », soit la deuxième option que contient la réponse.

(25 Sep '18, 00:09) Pathe ♦♦ Pathe's gravatar image
1

@Pathe La solution est d'utiliser \counterwithin{figure}{section} sans \usepackage{chngcntr}.

(25 Sep '18, 00:21) touhami touhami's gravatar image
Affichage de 5 parmi 10 Afficher 5 commentaire(s) en plus
Votre réponse
[Masquer l'aperçu]

Suivre cette question

Par courriel :

Une fois que vous serez enregistré, vous pourrez souscrire à n'importe quelle mise à jour ici

Par flux RSS :

Réponses

Réponses et commentaires

Mots-clés de la question :

×34
×23
×3

Question posée : 22 Sep '18, 22:17

Question vue : 12,038 fois

Dernière mise à jour : 25 Sep '18, 00:21

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

×