Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. renewcommand*{theHfigure}{runningfigurecounter.thevalue{runningfigurecounter}}
  2.  
  3. newlabel{figure:somelabel}{{1}{1}{A title}{hyperref counter-specific label}{random parameter that is empty until the cows home}}
  4.  
  5. figure.caption.5
  6.  
  7. runningfigurecounter.5
  8.  
  9. documentclass{article}
  10. usepackage{lipsum}
  11. usepackage{caption}
  12. usepackage{hyperref}
  13.  
  14. % Running Counter
  15. newcounter{runningfigurecounter}
  16.  
  17. % Redefine hyperref newlabel counters for unique targets with disregard for the printed form
  18. renewcommand{theHfigure}{runningfigurecounter.thevalue{runningfigurecounter}}
  19.  
  20. % Apply refstepcounter in macros called in the document
  21. letoldfigurefigure
  22. renewcommand{figure}{refstepcounter{runningfigurecounter}oldfigure}
  23.  
  24.  
  25. % Counter For TeX Loop (these are not global)
  26. newcountSTEP
  27. newcountSTEPTOTAL
  28. STEPTOTAL=5
  29.  
  30. begin{document}
  31.  
  32. References:
  33. STEP=0
  34. loop
  35. advanceSTEP 1
  36. ref{fig:theSTEP}
  37. ifnumSTEP<STEPTOTAL
  38. repeat
  39.  
  40.  
  41. % TeX Loop to Generate Figures and Labels
  42. STEP=0
  43. loop
  44. advanceSTEP 1
  45. newpage
  46. begin{figure}
  47. caption{Another fake picture. textbackslash theHfigure = texttt{theHfigure}}
  48. label{fig:theSTEP}
  49. end{figure}
  50. lipsum
  51. ifnumSTEP<STEPTOTAL
  52. repeat
  53.  
  54. end{document}
  55.  
  56. newlabel{fig:1}{{1}{2}{Another fake picture. textbackslash theHfigure = texttt {theHfigure }relax }{figure.caption.1}{}}
  57.  
  58. newlabel{fig:2}{{2}{4}{Another fake picture. textbackslash theHfigure = texttt {theHfigure }relax }{figure.caption.2}{}}
  59.  
  60. newlabel{fig:3}{{3}{6}{Another fake picture. textbackslash theHfigure = texttt {theHfigure }relax }{figure.caption.3}{}}
  61.  
  62. newlabel{fig:4}{{4}{8}{Another fake picture. textbackslash theHfigure = texttt {theHfigure }relax }{figure.caption.4}{}}
  63.  
  64. newlabel{fig:5}{{5}{10}{Another fake picture. textbackslash theHfigure = texttt {theHfigure }relax }{figure.caption.5}{}}
  65.  
  66. renewcommand*caption@makestart[1]{%
  67. begingroup
  68. Hy@hypertexnamesfalse
  69. hyper@makecurrent{#1.caption}%
  70. endgroup
  71. caption@Debug{hypcap start=@currentHref}}%
  72. }
  73.  
  74. documentclass{article}
  75. usepackage{lipsum}
  76. usepackage{caption}
  77. usepackage{xpatch}
  78. usepackage{hyperref}
  79.  
  80. % Running Counters
  81. newcounter{runningfigurecounter}
  82. newcounter{runningsectioncounter}
  83.  
  84.  
  85. % Redefine hyperref newlabel counters for unique targets with disregard for the printed form
  86. renewcommand{theHfigure}{runningfigurecounter.therunningfigurecounter}
  87.  
  88. % Apply refstepcounter in macros called in the document
  89. letoldfigurefigure
  90. letoldsectionsection
  91. AtBeginEnvironment{figure}{%
  92. refstepcounter{runningfigurecounter}%
  93. }
  94.  
  95. % Counter For TeX Loop (these are not global)
  96. newcountSTEP
  97. newcountSTEPTOTAL
  98. STEPTOTAL=10
  99.  
  100. makeatletter
  101.  
  102. AtBeginDocument{%
  103. renewcommand*caption@makestart[1]{%
  104. begingroup
  105. Hy@hypertexnamesfalse
  106. hyper@makecurrent{csname theH#1endcsname}%
  107. endgroup
  108. caption@Debug{hypcap start=@currentHref}}%
  109. }
  110. makeatother
  111.  
  112.  
  113. begin{document}
  114.  
  115.  
  116. References:
  117. STEP=0
  118. loop
  119. advanceSTEP 1
  120. ref{fig:theSTEP}
  121. ifnumSTEP<STEPTOTAL
  122. repeat
  123.  
  124.  
  125. % TeX Loop to Generate Figures and Labels
  126. STEP=0
  127. loop
  128. advanceSTEP 1
  129. newpage
  130. begin{figure}
  131. caption{Another fake picture. textbackslash theHfigure = texttt{theHfigure}}
  132. label{fig:theSTEP}
  133. end{figure}
  134. lipsum
  135. ifnumSTEP<STEPTOTAL
  136. repeat
  137.  
  138. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement