Geekiness

Apr 15, 2008 00:42

My thesis contains many examples (c. 300) each of which is numbered and has a unique label. I also have a database containing all my examples (c. 1000) and those which have been included in my thesis (and a few that were included but have since been commented out!) have the label given them in the thesis in as a field.


When one compiles tex it produces aux files which inter alia include entries which tell tex (and anyone else who reads the file) what example number (etc) is associated with a label and on what page it occurs. Therefore it occurred to me that it ought to be possible to extract this example somehow as csv and import this into a table in Access and then relate this table to my examples so that it would be easier to cross-reference examples from the thesis to the database (because you could look up example 175 and find it!). Whilst it would be possible to do this manually it would be major faff and I was aware that it would be possible to automate this. I asked caliston about this and he told me to use perl and offered to lend me his book on perl. We then produced to fail to make me and this book be in the same place for a couple of months. I remembered to borrow it this time so I spent part of the long and crowded train journey yesterday reading the first chapter and bit. Tonight we managed to install cygwin and perl on my machine (with him doing computer help over the phone!). I've just produced a script that produces a list of the examples out of thesis.aux:
\newlabel{ex:WediChad 2}{{4}{27}}
\newlabel{ex:WediDe mensuris et ponderibus}{{5}{28}}
\newlabel{ex:WediJuvNawJuvencus Nine4}{{6}{28}}
\newlabel{ex:PostComputus8}{{7}{31}}
\newlabel{ex:PostComputus9}{{8}{32}}
\newlabel{ex:PostComputus15}{{9}{32}}
\newlabel{ex:PostAngers 47772 a 11}{{10}{35}}
\newlabel{ex:PostAngers 47779 b}{{12}{35}}
\newlabel{ex:PostAngers 47778 a 4--5}{{11}{35}}

I'm chuffed.

It's only a start, but it wasn't hard at all. Now I just need faff it a bit more so that I produce

ex:WediChad 2, 4, 27

etc and preferably make it cope with the fact that using \include (which I have done for my individual chapters) causes latex to produce a separate aux file called chapter.aux. Preferably by noticing the command \@input{chapter.aux} in thesis.aux and going off and treating that in the same way. But I'm less sure how to do that, but then again yesterday when I was thinking about what I needed to do, I'd forgotten about that complication.

But now I should go to bed!

perl, thesis, geeky

Previous post Next post
Up