1

I'm searching for a theorem style like that the one that is used in this book:
Elementary Analysis by Ross

I've got already most things working, except that I want to get a custom theorem like this:

enter image description here

When I type something like:

\begin{thm}[Rational Zeros Theorem]
...
\end{thm}

The rest of the styles that I want are:

  1. Having the number and theorem swapped
  2. Having a newline after the head of the theorem/defintion
  3. Having "Proof." in boldface instead of italic and a newline after it
  4. Having also a newline if the proof begins with a list

I've been already trying to implement 1,2 and 3, and if you are interested, you can find it on github: https://github.com/kasperpeulen/Ross-Theorem-Style

I've not yet solved 4, but I found some other posts here, so I think I can solve that by myself, but any help with that would be appreciated as well of course.

2

Okay, I've got it working now, thanks to other posts at this website, help from percusse in the chat:

enter image description here

Here is the code, which you can also find here: https://github.com/kasperpeulen/Ross-Theorem-Style

\documentclass[12pt]{article}
\usepackage{amsmath, amssymb, amsthm}

\newtheoremstyle{theorem}% name
  {}%         Space above, empty = `usual value'
  {}%         Space below
  {\itshape}% Body font
  {}%         Indent amount 
  {\bfseries}% Head font
  {.}%        Punctuation after head
  {\newline}% Space after head: \newline = linebreak
   {\def\temp{#3}\ifx\temp\empty\thmnumber{#2 }\thmname{#1}\else\thmnumber{#2}\thmnote{ #3}\fi}%         Head spec

\theoremstyle{theorem}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}

\swapnumbers    
\newtheoremstyle{definition}% name
  {}%         Space above, empty = `usual value'
  {}%         Space below
  {}% Body font
  {}%         Indent amount
  {\bfseries}% Head font
  {.}%        Punctuation after thm head
  {\newline}% Space after head: \newline = linebreak
  {}%         Head spec

\theoremstyle{definition}
\newtheorem{defn}[thm]{Definition}
\newtheorem{example}[thm]{Example}
\theoremstyle{remark}
\newtheorem{remark}[thm]{Remark}

%Makes "Proof." boldface
\makeatletter
\renewenvironment{proof}[1][\proofname] {\par\pushQED{\qed}\normalfont\topsep6\p@\@plus6\p@\relax\trivlist\item[\hskip\labelsep\bfseries#1\@addpunct{.}]\mbox{}\\*}{\popQED\endtrivlist\@endpefalse}
\makeatother

%Fix if theorem starts with a list
\makeatletter
\def\itemfix{%
\if@inlabel
 \noindent \par\nobreak\vskip-\baselineskip\hrule\@height\z@
\fi}

\let\olditemize\itemize
\def\itemize{\itemfix\olditemize}
\makeatother

\makeatletter
\def\enumfix{%
\if@inlabel
 \noindent \par\nobreak\vskip-\baselineskip\hrule\@height\z@
\fi}
\let\oldenumerate\enumerate
\def\enumerate{\enumfix\oldenumerate}

\begin{document}
\section{Some examples}

\begin{defn}
Here is a definition of \emph{something}.
\end{defn}

\begin{thm}[Intermediate Value Theorem]
This is a theorem with a name and with a number.
\end{thm}

\begin{thm}
This is a theorem without name and with a number.
\end{thm}

\begin{proof}
Here is the proof.
\end{proof}

\begin{thm}
\begin{enumerate}
\item Theorem that starts with a list.
\item Which seems to work.
\end{enumerate}
\end{thm}

\begin{thm}
\begin{itemize}
\item Theorem that starts with a list.
\item Which seems to work.
\end{itemize}
\end{thm}

\end{document}
  • In your linked book, the proof label doesn't have a final dot. – Bernard Oct 2 '14 at 12:27
1

Here is a simple solution with ntheorem – which has the advantage of placing automatically the end-of-proof (customisable) symbol, even when the proof ends in a display (group of) equation(s):

\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb}
\usepackage{mathtools, nccmath}
\usepackage{enumitem}
\usepackage[thmmarks, thref, amsmath]{ntheorem}

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

\theoremstyle{changebreak}
\theoremseparator{. }
\theoremheaderfont{\upshape\bfseries}
\theorembodyfont{\itshape}

\newtheorem{thm}{Theorem}[section]

\theorembodyfont{\upshape}
\newtheorem{defi}[thm]{Definition}
\theoremstyle{nonumberbreak}
\theoremseparator{}
\theoremsymbol{\ensuremath{\blacksquare}}
\newtheorem{proof}{Proof}

\begin{document}

\section{A First Section}

\begin{thm}
 A numbered, unnamed theorem.
\end{thm}

\begin{thm}[Rational Zeros Theorem]
Suppose $ c_0 ,c_1 ,\dots, c_n $ be integers and $ r $ a rational number satisfying the polynomial equation.
\begin{equation}\label{intpol}
  c_n xⁿ + c_{n-1} x^{n-1} + ... +c_1 x + c_0 =0
\end{equation}
where $ n ≥ 1$, $ c_{n} \ne 0$ and $ c_0 \ne 0 $. Let $ r = \mfrac{c}{d}$, where $ c, d $ are integers having no common factors and $ d \ne 0 $. Then $ c $ divides $ c_0 $ and $ d $ divides $ c_n $.
\end{thm}

\begin{proof}
\begin{itemize}[wide = 0pt]
  \item[\em First proof.]
Left as an exercise.

  \item[\em Second proof.] We deduce from the hypothesis that
\begin{align*}
   & c_{n}cⁿ + c_{n-1}c^{n-1}d + ... + c_1 cd^{n-1} + c_0 dⁿ = 0, \\
\intertext{which we may rewrite as}
   & c(c_{n}c^{n-2} + c_{n-1}c^{n-2}d + ... + c_1 d^{n-1}) = -c_0 dⁿ\\
\shortintertext{or}
 & d(c_{n-1}c^{n-1} + ... + c_1 cd^{n-2} + c_0 d^{n-1}) = -c_{n}cⁿ.
\end{align*}
\end{itemize}
\end{proof}

\begin{defi}
  A \textbf{rational function} is the quotient of two polynomial functions.
\end{defi}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.