2

There are a lot of questions about skip control before and after theorem and align environments, see, please, solution with hack of theorem environment, general solution for align environments, however unexpected mysterious skip has come back.

As a MWE we can use a mixture of MWEs given here and here.

It happens that only white \hrule can slightly improve the situation, however this solution is a little bit ugly.

The question is how not to get unexpected skip in a simple and reasonable way?

Here is a MWE:

MisteriousSkip.tex:

\documentclass[11pt,a4paper]{report}

\usepackage{amsmath,amssymb,amsthm,xpatch}

\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt plus 0pt minus 0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bfseries}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\makeatletter
\xpatchcmd{\proof}{\topsep6\p@\@plus6\p@\relax}{}{}{}
\makeatother

\begin{document}
    \setlength{\abovedisplayskip}{0pt}%
    \setlength{\belowdisplayskip}{0pt}%
    \setlength{\abovedisplayshortskip}{0pt}%
    \setlength{\belowdisplayshortskip}{0pt}%
Some normal text goes here, with a lemma immediately below.
\begin{lemma}
This is the statement of the lemma.
\end{lemma}
%\hrule % if we \hrule, the skip becomes smaller!
\begin{align*}
x_1+x_2+x_3+x_4 &\leq 10 \\
x_5+x_5         &\leq 8 \\
x_7+x_8         &\leq 5 
\end{align*}
\begin{proof}
This is the proof of the lemma, with a mysterious space above.
\end{proof}
Some normal text goes here, with a mysterious space above. \par
The next paragraph comes immediately below.

\end{document}

A screenshot of MysteriousSkip.pdf is below:

enter image description here

  • 1
    So, why do not include the align* as part of your lemma? – Werner Dec 5 '16 at 18:28
  • 1
    Well, the equation forms part of the lemma, doesn't it? So, keep it that way, otherwise it's just an equation between a lemma and a proof, breaking up the two. No one wants to be broken up. – Werner Dec 5 '16 at 18:44
1

Since the align is part of the proof, include it within that environment. Also, it would be advisable to not start a proof with an equation, particularly because of the setup - it sets Proof. by default, necessarily putting the alignment on the following line. Instead, add some informal descriptive text prior to it:

enter image description here

\documentclass{report}

\usepackage{amsmath,amsthm}

\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bfseries}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\AtBeginDocument{%
  \setlength{\abovedisplayskip}{0pt}%
  \setlength{\belowdisplayskip}{0pt}%
  \setlength{\abovedisplayshortskip}{0pt}%
  \setlength{\belowdisplayshortskip}{0pt}%
}

\begin{document}
Some normal text goes here, with a lemma immediately below.

\begin{lemma}
This is the statement of the lemma.
\end{lemma}
\begin{proof}
It is possible to derive the following:
\begin{align*}
  x_1 + x_2 + x_3 + x_4                        &\leq 10 \\
                         x_5 + x_6             &\leq 8 \\
                                    x_7 + x_8  &\leq 5 
\end{align*}
This is the proof of the lemma, with a mysterious space above.
\end{proof}

Some normal text goes here, with a mysterious space above.

The next paragraph comes immediately below.

\end{document}
  • @ Werner, thank you for the answer, however actually I need to add some conditions inside a lemma or theorem-like environment. In this case extra skip appears! A white \hrule or \vspace*{0pt} can be useful, however a little bit expensive decision. Everywhere I need to put one of these commands. – Vladimir Parkhomenko Dec 5 '16 at 19:06
  • @VladimirParkhomenko: Please provide a complete, minimal working example (MWE) that replicates your problem so it can be replicated. – Werner Dec 5 '16 at 19:09
  • @ Werner, the example is complete, we should drop an extra skip between a lemma and align environments. Your way with embedded environments is working very good with proof, however it does not work if we put align inside a lemma. – Vladimir Parkhomenko Dec 5 '16 at 19:19
  • 1
    @VladimirParkhomenko: I get a zero skip between the text in the lemma and the start of align. output; code – Werner Dec 5 '16 at 19:22
  • Dear @Werner, thank you for the last link, finally I fixed a bug - there was an empty line before align in the embedded decision. – Vladimir Parkhomenko Dec 5 '16 at 19:26
1

It is not a skip. as always in TeX if you can not start a paragraph with display math, if you try, a spurious white paragraph just consisting of indentation and parfillskip is generated. Not only does this look like extra vertical space, being a paragraph line not vertical space, it is not dropped if the page break happens at that point.

You can see this if you add some text

\documentclass[11pt,a4paper]{report}

\usepackage{amsmath,amssymb,amsthm,xpatch}

\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt plus 0pt minus 0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bfseries}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\makeatletter
\xpatchcmd{\proof}{\topsep6\p@\@plus6\p@\relax}{}{}{}
\makeatother

\begin{document}
    \setlength{\abovedisplayskip}{0pt}%
    \setlength{\belowdisplayskip}{0pt}%
    \setlength{\abovedisplayshortskip}{0pt}%
    \setlength{\belowdisplayshortskip}{0pt}%
Some normal text goes here, with a lemma immediately below.
\begin{lemma}
This is the statement of the lemma.
\end{lemma}
%\hrule % if we \hrule, the skip becomes smaller!
xxx
\begin{align*}
x_1+x_2+x_3+x_4 &\leq 10 \\
x_5+x_5         &\leq 8 \\
x_7+x_8         &\leq 5 
\end{align*}
\begin{proof}
This is the proof of the lemma, with a mysterious space above.
\end{proof}
Some normal text goes here, with a mysterious space above. \par
The next paragraph comes immediately below.

\end{document}

enter image description here

The display does not move, but the one line paragraph above it now has visible text.

Solutions are to write something meaningful instead of xxx or to move the align inside the lemma

enter image description here

\documentclass[11pt,a4paper]{report}

\usepackage{amsmath,amssymb,amsthm,xpatch}

\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt plus 0pt minus 0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bfseries}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\makeatletter
\xpatchcmd{\proof}{\topsep6\p@\@plus6\p@\relax}{}{}{}
\makeatother

\begin{document}
    \setlength{\abovedisplayskip}{0pt}%
    \setlength{\belowdisplayskip}{0pt}%
    \setlength{\abovedisplayshortskip}{0pt}%
    \setlength{\belowdisplayshortskip}{0pt}%
Some normal text goes here, with a lemma immediately below.
\begin{lemma}
This is the statement of the lemma.
\begin{align*}
x_1+x_2+x_3+x_4 &\leq 10 \\
x_5+x_5         &\leq 8 \\
x_7+x_8         &\leq 5 
\end{align*}
\end{lemma}
\begin{proof}
This is the proof of the lemma, with a mysterious space above.
\end{proof}
Some normal text goes here, with a mysterious space above. \par
The next paragraph comes immediately below.

\end{document}
  • @ David, thank you for the explanations, the problem turned to be inlined in Tex logic. I accepted Werner's answer as the first solution. – Vladimir Parkhomenko Dec 5 '16 at 19:32
  • 1
    @VladimirParkhomenko that's OK Werner needs the points to catch me up anyway:-) – David Carlisle Dec 5 '16 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.