Guest User

Untitled

a guest
Jun 30th, 2016
81
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. \documentclass{book}
  2. %compile twice
  3.  
  4. \usepackage{xassoccnt}
  5. \NewTotalDocumentCounter{totalfigures}
  6. \NewTotalDocumentCounter{totaltables}
  7. \NewTotalDocumentCounter{appendixchapters}
  8. \DeclareAssociatedCounters{figure}{totalfigures}
  9. \DeclareAssociatedCounters{table}{totaltables}
  10. \NewTotalDocumentCounter{totalpages}
  11. \DeclareAssociatedCounters{page}{totalpages}
  12.  
  13. \makeatletter
  14. \DeclareAssociatedCounters{page}{totalpages}
  15. \AtBeginDocument{%
  16.   \addtocounter{xassoccnt@total@totalpages}{1}
  17. }
  18. \makeatother
  19.  
  20. \begin{document}
  21.  
  22. There are \TotalValue{totalfigures} figures in this document
  23.  
  24. There are \TotalValue{totaltables} tables in this document
  25.  
  26. There are \TotalValue{appendixchapters} appendix chapters in this document
  27.  
  28. There are \TotalValue{totalpages} pages in this document
  29. \chapter{First}
  30.  
  31. \begin{figure}
  32.  \caption{Figure foo \thefigure}
  33. \end{figure}
  34.  
  35. \begin{table}
  36.  \caption{Table foo \thetable}
  37. \end{table}
  38.  
  39. \begin{table}
  40.  \caption{Table foo \thetable}
  41. \end{table}
  42.  
  43. \begin{table}
  44.  \caption{Table foo \thetable}
  45. \end{table}
  46.  
  47.  
  48. \chapter{Second}
  49.  
  50.  
  51. \begin{figure}
  52.  \caption{Figure foo \thefigure}
  53. \end{figure}
  54.  
  55. \begin{figure}
  56.  \caption{Figure foo \thefigure}
  57. \end{figure}
  58.  
  59.  
  60. \begin{table}
  61.  \caption{Table foo \thetable}
  62. \end{table}
  63.  
  64. \begin{table}
  65.  \caption{Table foo \thetable}
  66. \end{table}
  67.  
  68. \begin{table}
  69.  \caption{Table foo \thetable}
  70. \end{table}
  71.  
  72.  
  73. \appendix
  74.  
  75. \AddAssociatedCounters{chapter}{appendixchapters}
  76.  
  77. \chapter{Foo Appendix}
  78. \chapter{FooBar Appendix}
  79.  
  80. \begin{table}
  81.  \caption{Table foo \thetable}
  82. \end{table}
  83.  
  84. \begin{table}
  85.  \caption{Table foo \thetable}
  86. \end{table}
  87.  
  88. \begin{table}
  89.  \caption{Table foo \thetable}
  90. \end{table}
  91.  
  92.  
  93. \end{document}
RAW Paste Data