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

How to implement the same functionality as \newtheorem in LaTex #337

Closed
lsl00 opened this issue Mar 26, 2023 · 8 comments
Closed

How to implement the same functionality as \newtheorem in LaTex #337

lsl00 opened this issue Mar 26, 2023 · 8 comments

Comments

@lsl00
Copy link

lsl00 commented Mar 26, 2023

As the title says,in Latex you can define new mathematical environment like lemma :\newtheorem{lemma}{Lemma}.

Even you can attach a counter like:\newtheorem{lemma}{Lemma}[section].

And you can also add label to it ,then reference it.

@sahasatvik
Copy link

sahasatvik commented Mar 26, 2023

I've been trying to script this, but the counters don't quite work the way I want them to! Specifically, I'd like the "corollary" and "proof" counters to be attached to the "theorem/lemma" counter, but the trailing number doesn't update - see Corollaries following Theorem 1.2 in the preview. I'd like them to go 1.2.1, 1.2.2, 1.2.3. Annoyingly, the attachment works here only after the first theorem - see Proofs following Theorem 1.1.1. I think #325 would help a lot here.

Project here.

UPDATE: Up on GitHub as typst-theorems.

download

@sahasatvik
Copy link

sahasatvik commented Mar 27, 2023

Update: I managed to make this work, using a rather hacky manipulation of state (thanks to @laurmaedje !)
Once again, the complete solution is in this project.

UPDATE: Up on GitHub as typst-theorems.

@lsl00
Copy link
Author

lsl00 commented Mar 28, 2023

Update: I managed to make this work, using a rather hacky manipulation of state (thanks to @laurmaedje !) Once again, the complete solution is in this project.

A nice work!

@taooceros
Copy link

I am a little bit query can we do cross reference to theorem? I couldn't find a good way to create label on the thmbox

@sahasatvik
Copy link

sahasatvik commented Mar 29, 2023

That's true; currently I'm using a messy state instead of a counter to keep track of the numbering. I'll try and implement proper labeling later. Feel free to open an issue at typst-theorems!

Update: A basic from of labeling/referencing for these theorem environments is up; see the example here.

@SeniorMars
Copy link

I will port my latex template soonish, I hope that typst gets more extensive because I love these new projects.

@taooceros
Copy link

That's true; currently I'm using a messy state instead of a counter to keep track of the numbering. I'll try and implement proper labeling later. Feel free to open an issue at typst-theorems!

Update: A basic from of labeling/referencing for these theorem environments is up; see the example here.

Thanks! This is very nice

@laurmaedje
Copy link
Member

This is a bit broad for an issue, so I'm gonna close this.

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

5 participants