Thursday, May 31, 2007

Indexing my Thesis


Okay. For those who have missed it so far, i'm writing down my PhD thesis ... and it's built with Latex.

Updating and completing a 1 year-old Latex document with new parts coming from conference paper, autonomic thoughts, etc. is some challenge i haven't met so far, so i'm upgrading my toolset as well.


Au cas où vous auriez loupé un épisode, je suis en train de rédiger ma thèse. Et je fais ça en Latex. Un document commencé il y a plus d'un an que je dois compléter avec des articles de conférence, etc. Bref, un des plus gros challenges auxquels j'ai eu à faire face jusqu'ici.

Le défi d'aujoud'hui ? Garder le fil de ce dont j'ai parlé, et où j'en ai parlé tandis que je fusionne et réorganise tous les bazars. En gros, construire et utiliser un index pour mon document.

Today's challenge: how to keep track of what i'm talking about in the different part and see whether merging/reorganizing things would help. In a word, building and working with an index of terms in my manuscript.

http://www.dtr.isy.liu.se/latexindex.html is a first good reference. Just adding \usepackage{makeidx}, and \makeindex \printindex to the document structure, and voilà. (oh, well, almost. I also have to make sure i properly call the makeindex command between latex calls :P)

Un petit peu de googling, et j'ai trouvé comment me servir de \usepackage{makeidx} de \makeindex et \printindex (oh, ne pas oublier d'appeler makeindex sur la ligne de commande, au passage). Reste à remplacer ici et là les \emph{protected tags} par quelque-chose comme \index{tags!protected}\emph{protected tags} ... dans près de 70,000 mots répartis sur 37 fichiers source ... de quoi devenir dingue si on ne fait pas un peu attention.

Now, i'm starting to do mass-replacement of "\emph{protected tags}" with "\index{tags!protected}\emph{protected tags}" ... in those +70000 words split in 37 source files ... Time for something to automate grep/open-file/query-replace, no?

Well, another google search pointed me at Sam teachs yourself Xemacs in 24 hours where they had a very nice explanation on regexp-query-replace and how to use the etags tool to operate on many file at a time. Roughly, all i have to do is invoking "wasp/phd> etags *.tex" to produce a condensed TAGS file for the current directory and then invoke M-x tags-query-replace to replace all the instances of the text with index-augmented text (well, i'm prompted whether i want the replacement or not ;)


Heureusement, il y a Sam, pour m'aider à comprendre le fonctionnement de etags de manière à invoquer M-x regexp-query-replace et remplacer tous ces mots l'un après l'autre en un clin d'oeil.
Allez, les windoziens. Qui dit mieux ?

edit: plein d'autres trucs latex en FAQ sur cette page

No comments: