1

In one section I wrote some numbered hypothesis, for which I created a theorem environment as follows:

\newtheorem{ipotesi}{Ipotesi}%[section]
\renewcommand{\theipotesi}{A\arabic{ipotesi}}

In another section, far away from the one where I put firstly my hypothesis, I would like to rewrite them using again the same environment, with the same number of course and possibly a cross reference that points exactly to the first ones.

Here I found something but I am not able to apply it to my case

From what I deduced, I should write something like this, but it does not work.

\makeatletter
\newcommand{\neutralize}[1]{\expandafter\let\csname c@#1\endcsname\count@}
\makeatother

\newtheorem{hp}{Ipotesi}

\newenvironment{hpbis}[1]
  {\renewcommand{\thehp}{\ref{#1}}%
   \neutralize{hp}\phantomsection
   \begin{hp}}
  {\end{hp}}

I managed to solve the problem using \addtocounter{ipotesi}{-x} where x is the number of hypothesys I wrote in between the sections. However, this does not fully satisfies me..

Can anyone please explain me what does the code written by @egreg and also how could I manage do make this working more properly?

2
  • I don't really understand what exactly you want to typeset. Can you show a MWE that uses the addtocounter negative value? (if the content of the two environments are exactly identical then I think you can save the content into a box then use it later)
    – user202729
    Commented Aug 3, 2022 at 11:50
  • Oh, thank you. I was not aware of such features.
    – Gabrielekk
    Commented Aug 3, 2022 at 15:44

0

Browse other questions tagged .