JesseStraat / reptheorem

LaTeX Project Public License v1.3c
1 stars 0 forks source link

Extra vertical spacing between restatable theorems #2

Closed emalizia closed 1 month ago

emalizia commented 1 month ago

Hi,

It seems that additional vertical space is left between restatable theorems. Consider the following MWE:

%%% Begin of the MWE
\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{lmodern}

\usepackage{amsmath,amsthm}

\usepackage{reptheorem}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{construction}[theorem]{Construction}

\begin{document}

\begin{makethm}{theorem}{thmOne}[First Theorem]
This is a first theorem.
\end{makethm}

\begin{makethm}{theorem}{thm2}[Second Theorem]
This is a second theorem.
\end{makethm}

\begin{makethm}{theorem}{thm:third}[Third Theorem]
This is a third theorem.
\end{makethm}

\begin{makethm}{theorem}{thm_fourth}[Fourth Theorem]
This is a fourth theorem.
\end{makethm}

\repthm{thmOne}

\repthm{thm2}

\repthm{thm:third}

\repthm{thm_fourth}

\end{document}
%%% End of the MWE

In the output of the MWE above, for the initial sequence of theorem declarations, there is a bigger vertical space between the theorems, compared to the vertical space between the repeated theorems in the second part of the document. I don't know exactly why this happens. It seems to be something similar to what thmtools does for its restatable theorems (see, e.g., https://tex.stackexchange.com/questions/111639/).

JesseStraat commented 1 month ago

Issue was found to be part of the makethm definition. As opposed to thmtools, the white space is after the theorem, not before.

JesseStraat commented 1 month ago

Vertical space is caused by \write in the definition of makethm. See https://tex.stackexchange.com/questions/350339/texs-write-command-sometimes-induces-a-spurious-vertical-space.

JesseStraat commented 1 month ago

Fixed with commit fdcfc283eab83131bd72a8c96b8c99c035059090. This will be included with version 1.2 as soon as https://github.com/JesseStraat/reptheorem/issues/3 is fixed, as well.

JesseStraat commented 1 month ago

Hi @emalizia,

The bug has been fixed, and version 1.2 has been uploaded to CTAN (with better documentation this time...). It will soon be included in most major distributions besides Overleaf (they only update their packages once a year).

emalizia commented 1 month ago

Great! Thanks