-
Notifications
You must be signed in to change notification settings - Fork 183
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
Enable more advanced math rendering by default #55
Comments
|
No, I didn't really look at options, but I'm using the This is on Safari 10.1.2 and I've changed to HTML5 output because it looks better on my phone. I can't tell a difference between the HTML and HTML5 output on a desktop browser. This is using the built-in Safari PDF renderer. My impression was that I'd probably just produce a PDF through LaTeX when the time came, because I often rely on LaTeX macros that aren't available as javascript libraries, for example, using |
(Digression from the main topic, but I see a table rendering bug in the manuscript PDF you linked. It looks like the header gets reproduced across page breaks -- nice -- but overwrites a row in the process. We may want to report upstream.) |
One benefit of MathJax is that you can right-click the equation to show the MathML or TeX Commands. Since Manubot manuscripts are entirely open source (you can always get back to the source TeX), this is not essential (but is still nice). What really is annoying is when you can't get the TeX out of an online equation and hence have no way to copy it.
Is Manubot Rootstock not using the HTML5 output?!?! Want to fix this with a PR? Nice to see your in-progress manuscripts
See wkhtmltopdf/wkhtmltopdf#3557. I wonder if we could implement the |
Fair point. I've always enjoyed that on Wikipedia, for example.
By default,
Not sure about that, but worth a shot. |
This github code embed feature you triggered is rad! As a screenshot: As quoted text:
Never knew this existed. |
This build is based on 9f4deeb. This commit was created by the following Travis CI build and job: https://travis-ci.org/greenelab/manubot-rootstock/builds/264565127 https://travis-ci.org/greenelab/manubot-rootstock/jobs/264565128 [ci skip] The full commit message that triggered this build is copied below: Pandoc: use --html5 not --html5 for output (#56) Refs #55 (comment)
This build is based on 9f4deeb. This commit was created by the following Travis CI build and job: https://travis-ci.org/greenelab/manubot-rootstock/builds/264565127 https://travis-ci.org/greenelab/manubot-rootstock/jobs/264565128 [ci skip] The full commit message that triggered this build is copied below: Pandoc: use --html5 not --html5 for output (#56) Refs #55 (comment)
It looks like you may be able to extend MathJax to support Are there other macros that you have in mind specifically? If the overhead for enabling these extensions is low, we may want to consider enabling some by default. I imagine they could provide compelling incentives to use the Manubot. My only worry is that they will increase the HTML lockin, when the longterm best option may be to create JATS XML (see #51) as that may become the standard for scholarly content and the best route to a nice frontend. |
Exactly. I saw that thread but I haven't had time to play around with it yet.
In my latest stuff, I think I used
Neat! I didn't know about that. One pain point right now (for me) is not being able to see the figures while writing. One of my use cases at the moment is more of a notebook than a manuscript (with the goal that I could turn the notebook into an article without much trouble). It's much easier to write about images when they are rendered; I've been using Edit: the full preamble for a scientific manuscript in LaTeX with all the macros I used, for reference. \documentclass[12pt]{extarticle}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{siunitx}
\usepackage{helvet} % to make the document Helvetica
\renewcommand{\familydefault}{\sfdefault}
\usepackage[EULERGREEK]{sansmath} % to get Greek units to behave
\sansmath
\usepackage{amsmath, amsfonts} % math
\usepackage{bm}
\usepackage[version=4]{mhchem} % for formatting magnesium and ATP
\usepackage[varioref=false]{chemstyle} % symbols
\usepackage{graphicx} % images
\usepackage{hyperref} % for TOC
\usepackage[usenames, dvipsnames]{xcolor}
\definecolor{purple}{RGB}{112,48,160}
\usepackage{booktabs, multirow, threeparttable} % For the tables
\usepackage{etoolbox}
\robustify\tnote % for tnote with siunitx
\usepackage{esdiff} % derivatives
\usepackage{comment} % to hide stuff in drafts
\usepackage{setspace}
% \usepackage{lineno}
% \setstretch{1.2}
\setstretch{2}
% Comment below for easier editing on small screens (makes document narrower)
\usepackage[left=0.4in, right=0.4in, top=1in, bottom=1in, headheight=13.6pt]{geometry}
\usepackage[backend=biber, style=nature, doi=false, isbn=false, url=false]{biblatex} |
It's a difficult decision between mathjax and katex. I'm thinking we should go with mathjax because it:
See also https://www.bersling.com/2016/05/10/displaying-math-on-the-web/. If MathJax becomes too slow, users can always swap it out for katex.
Can you preview the markdown in your text editor? vscode claims to support side-by-side markdown preview.
Texture only reads JATS XML (not markdown). We'd be converting markdown to JATS in pandoc and then feeding that to Texture... but we'd still be writing in markdown. |
The Atom editor also shows local images in the side-by-side Markdown preview. It doesn't resize them according to the |
Closes manubot#55 Also reorder some pandoc CLI arguments.
Closes #55 Also reorder some pandoc CLI arguments.
@dhimmel Oh, |
@slochower I believe that all I did in Atom was |
@agitter Ah. And then you just press enter at the end of the sentence instead of space? Hard habit to break for me. |
Yes, I hit enter at the end of a sentence. But I don't insert newlines in the middle of long sentences, which is what we did during deep review.
( *edited for clarity* )
|
@dhimmel There's a non-ideality with the interaction of this and I couldn't find an issue directly addressing this. Maybe we need a delay before rendering? wkhtmltopdf/wkhtmltopdf#3122 |
@slochower does increasing the default |
@dhimmel that did work! Good intuiting. I found another issue, however. Inline math seems to be creating new lines in the PDF rendering only. (Below, D is Edit: I can confirm that the HTML shows "math inline" as the span. <p><span class="math inline">\(D\)</span> was chosen to replicate free diffusion in the absence of any energy barriers. That is, <span class="math inline">\(D\)</span> controls how rapidly the landscape is sampled. |
I don't know how per se, but we should be able to configure it, as we can always insert javascript. |
Good point. Not getting anything relevant by Googling "wkhtmltopdf math line break" or variants thereof. |
A workaround is to use |
My current suspicion for the problem with |
Reported wkhtmltopdf/wkhtmltopdf#3609 |
Although this issue is closed, in case others are wondering about MathJax integration with <script type="text/x-mathjax-config">
MathJax.Ajax.config.path["mhchem"] =
"https://cdnjs.cloudflare.com/ajax/libs/mathjax-mhchem/3.3.0";
MathJax.Hub.Config({
TeX: {
extensions: ["[mhchem]/mhchem.js"]
}
});
</script> For interested users, this could be incorporated into the build script around here: Edit: It might also work by putting the script directly into the Markdown and using a |
@slochower nice! Glad you've got mhchem working. It may not be a bad idea to add a file
to |
Good idea, actually. I made another small tweak, to center non-full-width images in the CSS. I think this looks a bit nicer than left-aligned images. Change I also began to work on a version for GitLab, using their alternative CI build process, but haven't gotten it working yet and it's pretty low on my priority list. But briefly: (a) change TRAVIS environmental variables to GitLab ones in `.gitlab.yaml`
|
Can you move this part to a new comment in #88? It's very helpful, but doesn't belong in this issue.
That could be of interest to us, if you want to open a PR we could evaluate whether its something we generally want. |
👍 on centering non-full-width images. That's my personal preference at least. |
Closes manubot/rootstock#55 Also reorder some pandoc CLI arguments.
The current default math used in our pandoc build command is severely limited: see the "TeX math in HTML" section of the pandoc demos. Pandoc has support for several more advanced methods for math rendering in HTML.
The question is which one to choose? I've seen MathJax used before in scholarly publishing. However, KaTex is faster to render. There are also several more options.
@slochower did you look into the math options at all for b03e1c3?
The text was updated successfully, but these errors were encountered: