TransWikia.com

Is it possible for ntheorem to number each instance with subscript numbers?

TeX - LaTeX Asked by Stanislav Stanchev on February 12, 2021

I am wondering if it is possible to alter ntheorem’s numbering of theorems/hypotheses/instances with subscript numbers. I could not find anything on this matter in the package’s documentation, which has options for arabic, greek, alph, roman and so on, but not regarding subcript numbers.

MWE:

documentclass{article}
usepackage[utf8]{inputenc}
usepackage{ntheorem, fixltx2e, hyperref}
theoremseparator{:}
newtheorem{hyp}{Hypothesis}
begin{document}
Below is my first hypothesis.
begin{hyp}[Href{hyp:h1}] label{hyp:h1}
The apple seldom falls far from the tree.
end{hyp}
Below is my second hypothesis.
begin{hyp}[Href{hyp:h2}] label{hyp:h2}
All swans are white.
end{hyp}
I am interested in the "H label" appearing like so: textbf{Hypothesis 2 (Htextsubscript{2})}.
end{document}

This is the output of the code above
Thank you very much in advance.

One Answer

Since you seem to want the same number, you don't really need label and ref. It's easier defining a new environment based on a theorem-like one. I also provided a new hypref command for referencing to hypotheses.

documentclass{article}
usepackage[utf8]{inputenc}
usepackage{ntheorem,hyperref}

theoremseparator{:}

newtheorem{hypx}{Hypothesis}
newenvironment{hyp}{hypx[Htextsubscript{thehypx}]}{endhypx}
newcommand{hypref}[1]{textup{(Htextsubscript{ref{#1}})}}

begin{document}

Below is my first hypothesis.

begin{hyp}label{hyp:h1}
The apple seldom falls far from the tree.
end{hyp}

Below is my second hypothesis.

begin{hyp}
All swans are white.
end{hyp}

Here is a reference to hypref{hyp:h1}.

end{document}

enter image description here

Correct answer by egreg on February 12, 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