Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2018, 12:06 AM
antros48 antros48 is offline Figures and equations numbering Windows 10 Figures and equations numbering Office 2016
Novice
Figures and equations numbering
 
Join Date: Jul 2018
Posts: 6
antros48 is on a distinguished road
Default Figures and equations numbering


Hi all, I am writing my dissertation and i have an issue with numbering on figures and equations. I want them to include the chapter number which means that for sub-chapter 1.2.1 figure 2 will be shown as Figure 1.2.1-2 and so as the equation which was created using the Seq Eq method.
However under References when i select insert caption under numbering on the point where Chapter Starts with Style, if i select Heading 1 the result will be Figure 1-5 and when i select another level, like Heading 4 the result will be again invalid such as 1.2.1.1-1.

Is there anyway i can troubleshoot and fix this situation?

Thank you
Reply With Quote
  #2  
Old 07-29-2018, 02:04 PM
Stefan Blom's Avatar
Stefan Blom Stefan Blom is offline Figures and equations numbering Windows 10 Figures and equations numbering Office 2016
Moderator
 
Join Date: Aug 2011
Posts: 3,906
Stefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to all
Default

It seems to me that you want Word to include the "current" heading number with a caption? In other words, if a Figure follows a Heading 2 whose numbering is "1.2" you want the caption to be "Figure 1.2-1" and if the figure follows a Heading 1 whose number is 4 you expect the number to be "Figure 4-1"? Unfortunately, Word isn't that clever...

You have to pick a specific level to include with the chosen caption label.
__________________
Stefan Blom
Microsoft Word MVP

Microsoft 365 apps for business
Windows 11 Professional
Reply With Quote
  #3  
Old 07-30-2018, 07:53 AM
antros48 antros48 is offline Figures and equations numbering Windows 10 Figures and equations numbering Office 2016
Novice
Figures and equations numbering
 
Join Date: Jul 2018
Posts: 6
antros48 is on a distinguished road
Default

Quote:
Originally Posted by Stefan Blom View Post
It seems to me that you want Word to include the "current" heading number with a caption? In other words, if a Figure follows a Heading 2 whose numbering is "1.2" you want the caption to be "Figure 1.2-1" and if the figure follows a Heading 1 whose number is 4 you expect the number to be "Figure 4-1"? Unfortunately, Word isn't that clever...

You have to pick a specific level to include with the chosen caption label.
Thank you for the reply. However, when i select a level for chapter 1 to be on Heading 1, and i move on to the sub section of chapter 1 with Heading 2, if i change it to level 2 then all of figures change to level 2. How can i keep it different for every section?
Reply With Quote
  #4  
Old 07-30-2018, 09:29 AM
slaycock slaycock is offline Figures and equations numbering Windows 7 64bit Figures and equations numbering Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

For captions, each label is linked to a single heading style, and the chapter numbering for the caption is obtained from the linked heading style.

If you want your captions to follow a legal heading numbering system then you will have to create a set of caption labels that link a set of caption labels to the relevant heading styles.

E.g.heading

Figure links to Heading 1
Figure2 links to Heading 2
Figure3 Links to Heading 3
Figure4 links to Heading 4

and likewise for equations

equation links to Heading 1
equation2 links to Heading 2
equation3 links to Heading 3
equation4 links to Heading 4

You then need to apply the caption label that reflects the preceding heading style.

Alternatively write a couple of macros that look backwards from the caption insertion point and inserts the relevant equation or figure caption based on the first heading style that is found.

You'll probably also want a macro that can scan through existing text and revise captions based on the preceding heading, just in case after editing the heading level has changed.

You create new labels using

References.Insert Caption.New Label

You link to the appropriate heading level by selecting (from the 'Insert Caption' dialog box)

Numbering
Tick the include numbering box
Use the pull down menu to select the heading style that will provide the chapter numbering for your figure/equation caption label.
Reply With Quote
  #5  
Old 07-30-2018, 10:17 AM
antros48 antros48 is offline Figures and equations numbering Windows 10 Figures and equations numbering Office 2016
Novice
Figures and equations numbering
 
Join Date: Jul 2018
Posts: 6
antros48 is on a distinguished road
Default

Quote:
Originally Posted by slaycock View Post
For captions, each label is linked to a single heading style, and the chapter numbering for the caption is obtained from the linked heading style.

If you want your captions to follow a legal heading numbering system then you will have to create a set of caption labels that link a set of caption labels to the relevant heading styles.

E.g.heading

Figure links to Heading 1
Figure2 links to Heading 2
Figure3 Links to Heading 3
Figure4 links to Heading 4

and likewise for equations

equation links to Heading 1
equation2 links to Heading 2
equation3 links to Heading 3
equation4 links to Heading 4

You then need to apply the caption label that reflects the preceding heading style.

Alternatively write a couple of macros that look backwards from the caption insertion point and inserts the relevant equation or figure caption based on the first heading style that is found.

You'll probably also want a macro that can scan through existing text and revise captions based on the preceding heading, just in case after editing the heading level has changed.

You create new labels using

References.Insert Caption.New Label

You link to the appropriate heading level by selecting (from the 'Insert Caption' dialog box)

Numbering
Tick the include numbering box
Use the pull down menu to select the heading style that will provide the chapter numbering for your figure/equation caption label.
Thank u for the reply. It seems a lot of "manual" work for something that looks simple if you consider that i now have to go through 200 pages of dissertation to fix all figures and equations..
Anyway thanks again.
Reply With Quote
  #6  
Old 07-30-2018, 10:55 AM
slaycock slaycock is offline Figures and equations numbering Windows 7 64bit Figures and equations numbering Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

Quote:
It seems a lot of "manual" work for something that looks simple if you consider that i now have to go through 200 pages of dissertation to fix all figures and equations.
You can do it the hard way or follow my advice.

Quote:
You'll probably also want a macro that can scan through existing text and revise captions based on the preceding heading, just in case after editing the heading level has changed.
Reply With Quote
  #7  
Old 07-30-2018, 01:51 PM
slaycock slaycock is offline Figures and equations numbering Windows 7 64bit Figures and equations numbering Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

As usual word can deliver most of what we want but not all.

The advice I provided above works BUT is not satisfactory as it is not possible to separate the label text from what appears in the caption.

E.g. if you define a caption with Label 'Figure2' then what appears in the caption is 'Figure2' so you will get

Figure2 1: Caption text blah blah blah

So as I appear to have misled you please find below a macro that will go through your dissertationand insert the correct styleref in any Table/Figure/Equation caption. Word then correctly reproduces the additional numbering in cross references and TOC.

Code:
Sub update_captions()

Dim my_field                                    As Word.Field

    
    For Each my_field In ActiveDocument.Fields
        If my_field.Type = wdFieldSequence Then
            insert_previous_heading_number my_field
        End If
    Next
    
End Sub

Sub insert_previous_heading_number(this_field As Word.Field)

Const styleref_text                             As String = "Styleref ""XX""  \r "
Dim styleref_range                              As Word.range

    Set styleref_range = this_field.result
    
    With this_field.Code
        If InStr(.Text, "Table") = 0 And InStr(.Text, "Figure") = 0 And InStr(.Text, "Equation") = 0 Then
            Exit Sub ' DO nothing
            
        End If
        
    End With
    
    If this_field.result.Previous(unit:=wdCharacter).Text = "-" Then
        styleref_range.MoveStart Count:=-2
        styleref_range.Fields(1).Delete
        styleref_range.Collapse Direction:=wdCollapseStart
    Else
        styleref_range.Move Count:=-1
        styleref_range.InsertBefore Text:="-"
        styleref_range.Collapse Direction:=wdCollapseStart
    End If
    
    styleref_range.Fields.Add _
            range:=styleref_range, _
            Type:=wdFieldEmpty, _
            Text:=replace(styleref_text, "XX", CStr(get_previous_heading_level(this_field.result))), _
            PreserveFormatting:=False

End Sub

Function get_previous_heading_level(ByVal this_range As Word.range) As Long

    Do While this_range.ParagraphFormat.OutlineLevel = wdOutlineLevelBodyText
        Set this_range = this_range.Previous(unit:=wdParagraph)
    Loop
    
    get_previous_heading_level = this_range.ParagraphFormat.OutlineLevel
End Function
After running the macro please be sure to select the whole document and update all to make sure that all cross references and TOC's are updated correctly.

And of course, please test the macro on a COPY of your dissertation.
Reply With Quote
  #8  
Old 07-30-2018, 02:37 PM
Stefan Blom's Avatar
Stefan Blom Stefan Blom is offline Figures and equations numbering Windows 10 Figures and equations numbering Office 2016
Moderator
 
Join Date: Aug 2011
Posts: 3,906
Stefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to all
Default

Quote:
Originally Posted by antros48 View Post
Thank you for the reply. However, when i select a level for chapter 1 to be on Heading 1, and i move on to the sub section of chapter 1 with Heading 2, if i change it to level 2 then all of figures change to level 2. How can i keep it different for every section?

As I wrote, you can't do that via the Caption dialog box. The heading level you choose applies to the whole document (for the selected caption).


Any attempt to do what you are asking would require some sort of workaround.
__________________
Stefan Blom
Microsoft Word MVP

Microsoft 365 apps for business
Windows 11 Professional
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
List of figures with several labels (caption) - Table of Figures sorting ibra_ca Word 2 10-11-2017 07:02 AM
Figures and equations numbering Automated numbering for Figures in Word 2010? JJH Word 4 04-14-2016 08:39 AM
Automatic table of figures includes one of the figures, not just the caption - help! sarahlt Word 1 09-28-2014 09:34 AM
Figures and equations numbering Problem with captions for equations and figures in my Ph.D thesis. NoBolts Word 1 12-08-2012 09:58 PM
Numbering equations Yonnif Word 1 12-01-2010 03:37 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:21 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft