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

Separate math macros file #336

Open
alanlujan91 opened this issue Mar 30, 2023 · 6 comments
Open

Separate math macros file #336

alanlujan91 opened this issue Mar 30, 2023 · 6 comments
Labels
story Feature request or idea to improve mystjs

Comments

@alanlujan91
Copy link

Which area is this feature request for?

MyST Markdown Syntax

Describe the feature you'd like to request

I have a huge list of latex macros defined on my myst.yml file under math:. I would like to be able to define these on a separate file, such as math_macros.yml that I could reference in my myst.yml config file instead of having the list in it.

This could also allow me to organize my macros better by adding comments and some separation between different types of macros.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

@alanlujan91 alanlujan91 added the story Feature request or idea to improve mystjs label Mar 30, 2023
@welcome
Copy link

welcome bot commented Mar 30, 2023

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@rowanc1
Copy link
Member

rowanc1 commented Mar 30, 2023

Thanks @alanlujan91! This is really cool, and can mean that these are shared between projects pretty easily as well. The LaTeX writing as well as the HTML only pulls in the macros that you use, which I quite like -- meaning if you submit the source to arXiv or something, you get a concise set of macros at the top of the LaTeX file of only the macros that you used.

@fwkoch I think that we could do this if the math macros is a string (and exists on disk or remotely)? I think the one thing that we need to look out for is that we don't make myst-frontmatter dependent on running from the filesystem or on fetch behaviour (needs to run in a browser as well). That could be done by passing in a function that can resolve files, and might take a bit of thought beyond this specific use case. Any thoughts on that?

@agoose77
Copy link
Collaborator

agoose77 commented Mar 30, 2023

@rowanc1 this might be where you're thinking already, but maybe this can be a project-like property? That way, per-file properties are defined externally, and per-file macros are defined in the particular file frontmatter.

@rowanc1
Copy link
Member

rowanc1 commented Mar 30, 2023

Yes, totally! I think this probably would make the most sense on the project. The way that citations work is that you can define on the project, and then layer in per-file bibliographies. I think that makes sense for this feature as well. You might want to use your lab-groups macros in general, but add a few extra ones for a specific file.

I think that also might mean that this could be a list of strings/files/urls well.

e.g.

math: my_lab_group_macros.yml
# or
math:
  - my_lab_group_macros.yml
  - my_custom_macros.yml
# or
math:
  '\dobs': '\mathbf{d}_\text{obs}'

I think in all cases these resolve to a single dictionary, and also warn if there are things that get over-written.

When we are changing this we should also think about #280, which allows for optional arguments in the macros.

@fwkoch
Copy link
Member

fwkoch commented Mar 30, 2023

Should we do this in a non-math specific way? i.e. just specify external frontmatter file(s) that combine together? We already do this for page frontmatter, with fallback logic to fill in fields from project frontmatter. We would need slightly different logic to combine these, but then we could basically include any number of frontmatter files. So something like:

title: My Article
authors:
  - name: Jane Doe
include:
  - my_lab_group_macros.yml
  - my_custom_macros.yml
  - https://example.university.edu/data/myst_licenense.yml
  - lab_group_authors.yml

@rowanc1
Copy link
Member

rowanc1 commented Mar 30, 2023

I really like that idea, and we do already do this with site/project/page frontmatter, it is just adding a few new ways of bringing that in (I think we will also have to tweak the math side a bit). The potential for reuse and some standardization of these components is pretty high.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
story Feature request or idea to improve mystjs
Projects
None yet
Development

No branches or pull requests

4 participants