LaTeX

Art of Problem Solving's AMC 10 Problem Series starts on June 5. This class is designed for students preparing for the AMC 10, and will consist of discussion of problems from past exams, as well as strategies for taking the test. Click here to enroll today!

A complete guide to the outstanding Asymptote graphics language for LaTeX has been created by Maria Monks for the AoPSWiki. Click here for more information about how to install and use Asymptote. This is the best way we've found to produce geometric diagrams within LaTeX. For other images that you have already created and want to include in your documents, continue reading below.

If you are using LaTeX to produce PDF documents, you can images such as geometric diagrams in your documents. The machine that we'll use to include images is the graphicx package.

To walk through this example, first download a sample image by clicking here to open the image, then saving it to your own computer. (Alternatively, depending on your browser, you may be able to right-click on the link to the image and choose "Save link as...") Save the image with the name 'myimage.png'. Make sure you pay attention to what folder you are saving the image to.

Next, open a new LaTeX source file in TeXnicCenter and input the following:

\documentclass{article}
\usepackage[pdftex]{graphicx}
\begin{document}

This is my first image.

\includegraphics{myimage.png}

That's a cool picture up above.
\end{document}

Save your source file in the same folder as you saved myimage.png. (Very important - if you save it in a different folder, you will get an error!)

Compile your source code and view the result. Make sure you have TeXnicCenter set up to produce PDF documents (LaTeX => PDF in the appropriate drop-menu). If you don't, you'll get a bunch of errors. If you followed all the steps correctly, you should get a file that looks a lot like what you'll see when you click here.

Let's take a closer look at how this code works. First, notice the new line

\usepackage[pdftex]{graphicx}

This line includes the package graphicx, which contains all the image-handling routines you need to include images. To include a specific image, we use the statement:

\includegraphics{myimage.png}

That's it! Now you're ready to learn how to manipulate images.

Art of Problem Solving's MATHCOUNTS Problem Series starts on June 9. This class is designed for students preparing for MATHCOUNTS, the premier middle school mathematics contest in the US. Click here to enroll today!
© Copyright 2007 AoPS Incorporated. All Rights Reserved. • FoundationPrivacyContact Us