I want to render LaTeX inside Roblox, a 3D game engine, to create educational math games. There are 3 problems with this plan:

  1. You can only run Lua code in Roblox, so natively compiling LaTeX is not possible.
  2. 2D user interfaces can only render text and pre-uploaded images, so displaying a PDF is not possible.
  3. Decompiling an image file is against the terms of service because it avoids image moderation.

Current solutions solve problem 1 by piping their TeX files to an external server to be compiled, and they solve problem 2 by returning a PNG that gets decompiled and rendered as individual pixels with text boxes. Unfortunately, problem 3 makes the PNG solution unsafe, and rendering PNGs as individual pixels is slow.

Instead, I want a solution that does not break the terms of service and renders TeX natively using images for characters and symbols. Given my constraints, what is a viable way to do this?

What I have researched

It appears that what I am wanting to achieve is a DVI driver. As PDF is a significantly more complicated format, I see this as the most practical option. My working plan is to send the TeX code to a server, return the outputted DVI, and parse the DVI inside Roblox to be rendered as images.

I am unsure of where to go from here. I found this DVI spec, but I read that XeTeX does not use the original DVI spec (not sure about pdfTeX and LuaTeX). I do not know where to find updated specs.

  • 1
    best place is probably the manual and code of the xdvipdfmx driver that is used by xetex, but depending on how text generally is rendered by the engine a simpler math component eg the katex or mathjax javascript would return css or svg based math renderings which might be easier to include Nov 25, 2021 at 7:53


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.