-
Notifications
You must be signed in to change notification settings - Fork 32
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
[Features] Preserve heading style in title and subtitle #71
Comments
I think that's hard to implement, you might consider setting the color of primary. |
As you wish, However, I believe the solution is really simple. You can just remove the |
Ok, I thought removing |
I suggest that the function #let display-current-heading(
self: none,
level: auto,
numbered: true,
hierachical: true,
depth: 9999,
setting: body => body,
..sty,
) = (
context {
let sty = if sty.pos().len() == 0 {
current-heading => {
if numbered and current-heading.numbering != none {
_typst-builtin-numbering(
current-heading.numbering,
..counter(heading).at(current-heading.location()),
) + h(.3em)
}
current-heading
}
} else if sty.pos().len() == 1 {
sty.pos().at(0)
} else if sty.pos().len() > 1 {
panic("sty allows only a positional argument")
}
let current-heading = utils.current-heading(level: level, hierachical: hierachical, depth: depth)
if current-heading != none {
setting(sty(current-heading))
}
}
)
To achieve the same results in e.g. in header: self => display-current-heading(
setting: utils.fit-to-width.with(grow: false, 100%),
depth: self.slide-level,
it => it.body,
), Moreover, given that there is a #show heading.where(level: 1): set text(size: (1em / 1.4))
#show heading.where(level: 2): set text(size: (1em / 1.2)) |
This doesn't solve the text-size problem and can lead to double numbering. I'd consider adding a 'native' parameter that defaults to false to control this behavior, so that theme developers can choose from it. |
Nonetheless, the parameter of
After some thoughts, I suggest this implementation: #let display-current-heading(
self: none,
level: auto,
hierachical: true,
depth: 9999,
sty: (setting: body => body, numbering: false, current-heading) => setting({
if numbering and current-heading.numbering != none {
_typst-builtin-numbering(
current-heading.numbering,
..counter(heading).at(current-heading.location()),
) + h(.3em)
}
current-heading.body
}),
..setting-args,
) = (
context {
let current-heading = utils.current-heading(level: level, hierachical: hierachical, depth: depth)
if current-heading != none {
if sty == none {
current-heading
} else {
sty(..setting-args, current-heading)
}
}
}
) In this way, the current behavior is preserved, and one can easily use a custom |
I think it's a good idea, and I'll consider adding it in the next release. |
I would like to be able to set a style for all heading, which if not explicitly modified in the theme is honored.
For example, I would like to set the style for all the headings, even if they are the title or the subtitle of the slide.
In the following code, I would expect that
Title
,First Slide
and123
will be alwaysred
andsmallcaps
.Currently, only
123
isred
andsmallcaps
Also adding this option in the
init
of theconfig-methods
doesn't work.The text was updated successfully, but these errors were encountered: