1

I am writing my thesis and am using the amsmath package for the theorem/lemma/definition/proof environments. I am having trouble figuring out how to simultaneously have the "definition" environment in plain text and then I manually italicize the definition and having the proof environment work correct. I have been able to get both to work independently following the information on overleaf's site:

https://www.overleaf.com/learn/latex/Theorems_and_proofs

To get the proof environment to work, my preamble looks like the below code:

\usepackage{amsmath}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lemma}[thm]{Lemma}
\newtheorem{ex}[thm]{Example}
\theoremstyle{definition}
\newtheorem{dfn}[thm]{Definition}

As an example, consider this snippet of code:

\begin{dfn}
A \textit{group} is a set blah blah blah
\end{dfn}
\begin{proof}
does it work?
\end{proof}

This is what the output looks like using the above preamble: enter image description here

As you can see, the defintion is fully italicized. This doesn't look the way I want it to until I add \usepackage{amsthm}, like below:

\usepackage{amsmath}
\usepackage{amsthm}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lemma}[thm]{Lemma}
\newtheorem{ex}[thm]{Example}
\theoremstyle{definition}
\newtheorem{dfn}[thm]{Definition}

This is what the same code looks after loading amsthm: enter image description here

When I compile my document using the second example for the preamble, my definitions look how I want them to, but the proof environment no longer works correctly. The word "proof" is no longer in bold and the standard square QED icon does not show up. I get the error "Something's wrong--maybe missing a \item" all over my document.

Does anyone know how to resolve both of these issues simultaneously? This is not my entire preamble, I can add the rest if needed. Also, I am not typing my text directly in the file that is loading the document. I am using a separate file introduction.tex file and then using the command "\include{introduction}. I am not sure if this matters but I thought it was somewhat relevant.

edit: My documentlcass is unique to my university because all of the formatting and whatnot is regulated. A template can be found on overleaf:

https://www.overleaf.com/latex/templates/purdue-university-thesis-template/rkjkbcgbcdck

6
  • 2
    Why defining theorems before loading amsthm?
    – egreg
    Commented Jan 17, 2020 at 17:54
  • If I'm not mistaken, amsmath contains amsthm, so they should still be correctly loading when I load amsmath. In any event, if I load amsthm immediately after amsmath, the problem still persists
    – Jake
    Commented Jan 17, 2020 at 17:54
  • 2
    No, amsmath and amsthm are independent of each other. You don't have a proof environment without amsthm.
    – egreg
    Commented Jan 17, 2020 at 17:59
  • In any event, like I mentioned earlier, the problem persists if I load amsthm immediately after amsmath. I will edit my question to reflect this. Do you have any other suggestions?
    – Jake
    Commented Jan 20, 2020 at 19:00
  • Could you add a minimal working example showing the problem? It should start with \documentclass{...} and end with \end{document}.
    – Vincent
    Commented Jan 20, 2020 at 19:04

1 Answer 1

3

The puthesis class already defines a proof environment in a way that I find no polite word to describe, namely

\newsavebox{\proofbox}
\sbox{\proofbox}{\rule{7pt}{7pt}}
\newtheorem{Proof}{Proof}
\renewcommand{\theProof}{}
\newenvironment{proof}{\begin{Proof}\rm}{\hfill \usebox{\proofbox} \end{Proof}}

What's the problem here? First: \rm has been deprecated for more than 25 years at the time of writing. Second: the end-of-proof marker is not guaranteed to be typeset at the end of a line. And more.

Of course, if you load amsthm, you will get errors.

You can do like this:

\documentclass[ece,dissertation]{puthesis}
\usepackage{amsmath}

\let\proof\relax\let\endproof\relax % use proof from amsthm
\usepackage{amsthm,xpatch}

\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lemma}[thm]{Lemma}
\newtheorem{ex}[thm]{Example}
\theoremstyle{definition}
\newtheorem{dfn}[thm]{Definition}

% tombstone like in puthesis
\renewcommand{\qedsymbol}{\rule{7pt}{7pt}}
% Proof in boldface like in puthesis
\xpatchcmd{\proof}{\itshape}{\bfseries}{}{}

\begin{document}

\begin{thm}
A theorem statement.
\end{thm}

\begin{proof}
Its proof.
\end{proof}

\begin{dfn}
A definition.
\end{dfn}

\end{document}

enter image description here

You must log in to answer this question.

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