2

If I have a theorem environment which uses a QED symbol, and I put a verbatim block at the end of such a theorem, then the QED symbol gets put on a new line below, creating extra space. Is there a way to define a macro similar to \qedhere but which places the symbol at the end of the line above, and so doesn't create an extra line just for the symbol?

MWE:

\documentclass{article}
\usepackage{amsthm}

 \begin{document}
 \begin{proof}
 For example:
 \begin{verbatim}
 Some code.
 \end{verbatim}
 \qedhere
 \end{proof}
 \end{document}

enter image description here

Edit: This suggests \par\vspace{-1.7\baselineskip}\qedhere, which sort of works, but there's a "magic" value of 1.7 that needs adjusting, and the QED symbol can still be put on the next page.

2
  • 1
    Could you post a full compilable code which shows the problem?
    – Bernard
    Feb 12, 2018 at 17:54
  • @Bernard just done
    – Doris
    Feb 12, 2018 at 18:09

1 Answer 1

2

This code seems to work:

\documentclass{article}
\usepackage{amsthm}

 \begin{document}

 \begin{proof}
 For example:

 \begin{verbatim}
 Some code.
 \end{verbatim}
\vspace*{-\dimexpr2\baselineskip + \topsep + \partopsep}
 \qedhere
 \end{proof}

 \end{document} 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .