Embedding Code and Formulas in Your WordPress Posts

Recently I wrote a post for my programming blog that included both mathematical formulas and actual code. It got me thinking about the fact that most of my readers here might need to do the same.

Those of you who use WordPress will probably know that there are countless plugins to achieve just that. That in and of itself is a problem, however. Which plugins do you choose?

For mathematics, you can visit:

/wp-admin/admin.php?page=jetpack_modules

and activate Beautiful Math in JetPack from there. You’ll need JetPack, of course, but I recommend you install it regardless of this feature, as it houses many useful features.

At that point, you’ll be able to embed mathematical formulas by specifying \LaTeX code between [ latex ]xn + yn = zn[ /latex ] tags (without the surrounding spaces of course).

For code syntax highlighting, I like to use the plugin Crayon Syntax Highlighter.

Embedding code in WordPress with Crayon

You can see what its output looks like in the post I mentioned above.

I realize not everyone uses WordPress, but I thought I’d share a quick and handy tip here today for those who do.

Get more stuff like this

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Alternatively, you can subscribe via RSS feed.
About Antonio Cangiano

Antonio Cangiano is a Software Developer and Technical Evangelist for IBM, as well as a web entrepreneur, serial blogger, and published author. He makes extra income blogging in his spare time about technical topics. He authored a definitive blogging book published by The Pragmatic Bookshelf.

Comment Policy: We greatly appreciate your comments and thoughts. To keep things nice and friendly, comments are moderated and will be approved shortly after you submit them. Please use your name or handle to comment, and not that of your company or website.


Speak Your Mind

*