LaTeX is a software system for placing documents and is mainly used to format scientific texts. With the help of certain packages you make LaTeX very suitable for the presentation of mathematical, physical and chemical formulas on websites and print. mPDF is a PHP library for generating PDF files from HTML content. For the Publishtool platform I have developed a module with which you can make formulas and comparisons using LaTeX and place them in a document. You can then publish the document as a website and PDF. You can generate the PDF automatically using mPDF or via inDesign by means of an XML export.
To present scientific formulas encoded with LaTeX on a web page, it is enough to load MathJax (A Javascript library) into your pages. Below is an example of LaTeX code and its presentation.
When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$$
In addition, it is useful if you can also generate images from the LaTeX code. You can then place these images in your document to generate a PDF with mPDF or in the XML for inDesign. With PHPLatex you can generate images or PDFs from LaTeX code. Another example is the script found on Mike's Software Blog. I have written a new script from these two examples to make.svg,.png and.pdf files of the formulas. Using the code found on TeX stack exchange I create PDFs with a page equal to the formula. I use these PDFs in inDesign and the svgs in mPDF. The Server must have LaTeX installed. On my VPS I followed the procedure described on SysTutorials.