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

Manually set inline math delimiter #118

Open
aiifabbf opened this issue Dec 5, 2018 · 6 comments · May be fixed by #188
Open

Manually set inline math delimiter #118

aiifabbf opened this issue Dec 5, 2018 · 6 comments · May be fixed by #188

Comments

@aiifabbf
Copy link

aiifabbf commented Dec 5, 2018

If I want MathJax to detect and render inline equations delimited in a pair of $, there currently seems no way to specify this in config.yml.

I tried inserting MathJax loading script and manually setting the delimiters by

    <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML"></script>
    <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        tex2jax: {
            inlineMath: [ ['$','$'], ["\\(","\\)"] ],
            displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
            processEscapes: true,
            processEnvironments: true
        },
        // Center justify equations in code and markdown cells. Elsewhere
        // we use CSS to left justify single line equations in code cells.
        displayAlign: 'center',
        "HTML-CSS": {
            styles: {'.MathJax_Display': {"margin": 0}},
            linebreaks: { automatic: true }
        }
    });
    </script>

but the output pdf looks like this, with a MathJax loading mark on the bottom left
image

It seems ReLaXed did not wait until MathJax has done rendering.

How can I set inline equation delimiter to $ then?

@Zulko
Copy link
Member

Zulko commented Dec 5, 2018

@aiifabbf
Copy link
Author

aiifabbf commented Dec 5, 2018

Thank you for the quick reply.

Have you had a look at this wiki section ?
https://github.com/RelaxedJS/ReLaXed/wiki/Special-file-renderings#equations

I have, but it only says use delimiters \\( and \\), did not mention how one can manually change the default delimiters for inline equations.

And this example:
https://github.com/RelaxedJS/ReLaXed-examples/blob/master/examples/paper/paper.pug

This demo does not seem to contain any inline equation.

@Zulko
Copy link
Member

Zulko commented Dec 5, 2018

Ok (I was just checking that you were aware of the original feature for equations). What you are asking is a custom configuration of mathjax, which is not implemented at the moment. Apparently it is a matter of adding "singleDollars: true" to the configuration of mathjax-node-page, in this ReLaXed file. I'll look at it later.

@aiifabbf
Copy link
Author

aiifabbf commented Dec 5, 2018

Thanks for your concern.

Actually, I had worked on my own very primitive attempt to bring web technologies to scientific writing, until I found this great project today. However, I do not think ReLaXed is yet ready for scientific writing as it lacks some crucial (at least for me) functionalities like auto numbering for figures and tables(such as Figure 1 in figure captions), cross reference(such as as Figure 1 shows somewhere else in the article). Maybe I should propose these in other issues. Nevertheless, hopefully ReLaXed can evolve to replace LaTeX. 👏

@Zulko
Copy link
Member

Zulko commented Dec 5, 2018

Simple latex-style figures and tables numbering could be implemented using pug macros (or even maybe CSS counters, not sure). I'll try a plugin when I have time.

One thing that will be more difficult however is to generate table of contents or figure tables.

At the moment I use ReLaXed for making slideshows, more than for other kind of documents. See here for some examples (I'll certainly add more in the future). One nice feature I use a lot is the capability of the SVG plugin to turn a SVG into a progressive slide. This saves me a lot of time.

zicklag added a commit to zicklag/ReLaXed that referenced this issue Jan 7, 2021
@zicklag zicklag linked a pull request Jan 7, 2021 that will close this issue
@zicklag
Copy link

zicklag commented Jan 7, 2021

I submitted a fix in #188 . Thanks for pointing out the solution @Zulko.

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

Successfully merging a pull request may close this issue.

3 participants