Skip to content

typst logo partial #13108

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

Closed
wants to merge 4 commits into from
Closed

typst logo partial #13108

wants to merge 4 commits into from

Conversation

gordonwoodhull
Copy link
Contributor

@gordonwoodhull gordonwoodhull commented Jul 21, 2025

Fixes #13107

This PR

  • Moves the Typst logo declaration to a new partial.

    The typst-brand-yaml.lua filter populates the logo object in the pandoc metadata.

    So one can replace the partial, or change the logo properties after the Lua filter.

  • Declares new brand-logo and brand-logo-images dictionaries in the Typst header, for access to all the resolved logos for the chosen brand-mode

Not sure if it's too late to add new Typst partials for 1.8. If not, we might also consider

moves the logo declaration to a new partial
the lua filter fills the logo object in the pandoc metadata

declares new brand-logo and brand-logo-images dictionaries in Typst header
@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Jul 21, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@gordonwoodhull gordonwoodhull marked this pull request as ready for review July 22, 2025 17:06
@gordonwoodhull gordonwoodhull force-pushed the feature/typst-logo-partial branch from 8101223 to 73d72e9 Compare July 22, 2025 17:20
@gordonwoodhull
Copy link
Contributor Author

@mcanouil, does this suit the use case you had in mind?

IIRC you ran into conflicts customizing page.background.

@mcanouil
Copy link
Collaborator

mcanouil commented Jul 22, 2025

It seems so, I'll check more thoroughly tomorrow to see how this can work with the workaround I've put in place to add side text in margins.

My first thought is that I'm not sure we want to name that partial logo.
For instance, having to modify the logo partial in order to add background elements is a bit weird.
Since the partial is about setting the page background to set the logo but is not limited to the logo, maybe a name closer to what the partial set would be better: page-background?

@mcanouil
Copy link
Collaborator

mcanouil commented Jul 23, 2025

I confirm having the set page() has a partial would allow users to set/reset background with more than just the logo and because the logic would be in the template, it also allows to place the logo anywhere with any kind of transformation allowed by Typst.

Another thought, If the other set page() code from the article function were to be placed alongside the setting for the logo, it could be a general partial named page-layout.

#set page(
  paper: $if(papersize)$"$papersize$"$else$"us-letter"$endif$,
  margin: $if(margin)$($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$)$else$(x: 1.25in, y: 1.25in)$endif$,
  pagenumbering: $if(page-numbering)$"$page-numbering$"$else$none$endif$,
  background: $if(logo)$align($logo.location$, box(inset: $logo.inset$, image("$logo.path$", width: $logo.width$$if(logo.alt)$, alt: "$logo.alt$"$endif$)))$else$none$endif$,
)

(not 100% sure of the syntax)

@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Jul 23, 2025

Thanks @mcanouil!

I'm definitely on board with page-background.

I'm a bit wary of diverging further from the Pandoc template, and any unforeseen consequences of moving the other page stuff, but that is a neat idea as well. I know users have asked for more control over page numbering. Hmm.

@mcanouil
Copy link
Collaborator

mcanouil commented Jul 23, 2025

My main concern is the partial will be used so it will be harder to change any decisions without making a breaking change, regardless of doing any of the proposals.

I do like the partial idea but I'm wondering if this should be a bigger work design not focusing on logo. Maybe a PR to Pandoc.

@gordonwoodhull
Copy link
Contributor Author

gordonwoodhull commented Jul 23, 2025

Yeah... I think the fact that there are two #set page(...), and we don't really know if they should be combined, indicates we should discuss further and maybe submit upstream. And it should be way more general than just for logos.

The title block partial is better defined, maybe we should do that first.

I'll convert this back to a draft for now.

@gordonwoodhull
Copy link
Contributor Author

Replaced by #13120

@gordonwoodhull gordonwoodhull deleted the feature/typst-logo-partial branch July 23, 2025 19:37
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.

access typst brand yaml logo in templates/partials
3 participants