linjer / jekyll-katex

[DEPRECATED] Jekyll plugin for easy server-side math rendering via KaTeX
MIT License
96 stars 8 forks source link

Macro options? #16

Open Jaxan opened 5 years ago

Jaxan commented 5 years ago

Hi,

Thank you for this Jekyll plugin. It works really well so far. However, I tried adding macros to the configuration, like so:

katex:
  rendering_options:
    macros:
      - "\\Nat": "\\mathbb{N}"

I tried several variations with quotes and backslashes, but none of them works. Is it supported?

linjer commented 5 years ago

@Jaxan thanks for opening this issue. Only a few rendering_options are actually supported, and macros is currently not one of them. It looks like it should be fairly easy to add support for. I'll work on this as soon as I am returned from traveling abroad.

dshemetov commented 4 years ago

+1, would appreciate this feature.

linjer commented 4 years ago

@dshemetov @jaxan Thanks for bringing this back up. Do either of you have some examples of complex macros you want to provide? I want to make sure I understand the use case and test against them.

Would something like the following in yaml work?

katex:
  js_path: "{{ Gem::lib_path }}/assets/js"  # Path used to search for katex.min.js
  rendering_options:
    # ...
    macros:
      "mymacro": "x^2"
      "fooMacro": "\frac{1}{x}"
dshemetov commented 4 years ago

Yes, that looks good. Commands with arguments would also be good to test, e.g. expectation. I think this should just work (it's on their main page).

macros:
    "\\E": "\\mathbb{E}\\left[ #1 \\right]"
ethanweinberger commented 3 years ago

Just wanted to add another +1/check for any updates on this issue. Macro support would make this awesome plugin even better!