[Tex/LaTex] Environments with thmtools => too much space if using itemize at the end (also problem with q.e.d. symbol)

environmentsitemizeparagraphsspacingthmtools

I want to use the thmtools package, because it provides some awesome features for declaring environments (proofs, theorems, examples etc.)

And I especially like the "qed" feature which places some nice symbols like the q.e.d. square at the end of the environments. For example, I am using different symbols for different environments.

However, there are some issues, if I use special blocks (itemize, align) at the end of such an environment. The "qed" symbol is too low and much space is wasted.

Test the following example:

\documentclass{book}

\usepackage{amsthm}
\usepackage{thmtools}

\declaretheoremstyle[headpunct=\\*,qed=\ensuremath{\triangle}]{myexstyle} 
\declaretheorem[style=myexstyle]{myexample} 

\begin{document} 

\begin{myexample}[This is an example 1]
This is an example...

And the symbol is on the correct line!
\end{myexample} 

\begin{myexample}[This is an example 2]
This is an another example...
\begin{itemize}
  \item And the symbol is \emph{not} on the correct line!
\end{itemize}
\end{myexample} 

\end{document}

I want that the \triangle is shown on the same line as the last \item.

I already fixed that problem for align environments (I am using package adjustbox und aligned now), but I cannot solve the problem, if I want to use itemize the way shown.

I think that I also know the reason for the problem. \end{itemize} ends the paragraph and a new paragraph must be started in order to place the "qed" symbol.

Is there an option? A Workaround? Preferably without \qedhere or manual adjustments for each environment! I was also wondering if package enumitem (or another one) could be helpful with any kind of option?

Best Answer

The problem with the endmarks in amsthm is a well known issue; the following remark is from the documentation:

Placement of the QED symbol can be problematic if the last part of a proof environment is a displayed equation or list environment or something of that nature. In that case put a \qedhere command at the place where the QED symbol should appear...

So one option is to manually put \qedhere:

\begin{myexample}[This is an example 2]
This is an another example...
\begin{itemize}
  \item And the symbol is on the correct line!\qedhere
\end{itemize}
\end{myexample}

However, you said you don't want to manually use \qedhere, then I am afraid that using amsthm is not the best choice. One option would be to use ntheorem as the back-end for thmtools instead of amsthm, since the former solves the problem of setting endmarks of theorem-like environments automatically at the right positions (even if the environment ends with a displaymath or list environment).

Now, you have to make a choice: either you stick to amsthm and accept having to manually put \qedhere under some circumstances, or you switch to ntheorem; perhaps Theorem packages: which to use, which conflict? can help you to make a decision.

Here's your example but now using ntheorem:

\documentclass{book}
\usepackage[thmmarks]{ntheorem}
\usepackage{thmtools}

\declaretheoremstyle[
headpunct={},
qed=\ensuremath{\triangle},
bodyfont=\normalfont
]{myexstyle} 
\declaretheorem[style=break]{myexample} 

\begin{document} 

\begin{myexample}[This is an example 1]
This is an example...

And the symbol is on the correct line!
\end{myexample} 

\begin{myexample}[This is an example 2]
This is an another example...
\begin{itemize}
  \item And the symbol is on the correct line!
\end{itemize}
\end{myexample} 

\end{document}

enter image description here

As you can see, the note for the title appears boldfaced; unfortunately, the notefont key for thmtools is not supported with ntheorem, so if you want to change the note font, you will have to add the following to the preamble:

\makeatletter
\renewtheoremstyle{break}%
  {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
          ##1\ ##2\theorem@separator}\hbox{\strut}}}]}%
  {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
          ##1\ ##2\ {\normalfont(##3)}\theorem@separator}\hbox{\strut}}}]}
\makeatother