lagrange icon indicating copy to clipboard operation
lagrange copied to clipboard

Support for LaTeX?

Open koyuawsmbrtn opened this issue 2 years ago • 4 comments

Just thought it'd be nice for our scientists

koyuawsmbrtn avatar Dec 09 '22 17:12 koyuawsmbrtn

The general issue here is embedding non-Gemtext syntax into a Gemtext file, and that is largely inadvisable due to compatibility issues. One should be able to view the document with any client, even those that don't support LaTeX.

One way would be to detect "application/x-latex" MIME type and render it as an image, so that those could then appear as inline images on the page. This is at least in theory doable with Lagrange's MIME hooks feature, but requires one to have a fully functional LaTeX system already installed. Such images are best pre-generated on serverside so the client doesn't have to worry about it.

My personal recommendation is to use Unicode math symbols and box drawing characters in a preformatted block, like so:

   n!      ╭ n ╮                 
──────── = │   │   for 0 ≤ k ≤ n 
k!(n-k)!   ╰ k ╯                 

However, creating these would likely require manual work as there isn't a trivial 1:1 conversion from a LaTeX equation into the corresponding Unicode representation. One has to take some artistic license to achieve the desired result... The benefit here is that any Gemini client can be expected to show the equation just fine without any special processing.

skyjake avatar Dec 10 '22 13:12 skyjake

I thought OP was asking about using it as its own document type, instead of embedded.

bleonard252 avatar Dec 21 '22 19:12 bleonard252

I thought OP was asking about using it as its own document type, instead of embedded.

@bleonard252 There is no fundamental technical difference when it comes to implementing that. The MIME hooks approach would work for entire documents as well. However, I don't really see a point in adding support for viewing new document formats as a built-in feature... Much better to rely on external full-featured viewers (#135).

skyjake avatar Jan 02 '23 17:01 skyjake

TeX is just too huge to use in browsers. If you need math, modern web provides tools like MathML

CyberTailor avatar Jan 06 '23 09:01 CyberTailor