-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong spacing above theorems #29
Comments
Does the following example reproduces the problem you reported? If so I'm afraid that's the default behavior inherited from LaTeX2e format. \documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath}
% case 1: LaTeX2e's \newtheorem
\newtheorem{theorem}{Theorem}
% case 2: amsthm's \newtheorem
% \usepackage{amsthm}
% \newtheorem{theorem}{Theorem}
% case 3: thmtools' \declaretheorem, with amsthm loaded
% \usepackage{amsthm, thmtools}
% \declaretheorem{theorem}
\parindent=0pt
\def\dummy{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulumut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
\hfill mauris.}
\begin{document}
\dummy
\begin{theorem}
preceded by a paragraph ends in a full-line
\end{theorem}
\dummy
\begin{align*}
a + b = c
\end{align*}
\begin{theorem}
preceded by an \verb|align*|
\end{theorem}
\dummy
\begin{align*}
a + b = c
\end{align*}
\dummy
\bigskip
Accumulated natural height of the current page: \the\pagetotal
\end{document} Accumulated natural height of the current page:
|
I suspect the text before lemma wraps to the second line and leaves the second line empty. Can you check if the problem persists when the lemma env is replaced with other Please share a short but complete latex example. If free fonts can't reproduce problem, commercial fonts are ok. |
A center environment works fine. No additional space if I remove the %. I'll try to find a small example to reproduce, but it might take some time. |
Okay, I found a small example using Computer Modern. It seems to be an interaction between thmtools and hyperref.
|
PS: If I run my example with amsthm only, it works as expected. |
Thank you for the example. Starting from it I got a further simplified one: \documentclass{article}
% \usepackage{showframe}
\usepackage{thmtools}
\usepackage{hyperref}
\newtheorem{Lem}{Lemma}
% \AddToHook{env/Lem/begin}{\unskip} % workaround
\begin{document}
Finally, let us consider morphisms between polynomial functors functors ab.
\begin{Lem}
foo
\end{Lem}
Finally, let us consider morphisms between polynomial functors functors ab.
\begin{center}
foo
\end{center}
\end{document} A thorough analysis and fix would need more time. Before that, can you test if the workaround |
I tried it with the large document I'm working on, and it seems to fix the spacing issue. But now I get a lot of errors: ! You can't use `\unskip' in vertical mode. |
Then |
That seems to fix the issue. |
I spoke too soon: The issue is fixed after paragraphs with full lines, but it persists after align* environments. |
Here is a test case: \documentclass{article}
% \usepackage{showframe}
\usepackage{amsmath}
\usepackage{thmtools}
\usepackage{hyperref}
\newtheorem{Lem}{Lemma}
\AddToHook{env/Lem/begin}{\unskip} % workaround
\begin{document}
Finally, let us consider morphisms between polynomial functors functors ab.
\begin{Lem}
foo
\end{Lem}
Finally, let us consider morphisms between polynomial functors functors ab.
\begin{center}
foo
\end{center}
Finally, let us consider morphisms between polynomial functors functors ab.
\begin{align*}
foo
\end{align*}
\begin{Lem}
foo
\end{Lem}
\end{document} |
Hmm the |
Do you need more input from me? It is clearly a bug, not only in thmtools but also for the vanilla version, that is fixed in amsthm. |
Hope it will be resolved by latex3/latex2e#990. |
I am able to reproduce the extra space with both the vanilla |
I noticed that sometimes there is too much spacing above a theorem. I found two cases where this occurs:
If the preceding paragraph ends in a line that is exactly as long as the \textwidth. (In this case, adding a % at the end of the paragraph solves the issue.)
If the theorem is preceded by an align* environment.
The text was updated successfully, but these errors were encountered: