Topic
3 replies Latest Post - ‏2012-10-22T18:08:30Z by pete.giorgianni
cliff.sadler
cliff.sadler
32 Posts
ACCEPTED ANSWER

Pinned topic Figure and Table captions that follow heading levels

‏2012-09-12T16:06:18Z |
Not sure if this can be done or not, but maybe someone has figured out a way....

I would like for my figure and table title captions to be auto-numbered according to the section level they appear in. for instance, the third figure in section 1.1.2 would look like "Figure 1.1.2-3 Some Title".
To the best of my knowledge of auto numbering fields, I can manually set a STYLEREF to the field to pull the heading numbering, but can only specify one. A valid manually coded field to accomplish this would be "{STYLEREF \s "Heading 3"\n}-{SEQ Figure \* ARABIC} Some Title".

What I'm looking for is a way to dynamically set the Heading number based on the Object Level (maybe minus 1) of the figure, and populate that in the field code property of the Figure Caption and Table Caption elements in my RPE template. Has anyone scripted something like that? Can we use internal variables in the field code property? can you mix string and integer variables there, or do I have to build up the field code string and store it in a variable first?
Updated on 2012-10-22T18:08:30Z at 2012-10-22T18:08:30Z by pete.giorgianni
  • Dragos.Cojocari
    Dragos.Cojocari
    1603 Posts
    ACCEPTED ANSWER

    Re: Figure and Table captions that follow heading levels

    ‏2012-09-13T09:06:47Z  in response to cliff.sadler
    Hey Cliff,

    this is doable as you can use scripts for defining the field's contents. What you need to do is keep in a variable the current heading version and use that in the script that defines the heading's content. The script could look like this:

    
    
    'STYLEREF  "Heading XYZ"  \\n'.replace( 
    "XYZ", 
    "1");
    


    I've hardcoded "1" here so you need to replace it with the variable holding the current heading level. "XYZ" is markup used for the replace operation.

    Note that you need to introduce 2 fields to get the desired behavior, one introduces the styleref and the other the figure number. See attached example, run it with the rpe.dot stylesheet ( so you get numbered headings) and update the fields.

    Regards,
    Dragos

    RPE Actual
  • cliff.sadler
    cliff.sadler
    32 Posts
    ACCEPTED ANSWER

    Re: Figure and Table captions that follow heading levels

    ‏2012-09-13T12:49:06Z  in response to cliff.sadler
    Thanks, I did figure that out yesterday, that I would need 2 figure caption elements to set up the 2 fields.
    What I did was get the current object level, and then decrement it (the figure or table is always a child of the section it resides in). For others, here is my template. It processes based on an entry in Object Type.
    • pete.giorgianni
      pete.giorgianni
      23 Posts
      ACCEPTED ANSWER

      Re: Figure and Table captions that follow heading levels

      ‏2012-10-22T18:08:30Z  in response to cliff.sadler
      Here is what we did:

      Have a standard attribute that IDs the objects and added values for figures and tables. We then had a dxl attribute that automatically sets the number based on the header number.

      You can email for the code if you want.

      Pete