12.07.2015 Views

TEX pour l'Impatient - Apprendre en ligne.net

TEX pour l'Impatient - Apprendre en ligne.net

TEX pour l'Impatient - Apprendre en ligne.net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

24 Sep 2004 2:48 p.m.<strong>TEX</strong> <strong>pour</strong> l’Impati<strong>en</strong>t N o 333Table des matières 311Table des matièresLa macro \writetoc<strong>en</strong>try écrit une macro dans le fichier \jobname.toc.Le premier argum<strong>en</strong>t de \writetoc<strong>en</strong>try, par exemple, “chapitre”, estutilisé <strong>pour</strong> composer le nom de la macro appelée. Le deuxièmeargum<strong>en</strong>t est le texte qui doit apparaître dans la table des matières.\writetoc<strong>en</strong>try appose le numéro de la page à l’appel de la macro.Par exemple :\writetoc<strong>en</strong>try{chapter}{Introduction}produira la <strong>ligne</strong> :\tocchapter<strong>en</strong>try{Introduction}{2}dans le fichier .toc, ce qui indique que ‘Introduction’ débute <strong>en</strong> page 2.Vous pouvez utiliser \writ<strong>en</strong>umberedtoc<strong>en</strong>try <strong>pour</strong> apporter untroisième paramètre, tel qu’un numéro de chapitre. Par exemple :\writ<strong>en</strong>umberedtoc<strong>en</strong>try{chapter}{The second chapter}{2}écrira une <strong>ligne</strong> :\tocchapter<strong>en</strong>try{The second chapter}{2}{14}Vous pouvez aussi faire un \write vers le \tocfile vous-même.\newwrite\tocfile \newif\iftocfileop<strong>en</strong>ed\def\op<strong>en</strong>tocfile{\iftocfileop<strong>en</strong>ed\else\tocfileop<strong>en</strong>edtrue\immediate\op<strong>en</strong>out\tocfile = \jobname.toc\fi}%\def\writ<strong>en</strong>umberedtoc<strong>en</strong>try#1#2#3{\ifrewritetocfile\op<strong>en</strong>tocfile\write\tocfile{%\expandafter\noexpand \csname toc#1<strong>en</strong>try\<strong>en</strong>dcsname{#2}{#3}{\folio}}%\ignorespaces\fi}%\def\writ<strong>en</strong>umberedtoc<strong>en</strong>try#1#2#3{\ifrewritetocfile\op<strong>en</strong>tocfile\write\tocfile{%\expandafter\noexpand \csname toc#1<strong>en</strong>try\<strong>en</strong>dcsname{#2}{#3}{\folio}}%\ignorespaces\fi}%Pour produire une table des matières, lisez le fichier .toc avec\readtocfile. Vous devez appeler \readtocfile avant le premier\writetoc<strong>en</strong>try. Quand vous traitez la table des matières sansla régénérer, vous ne devriez pas récrire le fichier .toc—si vous le

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!