TransWikia.com

Implement proof environment as normal paragraph, without list

TeX - LaTeX Asked by Miguel V. S. Frasson on July 22, 2021

I am formatting a math book from another author that uses a lot of figures inside paragraphs, like those produced by wrapfigure environment. I am getting a lot of trouble because proof and other theorem like environments are implemented by means of lists, and lists interact badly with wrapfigure.

I tried packages wrapfig, cutwin and insbox.tex. The last one was promissing, works inside usual proof for first wrapped figure, but fails from the second and so on, I suspect that it is because of its “restoration” after it finishes with the figure:

def@restore@{%
    global@wherebottom = 0cm
    global@byframefalse
    globaleverypar = {}%
    globallet par = endgraf
    globalparshape = 1 0cm hsize
}

So I decided to avoid list environments and stick with wrapfigure or insbox.

From amsbook.cls we have the following definition for proof environment:

newenvironment{proof}[1][proofname]{par
  pushQED{qed}%
  normalfont topsep6p@@plus6p@relax
  trivlist
  itemindentnormalparindent
  item[hskiplabelsep
        scshape
    #1@addpunct{.}]ignorespaces
}{%
  popQEDendtrivlist@endpefalse
}

(You can see trivlist and endtrivlist in the definition.)

I have made my version without lists, that seams to be OK. Even qedhere inside math is working. Wrapped figures are all happy.

renewenvironment{proof}[1][proofname]{par
  pushQED{qed}%
  vspace{6p@@plus6p@}%
  noindent
    textit{#1@addpunct{.}}enskipignorespaces
  }{%
    popQED
    vspace{6p@@plus6p@}@endpefalse
  }

But there must be a reason AMS and others implement these environments as lists that I don’t know, but would like to know, and if you know, please share this knoledge 🙂 I suspect it could be better spacing before and after the environment.

My question is: how to have a proof environment as good as the one from AMSmath, good looking, good spacing, but without list environments? Am I missing something in my definition of proof?

Edit: I add here a MWE to illustrate.

documentclass{article}

usepackage{lipsum,amsthm}
input{insbox}

% my version of proof, here as myproof
makeatletter
newenvironment{myproof}[1][proofname]{par
  pushQED{qed}%
  vspace{6p@@plus6p@}%
  noindent
    textit{#1@addpunct{.}}enskipignorespaces
  }{%
    popQED
    vspace{6p@@plus6p@}@endpefalse
  }
makeatother
  
begin{document}

InsertBoxR{0}{rule{1cm}{1cm}}
begin{proof}
  lipsum[1][1-7]

  InsertBoxR{0}{rule{1cm}{1cm}}
  lipsum[1][1-7]
end{proof}

lipsum[1][1-7]

InsertBoxR{0}{rule{1cm}{1cm}}
begin{myproof}[My proof]
  lipsum[1][1-7]

  InsertBoxR{0}{rule{1cm}{1cm}}[-1]
  lipsum[1][1-7]
end{myproof}

end{document}

Result below: fisrt black square is over text, others are OK.

first black square is over text

One Answer

When AMS created the three document classes amsart, amsbook and amsproc, there was a strongly held philosophy that they should be as close to the basic LaTeX classes article, book and proc, so that it would be possible for an author to prepare a document using one of those, and simply change the documentclass line to apply the AMS style. This has proved to be a sound decision for the most part.

The "basic" theorem support in article, etc., was based on the list structure, so that was essentially copied for the AMS classes, of which amsthm is an integral part. This was a big mistake, but it wasn't realized until it was too late, and the AMS classes were already in quite extensive use. (In fact, it's my opinion that considering almost everything to be a list is a serious design misfeature in LateX, one that has never been properly reconsidered, and now it's too late.)

I know that it is on the list of modifications "to be considered" (also known locally as the "bugs and requests list") to get rid of the list restriction -- it only causes problems -- but when or if it might happen is unknown to me. (I no longer have access to that list, but guess that this request was first made in the last century, i.e., pre-2000.)

By the way, amsmath is only peripherally related to the proof environment. amsmath and amsthm work together, but proof is defined in amsthm, not amsmath.

Sorry that this answers only half your question.

Correct answer by barbara beeton on July 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP