ghandic / nbconvert

Wordpress plugin to convert notebooks into blog posts
MIT License
35 stars 45 forks source link

rendering latex? #6

Open cbernet opened 5 years ago

cbernet commented 5 years ago

Hello, first of all I'd like to thank you very, very much for this plugin!

Your solution is the only one that seems to work for properly integrating notebooks into blog posts.

But now I'm a bit stuck. I see that all latex math equations are not rendered, please see here: https://thedatafrog.com/the-logistic-regression/ All maths appear between dollars, as I typed them.

From the code, you're using nbviewer to render the notebook, and I checked that on https://nbviewer.jupyter.org/github/cbernet/maldives/blob/master/one_neuron/logistic_regression_1d.ipynb the equations are rendered properly.

Would you have an idea of what could be tried to enable the rendering of latex equations?

Any help or pointer would be greatly appreciated, and I will send you a PR if I manage to sort this out.

Cheers! Colin

ghandic commented 5 years ago

Apologies, I have just gotten around to investigating this. It looks like nbviewer passes the file thorugh mathjax. Adding this into the header will be a quick fix for now.

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML" type="text/javascript"></script>

However, it would be better to grab all of the formatting, links etc that nbviewer uses, that way it will be an encapsulated version of nbviewer on your page. Pull requests welcome, I will give it a go if I get around to it.

ccgarant commented 5 years ago

Hi. I also wanted to say thank you, this is definitely the best solution i've seen so far. Adding the code clip into the header did work, but curiously enough the characters in the equation are showing up green. Any way I can fix this, or point me in the right direction. Thanks! See picture below.

Screen Shot 2019-09-04 at 9 34 25 PM

ghandic commented 5 years ago

Hey @ccgarant could you send me a link to the webpage? I'll be able to inspect it then. It seems too be something to do with the css selector

saenzac commented 4 years ago

Hi, thanks for the plugin just to mention that for the inline "$" to work I need to add in the header:

There is a fix for the green color problem? Thanks!

ghandic commented 4 years ago

Hey, this will be a css issue, if you use your browser and right click on it and inspect the element what class does it show on the node? And what css attributes are attributed to it?

saenzac commented 4 years ago

Hey, this will be a css issue, if you use your browser and right click on it and inspect the element what class does it show on the node? And what css attributes are attributed to it?

In the following picture the inspection of a latex block, \begin{align}..

image

Thanks!

ghandic commented 4 years ago

Do you have a webpage with it on that I could view to help debug? Would need to see the dev tools in the browser

saenzac commented 4 years ago

Do you have a webpage with it on that I could view to help debug? Would need to see the dev tools in the browser

Hello,
This page: http://www.johsac.com/2020/09/05/test4/