Math Publishing – Latex and WordPress

My initial reason for trying WordPress was for its LaTex support, enabling recognition of mathematics typesetting tags. Mathematics cognoscenti use the page layout standard called LaTeX to typeset their pages. A file.tex is created and then rendered to a file.pdf image. LaTeX is a derivative of Knuth’s TeX (pronounced tek), the original mathematics typesetting package.

A file.tex document has different publishing intent from an file.html document, the difference being where the rendering takes place. Both approaches use mark-up languages imbedded in the document to specify their rendering instructions. But LaTeX is a page layout specification that completely specifies how the final page should look, whereas an html markup defines the structure of a document and then leaves it up to the user’s browser to render the final appearance of the viewable pages as it sees fit, based on the windowing configuration in use at the time and any hints provided in the html and CSS specifications.

There are LaTeX-like html math packages that imbed math expressions as images. But on the theory that a LaTeX renderer will create output more visibly like the LaTeX-produced PDF file, here we are at WordPress.

WordPress has a server-side LaTeX renderer, making it a blogging site of choice for math scribblings. Because a blogging page is formatted by html, not LaTeX, there is a hybrid approach to posting, using a Python conversion script. LaTeX2WP converts the structural characteristics of LaTeX into html, and converts any $mathexpression$ into $ latex mathexpression$, to clue the server latex renderer to process the enclosed expression, producing mathexpression.

The conversion script is a great benefit for which this user is appreciative. There are a couple of minor issues for my particular use that require hand editing of the file.html before pasting it to WordPress. The LaTeX equation and alignat contexts are not supported, just \[ \] and $$ $$ contexts. The \url text style is not recognized. Sometimes, extra {} remain after the conversion in textmode, and need to be removed. Some fine structuring and formatting features of LaTeX are not converted, such as font size, vertical skip directives, and control over list bullet appearance (where html doesn’t provide much flexibility either). All math expressions are modified by font color black spec. This needs to be removed when posting on a dark background. Finally, the default LaTeX expression font size can be too large and unattractive when used with the smaller font sizes of some WordPress posting themes. In these cases, an &S=-1 or &S=-2 specification can be added to each LaTeX expression to shrink the LaTeX font by one or two sizes, whichever looks best.

The WordPress HTML input processor itself has a problem. The character sequence \[zero] apparently has a special meaning to the input processor and is stripped, thus making some equations unparseable by the LaTeX renderer (where [zero] stands for the digit 0). I notified WordPress; they did acknowledge the problem, but it is still not fixed after more than a year. The quick workaround is to wrap the 0 up: \{0}. The problem usually happens to me when the second or subsequent row of a matrix begins with 0.

When my eyes get tired at night, sometimes I magnify the size of the browser text. I usually use Firefox. When WordPress math pages are being displayed in this mode, the .png images of rendered formulae are frequently corrupted on first display. Then a page refresh must be commanded to get the corrupted image displays to regenerate correctly. I don’t know if other browsers are affected in this way. This has nothing to do with LaTex processing; it can happen to any image embedded in the html.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s