-
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
Color text on set of subslides #111
Comments
This is because #import "@preview/touying:0.5.3": *
#import themes.simple: *
#let my_color(self: none, visible-subslides, col, cont) = {
if utils.check-visible(self.subslide, visible-subslides) {
text(fill: col, cont)
} else {
cont
}
}
#let color(visible-subslides, col, cont) = {
touying-fn-wrapper(
my_color,
last-subslide: utils.last-required-subslide(visible-subslides),
visible-subslides,
col,
cont,
)
}
#show: simple-theme.with(
aspect-ratio: "16-9",
config-methods(
cover: utils.semi-transparent-cover.with(alpha: 85%),
color: my_color,
),
)
= Title
== Title of Slide
#color("2-", red, "this works as I want")
#slide(repeat: 3, self => [
#let (uncover, color) = utils.methods(self)
This doesn't:
$ f(x) &= (x + 1)^2 \
uncover("2-", color("2", #red, &= x^2 + x + x + 1)) \
uncover("3", &= x^2 + 2x + 1)
$
]) |
Thanks for your comments, I'm not against including such a function into touying, but I think it should be more elegant designed, for example we might use syntax. #effect("2", text.with(fill: red))[Something] |
Ah, that makes sense! Thanks!
Yes, that's true. I like your suggestion. That would also make it more general. I would really like to see this feature in touying. |
I may consider it further in the future, thanks. |
I see a function Lines 375 to 387 in e54003c
Is that intentional? And if not could it be added? I also noticed a typo in the example of the docstring for the function here: Line 492 in e54003c
I guess the example should rather read #effect("2-", text.with(fill: red))[Something] ?
|
I forgot to add it to methods, I will add it in the next version.
|
Great, thanks! Do you have a rough estimate, when that will be? I'm considering updating my template to touying:0.5.4. But if version 0.5.5 will be out soon, I will directly update it to 0.5.5.
I'm not sure I understand. #let effect-red = effect.with(text.with(fill: red))
effect-red("2-")[Something] doesn't work because of the same reason. I updated the above link to demonstrate it. Maybe I'm misunderstanding what you mean. Could you clarify? |
I made a mistake, I'm sorry, I will immediately release a new version to fix. |
Thanks! |
Oh, I have already released a new waiting version. Since I have been busy recently, I just rushed to deal with these things, so it may be a little rough :-( |
First of all, thank you for the very nice package. I recently built my own template based on my previous LaTeX template and managed to create almost identical results (while benefiting from typst and touying compared to LaTeX and beamer).
I mainly have two issues, which currently hinder me in completely switching to typst for presentations (this issue and an upcoming one).
I usually heavily use coloring of certain parts (in LaTeX with
\color<>[]{}
), i.e. I want some text (or part of a formula) to be colored only in a set of subslides. If I haven't missed anything, this is currently not supported by touying out-of-box. After looking at the source code, I figured out I can hack something together by defining it on my own. See https://typst.app/project/r2RWPmJouYepvYdkL3EtPE for an MWE. This already works quite nicely in simple situations, but doesn't work for more complex ones, where I need the callback style because IIUC I cannot get mycolors
function byutils.methods(self)
. Note that my example works without thesemi-transparent-cover
, which I don't quite understand.Is there interest in including such a function in touying? If yes, I would be happy to create a PR with an initial suggestion.
The text was updated successfully, but these errors were encountered: