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

Markdown math rendering fails on multiple subscripts with curly brackets #1575

Closed
stroitzsch opened this issue Jul 18, 2022 · 12 comments
Closed

Comments

@stroitzsch
Copy link

Multiple subscripts in combination with curly brackets in LaTeX-based math expressions don't render as expected.

Single underscore with curly brackets works fine: \mathbf{x}_{i,j} = \mathbf{y} renders as $\mathbf{x}_{i,j} = \mathbf{y}$.

Multiple underscores without curly brackets work fine: x_i = y_i renders as $x_i = y_i$.

Multiple underscores with curly brackets fail: \mathbf{x}_{i,j} = \mathbf{y}_{i,j} renders as $\mathbf{x}{i,j} = \mathbf{y}{i,j}$.

@stroitzsch
Copy link
Author

In the meantime, a workaround is to use trailing spaces after underscore symbols: \mathbf{x}_ {i,j} = \mathbf{y}_ {i,j} renders as $\mathbf{x}_ {i,j} = \mathbf{y}_ {i,j}$

@zhongzachary
Copy link

Same issue, thanks for the workaround tho!

@giopalma
Copy link

giopalma commented Aug 20, 2022

In some cases also without curly brackets don't work.
Example: 19 =_2 010011
The workaround works fine.

@tautomer
Copy link

If the two subscripts are in two expressions but in the same line, render is broken as well.

Range of $\mathbf{d}_{ij}$ and $\mathbf{d}_{ij} \cdot \Delta E$

will be rendered as "Range of $\mathbf{d}{ij}$ and $\mathbf{d}{ij} \cdot \Delta E$", but the workaround also work for this case "Range of $\mathbf{d}_ {ij}$ and $\mathbf{d}_ {ij} \cdot \Delta E$"

@tobiasBora
Copy link

tobiasBora commented Nov 21, 2022

To give more strange examples (but thanks a lot for the workaround), if I put a single expression it works, if I copy/paste it it fails:

$V^{a}_{x}$

Gives $V^{a}_{x}$

But

$V^{a}_{x} V^{a}_{x}$

Gives $V^{a}{x} V^{a}{x}$

My bet is that github confuses it with emphasis (like in _emphasis_), explaining why adding a space solves the issue…

@tobiasBora
Copy link

Also something similar happens with stars (I guess again because it thinks it's bold, so the same work around also works):

$V^{*}$

Gives
$V^{*}$ (ok)

$V^{*} V^{*}$

Gives $V^{} V^{}$ (bad!)

$V^{ * } V^{ * }$

Gives
$V^{ * } V^{ * }$ (ok)

@ImpleLee
Copy link

ImpleLee commented Dec 1, 2022

I suspect this happens because a_b is detected as one word, so emphasis doesn't come in, but in a}_b, there is a word boundary between } and _, so it can be detected as emphasis.

So a _b c_d is working but a _b c_ d is not.

$$ a _b c_d $$

$$
a b c d
$$

@ImpleLee
Copy link

ImpleLee commented Dec 1, 2022

For non-inline math, as an alternative, we can use

```math

to replace $$.

I have more experiments at ImpleLee/c4w#1 .

@prasanth-ntu
Copy link

prasanth-ntu commented Mar 10, 2023

Inline math expression: $\sum_{i=1}^{m}$ $\sum_{i=1}^{m}$ Summation superscript rendering is bad!
Another e.g., $\frac{1}{2m}\sum_{i=1}^{m}{(\hat{y} _{i} - y _{i})}^{2}$ $\frac{1}{2m}\sum_{i=1}^{m}{(\hat{y} _{i} - y _{i})}^{2}$

Block math expression: Summation superscript is okay!
$$\sum_{i=1}^{m}$$ $$\sum_{i=1}^{m}$$
Another e.g.,
$$\frac{1}{2m}\sum_{i=1}^{m}{(\hat{y} _{i} - y _{i})}^{2}$$

Any workarounds?

garid3000 added a commit to garid3000/Emacs-TeQ that referenced this issue Apr 15, 2023
braniii added a commit to moldyn/HP35-DESRES that referenced this issue May 16, 2023
@mbaudin47
Copy link

See e.g. ${\boldsymbol{x}1, ..., \boldsymbol{x}{i-1}, \boldsymbol{x}_{i+1}, ..., \boldsymbol{x}_n}$, which fails to render.

@kirk86
Copy link

kirk86 commented Jun 13, 2023

@prasanth-ntu I was looking for the same and found a workaround on a github gist of some repo. One of the solutions described there was the following ${\sum}_{k=0}^{K}$ = ${\sum}_{k=0}^{K}$. Although, these issues require #github's attention and hopefully should be fixed at some point 🤞

simeonkr added a commit to simeonkr/HaGL that referenced this issue Jun 16, 2023
nosewings added a commit to lastland/ClairvoyanceMonad that referenced this issue Oct 31, 2023
Today, we learned that GitHub's math rendering engine has some problem
relating to subscripts/superscripts and curly brackets.  See
github/markup#1575.  I have applied a
workaround.
staadecker added a commit to staadecker/gurobipy_examples that referenced this issue Dec 7, 2023
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 20, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 28, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 28, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 28, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 29, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 29, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 29, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... trying workaround from github/markup#1575
evaleev added a commit to ValeevGroup/SeQuant that referenced this issue May 29, 2024
most SeQuant LaTeX output will not render correctly in GitHub markdown (seemingly due to GH issues, since MacDown renders it correctly) ... workaround from github/markup#1575 seems to work, but still need to break up overly long lines
Copy link

Stale issue message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants