Custom figure numbering
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Custom figure numbering
I am working in a Word 2007 document that has no section breaks. The document has one appendix, Appendix A. In the body of the document, Figure and Table captions look like this: "Figure 1. FigureTitle" or "Table 1. TableTitle". The author requests that Figure and Table captions in Appendix A look like this: "Figure A.1. FigureTitle" or "Table A.1 TableTitle".
I inserted a section break ahead of the Appendix, which starts with a Heading 1 (Appendix A. AppendixTitle). After the section break, I inserted "A. " Then, below a figure, References > Insert Caption > Numbering > Format: 1,2,3; Include chapter number; Chapter starts with style Heading 1; Use separator . (period) > OK.
Word then tells me that "There is no chapter number to include in the caption or page number. To apply chapter numbers use the Multilevel List button on the Home tab and select a numbering scheme that is linked to the Heading styles."
From there, I need help. Things I try apply to all Heading 1s throughout the document; not what is desired.
I inserted a section break ahead of the Appendix, which starts with a Heading 1 (Appendix A. AppendixTitle). After the section break, I inserted "A. " Then, below a figure, References > Insert Caption > Numbering > Format: 1,2,3; Include chapter number; Chapter starts with style Heading 1; Use separator . (period) > OK.
Word then tells me that "There is no chapter number to include in the caption or page number. To apply chapter numbers use the Multilevel List button on the Home tab and select a numbering scheme that is linked to the Heading styles."
From there, I need help. Things I try apply to all Heading 1s throughout the document; not what is desired.
Sundog
-
- Administrator
- Posts: 12617
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Custom figure numbering
You can't have a different heading 1 style in one section of the document.
Would you be able to use Figure 1.1, 1.2 etc. in the main document and Figure A.1, A.2 etc. in the appendix?
Would you be able to use Figure 1.1, 1.2 etc. in the main document and Figure A.1, A.2 etc. in the appendix?
StuartR
-
- Panoramic Lounger
- Posts: 8182
- Joined: 25 Jan 2010, 09:09
- Location: retirement
Re: Custom figure numbering
Can't you just create a new label for the Appendix table & figure captions? I'm at home at the moment and only have Word 97 to hand:
Insert | Caption and click on the New label button
You could then create a new caption style that looks[/i ]like Heading 1 and use that to format the Appendix tables & figures
I have Word 2007 at work and can investigate more tomorrow morning.
Ken
Insert | Caption and click on the New label button
You could then create a new caption style that looks[/i ]like Heading 1 and use that to format the Appendix tables & figures
I have Word 2007 at work and can investigate more tomorrow morning.
Ken
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Custom figure numbering
Ken, that works, but it results in "Figure A. 1" with a space after the "A." Same results if I use "A-" (A hyphen). But Insert Table of Figures won't allow two different figure Labels, so this approach won't work.
Sundog
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Custom figure numbering
Stuart, I inserted a Section Break before the Appendix. How can I use a Heading 1 in the main body and a different Heading 1 in the Appendix, after the section break? The Author requests not to use Figure 1.1 etc. if it can be avoided.
Sundog
-
- Administrator
- Posts: 12617
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Custom figure numbering
It's not entirely satisfactory, but see if Shauna Kelly's article about appendix numbering helps.
Alternatively you could create your figure captions manually, using a SEQ field. For example.
Figure {SEQ fignum}. Title of a figure in the body of the document
Figure {SEQ fignum}. Title of another figure in the body of the document
Figure A.{appfignum} Title of a figure in the appendix
Figure A.{appfignum} Title of another figure in the appendix
the trouble with this method is that you can't create a table of contents very easily, and adding references would require you to create suitable bookmarks.
Alternatively you could create your figure captions manually, using a SEQ field. For example.
Figure {SEQ fignum}. Title of a figure in the body of the document
Figure {SEQ fignum}. Title of another figure in the body of the document
Figure A.{appfignum} Title of a figure in the appendix
Figure A.{appfignum} Title of another figure in the appendix
the trouble with this method is that you can't create a table of contents very easily, and adding references would require you to create suitable bookmarks.
StuartR
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Custom figure numbering
Didn't you mean Figure A.{SEQ appfignum} instead of Figure A.{appfignum} ?
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
-
- Administrator
- Posts: 12617
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Custom figure numbering
Yes, of course, thanks for the correction.HansV wrote:Didn't you mean Figure A.{SEQ appfignum} instead of Figure A.{appfignum} ?
StuartR
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Custom figure numbering
Stuart, thanks for the Shauna link; interesting, but as you said, not entirely satisfactory.
About all I've found that sort of works is to insert the Appendix figure captions normally, then in the Appendix, search for "Figure " (Figure followed by a space) and replace with "Figure A-" (Figure followed by a space followed by A followed by a hyphen). Then update the Table of Figures. Appendix Figure 18 becomes Figure A-18.
Now if I could only get the numbers in the figure captions to start from 1 in the Appendix, I'd be set.
About all I've found that sort of works is to insert the Appendix figure captions normally, then in the Appendix, search for "Figure " (Figure followed by a space) and replace with "Figure A-" (Figure followed by a space followed by A followed by a hyphen). Then update the Table of Figures. Appendix Figure 18 becomes Figure A-18.
Now if I could only get the numbers in the figure captions to start from 1 in the Appendix, I'd be set.
Sundog
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Custom figure numbering
Right-click the first caption number in the appendix.Sundog wrote:Now if I could only get the numbers in the figure captions to start from 1 in the Appendix, I'd be set.
Select Toggle Field Codes from the popup menu.
You should see something like
{ SEQ Figure \* ARABIC }
Add the switch \s 1 before the closing field brace, so that it looks like
{ SEQ Figure \* ARABIC \s 1 }
Press F9 to hide the field code and to update the field result. The \s switch forces the sequence to restart at the value specified after \s, in this example at 1.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Custom figure numbering
Excellent clue, Hans. In my Word 2007, \r 1 also works. Then it is necessary to select all and update the fields. That solves the problem completely.
However, if I Ctrl+A in my document to select everything, which has a lot of charts, and hit F9, I get the following error message, and after wearing out my left-clicker, it forces me to nuke Word to get out of it:
However, if I Ctrl+A in my document to select everything, which has a lot of charts, and hit F9, I get the following error message, and after wearing out my left-clicker, it forces me to nuke Word to get out of it:
You do not have the required permissions to view the files attached to this post.
Sundog
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Custom figure numbering
One option would be to select Edit | Links... as the error message suggests, and to break the links to source files that cannot be found. You should be able to update all fields after that.
Another option is to run the following macro; it will update only the SEQ fields and leave all other fields alone:
Another option is to run the following macro; it will update only the SEQ fields and leave all other fields alone:
Code: Select all
Sub UpdateSEQFields()
Dim fld As Field
For Each fld In ActiveDocument.Fields
If fld.Type = wdFieldSequence Then
fld.Update
End If
Next fld
End Sub
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Custom figure numbering
A workaround that only gives me the Chart link error once: Open the Styles pane, click in an Appendix caption, right-click on the style, and choose Select All nnn Instance(s). THEN hit F9.
I like your macro idea, since the document charts may be linked to who knows how many files.
I like your macro idea, since the document charts may be linked to who knows how many files.
Sundog
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Custom figure numbering
Macro works great.
To help automate this process, I'm thinking I need a macro that would do the Figure > Figure A. search and replace starting from the Appendix. Since the word "Figure" also appears in the running text, the macro would have to start at the cursor and run to the end of the document, acting only on the word "Figure " that has a certain Style.
So, something along these lines?
This needs help, as I am unsure of all the proper VBA to use.
To help automate this process, I'm thinking I need a macro that would do the Figure > Figure A. search and replace starting from the Appendix. Since the word "Figure" also appears in the running text, the macro would have to start at the cursor and run to the end of the document, acting only on the word "Figure " that has a certain Style.
So, something along these lines?
Code: Select all
' Changes Figure to Figure A., from cursor to end of document.
Sub AddAtoFigureCaptions()
Dim capt As Style
For Each capt In ActiveDocument.Styles
' If capt.ParagraphFormat = something Then
' Replace "Figure " With "Figure A."
End If
Next capt
' Stop when you reach end of document.
End Sub
Sundog
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Custom figure numbering
Try this version. It uses the Find object to replace all instances of "Figure " formatted with the Caption style with "Figure A." from the current insertion point to the end of the document in one go.
Code: Select all
Sub AddAtoFigureCaptions()
With Selection.Find
.Text = "Figure "
.ClearFormatting
.Style = ActiveDocument.Styles(wdStyleCaption)
With .Replacement
.Text = "Figure A."
.ClearFormatting
End With
.MatchCase = False
.MatchWildcards = False
.Forward = True
.Wrap = wdFindStop
.Execute Replace:=wdReplaceAll
End With
End Sub
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Custom figure numbering
Thanks again, Hans. I will try your code today.
Is it thethat gets to the end of the document and quits?
Is it the
Code: Select all
.Wrap = wdFindStop
Sundog
-
- Administrator
- Posts: 78549
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Custom figure numbering
Yes, it is. The other options are wdFindContinue (continue searching at the top of the document) and wdFindAsk (display a message box).
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)