KaTex does not render on mac Sequoia 15.0 (M2 chip)

Gordon Erlebacher's Avatar

Gordon Erlebacher

05 Oct, 2024 03:23 PM

// Please enter a detailed description of the issue // Description of the issue: Latex equations do not render with KaTex on my macbook Pro, Sequoia 15.0

// Please enter a list of steps required to reproduce the issue // Steps to reproduce:

  1. Enable KaTex in the Settings
  2. Create a file with a simple equation, delimited with $ or $$
  3. Open Marked 2. The equations do not render.

// If applicable please attach a sample document that causes the issue for you.

// Configuration (do not edit) Marked 2 1067 (Direct)

macOS Version: 15.0

additionalMathJaxConfig:
allowPageBreakInCode: YES
bookTxtIsLeanpub: NO
summaryMdIsGitBook: NO
codeIsPoetry: NO
codeCanWrap: YES
collapsibleHeadlines: NO
convertGithubCheckboxes: YES
convertGithubEmoji: YES
convertYAMLToMMD: NO
defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
defaultPreviewStyle: swiss
defaultProcessor: MultiMarkdown
enableMiniMap: NO
excludeBlockQuotesFromCounts: NO
excludeFootnotesFromCounts: NO
excludeVerbatimFromCounts: NO
excludeCaptionsFromCounts: NO
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: YES
h1IsPageBreak: NO
h2IsPageBreak: NO
hrIsPageBreak: NO
includeMathJax: NO
includeKatex: YES
limitTextWidth: NO
mathNumberEquations: NO
mathNumberEquationsSide: 0
mathNumberEquationsAMSOnly: NO
minimalJavaScript: NO
outlineModeExtensions: d
permissionGranted: NO
printHeaderBottomLeft:
printHeaderBottomRight:
printHeaderFirstPage: NO
printFooterFirstPage: NO
printHeaderTopLeft:
printHeaderTopRight:
processHTMLFiles: YES
removeMetadataForPreview: NO
removeYAMLHeaders: NO
scrollToEdit: YES
shouldDetectCritic: YES
shouldHighlightMarkupErrors: NO
shouldLoadCritic: NO
syntaxHighlight: YES
syntaxHighlightOnlyLang: NO
useCustomMarkdownProcessor: NO
customMarkdownProcessor:
useCustomPreprocessor: NO
customPreprocessor:
useFirstH1AsPrintTitle: YES

  1. Support Staff 1 Posted by Brett on 05 Oct, 2024 04:47 PM

    Brett's Avatar

    Seems to be some syntax irregularities that I'll need to look into. I'm not an academic and have no actual experience with these equation markup syntaxes, so it will take some research. In the meantime, all of the equations appear to render as written when using MathJax instead of Katex, is there a specific reason you need one processor over the other?

    I did get Katex to render using the following syntax:

    - **S4 Algorithm:** 
        - The system in S4 is governed by:
    
        \\[
        x'(t) = A x(t) + B u(t) \\
        y(t) = C x(t) + D u(t)
        \\]
     
        where $x(t)$ is the hidden state, $u(t)$ is the input, and $y(t)$ is the output. The main improvement in S4 is how this continuous-time model is discretized to operate on input sequences (via convolution), allowing for efficient long-range sequence modeling.
    

    This isn't a Sequoia issue, it's a general math rendering issue.

  2. Support Staff 2 Posted by Brett on 05 Oct, 2024 04:48 PM

    Brett's Avatar

    By the way, you should use more line breaks in your markdown. Blank lines on either side of equations and code blocks are necessary in most processors, and having them around paragraphs within list items, headlines, etc. doesn't hurt anything and makes the text easier to read. Just a tip, and one that might solve some math rendering issues (though it didn't fix the current issue, I don't think).

  3. 3 Posted by Gordon Erlebach... on 05 Oct, 2024 04:49 PM

    Gordon Erlebacher's Avatar

    HI Brett,

    Yes, I have not been able to align equations in MathJax using the
    \begin{ailgn} environment.
    My code runs perfectly in the free app `logseq`.

    On Sat, Oct 5, 2024 at 12:47 PM Brett <[email blocked]>
    wrote:

  4. 4 Posted by Gordon Erlebach... on 05 Oct, 2024 05:19 PM

    Gordon Erlebacher's Avatar

    Thanks for the tip, Brett. Does not resolve the problem. Here is a snippet
    of the file.

    - S4 Algorithm:

        - The system in S4 is governed by:

        \begin{align*}
        x'(t) &= A x(t) + B u(t) \\
        y(t) &= C x(t) + D u(t)
        \end{align*}

        where \( x(t) \) is the hidden state, \( u(t) \) is the input, and \(
    y(t) \) is the output. The main improvement in S4 is how this
    continuous-time model is discretized to operate on input sequences (via
    convolution), allowing for efficient long-range sequence modeling.

    =============================

    Try the following file:

    \begin{align}
     x + y &= 45 \\
     y &= 45 + z
    \end{align}

    which should work with KaTeX.

    On Sat, Oct 5, 2024 at 12:49 PM Brett <[email blocked]>
    wrote:

  5. 5 Posted by Gordon Erlebach... on 05 Oct, 2024 06:08 PM

    Gordon Erlebacher's Avatar

    Could somebody running on Mac Sequoia try using Katex and let me know if it works? If it does, could you please provide your configuration file? Thanks.

  6. 6 Posted by Gordon Erlebach... on 05 Oct, 2024 09:00 PM

    Gordon Erlebacher's Avatar

    Hi Brett,

    Check out the following:

    $ {x} t \in R^{h} $ : Hidden state vector at time $t$.
    $ {x}_t \in R^{h} $

    $$ x = z + t $$

    \begin{equation}
    x = z + t
    \end{equation}

    In the first line, there is a space between the dollar sign and the next
    character, and the same at the end
    of the equation. Remove the space, and the equation renders fine in KaTex.
    I think there are bugs in the
    implementation.

    Here are the results with KaTex. Environments don't work for me. Single
    double dollar signs only work when equations are on the same line as the
    dollar signs, and finally, there can be no space between the equation
    delimiters and the next characters.

    [image: image.png]

    Is there a bug somewhere? This is all very strange. Doesn't anybody use
    macs among the users? :-)
    thanks,

       Gordon

    On Sat, Oct 5, 2024 at 1:19 PM Gordon Erlebacher <[email blocked]>
    wrote:

  7. 7 Posted by Gordon Erlebach... on 21 Oct, 2024 09:17 PM

    Gordon Erlebacher's Avatar

    Hi Brett,

    Try rending the included file with your version of Marked 2 on a mac (I
    have OS Sequoia 15.0.1), but I doubt it works on earlier OS. Please let me
    now what happens.

    I could only get the code to render properly by enclosing the equation in
    $$...$$ symbols, with no space between the $$ and the start or end of the
    equations). Also, if I wish to align three equations, the three equations
    have to be on a single line.

    This appears to be a serious bug. Could you please let me know what you
    find?

    Thanks,

         Gordon

    On Sat, Oct 5, 2024 at 4:59 PM Gordon Erlebacher <[email blocked]>
    wrote:

  8. Support Staff 8 Posted by Brett on 26 Nov, 2024 04:55 PM

    Brett's Avatar

    Ok, looking into it further:

    MultiMarkdown is the limitation here, it doesn't recognize bare \begin type blocks as math. They have to be delimited with $$ or \\[. If you use \\[ you can put it on a separate line. Inline equations have to be delimited with $ with no spaces to be recognized. If you follow these rules, your equations should render fine.

    This has nothing to do with your OS version or your type of Mac. It's just syntax limitations of the processor.

  9. Support Staff 9 Posted by Brett on 26 Nov, 2024 04:58 PM

    Brett's Avatar

    I don't think the \begin{align syntax is going to be recognized by Marked/MultiMarkdown/Katex at all. I'm not familiar enough with the syntax to understand what alternatives may be.

  10. Support Staff 10 Posted by Brett on 26 Nov, 2024 05:00 PM

    Brett's Avatar

    These options work:

    \\[
    x'(t) = A x(t) + B u(t) \\
    y(t) = C x(t) + D u(t) 
    \\]
    
    $$x'(t) = A x(t) + B u(t) \\
    y(t) = C x(t) + D u(t)$$
    

    As do these:

    where $x(t)$ is the hidden state, \\( u(t) \\) is the input
    

    Let me know if that helps.

  11. 11 Posted by Gordon Erlebach... on 26 Nov, 2024 05:04 PM

    Gordon Erlebacher's Avatar

    So we have to escape the single backslash. Surely you could modify the
    Marked 2 editor to handle this? :-)

      Gordon

    On Tue, Nov 26, 2024 at 12:00 PM Brett <[email blocked]>
    wrote:

  12. Support Staff 12 Posted by Brett on 26 Nov, 2024 05:18 PM

    Brett's Avatar

    It gets messy to do a regex replace on what could be common characters in code blocks and other places. I prefer to let the Markdown processor handle it, and Marked conforms to the standards for MultiMarkdown math handling.

    On 26 Nov 2024, at 11:04, Gordon Erlebacher wrote:

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • from_HIPPO_to_S4.md 34.2 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac