Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

math: allow to work with Hugo's passthrough configuration #832

Closed
Kevinanny opened this issue Apr 18, 2024 · 4 comments
Closed

math: allow to work with Hugo's passthrough configuration #832

Kevinanny opened this issue Apr 18, 2024 · 4 comments
Assignees
Labels
feature New feature or request
Milestone

Comments

@Kevinanny
Copy link

When I was using a '\' to break line in array environment using mathjax, it can't break line properly. The reason is the last \ was escaping. As i know, hugo didn't support escaping configuration for now. Some people say Katex can solve this issue. Some say that is bug from the render. But i know less to figure it out. I guess the author may could solve this from the theme side. By the way, would this theme will consider support Katex in the future?

@McShelby
Copy link
Owner

I am not a MathJax nerd either. Please provide your formula in source code and expected output (as gif).

The theme will not support Katex. One math library is enough but you could write a katex shortcode yourself.

@Kevinanny
Copy link
Author

Kevinanny commented Apr 19, 2024

Thank you for the reply very much! Here is my issue.

To keep consistence between markdown and latex, my mathjax configure is :

<script>
  MathJax = {
    tex: {
      packages: ['base', 'ams'],        // extensions to use
      inlineMath: [['$','$'], ['\\(','\\)']], // allow using $ $ to input inline equation
      displayMath: [['$$','$$'], ['\[','\]']], //allow using $$ $$ to display equation
      processEscapes: true,      // use \$ to produce a literal dollar sign
    }
  };
  </script>

<script type="text/javascript" id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-svg.js">
</script>

I didn't use codefence to input formula, because it display formular as source code in markdown. It's unintuitive. I use $$ $$ to input formula, which is supported both in markdown and latex.

My formula source code is below:

$$\left|
\begin{array}{cc}
a & b \\
c & d
\end{array}\right|$$

The display should be:
expected

While it seems there is a '\' escaping, that means '\\' won't break line, so the actual display is
expected

Some people implied that '\\\\' could breakline, it did work. However, it will break the consistence between markdown and latex. Change formula one by one is very annoyed.

@McShelby
Copy link
Owner

Thanks for providing. I'll take a look into it.

@McShelby McShelby changed the title escaping issues of '\\' when using mathjax math: allow to work with Hugo's passthrough configuration Apr 19, 2024
@McShelby McShelby added this to the 6.0.0 milestone Apr 19, 2024
@McShelby McShelby added the feature New feature or request label Apr 19, 2024
@McShelby McShelby self-assigned this Apr 19, 2024
@McShelby
Copy link
Owner

With this fix, your example should work without a shortcode or codefence if adhering to the passthrough configuration.

I've reused your example on the above linked docs page.

McShelby added a commit that referenced this issue Apr 21, 2024
McShelby added a commit that referenced this issue Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants