[Tex/LaTex] How to remove this space in proof environment

environmentsmath-modespacing

When a proof ends with a math equation, it adds an extra space. It means that the proof square goes to the next line and doesn't appear exactly in the last line.

Here is an example:

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]

\begin{document}
\begin{theorem}
...
\end{theorem}
\begin{proof}
...
$$\begin{array}{ccc}
A & \Longrightarrow & B\\
 & \Longrightarrow & C
\end{array}$$
\end{proof}
\begin{theorem}
...
\end{theorem}
\end{document}

And the compiled result is the following.

enter image description here

What should I do to have the square exactly aligned, it means in the same line "\Longrightarrow C" exists?

Best Answer

You should never (in the sense of never ever) use $$...$$ in LaTeX. For no reason whatsoever. See Why is \[ ... \] preferable to $$ ... $$?

For proofs that end with a display there is \qedhere.

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]

\begin{document}
\begin{theorem}
...
\end{theorem}
\begin{proof}
...
\begin{align*}
A & \Longrightarrow B\\
 & \Longrightarrow C\qedhere
\end{align*}
\end{proof}
\begin{theorem}
...
\end{theorem}
\end{document}

enter image description here

Depending on the nature of the alignment, you can also use

\begin{proof}
...
\begin{equation*}
\begin{split}
A & \Longrightarrow B\\
 & \Longrightarrow C\qedhere
\end{split}
\end{equation*}
\end{proof}
Related Question