This may be an odd question, but I'm having trouble writing information on the main .aux file when I split my documents through more than one .tex.
Here is the deal: I'm trying to calculate the size of the widest TOC label so that I can align all chapter/section names in the TOC based on this measure. Someone has already told me how to do this measuring, but I need to write this info in the .aux file so that in the first pass I calculate the size and in the second pass I make use of it.
What is troubling me is that the command that I'm using is not working, and I believe the reason is the said modularization of the document, since when I try it in a single-file document it works ok.
Here is the part of the code that should write the info:
\AtEndDocument{
\protected@write\@auxout{}%
{\string\global\string\setlength{\string\widesttoclabel}{\the\widesttoclabel}}
}
With \widesttoclabel being the macro that holds the length I've calculated.
But when I check the .aux file, that entry is not anywhere around, neither in the "master document's" aux nor in the others'.
Am I missing something?
OBS: I know I could workaround and replace \includes with \inputs, but this would be terrible, since my document has very many pages... So this shouldn't be an option if I could choose.