May 21, 2009 11:38 AM Subscribe

What the best way to put two-coordinate graphs in a LaTex document?

I am keeping a set of course notes for a math class. I am using LaTex (TexMaker on a Mac) for this. I need to create and insert some two-coordinate graphs (linear functions, quadratic functions, etc.) into the notes.

As an undergraduate I did all my math with pencil and paper - I have not done anything like this on the computer since high school. I am a total novice at this and I am figuring it out as a go. What's the best (simplest, least likely to fail) method to do this? Thanks!

I am keeping a set of course notes for a math class. I am using LaTex (TexMaker on a Mac) for this. I need to create and insert some two-coordinate graphs (linear functions, quadratic functions, etc.) into the notes.

As an undergraduate I did all my math with pencil and paper - I have not done anything like this on the computer since high school. I am a total novice at this and I am figuring it out as a go. What's the best (simplest, least likely to fail) method to do this? Thanks!

If they're simple graphs they can be done in gnuplot. Then save them as encapsulated postscript files (eps), and reference them in the LaTeX document.

posted by kiltedtaco at 11:43 AM on May 21, 2009

posted by kiltedtaco at 11:43 AM on May 21, 2009

Since you're using a Mac, you already have Grapher. It's a bit more feature rich than gnuplot, and probably easier to use for most people, since it's WYSIWYG. It exports to EPS, which is great when importing scalable vector graphics to LaTeX.

posted by rlk at 11:47 AM on May 21, 2009

posted by rlk at 11:47 AM on May 21, 2009

Importing ps or pdfs output by gnuplot (or by something like mathematica/matlab/etc if you own one of these) is probably the easiest way, as people have suggested above. If you want more control than this will give you, you can use the pgf package to read in data output by gnuplot, and do all sorts of custom stuff (plus have the fonts match). Check out section 18 of part III of the pgf manual (pdf).

posted by advil at 11:59 AM on May 21, 2009

posted by advil at 11:59 AM on May 21, 2009

Simplest is to make PDFs and use pdflatex. People will say things like "can you send me figure such-and-so from your notes?" and you don't have to do anything bizarre to send people PDFs.

I use octave to make plots.

posted by fantabulous timewaster at 12:07 PM on May 21, 2009

I use octave to make plots.

posted by fantabulous timewaster at 12:07 PM on May 21, 2009

I would use some other program (mathematica or maple, if you have access to them; I've also heard good things about Sage but haven't used it) to produce the graphics and then include them as figures using the Figure environment and \includegraphics[width=.6\linewidth]{yourFig} in the Figure; this requires using the package graphicx. (Apologies if this is too basic: I can't tell from your question if you have ever used figures/graphics at all).

It's a pain to do all your graphics production from within LaTeX.

You should get a copy of a LaTeX book. I recommend to my students More Math into LaTeX, by George Gratzer.

posted by leahwrenn at 12:27 PM on May 21, 2009

It's a pain to do all your graphics production from within LaTeX.

You should get a copy of a LaTeX book. I recommend to my students More Math into LaTeX, by George Gratzer.

posted by leahwrenn at 12:27 PM on May 21, 2009

Thanks everyone. Gnuplot looks like something promising to explore in the future but this time I did it with grapher.

posted by mai at 2:54 PM on May 21, 2009

posted by mai at 2:54 PM on May 21, 2009

This thread is closed to new comments.

posted by Zed at 11:42 AM on May 21, 2009