It's possible to do this by reading the toc file another time for the sole purpose of getting the widths of the section numbers in each chapter.
Yeah. Why I never did it. Thanks for tackling it. I think the output does not necessarily look ideal. Not ideal, but a vast improvement. Thanks. to narrow this space, leading the spacing after 2.10 and following would be narrower (say 0.5 em rather than 1 em). So if there are 10+ sections, there would be 1.5em (instead of 2em) between 2.1-2.9 and the text, and 1em between 2.10 and the text? Yes, that could well look better. Have to see it to really know. Another option might be to use (say) .75em as the constant additional space, so there would be 1.5em for 2.1 and .75 for 2.10. I feel strongly that the text of the section titles should align. I don't have strong feelings about the space between the section numbers and titles. Indeed, I've always thought it was rather too much, e.g., the 1.1..1.6 cases in your example look to me like they could be tightened (a little, not a lot). Thanks again, Karl