TransWikia.com

Package 'thm-restate' breaks switching of theorem styles of 'ntheorem'

TeX - LaTeX Asked on May 11, 2021

I use ntheorem and define two theorem-like environments (“Theorem” and “Lemma”) that share the same counter which is reset for every section. Moreover I have a proof-environment that has no counter at all.

At the same time I include thm-restate because I need to repeat a particular theorem.

Even if I do not use thm-restate but simply load the package, the lemma environment does not print its counter. If thm-restate is not loaded the output is as expected. Alternatively, if I omit switching the theorem style to nonumberplain for the proof-environment the counter is printed, too. However, in this case the proof gets numbered, too, which is not desired.

The MWE below yields

  • List item
  • Theorem 1.1
  • Lemma
  • Theorem 1.3
  • Proof

expected output is

  • Theorem 1.1
  • Lemma 1.2
  • Theorem 1.3
  • Proof

This means, the shared counter is correctly incremented but not printed.

documentclass[american]{article}

usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[utf8]{inputenc}
usepackage[thmmarks,thref]{ntheorem}
% Option 1: Either do no use 'thm-restate' and 'lemma' will be numbered
usepackage{thm-restate}



theoremstyle{plain}
theoremheaderfont{normalfontbfseries}
theoremseparator{}
theorembodyfont{normalfontitshape}
theoremsymbol{}
newtheorem{theorem}{Theorem}[section]
newtheorem{lemma}[theorem]{Lemma}
% Option 2: or do not use 'nonumberplain' and 'lemma' will be numbered
theoremstyle{nonumberplain}
theoremheaderfont{normalfontscshape}
theoremseparator{}
theorembodyfont{normalfontupshape}
theoremsymbol{rule{1ex}{1ex}}
newtheorem{proof}{Proof}



begin{document}

section{Header}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum gravida mauris.

begin{theorem}[Suprising Result]
Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
end{theorem}

begin{lemma}[Trivial Conclusion]
Mauris ut leo.
Cras viverra metus rhoncus sem.
Nulla et lectus vestibulum urna fringilla ultrices.
end{lemma}

begin{theorem}[Awesome Result]
Phasellus eu tellus sit amet tortor gravida placerat.
Integer sapien est, iaculis in, pretium quis, viverra ac, nunc.
Praesent eget sem vel leo ultrices bibendum.
end{theorem}

begin{proof}
Aenean faucibus.
Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
Curabitur auctor semper nulla.
end{proof}

end{document}

One Answer

I finally found a workaround. The definitions in the preamble needs to be re-ordered: first define theorem-like environments which are unnumbered and then the remaining one. However, this workaround only works if there is only one counter which is shared by all numbered theorem-like environments.

theoremstyle{nonumberplain}
theoremheaderfont{normalfontscshape}
theoremseparator{}
theorembodyfont{normalfontupshape}
theoremsymbol{rule{1ex}{1ex}}
newtheorem{proof}{Proof}

theoremstyle{plain}
theoremheaderfont{normalfontbfseries}
theoremseparator{}
theorembodyfont{normalfontitshape}
theoremsymbol{}
newtheorem{theorem}{Theorem}[section]
newtheorem{lemma}[theorem]{Lemma}

Answered by nagmat84 on May 11, 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