Generating Web Content Using MiKTeX – Step-by-Step Guide

miktex

https://www.cv.nrao.edu/~abridle/toolmemo/node8.shtml says:

A basic TEX package such as MiKTeX 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. 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.
1

How to do the above? A work flow such as ABC window > Save Tab > Additional > Web is preferred.

Bonus questions:

  • What is being referred as Postscript? the programming language?
  • What are the other Software that include in the group "such as"?

1 I don't get it.

Best Answer

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.