Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
composition:texte:renvois:les_references_croisees_sont_fausses [2018/06/03 13:33] – d.p.carlisle | composition:texte:renvois:les_references_croisees_sont_fausses [2021/01/11 22:25] (Version actuelle) – Traduction de l'article anglais. yannick.tanguy | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | --- | + | ====== Pourquoi ma référence croisée n'est pas correcte? ====== |
- | title: LaTeX gets cross-references wrong | + | |
- | category: errors | + | |
- | permalink: / | + | |
- | --- | + | |
- | Sometimes, however many times you run LaTeX, | + | Parfois, malgré de multiples exécutions de < |
- | are just wrong. A likely reason is that you have placed the label | + | |
- | before the data for the label was set; if the label is recording a | + | < |
- | `\caption` command, the `\label` command must appear | + | |
- | _after_ the `\caption` command, or be part of it. For example: | + | |
- | ```latex | + | |
\begin{figure} | \begin{figure} | ||
- | | + | |
- | \caption{My figure} | + | \caption{Ma figure} |
- | \label{myfig} | + | \label{mafig} |
\end{figure} | \end{figure} | ||
- | ``` | + | </code> |
- | is correct, as is | + | |
- | <!-- {% raw %} --> | + | < |
- | ```latex | + | |
\begin{figure} | \begin{figure} | ||
- | | + | |
- | \caption{My figure% | + | \caption{Ma figure \label{mafig}} |
- | | + | |
\end{figure} | \end{figure} | ||
- | ``` | + | </code> |
- | <!-- {% endraw %} --> | + | |
- | whereas, in | + | Par contre, l' |
- | ```latex | + | |
+ | < | ||
\begin{figure} | \begin{figure} | ||
- | | + | |
- | \label{myfig} | + | \label{mafig} |
- | \caption{My figure} | + | \caption{Ma figure} |
\end{figure} | \end{figure} | ||
- | ``` | + | </ |
- | the label will report the number of the section (or whatever) in which | + | |
- | the surrounding text resides, or the like. | + | |
- | You can, with the same malign effect, shield the `\caption` command | + | Vous pouvez, avec les mêmes conséquences fâcheuses, protéger la commande '' |
- | from its associated `\label` command, by enclosing the caption in an | + | |
- | environment of its own. This effect will be seen with: | + | < |
- | ```latex | + | |
\begin{figure} | \begin{figure} | ||
- | | + | |
- | \caption{A Figure} | + | \caption{Ma figure} |
\end{figure} | \end{figure} | ||
- | \label{myfig} | + | \label{mafig} |
- | ``` | + | </ |
- | where the `\label` definitely _is_ after the `\caption`, | + | |
- | but because the `figure` environment closed before the | + | Ici, la commande '' |
- | `\label` command, the `\caption` is no longer "visible". | + | |
+ | En résumé, la commande '' | ||
+ | |||
+ | ----- | ||
- | In summary, the `\label` must be _after_ the command that | + | //Source:// [[faquk> |
- | defines it (e.g., `\caption`), | + | |
- | an environment, | + | |
+ | {{htmlmetatags> | ||
+ | metatag-og: | ||
+ | metatag-og: | ||
+ | }} | ||