Introducing a LaTeX Object into the Post

After the horrendous pun of the title, let’s get to a geeky post about tech, or specifically about the integration of typesetting systems into the WordPress editor.

You will have noticed that in What are your Expectations for 2019? I started using some simple mathematical formula within the post.

I have long debated with myself whether to write the posts in Markdown (WordPress supports that) or using the WP editor, and I have finally chosen the WP editor; the reason is that the editor features a simple way of inserting \LaTeX formulas. To obtain the same with Markdown, as far as I understand the WP Markdown plugin should support a Markdown \LaTeX plugin, which I guess is asking much of WordPress; correct me if I am wrong (@pablodecm, I am thinking about you).

Long story short, it turns out that the way of embedding formulas in the WP editor is quite simple: you just have to enclose the formula between dollar signs, and the first dollar sign must be followed without spaces by the word “latex” (the dollar signs are delimiters of an interpreted environment, and the word specifies which is the interpreter to be used). You can theb add options to the formula by adding to the end ampersands followed by the parameter=value syntax; it’s very useful for setting the colour of the text and of the background, for example (by default, the \LaTeX interpreter assumes white background and black text, and is blind to the actual HTML/CSS style.

One thing leaves me puzzled, though; one particular formula gets rendered in two mini-lines within a single text line, resulting in a pretty ugly effect:

E[gamble] = p(K)\times V(K) + p(nonK)\times V(nonK) = 0.08\times 10 + 0.92\times(-10) =-8.4.

As our can see, the last part gets put into an ugly mini-line that does not correspond to different main lines; as a result, the two lines of the formula are squeezed into a single text line. In case you see the formula just fine (i.e. the -8.4 in the same line as the rest of the formula), please drop me a line in the comments below: I have tried a couple different browsers both on a computer and on a phone, and the issue seems to be common, so I would exclude web browser issues). I have tried varying the spacing to no avail. I will keep digging, but if any of my two subscribers (literally; two people subscribed so far) has any suggestion, I’ll be glad to try it out!

Until then, I will go back to the main theme of the blog 😉

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s