Guest User

Untitled

a guest
Jan 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. documentclass{amsart}
  2. usepackage{amsthm}
  3. usepackage{zref}% http://ctan.org/pkg/zref
  4.  
  5. makeatletter
  6. letoldlabellabel
  7. renewcommand{label}[1]{%
  8. zref@labelbylist{#1}{special}% Special label
  9. oldlabel{#1}% Old label
  10. }
  11. newcounter{splabel}
  12. zref@newlist{special}% Create a new property list called special
  13. zref@newprop{section}{arabic{section}}% Section property holds arabic{section}
  14. zref@addprop{special}{section}% Add a section property to special
  15. newcommand*{thmref}[1]{%
  16. stepcounter{splabel}% Increment local "special label" counter
  17. zref@labelbylist{#1-thesplabel}{special}% Create label
  18. edeftargetsec{zref@extractdefault{#1}{section}{-1}}% Extract target section
  19. edefsourcesec{zref@extractdefault{#1-thesplabel}{section}{-1}}% Extract source section
  20. ifnumtargetsec=sourcesecelsetargetsec.fi%
  21. ref{#1}%
  22. }
  23.  
  24. newtheorem{dummy}{***}[subsection]% Used so that theorems, definitions, etc can have same counter within subsections
  25. newtheorem{theorem}[dummy]{Theorem}
  26. newtheorem{lemma}[dummy]{Lemma}
  27.  
  28. theoremstyle{definition}
  29. newtheorem{definition}[dummy]{Definition}
  30. newtheorem{remark}[dummy]{Remark}
  31.  
  32. renewcommand{thesubsection}{arabic{subsection}}% Custom numbering on subsection to remove section number
  33.  
  34. begin{document}
  35.  
  36. section{First Section}
  37. subsection{First Subsection in Section 1}
  38. begin{definition}
  39. Good definition.
  40. end{definition}
  41.  
  42. subsection{Second Subsection in Section 1}
  43. begin{remark}
  44. Interesting remark.
  45. end{remark}
  46. begin{lemma} label{lem:name}
  47. Useful lemma.
  48. end{lemma}
  49.  
  50. subsection{Third subsection in Section 1}
  51.  
  52. begin{theorem} label{thm:name}
  53. Important theorem.
  54. end{theorem}
  55.  
  56. section{Section 2}
  57. subsection{Another subsection} There's not much to say here.
  58. subsection{Last Subsection}
  59. As you can see, Theorem thmref{thm:name} is very important. Indeed, Lemma~thmref{lem:name} was quite useful.
  60. end{document}
Add Comment
Please, Sign In to add comment