TeX - LaTeX Asked on April 9, 2021
How to let the theorems display as Theorem A.1, Theorem A.2, etc. in appendix?
Solution
renewcommand*{thetheorem}{mbox{textrm A.arabic{theorem}}}
is not suitable because of wrong link (to the Theorem 1, not Theorem A.1) using hyperref
package…
Assuming you are using the standard book
class, without further packages, one solution is to redefine @thmcounter
at the time appendix
is declared:
usepackage{etoolbox}
makeatletter
pretocmd{appendix}{def@thmcounter#1{noexpandAlph{#1}}}{}{}
makeatother
Here is a minimal working example:
documentclass{book}
newtheorem{theorem}{Theorem}[chapter]
usepackage{etoolbox}
makeatletter
pretocmd{appendix}{def@thmcounter#1{noexpandAlph{#1}}}{}{}
makeatother
usepackage{hyperref}
begin{document}
chapter{Lorem}
See autoref{thm:2}
begin{theorem}label{thm:1}
Hello world!
end{theorem}
appendix
chapter{Ipsum}
See autoref{thm:1}
begin{theorem}label{thm:2}
Hello world!
end{theorem}
end{document}
which gives:
Answered by Ivan on April 9, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP