Separate table (or figure) numbering for appendices—Take II

This post will only make sense after you have read the first part. If you haven’t read it yet, go and read it first, and then follow the link at its end to return here.

If you’ve used my uTIlities, then you know that I do a little programming on the side. As such, although I am by no means an expert, or even a professional, programmer, I do have sympathy for the challenges that programmers face, like, for example, the team at Microsoft responsible for Word or Excel (despite my occasional griping about things I don’t like). One of the biggest challenges I find in programming is that I cannot anticipate all the contexts and ways in which some tools might be used. For example, how will the Fit Hyperlink tool work when the hyperlink is in a table? At first, I didn’t program for that eventuality, and, of course, the first time I tried it in that context, it didn’t work.

Of course, that doesn’t necessarily only happen when we do programming. About a year ago, I wrote a piece about how to get caption numbering set up in appendices. Of course, it worked, and the post has been reasonably popular, and, I am glad, seems to have been helpful to quite a few people. And then someone contacts me and lets me know that my solution is not working. Why not? They have tables and figures in their appendices, and I only set it up for tables. My solution would work for tables, or figures, or any other caption, but only when only one of those is present in the appendix. When tables and figures appear in the appendices, then the List of Tables and List of Figures (actually, in terms of Word, the TOC for tables and TOC for figures) contains all the tables as well as all the figures.

So how to fix this?

Well, the approach I suggested previously for the numbering is sound (the problem is with the TOCs), so for the tables, use SEQ fields with the customised identifier AppendixTable and use the customised identifier AppendixFigure for the figures. But for the List of Tables (and the List of Figures), we now need to split up the process. First, add this field: { TOC \H \C “Table” }. Then, right next to it, this one: { TOC \H \C “AppendixTable” }. What we are doing, is essentially creating two TOCs for the List of Tables: The first one finds all the tables in the main document (i.e., our chapters), then the second one finds all the tables (marked with the SEQ identifier AppendixTable) in the Appendices.

There is one trade-off. When the fields are built, an extra paragraph is inserted. It doesn’t actually look that bad, though, and the break between the main tables and the appendix tables seems natural.

There are some alternatives to this, if you really don’t want the break. Firstly, you could manually mark all the tables (and figures) with TC fields (I explain how to do this in my book). This will allow you to build a single TOC for the tables and a single TOC for the figures. But this is a lot of manual work, and I want an approach that is relatively automatic.

If you want to see this in action, this sample document shows the effect.

Share

Comments