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 change the init function of a theme? #107

Open
nasyxx opened this issue Oct 30, 2024 · 0 comments
Open

How to change the init function of a theme? #107

nasyxx opened this issue Oct 30, 2024 · 0 comments

Comments

@nasyxx
Copy link

nasyxx commented Oct 30, 2024

Hi,

I want to derive the simlpe theme, and change some content of it to make my own theme. Because I only want to change some default global settings, I don't like to leave a copy in my local. Thus, I tried to change the default init function to inject the configuration. But it failed.

I tried to do like this:

#show: simple-theme.with(
  aspect-ratio: "16-9",
  config-methods(
    init: (self: none, body) => {
      set text(size: 25pt, font: "Andale Mono", fallback: true)

      show heading.where(level: 2): it => {
        text(bottom-edge: "bounds")[
          *#it.body*
          // #v(-30pt)
          #line(length: 100%, stroke: 2pt + gradient.linear(..color.map.mako))
          // #v(-20pt)
        ]
      }

      set math.equation(numbering: "(1)")

      show link: underline

      show strong: alert

      body
    },
  ),
)

= A

== BB

cccc

However, it shows the error:

error: panicked with: "Unsupported mark `touying-fn-wrapper` at page 2. You can't use it inside some functions like `context`. You may want to use the callback-style `uncover` function instead."
   ┌─ @preview/touying:0.5.3/src/configs.typ:48:8
   │
48 │         panic("Unsupported mark `" + kind + "` at page " + str(page-num) + ". You can't use it inside some functions like `context`. You may want to use the callback-style `uncover` function instead.")
   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Looks like I missed something.

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

1 participant