Add support for page references through new ref.form property#4729
Add support for page references through new ref.form property#4729laurmaedje merged 7 commits intotypst:mainfrom
ref.form property#4729Conversation
|
I think it is very close to So, I think perhaps the best solution is not even |
|
Okay I see what you mean, and I agree that is a nicer solution. Just two questions on how
|
I'm not sure how useful it is, so I think I would skip it.
Tricky question. But I general agree that I would expect it to behave similarly to normal refs. |
pageref() element functionref.form property
|
I've added |
No, it doesn't make sense. Also since instances of PageElem won't exist anymore with #4840. |
|
I think I've fixed everything up so that it all works now that #4840 has been merged. Though I might have missed some things that need to be done differently. |
|
Can we use the translations from babel? |
We should be able to. I didn't want to go through babel and try to add them to this PR though until after its been reviewed. I am also not sure whether for other languages the following are the same as in English: page number after the page word, capitalisation of the page word (*), the grammar. Though I suppose this falls under #2485. (*) In the current implementation, the page word "Page" is always capitalised. I don't know if this is the right default; for figures or equations it makes sense for the word to be capitalised. I guess ideally we would automatically detect if |
laurmaedje
left a comment
There was a problem hiding this comment.
Handling suppelements properly is really tricky (not just for page references, more generally). With starting sentence, language, etc. Maybe there's a reason why LaTeX doesn't add a supplement by default ...
I think we could add translations now. |
|
I'll have a look at doing that. |
888ac0f to
285135e
Compare
|
A couple of things from my attempt at adding translations, using the info from babel. |
This comment was marked as resolved.
This comment was marked as resolved.
df293a5 to
f05bcd8
Compare
| heading = الفصل | ||
| outline = المحتويات | ||
| raw = قائمة No newline at end of file | ||
| raw = قائمة |
There was a problem hiding this comment.
What is "raw" in this context? because the Arabic word means "menu".
There was a problem hiding this comment.
a code listing from a backtick block
There was a problem hiding this comment.
Hah following the git blame it seems I am to blame, but this does not sound right. Apparently the etymology for "listing" is that it is, literally, a printed list of lines.
I do not actually know what a good Arabic word for that would be. قائمة (which does mean List, in my defense) is not it, however. Maybe مثال , "Example" ?
(In topic, the word for "page" is correct.)
There was a problem hiding this comment.
I got curious and did a bit of Googling, and it seems I found a suitable Arabic word: عادي. The phrase نص عادي is used in the Arabic Wikipedia to denote the term "plain" or "raw" text.
So, it's probably better to use the word عادي as it seems to be the closest and most commonly used term for conveying "plain" or "raw" text.
And the word قائمة really only shows images related to menus and lists😄
There was a problem hiding this comment.
عادي means regular. Has nothing to do with code, or code listings
I spent the day yesterday looking at Arabic computer papers, they either use شكل meaning figure or nothing at all.
There was a problem hiding this comment.
Maybe it'd be best to create an issue for the translation of raw, and move this discussion there. Unless a correct translation has been decided upon, then I guess I can add it to this PR.
a93233c to
20762d7
Compare
|
Thank you! I was a bit unsure about this but it's true that if we change the reference system in the future in a larger way (which I think will be necessary), things will be highly breaking either way. |
Closes #2873.
Although now in 0.11 it is fairly simple to write a
pageref()function yourself in Typst (see #2873 (comment) by @laurmaedje), the consensus in the linked issue seems to be that this should be built-in. This PR does just that.I'm not sure whether it should be scoped with
refor not. Currently it isn't, and can be called with#pageref(). Sincepageref()can take any label (not just ones attached to elements that are referenceable), imo it doesn't quite make sense being#ref.page().I also added the function in #2873 (comment) to the doc comment of
pageref(). I think it is a good example of context, though maybe it would be better placed elsewhere.