Guest User

Untitled

a guest
Jul 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. documentclass{book}
  2. usepackage{amsthm}
  3. usepackage{enumitem}
  4. usepackage{xparse}
  5. usepackage{hyperref}
  6.  
  7. usepackage{lipsum}
  8.  
  9. newtheoremstyle{fctaylor}% name
  10. {topsep}% Space above
  11. {topsep}% Space below
  12. {normalfont}% Body font
  13. {}% Indent amount (empty = no indent, parindent = para indent)
  14. {bfseries}% Thm head font
  15. {}% Punctuation after thm head
  16. {0pt}% Space after thm head: " " = normal interword space;
  17. {makethmhead{#1}{#2}{#3}}
  18.  
  19. newlengthfctaylortheoremindent
  20. AtBeginDocument{setlengthfctaylortheoremindent{3em}} % <- customize here
  21. newlengthfctaylorlabelsep
  22. AtBeginDocument{setlengthfctaylorlabelsep{1em}} % <- customize here
  23.  
  24. makeatletter
  25. newcommand{makethmhead}[3]{%
  26. gdefthisthmhead{%
  27. makebox[fctaylortheoremindent][l]{bfseries#2}%
  28. {bfseries#1}%
  29. @ifnotempty{#3}{ (#3)}%
  30. hspace{fctaylorlabelsep}%
  31. phantomsection%%% THIS LINE ADDED
  32. }%
  33. }
  34. makeatother
  35.  
  36. newenvironment{fctayloritemize}
  37. {list{}{%
  38. leftmargin=fctaylortheoremindent
  39. labelwidth=dimexprfctaylortheoremindent-labelseprelax
  40. itemindent=0pt
  41. }}
  42. {endlist}
  43.  
  44. NewDocumentCommand{newfctaylortheorem}{smomo}{%
  45. IfBooleanTF{#1}
  46. {newtheorem*{fctaylor@#2}{#4}}
  47. {IfNoValueTF{#3}
  48. {IfNoValueTF{#5}
  49. {newtheorem{fctaylor@#2}{#4}}
  50. {newtheorem{fctaylor@#2}{#4}[#5]}}
  51. {newtheorem{fctaylor@#2}[fctaylor@#3]{#4}}}%
  52. NewDocumentEnvironment{#2}{o}
  53. {IfNoValueTF{##1}{begin{fctaylor@#2}}{begin{fctaylor@#2}[##1]}%
  54. begin{fctayloritemize}item[thisthmheadhfill]}
  55. {end{fctayloritemize}end{fctaylor@#2}}%
  56. }
  57.  
  58. theoremstyle{fctaylor}
  59. newfctaylortheorem{mytheorem}{Theorem}[chapter]
  60. newcommand{thistheoremname}{}
  61. newfctaylortheorem{genericthm}[mytheorem]{thistheoremname}
  62. newenvironment{custom}[1][Custom]
  63. {renewcommand{thistheoremname}{#1}%
  64. begin{genericthm}}
  65. {end{genericthm}}
  66. newfctaylortheorem*{genericthm*}{thistheoremname}
  67. newenvironment{custom*}[1][Custom]
  68. {renewcommand{thistheoremname}{#1}%
  69. begin{genericthm*}}
  70. {end{genericthm*}}
  71.  
  72. begin{document}
  73. section{One}
  74.  
  75. begin{custom}{Custom Title}[optional words]label{A}
  76. lipsum*[2]
  77. end{custom}
  78.  
  79. newpage
  80.  
  81. begin{custom}label{B}
  82. Even though I've been teaching for n! years, every class is a fresh
  83. adventure -- An adventure. That word is a euphemism for the stark reality,
  84. which is that every class contains some totally shocking development
  85. that I have never seen before and haven't any idea how to cope with.
  86.  
  87. Just last year, for the first time in many years, I taught a section
  88. of the junior-level mathematical analysis course. You know -- the one
  89. where students meet proofs in analysis for the first time. The one where
  90. students and epsilons meet, eyeball to eyeball, and it isn't the epsilons
  91. that blink. The one where students decide that they really wanted to be
  92. doctors and lawyers after all.
  93. end{custom}
  94.  
  95. newpage
  96.  
  97. Here are the references: ref{A} and ref{B}.
  98.  
  99. end{document}
  100.  
  101. begin{custom}{Custom Title}[optional words]label{A}
  102. lipsum*[2]
  103. end{custom}
  104.  
  105. begin{custom}label{B}
  106. ...
  107. end{custom}
Add Comment
Please, Sign In to add comment