Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing qed symbol in nested proofs #25

Open
fagu opened this issue Apr 21, 2024 · 1 comment
Open

Missing qed symbol in nested proofs #25

fagu opened this issue Apr 21, 2024 · 1 comment

Comments

@fagu
Copy link

fagu commented Apr 21, 2024

If you nest multiple proofs, only the innermost ones get a qed symbol.

#set page(width: 11cm, height: auto, margin: 1em)
#set par(justify: true)

#import "@preview/ctheorems:1.1.2": *
#show: thmrules
#let theorem = thmplain("theorem", "Theorem")
#let claim = thmplain("claim", "Claim", base: "theorem")
#let proof = thmproof("proof", "Proof")

#theorem[
  #lorem(10)
]
#proof[
  #lorem(10)
  #claim[
    #lorem(10)
  ]
  #proof[
    #lorem(20)
  ]
  #claim[
    #lorem(10)
  ]
  #proof[
    #lorem(20)
  ]
  #lorem(20)
]

nested-qed

A solution could be to make the thm-qed-done state a stack of booleans: At the start of a proof, push false. When showing the qed symbol, set the last entry to true. At the end of a proof, remove the last entry and show the qed symbol if the removed entry was false.

(That also seems to be what latex does.)

@sahasatvik
Copy link
Owner

Thanks for pointing this out, and for the fix; I'll implement this in v2.0.0.

I'm pretty sure that there's some wonky behavior when nesting theorems (mainly with numbering and referencing), fair warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants