# Saving TeX formulae as images

I have a bit of a problem. I want to publish all things mathematical on blogs that do not have any MathJax support and, as a result, I'm forced to use images instead. Now, I've seen LyX and MATLAB and the like save LaTeX formulae to images but I'm not impressed with the result. In particular, I find Word's rendering of formulae to be vastly superior, but it's not a TeX environment.

So my question is, can I have the best of both worlds? I want to write in TeX but I want rendering as beautiful as this:

(source: hexlet.org)

• You can just do as you just did in your question: post a tex generated image. (tex4ht or latex2html would automate that, or just do it by hand if there are only a few) of course posting math as images is just wrong If the math were in MathML then reasonable browsers (=firefox and safari, currently) would render it in a manner more suitable for the web than a fixed bitmap image. – David Carlisle Sep 22 '13 at 18:18
• The best solution is to use MathJax as your source for web and non-web will be almost identical. Having different source for each will be painful if you need to update. Wordpress, for example, allows you to use MathJax, see this article. – kiss my armpit Sep 22 '13 at 18:39
• @DavidCarlisle typical output from these tools is of a low quality – Dmitri Nesteruk Sep 22 '13 at 19:59
• You should use MathJax, there is no better option. :-) – kiss my armpit Sep 22 '13 at 20:03
• If you are hosting wordpress then it is trivial to link to the CDN version of MathJax you don't even need to install any software. – David Carlisle Sep 22 '13 at 21:27

See this:

http://www.sciweavers.org/tex2img.php?eq=%5Cmathcal%7BL%7D%5C%7Bf%28t%29%5C%7D%20%3D%20%5Cint_0%5Et%20e%5E%7B-st%7D%20f%28t%29%20dt&bc=Transparent&fc=Black&im=png&fs=12&ff=arev&edit=0

It was done using the Sciweavers Online Latex Equation Editor.

However, for a blog, I'd suggest uploading images there, so that you don't depend on the Sciweaver's site. You can use "upload from web option", like I did here (using "Copy image location" on the generated image):

It may give better results with "Modern" font.

One other solution is CodeCogs Online LaTeX Equation Editor:

You can also "upload from web", picking "URL" in the form at the bottom of a page.

• While readable, the quality of the image rendered in this editor is strictly inferior to what is output by Word. Thanks for the pointer though! – Dmitri Nesteruk Sep 22 '13 at 19:58
• Try it with "Modern" or some other font. I've added another on-line solution to my post. – Vedran Šego Sep 22 '13 at 20:16

If you have Acrobat, you can also convert the PDF to a PNG.

\documentclass{standalone}
\usepackage{amssymb}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw (0,0) node{$\displaystyle{ \mathcal{L} \lbrace f(t)\rbrace = \int_{t=0}^\infty e^{-st} f(t)\,dt}$};
\end{tikzpicture}
\end{document}


• Neat idea. And I'm sure I can do a better rendering that way with what you have above (no offense). – Dmitri Nesteruk Sep 24 '13 at 8:19
• Actually, Acrobat converts at 200 dpi (ugh!). The standalone manual lists several other conversion programs which probably do better. – John Kormylo Sep 25 '13 at 3:51
• If you have a Mac, use Preview to convert a PDF to PNG. You can specify the resolution (I use 360 dpi in many cases). – Derek Aug 9 '18 at 14:13

For easy embedding in a blog post you could also use texit (found via hacker news), which is available at http://tex.sh/.

Your formula is rendered as image with a call to the relevant URL, boiling down to this: http://tex.sh/tex/$math$.png.

You don't say what operating system you're on, but if on macOS, there is always the LaTeXiT application, which is bundled with macTeX. Now, for your specific problem, using MathJax is superior, but there are other circumstances where LaTeXiT shines: For example, if you must use presentation software with poor equation support (a common affliction, sad to say).

• In other words, I added this answer for completeness and because it might help other users coming across this question, even though it may not be a solution in the OP' case. – Harald Hanche-Olsen Aug 9 '18 at 12:34

All you have to do is type an equation within delimiters, like $$55 + \sqrt{5}$$ and it can be rendered in super high quality at whatever time you like by rendering all the equations in your document. If you mess up, you can always undo one or all the equations.