jekyll-katex icon indicating copy to clipboard operation
jekyll-katex copied to clipboard

Macro options?

Open Jaxan opened this issue 5 years ago • 5 comments

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?

Jaxan avatar Apr 11 '19 09:04 Jaxan

@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.

linjer avatar Apr 14 '19 08:04 linjer

+1, would appreciate this feature.

dshemetov avatar Nov 09 '19 10:11 dshemetov

@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}"

linjer avatar Nov 13 '19 21:11 linjer

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]"

dshemetov avatar Nov 13 '19 21:11 dshemetov

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

ethanweinberger avatar Aug 20 '20 05:08 ethanweinberger