# I would like to implement \qedhere in a class that clashes with packages that include it

I am submitting a paper that requires the LMS class file:

I need to use a \qedhere to position an end-of-proof tombstone in a few places but can't because both amsthm.sty and ntheorem.sty are incompatible with the requested way of using the class file (ntheorem.sty doesn't throw an error outright, but I haven't found a way to make theorems display correctly with it, and the class uses its own theorem-environment‒definition system.)

Is there anything I can put into my document itself, not modifying the class, that will let me use \qedhere successfully?

This will allow you to use the proof environment of amsthm without changing the theorem-like structures as defined by the class, but perhaps the copy editors won't be happy.

\documentclass{lms}

%Include your preferred graphics and mathematics packages here,
%using the command \usepackage{}

\usepackage{etoolbox}

\makeatletter
\AtEndPreamble{%
\let\proof\relax
\let\endproof\relax
\let\old@thm\@thm
\let\old@xthm\@xthm
\let\old@ythm\@ythm
\let\old@begintheorem\@begintheorem
\usepackage{amsthm}%
\let\@thm\old@thm
\let\@xthm\old@xthm
\let\@ythm\old@ythm
\let\@begintheorem\old@begintheorem
}
\makeatother

\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}

\newnumbered{assertion}{Assertion}    % 1st argument is your name for it
\newnumbered{conjecture}{Conjecture}  % 2nd argument is what is printed

% TOP MATTER

\title[Using]
{Using the LMS class file} % This is the full title of the paper

\author{F. Irst, Second Author and T. Hird}

\dedication{A dedication can be included here}

\classno{11B83 (primary), 11J71, 37A45, 60G10 (secondary).}

\extraline{Acknowledgements of grants and financial support should
be included here; more general \textsl{Acknowledgements} are better
placed either immediately before the bibliography (see
page~\pageref{ackref}) or at the end of the introduction. Since
author names should not carry footnote marks, instead refer to The
first author', etc. No keywords' should be supplied.}

\begin{document}
\maketitle

\begin{abstract}
This is a combined guide and sample \texttt{.tex} file for authors
choosing to prepare their papers for the journals of the London
Mathematical Society with the LMS \LaTeXe\ class file. Papers
written in \texttt{article.cls} or \texttt{amsart.cls} are easily
converted to \texttt{lms.cls}, and this can reduce the time to
publication. The LMS class is compatible with commonly used
mathematical packages such as \texttt{amsmath}.

An \emph{abstract} written in English is
required and should preferably have fewer than 200 words.
Please do not include citations, footnotes or references
to numbered equations, figures, tables or theorems in your
abstract. Avoid complicated formulae or displayed equations, if
possible.
\end{abstract}

\section{Introduction}
\label{intro}

Some text some text some text some text some text
some text some text some text some text some text
some text some text some text some text some text
some text some text some text some text some text
some text some text some text some text some text
some text some text some text some text some text

\begin{theorem}
Abc
\end{theorem}

\begin{proof}
Abc
$1=1\qedhere$
\end{proof}

\end{document}


• This is nice, but I also need to use the thmtools for the restatable environment, and this package doesn't seem to be compatible with the solution. The following MWE fails to display theorems that include an optional citation argument as theorems, and eventually for some reason produces "nested too deeply" errors: pastebin.com/hK83kDEF. Is there any way to make everything compatible? – jdc Sep 29 '17 at 23:17
• @jdc For thmtools the full amsthm seems necessary. Just do \let\proof\relax\let\endproof\relax\usepackage{amsthm,thmtools} and define all theorems afterwards. But the chances of rejection increase. – egreg Sep 29 '17 at 23:19
• This gets me back \qedhere and doesn't break remarks, definitions, etc., and even compiles without error! But it makes theorems, lemmas, etc. follow the AMS style rather than the LMS style. Is there something I can do after this line of code to get back the LMS format for "theorem"-style theorem environments? – jdc Sep 30 '17 at 22:38
• @jdc You might try implement \qedhere yourself, based on the code in amsthm. I'm not going to try, to be honest. – egreg Sep 30 '17 at 22:40
• I thought I might have to do that... It sounds like tough going, though. Thanks, again! – jdc Oct 1 '17 at 21:03