TransWikia.com

theorem numeration in appendix

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…

One Answer

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:

enter image description here

Answered by Ivan on April 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP