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

🪄 Updates for multi-article typst export with interactive figures #1701

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fwkoch
Copy link
Collaborator

@fwkoch fwkoch commented Dec 18, 2024

I was working on building this PDF: msa-em/nanocartography#7 - It is a multi-article, typst export with many interactive figures and complex equations.

This triggered some updates to tex-to-typst, mainly matrices, brackets, arrows. See continuous-foundation/tex-to-typst@f4ca453...v0.0.12

Additionally, it encouraged some significant updates here in MyST:

Copy link

changeset-bot bot commented Dec 18, 2024

🦋 Changeset detected

Latest commit: 8e3054e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
myst-to-typst Patch
myst-directives Patch
myst-transforms Patch
myst-cli Patch
myst-parser Patch
myst-roles Patch
myst-to-html Patch
mystmd Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -56,6 +56,10 @@ export const figureDirective: DirectiveSpec = {
type: String,
doc: 'A placeholder image when using a notebook cell as the figure contents. This will be shown in place of the Jupyter output until an execution environment is attached. It will also be used in static outputs, such as a PDF output.',
},
static: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I suspect we do not want to call this static. @stevejpurves suggested hard-copy in #1157 . We could also do something like placeholder:pdf, but really, this applies to all "paper" exports: docx, tex, typst, and pdf. placeholder:paper? Not sure how confusing placeholder vs placeholder:pdf might be.

@@ -104,6 +104,11 @@ export const containerHandler: Handler = (node, state) => {
return;
}

if (node.enumerator?.endsWith('.1')) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This could be improved. It places strict assumptions on the enumerator in numbering. e.g. It works great for:

numbering:
  enumerator: 3.%s

But doesn't work at all for:

numbering:
  enumerator: (3-%s)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Possibly we need better translation between myst and typst enumerators.

@@ -49,8 +49,8 @@ const textOnlyReplacements: Record<string, string> = {
'©': '#emoji.copyright ',
'®': '#emoji.reg ',
'™': '#emoji.tm ',
'<': '\\< ',
'>': '\\> ',
'<': '\\<',
Copy link
Collaborator Author

@fwkoch fwkoch Dec 18, 2024

Choose a reason for hiding this comment

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

Making this change did not feel good - I'm not sure why we were previously adding a space after these characters. However, for the examples I was looking at, the addition of this space looked very wrong, and simply removing it here fixed the output.

@rowanc1 perhaps you have some recollection of this...?

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.

1 participant