Skip to main content
10-Marble
June 13, 2012
Question

Figure Total Sheet Count in Table of Contents

  • June 13, 2012
  • 9 replies
  • 1827 views

I need some help from the experts. I have a List of Figures and I need to be able to auto generate each figure title with the sheet numbers. It needs to look something like this:


Figure 1 Engineering (Sheet 1 of 2)
Figure 1 Engineering (Sheet 2 of 2)


Everything is working correctly except for the total sheet count. It is counting the maximum number of sheets and putting that as the total sheet count for each figure. Example:


Figure 1 Engineering (Sheet 1 of 3)
Figure 1 Engineering (Sheet 2 of 3)
Figure2 Engineering Symbols (Sheet 1 of 3)
Figure2 Engineering Symbols (Sheet 2 of 3)
Figure2 Engineering Symbols (Sheet3 of 3)


I have the following FOSI code:


<counter initial="1" style="arabic" enumid="totalsheet.ctr">


<stringdecl textid="totalsht.txt" status="1">


<e-i-c gi="figure">
<reset resetlist="totalsheet.ctr">
</e-i-c>


<e-i-c gi="sheet" occur="first">
<charlist inherit="0"><enumerat enumid="totalsheet.ctr"></charlist>
</e-i-c>


<e-i-c gi="sheet" occur="all">
<charlist inherit="0"><enumerat enumid="totalsheet.ctr"></charlist>
</e-i-c>


<e-i-c gi="sheet" occur="last">
<charlist inherit="0"><enumerat enumid="totalsheet.ctr">
<savetext textid="totalsht.txt" conrule="totalsheet.ctr" placemnt="after"></charlist>
</e-i-c>


****SAVETEXT FOR THE LIST OF FIGURES*******


<e-i-c gi="graphic" context="subfig" *=" figure&quot;=" occur="all">
<savetext textid="figurecol1.app" conrule="chapnum.txt,\-\,subfig.ctr,\.\,figtitle.txt,\" (sheet=" \,shtnbr.ctr,\=" of=" \,totalsht.txt,\)\,dotfill,chapnum.txt,\-\,bodyfolio.txt[bo]&quot;=" placemnt="before" append="1">
</e-i-c>


I apologize for the lengthy post. Any help would be greatly appreciated.


Sarah

    9 replies

    1-Visitor
    June 13, 2012
    We use the <graphic> element for our sheets.
    We have two e-i-c's; one for graphic within figure and one for graphic when it is the ONLY graphic within figure.

    We reset the sheet count on figure.

    <e-i-c gi="graphic" context="figure">
    <charlist inherit="1" charsubsetref="TypeInline">
    <enumerat increm="1" enumid="sheet.ct">
    <savetext textid="totalsheets.txt" conrule="sheet.ct">
    <usetext source="\Sheet" \,sheet.ct,\=" of=" \,totalsheets.txt&quot;="></usetext>
    </charlist></e-i-c>
    <e-i-c gi="graphic" context="figure" occur="only">
    <charlist inherit="1" charsubsetref="TypeInline">
    </charlist>
    </e-i-c>

    <e-i-c gi="figure">
    <charlist inherit="1" charsubsetref="Block" reset_sheetct&quot;="></charlist>
    </e-i-c>
    10-Marble
    June 13, 2012
    That part is working fine. It is just the part where I need the sheet counts in my List of Figures. Do you put your sheet count in your TOC?


    1-Visitor
    June 13, 2012
    Try adding a scope to the stringdecl

    <stringdecl textid="totalsht.txt" status="1" scope="figure">


    10-Marble
    June 13, 2012
    I have a scope added to my other stringdecl that produces the sheet totals within the chapter per figure but when I add it to the stringdecl for the TOC I get blanks.



    Such as...



    Figure 1 Engineering (Sheet 1 of )
    Figure 1 Engineering (Sheet 2 of )
    Figure 2 Engineering Symbols (Sheet 1 of )
    Figure 2 Engineering Symbols (Sheet 2 of )
    Figure 2 Engineering Symbols (Sheet 3 of )


    1-Visitor
    June 13, 2012
    Each graphic has a title and we include the (Sheet n of m) text in each graphic title, where applicable, and the title text gets saved as TOC/LOF (List of Figures) text and appended together with all the other LOF texts.
    10-Marble
    June 13, 2012
    Ours is generated through the graphic tag. Same result just different tag. I do have my LOF savetext on the graphic e-i-c. But it is giving me the total sheet number for the last figure that has sheets. My last figure has 5 sheets so when it generates in the LOF they all say Sheet X of 5 no matter how many sheets the figure has.


    1-Visitor
    June 13, 2012
    Sarah,

    I'm thinking that an e-i-c for graphic occur=first could save its sheetct to sheetct-first.txt and an e-i-c for graphic occur=last could save its sheetct to sheetct-last.txt. Then a savetext with placemnt=after on the container element subfig would save them both to the LOF. Hmmm ... you'll need to save the page number in the e-i-c with occur=first. You'll also need an e-i-c for occur=middle, which doesn't save the sheetct. However, if subfig requires at least two graphics, you won't need an e-i-c for occur=only.

    Clear as mud? Please let me know any questions. And please let us know your results.

    Thanks!
    Suzanne


    10-Marble
    June 14, 2012
    With the help of Brandon Ibach the problem is solved J!



    I changed the totalsht.txt reference in the figurecol1.app savetext to an XPATH statement. This allowed the sheet to count properly. So my List of Figures savetext looked like this:


    <savetext textid="figurecol1.app" conrule="chapnum.txt,\-\,subfig.ctr,\.\,figtitle.txt,\" (sheet=" \,shtnbr.ctr,\=" of=" \,#xpathstring(count(ancestor::figure=" subfig))#xpath,\)\,dotfill,chapnum.txt,\-\,bodyfolio.txt[bo]&quot;=" placemnt="before" append="1">



    It seems that the formatter had trouble with the time-independent variable (totalsht.txt) being placed into another time-independent variable (figurecol1.app). Editor seemed to lose the context needed to resolve it properly because of the nesting.



    Thanks again Brandon!


    1-Visitor
    July 7, 2013

    I was having this same issue and both Brendan's and Suzanne's solutions worked for me.This is something I should have figured out on my own, but I was stuck on saving the toc.app in the first occurrence of subfig instead of the last.


    <figure>


    <subfig><graphic></subfig>


    <subfig><graphic></subfig>


    <subfig><graphic></subfig>...etc


    </figure>


    The TOC required only the first subfig like so:


    Blah Blah Assembly (Sheet 1 of X).


    I hard-coded the "Sheet 1 of" since that was all I needed (although you have to follow Suzanne's advice and save the page number in the first occurrence.)


    In the last occurrence of subfig in figure (fig-title.txt is saved in title in figure):


    <savetext textid="subfigct.txt" conrule="sheetct"/">


    <savetext textid="toc.app" conrule="fig-title.txt,\" (sheet=" 1=" of=" \,subfigct.txt[bo],\)\,dot.fill,chapstr.txt[bo],\-\,folio-toc.txt&quot;<=" p=">

    append="1"/>


    I had tried using a second .tiv scoped to the document to save sheetct for the toc and that didn't work, so I agree with Sarah that a .tiv in a .tiv confuses the formatter.