Importing/saving from the web does not let MathJax complete

I am not sure the correct terminology but I find that web/html sources that contain large amounts of math formula using MathJax do not get converted to HTML archive or PDF with all formula converted.

I have tried grabbing a bookmark, then converting the bookmark to an HTML archive or a PDF. Some formula are left as source in both cases. I have tried grabbing HTML, then converting the HTML to an HTML archive or PDF. The results were the same. I have tried grabbing the page as a PDF. The results were the same. (I get the same results with every DEVONthink method.)

In one example I noticed that the final PDF contained the following message at the bottom.

image

So far the only way I have been able to produce a fully converted PDF and import to DEVONthink was to tell Safari to export the page to a PDF, then import the fully converted PDF to DEVONthink.

It looks like DEVONthink is not waiting until all the MathJAX javascript has completed before performing the conversion.

An example URL would be helpful.

:slight_smile:

Oh, yes. Good point.
TLA+ in Practice and Theory Part 2: The + in TLA+

Check this out…
mathPDF.zip (294.7 KB)

Do you feel that’s intact?

Yes, that looks correct.

I’m wondering if it’s network related. I clipped it from Safari with no issue at all.

And the MathJax is likely calling a remote resource to render the equations.

Yes, I think that is the cause of the slow rendering. What I would like to do is see if there is a way that I could cause DEVONthink to wait until the HTML page has been fully rendered, regardless of how long it takes, before attempting to convert to a static format like a PDF.

For some reason when I export from Safari directly to PDF, Safari waits until the page is fully rendered before converting to PDF, but DEVONthink does not.

DEVONthink waits actually until the page is completely loaded or until the connection times out. In case of dynamic pages loading contents after delays and/or after user actions (e.g. scrolling) this might not always work though.

I experience a similar problem when trying to export web pages with MathJax content to DEVONthink as PDF (one page). In my case, the MathJax content is just ignored (i.e., I don’t see the math in MathJax syntax, but just blank). Weirdly enough, the same page worked to export with embedded formulas earlier today (albeit always displaying MathJax formulas twice), but does not anymore: http://www.metafor-project.org/doku.php/tips:rma_vs_lm_lme_lmer?s%5B%5D=lme4 (I can’t include full links as this is my first post)

As far as I can see, I have a good internet connection. Do you have any suggestions on how to make sure that MathJax is rendered and included in the PDF? Thanks!

Does it work if from your browser you “print” to Preview then if ok move that pdf to DEVONthink?

Welcome @januzzz

This could be due to the page reloading before capture.

If you browse the site in DEVONthink and capture it there, the page is captured correctly.

Perhaps we could add a delay or check to see if the page is finished loading. Development would have to assess this.

(Note: In some rudimentary tests, a delay isn’t affecting this, but again, Development would have to look at this.)

Thanks for your response, @BLUEFROG!

Capturing the website in DEVONthink indeed solves the problem. So, would you suggest the following workflow?

  1. use “Clip to DEVONthink” to save webpage as bookmark
  2. convert to PDF in DEVONthink
  3. delete bookmark

Seems a little cumbersome, but definitely preferable to having to worry that math isn’t translated. Maybe I could automate this using AppleScript?!

If the developers could come up with a way to reliably parse and convert MathJax containing webpages, that would be great! Maybe the simplest solution would be to implement something like the above internally (i.e., save as temporary bookmark and parse/convert in DEVONthink).

Thank you for your help!

You’re welcome.
You can clip a bookmark or drag and drop the address from the browser into DEVONthink.
I do a lot of web access in DEVONthink and clip there too.

Interesting. How do you use DEVONthink as a browser, i.e., without having any kind of item entry representation (bookmark, etc.) of it?

I do have bookmarks in DEVONthink. For example, I have a bookmark to these forums and I am answering this post directly in DEVONthink.

1 Like

Okay, I know that one can use DEVONthink to browse from a given anchor point / representation like a bookmark. But is it possible to just have a browser window in DEVONthink in which one could type in / paste any URL and would be taken to that site without first having to create a bookmark? (that would allow to skip step 1 above). Thank you!

Try Script menu > Tabs > Open Location.

Great, thank you!

You’re welcome. :slight_smile: