thisiscam / math-with-slack

Rendered math (MathJax) with Slack's desktop client
MIT License
306 stars 28 forks source link

Alternative math delimiters or browser plugin #7

Closed voland66 closed 4 years ago

voland66 commented 4 years ago

Hi, Thanks for a great script. I wonder if it is possible to make it compatible with a "Latex in slack" plugin which exists for firefox and chrome. That plugin uses non-standard math delimiters, $$ and $$$ for inline and display math respectively. As a result the interoperation of your code with that plugin is imperfect whenever members of a slack group use different solutions.

The browser plugin has another option for math delimiters: '(' and '[' for starting math while ending math with ')' and ']'. So one could make the two solutions fully interoperable if the parenthesis/bracket version could be implemented in math-with-slack as an alternative. I tried adding the second method to math-with-slack.py following http://docs.mathjax.org/en/latest/input/tex/delimiters.html and it almost works but the math is always preceded by '\'.

So my question is whether it is possible to implement the alternative math delimiter in a way that works?

thisiscam commented 4 years ago

Have you tried https://github.com/thisiscam/math-with-slack#tex-customization? I imagine you'd want something like:

python math-with-slack.py --mathjax-tex-options="{\
  inlineMath: [['$$', '$$'], ['\\\(', '\\\\)']], \
  displayMath: [['$$$', $$$'], ['\\\\[', '\\\\]']], \
}"
thisiscam commented 4 years ago

Sorry, above doesn't work. Try this instead (tested on my end):

python math-with-slack.py --mathjax-tex-options="{\
  inlineMath: [['\\\(', '\\\\)'],['\$\$', '\$\$']], \
  displayMath: [['\\\\[', '\\\\]'],['\$\$\$','\$\$\$']], \
}"
voland66 commented 4 years ago

I think it works though what I did is to use '\$' for inline math and '\$\$' for display math. This way the standard latex delimiters work and I can use parenthesis/brackets when there are users who use browser plugin.

Thanks

Yuri

On 10/12/20 1:58 PM, Cambridge Yang wrote:

Sorry, above doesn't work. Try this instead (tested on my end):

python math-with-slack.py --mathjax-tex-options="{\ packages: {'[+]': ['noerrors', 'noundefined', 'physics']}, \ emacs -nw \ displayMath: [['\\[', '\\]'],['\$\$\$','\$\$\$']], \ }"

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thisiscam/math-with-slack/issues/7#issuecomment-707342528, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADB3H6XXJULH6F5AVZBQFSTSKNUXNANCNFSM4SNLA4VQ.