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

Unable to use cases extension of MathJax

Open raphaelsoul opened this issue 4 years ago • 6 comments

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

raphaelsoul avatar Sep 02 '21 11:09 raphaelsoul

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 avatar Sep 03 '21 07:09 jeffreytse

Hi @raphaelsoul

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

Thanks and Regards

jeffreytse avatar Sep 10 '21 06:09 jeffreytse

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

raphaelsoul avatar Sep 22 '21 02:09 raphaelsoul

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

jeffreytse avatar Sep 22 '21 11:09 jeffreytse

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}  
$$  

CharlieBailly avatar Nov 10 '22 19:11 CharlieBailly

@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

ksyu0508 avatar Jul 25 '23 09:07 ksyu0508