jeffreytse / jekyll-spaceship

🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
MIT License
637 stars 67 forks source link

Unable to use cases extension of MathJax #59

Open raphaelsoul opened 3 years ago

raphaelsoul commented 3 years ago

see https://docs.mathjax.org/en/latest/input/tex/extensions/cases.html

$$
\require{cases}
\begin{cases}
\text{if true} [] \\
\text{if false} []
\end{cases}
$$

this will not be compiled

jeffreytse commented 3 years ago

Hi @raphaelsoul

Thanks for your issue, could you please try to change the mathjax-config according to document? I think it should be the config issue. According to your case, the config should be as below snippet:

jekyll-spaceship:
    mathjax-processor:
    src:
      - https://polyfill.io/v3/polyfill.min.js?features=es6
      - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
    config:
      tex:
        inlineMath:
          - ['$','$']
          - ['\(','\)']
        displayMath:
          - ['$$','$$']
          - ['\[','\]']
        autoload:
          cases:
            - []
            - ['numcases', 'subnumcases']
      svg:
        fontCache: 'global'

Thanks and Regards

jeffreytse commented 3 years ago

Hi @raphaelsoul

Has your issue been settled down? Don't hesitate to let me know if you were still stuck.

Thanks and Regards

raphaelsoul commented 3 years ago

Hi @raphaelsoul

Has your issue been settled down? Don't hesitate to let me know if you were still stuck.

Thanks and Regards

sorry not working. See detail here
https://github.com/raphaelsoul/process/blob/master/_posts/2021-09-11-test-mathjax.markdown
http://www.geilcode.com/process/jekyll/update/2021/09/11/test-mathjax.html

jeffreytse commented 3 years ago

Hi @raphaelsoul

Thanks for your patience, actually, this is a bug that it can not handle multiline Mathjax expression, and it has been addressed and fixed. Please update your plugin to the latest version with below code snippet:

# Use this in your Gemfile
gem 'jekyll-spaceship', git: 'https://github.com/jeffreytse/jekyll-spaceship'

After updating your plugin, you can use the below example to test:

$$
\begin{cases}
\text{if true}\ foo \\
\text{if false}\ bar
\end{cases}
$$

Welcome to star this project for further updates in the future. Also, hope you have a good day! : )

Thanks and Regards

CharlieBailly commented 2 years ago

Hi, thanks for your job @jeffreytse !
I'm using jekyll-spaceship with jekyll chirpy, and a similar issue happens to me.
However, I managed to solve it by ending each line with a double space, for example only this works for me:

$$  
\begin{cases}  
\text{if true}\ foo \\  
\text{if false}\ bar  
\end{cases}  
$$  
ksyu0508 commented 1 year ago

@CharlieBailly

Your spacing method works for me!

I have similar problem in using multiline, and found that line break placed immediately after \\ cause the issue. Indentation doens't help, but adding one space after '\' or writing in one line works correctly.

$$
\begin{cases}
\text{if true}\ foo \\
\text{if false}\ bar
\end{cases}
$$

$$
\begin{cases}
    \text{if true}\ foo \\
    \text{if false}\ bar
\end{cases}
$$

$$
\begin{cases}
\text{if true}\ foo \\ 
\text{if false}\ bar
\end{cases}
$$

$$
\begin{cases}
\text{if true}\ foo \\ \text{if false}\ bar
\end{cases}
$$

스크린샷 2023-07-25 175936