Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Instead of using javascript and javascript libraries to render the LaTeX client-side, why not do the following?</p> <ol> <li><p>Write a server-side function that takes some LaTeX string and produces an image file. You can do this with the "out of the box" standard LaTeX command line tool. <em>(It seems like this is something you're capable of doing, and that the problem is in getting the rendering to take place client-side.)</em></p></li> <li><p>Create an endpoint on your web site/service that looks like the following:<br> <code>GET /latex?f={image format}&amp;s={latex string}</code><br></p></li> <li><p>On your web pages, use a simple HTML <code>&lt;img/&gt;</code> tag to render your LaTeX. For example:<br> <code>&lt;img src="/latex?f=jpeg&amp;s=f%40x%41%61x%942"/&gt;</code><br> will render the <code>f(x)=x^2</code> equation as a JPEG.</p></li> <li><p>(optional) Create a simple server-side cache for <code>(f,s)</code> pairs so that you only render a particular LaTeX string on the first request ever made for that particular string (by any client). As a first prototype, you could just have a server directory in which you have files named <code>{hash(s)}.{f}</code>, where <code>hash</code> is just some hash function like <code>SHA1</code>.</p></li> </ol> <p>This relieves you from trying to make everything work client-side with javascript. And, I would argue (although some may disagree), that this is a lot cleaner. All you're sending to the client is:</p> <ol> <li>the HTML <code>&lt;img/&gt;</code> tag</li> <li>the actual image contents when the browser resolves the <code>src</code> attribute</li> </ol> <p>Very lightweight and fast!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload