2
\documentclass[CEJB,PDF]{cej}
\usepackage{layout}
\usepackage{lipsum}
\usepackage{enumerate}
\usepackage{amssymb}
\begin{document}
\begin{proof}
In \begin{proof} \end{proof} the end of proof small appearing in same while the proof was ending with text.
But the proof is ending with enumerate or align or math mode the small box appearing in next line.
\end{proof}
\begin{proof}
\[{f}(x)=\left\{
                \begin{array}{ll}
                  \frac{{f(x)+f(y)}}{2}, & \hbox{if $f(x)+f(y)$ is odd} \\
                  \frac{{f(x)+f(y)+ 1}}{2}, & \hbox{if $f(x)+f(y)$ is even}
                \end{array}
         \right.
\]
\end{proof}
\begin{proof}
\begin{enumerate}
\item  item a
\item  item b
\item  item c
\end{enumerate}
\end{}

In \begin{proof} \end{proof} the end of proof small appearing in same while the proof was ending with text. But the proof is ending with enumerate or align or math mode the small box appearing in next line. Is it possible to same line ending theorem proof while using enumerate or align or math mode?

moewe
  • 175,683

1 Answers1

3

You have two options.

Option 1: use \qedhere to manually place the box in the position you prefer, for example in the last item of an enumerate. This will suppress the automatic box and place it there instead.

Option 2: use \unskip just after the end of your content, before \end{proof}. This will "undo" vertical space before the box, when applicable.

The solutions work only if supported by the class/packages you are using.

Here is a corrected version of your MWE. Things to note:

  1. it is preferred to use the cases environment for case splits
  2. when using arrays or cases it is a known problem that \qedhere is placed vertically centered. Here we correct the issue as suggested here

Code:

\documentclass[CEJB,PDF]{cej}
\usepackage{layout}
\usepackage{lipsum}
\usepackage{enumerate}
\usepackage{amssymb}

\begin{document}
\begin{proof}
  In \verb|\begin{proof} \end{proof}| the end of proof small appearing in same while the proof was ending with text.
  But the proof is ending with enumerate or align or math mode the small box appearing in next line.
\end{proof}
\begin{proof}
  This does not align well
  \[
    {f}(x)=
    \begin{cases}
        \frac{{f(x)+f(y)}}{2}, & \text{if $f(x)+f(y)$ is odd} \\
        \frac{{f(x)+f(y)+ 1}}{2}, & \text{if $f(x)+f(y)$ is even}
    \end{cases}
    \qedhere
  \]
\end{proof}
\begin{proof}
  \[
    {f}(x)=
    \begin{cases}
        \frac{{f(x)+f(y)}}{2}, & \text{if $f(x)+f(y)$ is odd} \\
        \frac{{f(x)+f(y)+ 1}}{2}, & \text{if $f(x)+f(y)$ is even}
    \end{cases}
  \]
  \par \vspace{-\baselineskip}
  \qedhere
\end{proof}
\begin{proof}
  \begin{enumerate}
    \item  item a
    \item  item b
    \item  item c\qedhere
  \end{enumerate}
\end{proof}
\end{document}
Bordaigorl
  • 15,135