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

Improve macro sharing mechanism #1

Open
paolobrasolin opened this issue Jan 7, 2022 · 3 comments
Open

Improve macro sharing mechanism #1

paolobrasolin opened this issue Jan 7, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@paolobrasolin
Copy link
Owner

paolobrasolin commented Jan 7, 2022

@jonsterling has implemented some high level mechanism to define and share macros between LaTeX/KaTeX/AnTeX. Context:

Hopefully we can use some oh his ideas to improve the setup, once he publish them!

@paolobrasolin paolobrasolin added the enhancement New feature or request label Jan 7, 2022
@paolobrasolin paolobrasolin self-assigned this Jan 7, 2022
@jonsterling
Copy link

I’ll share my code with you! it may or may not be the way that you want to proceed, but it could be potentially helpful.

@paolobrasolin
Copy link
Owner Author

paolobrasolin commented Jan 7, 2022

I’ll share my code with you! it may or may not be the way that you want to proceed, but it could be potentially helpful.

That'd be great!

@jonsterling
Copy link

jonsterling commented Jan 7, 2022

So my code is now available here: https://github.com/jonsterling/math

  1. I am targeting mathjax right now, but what I did can easily be adapted to katex, which takes as input only a slightly different format of macro definition. (update: I switched to KaTeX)

  2. The file macros/topos.rkt demonstrates how you might create a platform-agnostic macro library. When this file is executed by Racket, it replaces assets/macros/topos.sty and assets/macros/topos.json which are in format that can be understood by LaTeX and MathJax respectively.

  3. In a Jekyll page, set the variable macrolib to the name of the macro library that you wish to be exposed to MathJax. In our running example, I set macrolib: topos. Then in your page-local antex prelude, write \usepackage{topos}

The way that this works is as follows:

  1. The custom-head.html template has been upgraded to read the macrolib variable, and if it is set, dynamically load the corresponding json file, and then use it to dynamically set up the MathJax configuration.

  2. The antex configuration in _config.yml has been upgraded to allow latexmk to search assets/macros/ for packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants