question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

\begin{aligned} not being rendered

See original GitHub issue

For some reason, \begin{aligned} statements like the following aren’t being rendered in my markdown documents using Hugo:

$$
\begin{aligned}
	\bar{u} - \bar{v} &= \bar{u} - (2\mu - \bar{u}) \\
	&= \bar{u} - 2\mu + \bar{u} \\
	&= 2\bar{u} - 2\mu \\
	&= 2(\bar{u} - \mu)
\end{aligned}
$$

Everything else renders just fine.

I have the following config:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"></script>
<script>
    document.addEventListener("DOMContentLoaded", function() {
    renderMathInElement(document.body,
        {
            delimiters: [
            {left: "$$", right: "$$", display:true},
            {left: "$", right: "$", display:false},
            {left: "\\(", right: "\\)", display: false},
            {left: "\\[", right: "\\]", display: true}
            ],
            macros: {
                "\\R": "\\mathbb{R}",
                "\\B": "\\mathbb{B}",
                "\\summation": "\\sum\\nolimits_{#1}^{#2}",
                "\\product": "\\prod\\limits_{#1}^{#2}",
                "\\E": "\\text{E}",
                "\\bias": "\\text{bias}",
                "\\var": "\\text{var}",
                "\\step": "\\text{step}",
                "\\span": "\\text{span}",
                "\\P": "\\text{P}",
                "\\pmf": "\\text{pmf}",
                "\\T": "\\text{T}",
                "\\infinity": "\\infty",
                "\\then": "\\implies",
                "\\cross": "\\times",
                "\\approaches": "\\rightarrow",
                "\\yhat": "\\hat{y}"
            }
        });
        });
</script>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bobbywlindseycommented, Mar 23, 2020

I think this is really just a problem with how Hugo renders markdown into HTML. I haven’t been able to figure it out, so switching back to MathJax for now. But I’ll be closing this issue since the bug is not with Katex.

0reactions
bobbywlindseycommented, Mar 23, 2020

Even with four backslashes like you suggested:

$$
\begin{aligned}
	\bar{u} - \bar{v} &= \bar{u} - (2\mu - \bar{u}) \\\\
	&= \bar{u} - 2\mu + \bar{u} \\\\
	&= 2\bar{u} - 2\mu \\\\
	&= 2(\bar{u} - \mu)
\end{aligned}
$$

I still get this result:

 \begin{aligned} \bar{u} - \bar{v} &= \bar{u} - (2\mu - \bar{u}) \\
&= \bar{u} - 2\mu + \bar{u} \\
&= 2\bar{u} - 2\mu \\
&= 2(\bar{u} - \mu) \end{aligned} 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Github page fails to render \begin{align} environment #2274
It appears that the problem has to do with the way the html is formatted for AcademicPages. There are no line breaks in...
Read more >
math mode - \begin{align} not working as expected - TeX
In this small snippet of code, I'm doing quick derivation to arrive at an equation to be used later ...
Read more >
How to change alignment of displayed equations in IPython ...
Use \begin{align} and \end{align} . This does not exactly answer the question but it has the desired effect. For example try:
Read more >
LaTeX Tutorial-Math Mode
If we use the align environment and insert an & on every line where we wish the equations to be aligned (usually at...
Read more >
LaTeX/Advanced Mathematics - Wikibooks, open books for an ...
eqnarray and eqnarray*, Similar to align and align*, Not recommended because spacing is inconsistent ; multline and multline* · First line left aligned,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found