Skip to content

Change smallcaps into an element function#3981

Merged
laurmaedje merged 5 commits intotypst:mainfrom
Coekjan:smallcaps-elem-fn
May 6, 2024
Merged

Change smallcaps into an element function#3981
laurmaedje merged 5 commits intotypst:mainfrom
Coekjan:smallcaps-elem-fn

Conversation

@Coekjan
Copy link
Copy Markdown
Contributor

@Coekjan Coekjan commented Apr 22, 2024

Description

Different from upper and lower, smallcaps is not always supported by selected font (for example, default font in math equation). In my view, smallcaps is more like emph, strong, etc. so I suggest it should be element function (#3977 ).

This pr closes #3977 and maybe can help those who want to use smallcaps in math equations (#3138 ).

Usage

With this feature, users can customize smallcaps behavior with set/show rules:

#set align(center)

$ #smallcaps[SmallCaps] $

#show smallcaps: set text(font: "linux libertine", fill: blue)

$ #smallcaps[SmallCaps] $

#show math.equation: it => {
  show smallcaps: set text(font: "linux libertine", fill: red)
  it
}

$ #smallcaps[SmallCaps inside Math Equation] $

#smallcaps[SmallCaps outside Math Equation]

image

TODO?

  • Should I add some testcases to verify the behavior? If so, how can I add testcases?
  • Should documentation on smallcaps be changed? If so, I can add examples about the set/show rules on smallcaps.

@Coekjan Coekjan force-pushed the smallcaps-elem-fn branch from 51216be to f3b899f Compare April 30, 2024 13:08
Copy link
Copy Markdown
Member

@laurmaedje laurmaedje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add some testcases to verify the behavior? If so, how can I add testcases?

The only existing smallcaps test is in tests/suite/text/smallcaps.typ. You can add a new test there by adding another --- smallcaps-... --- line there and adding your test code below. For instructions on how to run the tests, see the README.md in tests.

Should documentation on smallcaps be changed? If so, I can add examples about the set/show rules on smallcaps.

We could add a second example showing how to use a custom font, i.e. #show smallcaps: set text(font: "..") and adjust the Note in the docs.

@Coekjan Coekjan force-pushed the smallcaps-elem-fn branch 3 times, most recently from 03b64e7 to 1e4d24b Compare April 30, 2024 14:03
@Coekjan Coekjan requested a review from laurmaedje April 30, 2024 14:04
@Coekjan Coekjan force-pushed the smallcaps-elem-fn branch from 1e4d24b to ba52521 Compare May 1, 2024 08:25
@Coekjan
Copy link
Copy Markdown
Contributor Author

Coekjan commented May 1, 2024

Hi @laurmaedje , I've made the requested changes to this PR and was hoping you could find time for another review when convenient. Thank you!

@Coekjan Coekjan changed the title Change smallcaps into element function Change smallcaps into an element function May 3, 2024
@laurmaedje laurmaedje enabled auto-merge May 6, 2024 12:53
@laurmaedje
Copy link
Copy Markdown
Member

Thanks for your contribution!

@laurmaedje laurmaedje added this pull request to the merge queue May 6, 2024
Merged via the queue into typst:main with commit 556979c May 6, 2024
@Coekjan Coekjan deleted the smallcaps-elem-fn branch May 7, 2024 02:22
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

Successfully merging this pull request may close these issues.

Let smallcaps be element function

2 participants