Skip to content

Render problem in existing mathmatical multiline expressions (R-Bookdown,R-Markdown) #20

@reisman234

Description

@reisman234

Hello,
i use your pseudocode.js lib in my r-bookdown project to generate the nice latex algorithmic output. The include step was stright forward, as it is mentioned in the usage guide in the readme.

  1. include mathjax and pseudocode.js in header: I have a header_index.html that lists everything that goes into the header tag. Beause there was already an existing entry of mathjax i tried it first, without the new mathjax-include, but this did not work and i added the include for mathjax3.
  2. write code: after that setup and some modifications on the css-file i could add example code in my Rmd-file (R-Markdown) and had the expected output in the browser.

However, I got some errors, existing mathematical expressions were apparently influenced by the change in MathJax. In my book i had both, inline expressions ($somesthing$) and also multiline expressions ($$ centered mathmatical expression $$) and only the latter expressions are affected and are not correctly displayed.

For Example: from following expression:
$$L[k](A) = \prod_{i=1}^N[a_i,k]\cdot h[k]$$
is the folling output generated:

I noticed the following lines in the include of MathJax:

inlineMath: [['$','$'], ['\\(','\\)']],
displayMath: [['$$','$$'], ['\[','\]']],

The second line looks to me what influences multiline expressions and has just one "\" insteed of two "\\" as it is in the top line. I changed it to the following:
displayMath: [['$$','$$'], ['\\[','\\]']],

and voila, that solve my problem.

I`m not very familiar with javascript and related subjects, so I don't really understand what happens in the include statement and if the backslash is really missing or not. As a simple test I created a simple HTML page. There it seems to be no matter if there are 1 or 2 backslashes in the expression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    K: docDocumentation issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions