Left Aligning Org-mode MathJax in HTML Export - org-mode

I customized my org file as follows;
#+HTML_MATHJAX: align: left mathml: t indent: 5em tagside: left font: Neo-Euler
This is the sample customization from Org manual. Still I get centered Latex output in my browser, using Microsoft Edge. Chrome does not show Latex output at all. What could be the problem?

On Linux (Fedora 22), both Firefox and Chrome behave as expected with the the above fragment. I'm not sure why Chrome on Windows would misbehave, but my suggestion would be to look at the produced HTML file (and possibly change some of the options and see how it changes) and see if that provides any clues (perhaps because your setup is not complete or correct - e.g. where do you get MathJax from?) I can't say anything about what MS Edge does: never used it, never will (most probably).
If you can, you might want to copy the file to a Linux machine and try to view it there (or copy it to an HTTP server and view it from anywhere): if you have trouble with all browsers, the HTML file is probably incorrect.If only some browsers show problematic behavior, they are probably buggy.

Related

Visual Studio Code - Live Server - Html Displays but no CSS markup

I have used VSC with LiveServer for some years with only 1 problem, back a few years ago when either LiveServer or Windows10 had an update installed, next time I opened my HTML file in LiveServer, the HTML was rendered in a "basic" layout, and did not include my CSS Styles.
On an Internet search I found a solution for either this site or similar where I needed to add a line of code to either LS or Windows, sorry but I cant remember which. And all was well again until, now. The very same problem has returned, and no matter how much I search, I cant fine the solution.
There are plenty where there were errors in HTML or CSS, but this is occurring on files which haven't changed, and on new ones from the same master I use for my new pages. The screenshot included shows the HTML, LS as basic HTML and how the page loads on the browser directly. I am using Chrome, but have tried on Firefox with same results.
How LS displays and how it should be
You need to open your VS Code project from a directory that contains your HTML and CSS.
Your HTML document is in the root directory of your project (hence the URL being /filename) but you are trying to load CSS from ../../css/filename.
The project needs to be two directories higher for the webserver to include that path.

is it possible to view a question with a browser before importing it to Moodle?

I have created a XML file using R-exams out of just a single exercise to be imported to Moodle. I would like to view it before uploading it in the Moodle question bank. I tried to open it with Firefox and I can see some code but not the output and a message appear saying that the XML file does not seem to have a style sheet associated to it. Is there a way to find this style sheet and to see how the question comes out just using a browser like Firefox or Chrome?
To emulate how the R/exams exercises are converted to HTML by exams2moodle() and how Moodle displays mathematical content, it's best to use
exams2html(..., converter = "pandoc-mathjax")
In recent versions of R/exams the resulting HTML file then automatically loads the MathJax Javascript that enables correct rendering of mathematical content in all modern browsers (including Google Chrome). See also http://www.R-exams.org/tutorials/math/ for some general advice about math in HTML.
To the best of my knowledge there is no tool that would quickly display Moodle XML files in such a way that you can easily assess them.

Share rCharts via IPython Notebook

I have been able to embed this map in an IPython Notebook (which is sweet), but I am not clear on how I can share this with folks not using the Notebook. I am familiar with the bl.ocks.org viewer. It's great for standalone examples, but I am looking to share the rest of the analysis in the Notebook along with interactive charts. Neither the HTML conversion of the Notebook nor the nbviewer rendering can locate the map (I get a 404 message).
After the first 404 (with this gist), I changed the viewer function to capture the github location of the map file (V2). I am not yet clear why, but that change stopped nbviewer from even rendering the surrounding materials. Any thoughts on a better way to go about this?
The trouble is that the map is saved as a local HTML file (rChart_map.html) and is hence not accessible to nbviewer when you are trying to view it online.
Even if you upload rChart_map.html to the gist, it won't show up due to path issues. Locally, you need to refer to it as /files/rChart_map.html in your IPython notebook, whereas online, it has a different path. I had posted this issue earlier on twitter using the #IPython tag, but got no responses on how to debug.
So where does that leave us. Well, fortunately, most modern browsers allow an iframe to contain inline HTML using the srcdoc tag. This allows the generated .ipynb file to be standalone, as seen here, at the end of the file.
The key is to use the following code. The first line creates an iframe with inline html of the map and stores it in the python variable map2. The second line imports the necessary python modules and the third line displays the HTML. Note that we use h2[0], since map2 is an array, due to conversion from R, which is vectorized.
map2 = %R paste(capture.output(map$show('iframesrc', cdn = TRUE)), collapse = '\n')
from IPython.display import display, HTML
HTML(map2[0])
For this to work, you will need to have rCharts version > 0.4.1.
I am interested in making it easier for rCharts to be used in IPython notebooks. So any suggestions/feedback is welcome.

firefox addon development and Unicode

So I started developing my firefox addon.
Most of the work is performed by a referenced javascript file.
Problem is that when I edit some of the html elements on the page and say, set their text it's written as pure giberish. I am writing the text in hebrew. Can't for the life of me figure the reason.
Any ideas?
Javascript strings are already Unicode at runtime. However, you have to make sure that your files are encoded correctly.
Always use utf-8 (without BOM) file encoding for all your js, XUL, DTD, properties files to be sure.
Firefox might try to guess the file character set incorrectly otherwise, and even worse some stuff might not even try guessing the encoding and instead simply always assume utf-8.
Better yet, do not hard-code strings in js/xul, but use DTD/properties files for localization (XUL tutorial, XUL School).
This, e.g. snippet works pretty well for me (on this very page):
document.getElementsByTagName("h1")[0].textContent="русский язык";
(Just fire up the Firefox Web Console)
"Inline" hewbrew embedded in js files might create additional problems because it is right-to-left and bidi sucks, so the localization approach should be preferred.

Is there a way to programmatically download a web page, for offline viewing, using WebKit?

What I'd like to be able to do is download any web page, and be able to view it offline.
It seems like html WebKit views cannot be converted to PDFs (on the Mac, you could 'print' a PDF, but that isn't possible on iPhone?).
So, the only way is to save the actual resources - save the html, the step thru each image, css, js file and save it locally. Then maybe alter the urls within the code so they point to the right place...etc ...etc...
Is there a standard way to do this?
Or, is there an open source project (in any programming lang) which does this kind of thing?
There's an excellent webkit html to pdf converter appropriately called wkhtmltopdf. Given the reources available on the iphone and its toolkits, I think it'd be easy to compile a version for the i-Phone ('think' being the operative word). We've managed to use the tool in a Windows, Linux and Solaris environment with absolutely no bugs. Here's the link:
http://code.google.com/p/wkhtmltopdf/