This week I gave a presentation on Sphinx
, a Python
-based multi-format publishing tool. It can generate LaTeX, Epub, HTML and many other formats from reStructedText
, a markup-format.
It was originally designed to generate documentation for Python software but can do much more.
You can find the (German) slides in my blog at Sphinx Introduction. Mathematics is well supported through MathJax
, one can use LaTeX Syntax directly. I have uploaded a sample to http://uweziegenhagen.de/sphinx/ and would be happy to share my findings. I intend to use it to create Epub
versions of my articles. It is not directly a website-software, but the results are pretty nice a worth to have a look at.
If you want to host a website to collaborate with others my choice would be to create a MediaWiki
site with MathSupport. There are extensions available which allow you to convert the Wiki syntax into LaTeX such as Wiki2LaTeX.
I will attempt to interpret the website quoted in the question, and supplement it with practical advice.
First thing to note is that the website was written in 2001, so it should not be taken to reflect the current situation. However, the information is in itself correct.
As I understand it, the quote should be interpreted as follows:
A basic TEX package such as MiKTeX
- A "package" here means a software product in general, and not a LaTeX package (i.e., library) such as amsmath or hyperref for example.
- More specifically, MiKTeX is a LaTeX distribution. This means that it is a collection of compilers (pdflatex, xelatex, lualatex, context, some others) and LaTeX packages. MikTeX is the most widely used distribution for Windows. The equivalents for other operating systems are TeX Live for Linux and MacTeX for Mac.
- MiKTeX comes with a package manager that allows you to install or uninstall specific LaTeX packages, but also supporting tools, which is relevant here (see below).
- MikTeX also includes an editor called TeXworks that can be used to write your documents. However, you can use any other editor that you like, see LaTeX Editors/IDEs for an overview. The editor itself does not produce pdf files, it calls the compilers provided by MikTeX in the background. Most other editors also use such background calls, however you can even use an editor that does not offer such functionality (like Notepad) and call the compiler yourself using the Command Prompt.
supports publication of the document on paper, or on the Web as a passive Postscript or PDF file. It is also increasingly attractive to publish technical documents on the Web with active hyperlinks to other material.
- The standard compilers pdflatex, xelatex, lualatex produce a pdf file. You can print such a file on paper. You can also upload the pdf file to a website, where a visitor can download the file and display it in their own pdf viewer. This is however not very interactive, and doesn't provide the connectivity of a real website.
- The standard compilers do not offer export or conversion to html. So the author is not saying that MiKTeX (read: any of the compilers provided by MiKTeX) can produce html. Instead, he is saying that it would be nice to do such a thing, and he then continues to describe an external tool for the conversion (see below).
- Note that since the introduction of the hyperref package the above is a bit less relevant, as hyperref provides clickable hyperlinks within the document and between documents or between the document and an external url, within the pdf format. However, still a real 'native' website can be faster and easier to navigate than a pdf.
- The mention of Postscript in the quote refers to Postscript as a file format, i.e., files with the extension
.ps
. This is the predecessor to the pdf format. You can still encounter it occasionally when you find an older research paper online (1990s and before). LaTeX can still produce .ps
files if you want. For some packages (pstricks and psfrag in particular) Postscript is required as an intermediate format, although you can convert it afterwards to pdf if you want.
There is a role for any package that can convert a single .tex master into high-quality printouts, into single-file Postcript or PDF files, or into an easily-navigable HTML file cluster with active hyperlinks, as required.
- Here I think the author is just trying to say that it is desirable to have a tool to convert .tex files into html, apart from the standard output in print or pdf.
- The website then continues to describe such a converter tool, called latex2html (in the follow-up page https://www.cv.nrao.edu/%7Eabridle/toolmemo/node9.shtml).
- This tool can be used from the command line or you can configure your editor to use it, the same as with the standard compilers.
- Latex2html is not used very much anymore, although the project is still active (see https://github.com/latex2html/latex2html). Other converters with better support for packages etc. are tex4ht and pandoc.
Now the answer to the actual question: what are the practical steps to convert LaTeX to html, using your own MikTeX installation?
First of all, this requires that you install a converter. Tex4ht is available in the MikTeX package manager. Pandoc needs to be installed separately, see https://pandoc.org/installing.html.
Then, you need to configure your editor to call the converter instead of the standard compiler. This configuration is different for each editor.
For TeXworks you can add an entry in tools.ini
or via the Preferences menu, see TexWorks: how do I add custom compiling sequences into the selection of available compiling sequences? for more details. Afterwards you can select the new entry from the menu when you want to produce a html page.
For TexMaker you can add a custom command in Quick Build, see Define a command containing a sequence of commands in texmaker for more details.
You can also run the converter directly from the command prompt instead of using an editor.
For tex4ht the command is simply tex4ht yourfile.tex
. For Pandoc the basic command is pandoc -s yourfile.tex -o yourfile.htm
, although many more options can be configured. See https://pandoc.org/demos.html for examples.
Best Answer
Yes, you can do that. However, remember that it's not going to be a simple task. I'll first try to point out some general facts:
You wouldn't be the first one doing that, others include:
Especially the last example above shows that people can use it without any LaTeX knowledge (I made the system, other colaborators have no idea what LaTeX is).
Then, excuse me for that, but I think that possible issues and things needed to solve should be pointed out:
The amount of 10000 a day is really really a lot! If the compilation took 8 seconds per document, it would be 80000 seconds, which is the full day! And 8 seconds per document is quite possible. Get a very good hardware for that all. From my point of view: a lot of memory, so that the whole LaTeX distro can be pre-cached, or installation on an hybrid drive, with LaTeX distro being on the SSD part of course.
If the data is not filled "from inside LaTeX", you have to cleverly and clearly take care of the input transformation, I mean: special characters, correct formatting, etc. It's a bit more difficult that how it looks at the first sight.
Big problem is if you don't solve some situation correctly and error messages appear during the LaTeX compilation, users will simply have to wait until you come and see what's going on.
You need the correct access to the services from within the web server environment. I mean, if it's in PHP, you can only call LaTeX using
exec()
, which is quite frowned upon by many sysadmins for its risks. Surely you should create a seperate user account just for this stuff on your (I suppose UNIX) server.