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:detecter_qu_un_label_est_vide [2018/06/03 13:17] – d.p.carlisle | 3_composition:texte:renvois:detecter_qu_un_label_est_vide [2021/11/29 22:56] (Version actuelle) – Correction de la mise en forme. yannick.tanguy | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | --- | + | ====== Comment savoir si une étiquette n'est pas définie? ====== |
- | title: Finding if a label is undefined | + | |
- | category: programming | + | |
- | tags: | + | |
- | - latex | + | |
- | - macros | + | |
- | permalink: / | + | |
- | --- | + | |
- | People seem to want to know (at run time) if a label is undefined (I | + | Au moment de l'exécution de votre code < |
- | don't actually understand _why_, particularly: | + | |
- | state, and LaTeX deals with it quite well). | + | |
- | A resolved label is simply a command: | + | ===== Avec les commandes de base ===== |
- | `\r@< | + | |
- | then simply a matter of detecting if the command exists. | + | |
- | LaTeX internal way of doing this is to use the command | + | |
- | `\@ifundefined`: | + | |
- | `\@ifundefined{r@label-name}{undef-cmds}{def-cmds}` | + | |
- | In which, & | + | |
- | a `\label` command, and the remaining two arguments are command | + | |
- | sequences to be used if the label is undefined | + | |
- | (& | + | |
- | (& | + | |
- | Note that any command that incorporates `\@ifundefined` is naturally | + | Une étiquette définie est simplement une commande : '' |
- | fragile, so remember to create it with `\DeclareRobustCommand` or to | + | * '' |
- | use it with `\protect` in a moving argument. | + | * et les deux autres arguments sont les commandes qui seront exécutées si l' |
- | If you're into this game, you may well not care about LaTeX's | + | Notez que toute commande qui intègre |
- | warning about undefined labels at the end of the document; however, | + | |
- | if you are, include the command `\G@refundefinedtrue` in | + | |
- | & | + | |
- | And of course, remember you're dealing in internal commands, and pay | + | Si vous suivez cette piste, vous ne soucierez peut-être pas de l'avertissement de < |
- | attention to the [at-signs](FAQ-atsigns). | + | |
- | All the above can be avoided by using the [`labelcas`](https:// | + | Enfin, bien sûr, rappelez-vous que vous avez affaire à des commandes internes. En cas de doute, consultez la question : « [[2_programmation: |
- | it provides commands that enable you to switch according to the state | + | |
- | of a single label, or the states of a list of labels. The package' | + | |
- | definition is a bit complicated, but the package itself is pretty | + | |
- | powerful. | + | |
+ | ===== Avec l' | ||
+ | Tout ce qui précède peut être évité en utilisant l' | ||
+ | |||
+ | ----- | ||
+ | |||
+ | //Source:// [[faquk> | ||
+ | |||
+ | {{htmlmetatags> | ||
+ | metatag-og: | ||
+ | metatag-og: | ||
+ | }} |