1

I am using amsthm and amsbook and nesting claims and proofs. I would like to have two things:

1) Proofs that are in a deeper layer should be indented.

2) There should be a semi-box (only left and bottom lines) around each proof to help the reader. If the proof is longer than a page the left line of the box should continue over pages.

This is what my example looks like right now: enter image description here This is what my example should look like:enter image description here Here is the code:

\documentclass[oneside,english,reqno]{amsbook}
\usepackage{etoolbox}
\usepackage{thmtools}

\makeatletter
\providecommand{\claimname}{Claim}
\providecommand{\definitionname}{Definition}
\providecommand{\theoremname}{Theorem}

\declaretheoremstyle[
  spaceabove=\thm@preskip, 
  spacebelow=\thm@postskip,
  headfont=\normalfont\scshape,
  notefont=\mdseries, 
  notebraces={(}{)},
  numberwithin=section,
  headformat=\smash{\fbox{\NUMBER.}}~\NAME\NOTE,
  bodyfont=\BodyFont,
]{boxed}
\def\BodyFont{\normalfont\itshape}
\declaretheorem[style=boxed,name=\theoremname]{thm}
\declaretheorem[style=boxed,name=\claimname]{claim}
\def\BodyFont{\normalfont}
\declaretheorem[style=boxed,name=\definitionname]{defn}

\numberwithin{section}{chapter}

\makeatletter 
\let\sv@thm\@thm
\def\@thm{\let\indent\relax\sv@thm} 

\let\oldref\ref
\newcommand\thref[1]{\textup{\fbox{\ref{#1}}}}

\expandafter\patchcmd\csname\string\proof\endcsname
  {\normalparindent}{0pt }{}{}
\makeatother


\begin{document}

\chapter{First Chapter}

\section{First Section}

\begin{claim}
\label{claim:Cool_Claim}Some Claim some words some words some
words some words some words some words some words some words some
words some words some words some words some words some words some
words some words some words some words some words some words some
words some words some words some words
\begin{proof}
This is the text of the proof. This is the text of the proof.  This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof.
\end{proof}
\end{claim}
\begin{claim}
This is a new claim
\begin{proof}
This is the proof of the new claim. 
\begin{claim}
Here is a subclaim of the new claim.
\begin{proof}
And this is the proof of the subclaim.
\end{proof}
\end{claim}
\end{proof}
\end{claim}
\begin{defn}
Some Definition
\end{defn}
This is now normal text again. As we learnt in \thref{claim:Cool_Claim}. 
\end{document}
5

One way to achieve this using mdframed and surrounding the proof environment with an appropriate mdframed environment:

\documentclass[oneside,english,reqno]{amsbook}
\usepackage{etoolbox}
\usepackage{thmtools}
\usepackage[framemethod=tikz]{mdframed}

\surroundwithmdframed[
  hidealllines=true,
  leftline=true,
  bottomline=true,
  innertopmargin=0pt,
  skipabove=\dimexpr\topsep+6pt\relax,
  skipbelow=\topsep,
  innerrightmargin=0pt,
]{proof}

\makeatletter
\providecommand{\claimname}{Claim}
\providecommand{\definitionname}{Definition}
\providecommand{\theoremname}{Theorem}

\declaretheoremstyle[
  spaceabove=\thm@preskip, 
  spacebelow=\thm@postskip,
  headfont=\normalfont\scshape,
  notefont=\mdseries, 
  notebraces={(}{)},
  numberwithin=section,
  headformat=\smash{\fbox{\NUMBER.}}~\NAME\NOTE,
  bodyfont=\BodyFont,
]{boxed}
\def\BodyFont{\normalfont\itshape}
\declaretheorem[style=boxed,name=\theoremname]{thm}
\declaretheorem[style=boxed,name=\claimname]{claim}
\def\BodyFont{\normalfont}
\declaretheorem[style=boxed,name=\definitionname]{defn}

\numberwithin{section}{chapter}

\makeatletter 
\let\sv@thm\@thm
\def\@thm{\let\indent\relax\sv@thm} 

\let\oldref\ref
\newcommand\thref[1]{\textup{\fbox{\ref{#1}}}}

\expandafter\patchcmd\csname\string\proof\endcsname
  {\normalparindent}{0pt }{}{}
\makeatother


\begin{document}

\chapter{First Chapter}

\section{First Section}

\begin{claim}
\label{claim:Cool_Claim}Some Claim some words some words some
words some words some words some words some words some words some
words some words some words some words some words some words some
words some words some words some words some words some words some
words some words some words some words
\begin{proof}
This is the text of the proof. This is the text of the proof.  This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof.
\end{proof}
\end{claim}
\begin{claim}
This is a new claim
\begin{proof}
This is the proof of the new claim. 
\begin{claim}
Here is a subclaim of the new claim.
\begin{proof}
And this is the proof of the subclaim.
\end{proof}
\end{claim}
\end{proof}
\end{claim}
\begin{defn}
Some Definition
\end{defn}
This is now normal text again. As we learnt in \thref{claim:Cool_Claim}. 
\end{document}

enter image description here

As barbara beeton has mentioned in a comment, having each structure with an independent counter will be a nightmare for your readers; it's much better to let the structures share one counter (achieved using the sibling key from thmtools). A little reduced example showing how to obtain structures sharing a counter:

\documentclass[oneside,english,reqno]{amsbook}
\usepackage{thmtools}

\numberwithin{section}{chapter}

\providecommand{\claimname}{Claim}
\providecommand{\definitionname}{Definition}
\providecommand{\theoremname}{Theorem}

\makeatletter
\declaretheoremstyle[
  spaceabove=\thm@preskip, 
  spacebelow=\thm@postskip,
  headfont=\normalfont\scshape,
  notefont=\mdseries, 
  notebraces={(}{)},
  headformat=\smash{\fbox{\NUMBER.}}~\NAME\NOTE,
  bodyfont=\BodyFont,
]{boxed}
\def\BodyFont{\normalfont\itshape}
\declaretheorem[style=boxed,numberwithin=section,name=\theoremname]{thm}
\declaretheorem[style=boxed,name=\claimname,sibling=thm]{claim}
\def\BodyFont{\normalfont}
\declaretheorem[style=boxed,name=\definitionname,sibling=thm]{defn}
\makeatother

\begin{document}

\chapter{Test}
\section{Test}
\begin{claim}
test
\end{claim}
\begin{claim}
test
\end{claim}
\begin{defn}
test
\end{defn}

\end{document}
  • very nice! i may steal it. – barbara beeton Feb 28 '15 at 15:07
  • @barbarabeeton Thanks. Feel free to steal it :) I also liked this idea (although it has so many lines, in my opinion). Since the rule is there to mark the end of a proof the end-mark could be suppressed. – Gonzalo Medina Feb 28 '15 at 16:30
  • i'll have to think about the final end-of-proof mark. you're probably right. i suppose that some text could follow the sub-claim, and in that case, the mark should not be suppressed. i do find the "matching" numbers for claims and definitions disconcerting -- did we learn something in claim 1.1.1 or definition 1.1.1? there's something to be said for using just a single numbering for everything (probably secion-wise) to make it reasonable to find what's being referred to. – barbara beeton Feb 28 '15 at 16:44
  • @barbarabeeton Yes, the counter should be shared. However, there seems to be some incompatibility trying to achieve this with thmtools: I haven't tested the similar approach directly using amsthm (as in another answer from the same OP). Could we continue this discussion in a chat room? (I'll be around here in some hours). – Gonzalo Medina Feb 28 '15 at 17:38
  • If space allows, it may be prudent to indent a little from the right, too. Myself, I'd do away with the lines but add an indicator at the end-of-proof marker, e.g. like $\square_{\text{1.3.1}}$. – Raphael Feb 28 '15 at 19:18

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.