# Incorporating LaTeX into Word documents as images

1. Jul 22, 2009

### RoyalCat

I'm sorry if this is covered in a tutorial somewhere on here, but I couldn't find it.

What I want to be able and do, is write in LaTeX code, and then export the product as an image.

I've tried to do it on my own, but I just got bogged down by all sorts of sophisticated programs.
I've installed the MikTeX package and Vim (Cream), but I'm afraid I just can't find my way around them.

A link to a program that can help me out would be greatly appreciated, or if someone could point me to a tutorial that will help me do what I want with what I already have, that'd be great as well.

2. Jul 22, 2009

### minger

The standard Latex output is a postscript (.ps) file. If you're on a linux machine, probably the easiest way would be to convert the ps to pdf via
Code (Text):

ps2pdf file.ps

Which should give you a file.pdf file. From there, you can open the pdf and use the snapshot tool to copy a selection to the clipboard. Paste in Paint and save as whatever you wish.

Alternatively, if you're on Windows, you can download/install Ghostscript which is a ps file viewer which can let you output to other formats. Unfortunately I'm not aware of any "stock" Windows apps that will let you manipulate a .ps file as it. You'll need to convert it first. Ghostscript should be pretty painless for you though.

Good luck,

3. Jul 22, 2009

### RoyalCat

Great, thanks a lot for the prompt response. :)
In case I have any follow up questions, I'd just like to add that I'm running Windows. Shouldn't have thought that would be obvious.

4. Jul 22, 2009

### vociferous

If you have a graphical LaTeX editor installed in windows, you may be able to convert it to an OEM object. I also believe the latest version of commercial program MathType, which integrates with Word, can have LaTeX pasted into it or written directly into the program.

Last edited by a moderator: May 4, 2017
5. Jul 22, 2009

### RoyalCat

That sounds good, especially since I can't seem to find a working mirror of GS.

I don't care about the integration into word as much. Print screen and paint would probably do just as well, as long as I can get some sort of graphical output. Could you point me in the direction of one such "graphical LaTeX editor?"

But I'd prefer a more permanent solution over a trial version of MathType, especially since I want to use it throughout the school year, and not just for whatever the trial period is.

6. Jul 22, 2009

### vociferous

Based on your requirements, I would probably consider investigating MathType. It seems to fit your requirements best. It is a mathematical equation editor (basically an "advanced" version of what is included in WordPerfect and what was included in Office 2003 and earlier). According to the documentation, it can accept most popular equation formats such as LaTeX, MathML, Mathematica, et cetera. It creates an OEM object, which you can insert into almost any windows programs.

This has a couple advantages. If you make a mistake, the OEM object allows you to edit the equation directly by double-clicking on it. It also allows you to smoothly scale the equations up or down in size without worrying about jagged edges caused by pixilation in bitmaps.

It is a commercial program, and the academic version runs somewhere around $50, but I do not know of any non-commercial program that has the same capabilities. 7. Jul 22, 2009 ### RoyalCat I see, then I'm afraid that's quite a bit out of my price range, especially considering how I won't be using it all that often for it to be worth 50$.

If I understood you correctly, all I need is a .ps editor so I can write my LaTeX code in that, and then GhostScript can translate that into an image PDF? I really appreciate the help and patience, by the way. :)

8. Jul 22, 2009

### Fenn

I am assuming you're using Windows to compile LaTeX? I use MikTeX and it comes with the pdflatex driver, which compiles directly to .pdf files. I belive all other packages have this as well, but I can't speak for certain. I assume you can embed .PDF within Word?

Another thing that might be handy is to look into the preview package for LaTeX. It lets you specify the document size to encompass only a particular specified environment. With this, you can output an individual equation as a .PDF with the margins set nice and tight to the object. This would make it easier to import into Word, or so I would imagine.

Also, there are free tools out there, like PDFill, which converts from .PDF to image files. I know Word easily handles images.

Good luck!

9. Jul 22, 2009

### alphysicist

If all you want is to convert a latex equation into an image file, you might also consider using online tools for that. You can google it; one example is at:

http://hausheer.osola.com/latex2png

But I was curious about your Miktex setup. Are you saying that you cannot get any output out of it at all? If so, could you describe the steps you take?

10. Jul 22, 2009

### robphy

If all you need are equations as images, then alphysicist's link latex2png is great.
Alternatively...
http://www.sitmo.com/latex/
http://rogercortesi.com/eqn/
http://www.codecogs.com/components/equationeditor/equationeditor.php [Broken]
http://sixthform.info/steve/wordpress/?p=59 (more)

Concerning MathType... even though it is a trial... it apparently will become better than the stock Equation Editor that comes with Microsoft Office (but is often not installed).

For something fancier that integrates with Word or Powerpoint (but still inexpensive)...
http://www.technion.ac.il/~zvikabh/software/iguanatex/ [Broken]
http://sourceforge.net/projects/latexinword/
(which rely on something like MikTeX)

If you can't get MikTeX working via the console or via a fancier text editor, you might wish to look into http://www.texniccenter.org/

Last edited by a moderator: May 4, 2017
11. Jul 22, 2009

### Phrak

Just in case you didn't know, and you want write your own equations in MS Word, MS Word has a equation editor.

12. Jul 23, 2009

### RoyalCat

That looks perfect! Thanks a lot. :) I think I'll just give up on MikTeX and whatever else I may have installed.

13. Jul 23, 2009

### alphysicist

That website does seem like that a good option for including latex equations into Word, but I also think that Miktex is worth getting up and running. (I use it about every day though, so I'm biased toward it.)

It sounds like you were not getting any output at all, so here is a minimal process to get some pdf output. (By the way, I had asked what process you were using to get an idea of what you had already done; please don't be offended if I'm telling you stuff you already know--if that's the case maybe it will help someone else.)

1. Open notepad and type or paste in the following:

Code (Text):

\documentclass{article}

\begin{document}

Wow, I can't thing of anything to write here for some text.

\bar f=\frac{1}{b-a}\int\limits_a^b f(x)\ dx

\end{document}

Save it in some directory and call it "tester.tex". (Be sure it's not saved as "tester.tex.txt"; when you go to save it, change the option "save as type text documents" to "save as type all files")

2. Open a command prompt window and navigate to the directory you saved tester.tex in, and then enter the command

Code (Text):

pdflatex tester.tex

If everything works, you should then have a file "tester.pdf" in the same directory.

Assuming miktex installed correctly, then if the above doesn't work, I think there are 2 main causes:

1. If the response in the command prompt window is something like

'pdflatex' is not recognized as an internal or external command, etc.