Register to reply

Incorporating LaTeX into Word documents as images

by RoyalCat
Tags: documents, images, incorporating, latex, word
Share this thread:
RoyalCat
#1
Jul22-09, 08:10 AM
P: 671
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.

With thanks in advance, Anatoli
Phys.Org News Partner Science news on Phys.org
Scientists discover RNA modifications in some unexpected places
Scientists discover tropical tree microbiome in Panama
'Squid skin' metamaterials project yields vivid color display
minger
#2
Jul22-09, 09:21 AM
Sci Advisor
P: 1,498
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
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,
RoyalCat
#3
Jul22-09, 01:23 PM
P: 671
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.

vociferous
#4
Jul22-09, 02:16 PM
P: 297
Incorporating LaTeX into Word documents as images

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.

I would download a trial version of MathType and see if it fits your needs.
RoyalCat
#5
Jul22-09, 02:21 PM
P: 671
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.
vociferous
#6
Jul22-09, 02:29 PM
P: 297
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.
RoyalCat
#7
Jul22-09, 03:16 PM
P: 671
Quote Quote by vociferous View Post
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.
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. :)
Fenn
#8
Jul22-09, 10:00 PM
P: 74
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!
alphysicist
#9
Jul22-09, 10:24 PM
HW Helper
P: 2,249
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?
robphy
#10
Jul22-09, 11:05 PM
Sci Advisor
HW Helper
PF Gold
robphy's Avatar
P: 4,139
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/e...tioneditor.php
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/
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/
Phrak
#11
Jul22-09, 11:31 PM
P: 4,512
Just in case you didn't know, and you want write your own equations in MS Word, MS Word has a equation editor.
RoyalCat
#12
Jul23-09, 01:19 AM
P: 671
Quote Quote by alphysicist View Post
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?
That looks perfect! Thanks a lot. :) I think I'll just give up on MikTeX and whatever else I may have installed.
alphysicist
#13
Jul23-09, 11:10 AM
HW Helper
P: 2,249
Quote Quote by RoyalCat View Post
That looks perfect! Thanks a lot. :) I think I'll just give up on MikTeX and whatever else I may have installed.
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:

\documentclass{article}

\begin{document}

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

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

\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

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.

then you don't have the latex directory added to your path.

2. If pdftex starts to run, but then it says:

! I can't find file 'tester.tex'.

then I would you are either in the wrong directory (not in the one with your file), or you have turned off visible file extensions and your file is actually called "tester.tex.txt" but windows is not showing the ".txt" part.




Anyways, if you are interested, just try the above and see what happens.


Register to reply

Related Discussions
Images don't show up in LaTeX Math & Science Software 4
Images in Latex Math & Science Software 16
Latex and images Academic Guidance 2
How to create PDF documents and write in LaTex? Math & Science Software 6