Incorporating Graphics
How do I incorporate graphics into my document?
- If you are a LaTeX2e user,
- Save your figure in EPS format (with Mac preview if possible)
- In the preamble of your document, put
\usepackage{graphicx}- In your figure environment, use the command \includegraphics{myfile.eps}
- Check out this small example file. For more information, download the graphics package documentation
- If you are a LaTeX2e user including a PICT file instead of an EPS file you can still use the graphicx package. Your file won't be as portable and you'll need to include the
natheightandnatwidthparameters which you can get by pasting the picture into the pictures window or from another graphics program.
- Find the height and width of the image.
- In the preamble of your document, put
\usepackage{graphicx}- In your figure environment, use the command
\includegraphics[natwidth=4.44in natheight=3.33in]{racecar.pict}
Note that the picture must have a .pict extension, otherwise the graphicx package will assume the file is in eps format.
Or you can use a Textures specific macro:
- Get the slightly modified version of picmacs (so it doesn't interfere with other graphics macros)
- Paste the pictures into your pictures window.
- Put the line
\input picmacs2ein your preamble.- Get the name of the picture and its dimensions from the pictures window.
- In your figure environment, put the line
\picture width by height (picturename scaled nnnn)- For more help, read your Textures User Guide, chapter 8 ("Pictures").
- If you are not a LaTeX user and you're using EPS format, use the EPSF macro. The referenced package comes with instructions, but the comments in the head of the macro file itself also have directions.
- If you are not a LaTeX user and you're using PICT, use the standard version of pics.tex.
Background information
TeX typesets with "boxes," without having to concern itself with what goes inside a box. Thus, the contents of a box may include graphics, and all TeX needs to know are the dimensions of the box the graphics element is in. The easiest way to include pictures in Textures is to use a macro package to make the box for you---this method is generally easier and tends to work well and consistently.
Textures allows you to add pictures to your documents which are in either encapsulated PostScript (EPS) or Macintosh PICT format (like what MacPaint produces). Pictures are included via commands called "specials" which are of the general form
\special{keyword filename size}. Specials are called special because they are different for every TeX implementation---some specials that work on a UNIX TeX system won't work on a Mac and vice versa.The best way to put pictures into a document is to save the pictures as separate files (as EPS for highest quality) and use an appropriate macro package to include them. These graphics macros are available from our ftp server.
If you're using LaTeX2e then you already have a graphics package. To use, type \usepackage{graphics} or \usepackage{graphicx} in the beginning of your file and then \includegraphics{filename} to include a picture. Check out Ben's notes file for some help with using graphics and for some general LaTeX examples, and see LaTeX: A Documentation Preparation Guide, 2nd ed. by Leslie Lamport or The LaTeX Companion. by Michel Goossens, Frank Mittelbach and Alexander Samarin.
Questions & Answers
- I have followed your advice and used a macro to include "myEPSpicture" in my document, and the TeX log says it it being included, but I don't see it on the screen! What's wrong?
- The problem is that the Macintosh does not display PostScript (once again, like with the fonts). An EPS file can (and should) also contain a Macintosh (PICT) representation of the figure so that it can display on the screen. If for some reason your EPS file doesn't have an attached PICT, several programs can make one for you, including Adobe Photoshop and Adobe Illustrator.
- Which of the EPS macro packages should I use?
- Well, that depends (:-):
- If you're using LaTeX2e then you already have a graphics package. Use this one. It's easy, it's the most portable, it works good with Textures. See above for more.
- If you need backwards compatible portability, the new psfig 1.10 is okay, because most UNIX systems also have a version of psfig and the commands will be the same (remember that the UNIX version is different though---don't try to use that one on your Mac!). The screen display from psfig 1.10 will be off, however, so it might not be desirable. Psfig has a nice documentation file, but it will look wrong on the Mac screen. It will still print fine to a PostScript printer, but not to a Quickdraw printer. (Don't know which you have? Maybe the printing page can help.)
- EPSF will do a fine job of including epsfs and also gets the preview in the right place. EPSF includes a documentation file with examples.
- pics will do a fine job of including PICT files into Plain TeX documents. Pics.tex has the virtue of simplicity. (You could write something like it yourself.)
- picmacs will do a fine job of including PICT files into LaTeX209 documents.
- picmacs2e will include PICTs into a LaTeX2e document, without colliding with the graphics macros (pics and graphics both define \picture; someone has to lose).
Many of these files contain useful comments---they're literate programming, which includes instructions and information about the instructions---some of which can teach you how to use the macros, and even what the pieces of the macros do.
- I want to send non-Textures users my files, but they use PICT resources from the pictures window. How do I translate them?
- You need to translate them into the EPS file format. It is the standard method in sending images with TeX. Please see our step-by-step PICT to EPS instructions in the File Saving section.
- I can print my EPS images just fine, but I can not see them on my screen. What's happening?
- When Textures displays an EPS image on the screen, it takes the PICT preview of the EPS image, which is included in the file. Why do we do this instead of displaying the EPS? EPS imaging (PostScript rasterizing) is very difficult and costly to do. Now, the more important question: how to attach a PICT preview to an EPS image so you can see your image in Textures.
You can attach a PICT preview with any EPS imager, like Adobe Photoshop and Adobe Illustrator, though they are expensive. Instead, you can attach a PICT preview to your EPS file with a shareware program called "EPS Factory". It is $25 if you decide to purchase it, though it is more than worth its cost; it creates a PICT preview of your EPS file as well as cleans them up if there are problems. You can see more about it on Art Age's site.
If none of these solutions helps, write to us: help@bluesky.com.