(click anywhere to close)

[LaTeX] Math Graphics

category: Writing | course: LaTeX Math | difficulty:

In the basic course we saw that the command for including a picture file, which could be a picture of mathematics of course, was \includegraphics, which was slightly odd. LaTeX does have a simple picture environment, but because the language was meant to typeset pieces with heavy use of math, this environment is reserved for mathematical graphics.

Within the picture environment, there’s a small list of commands you can use to place different types of simply figures, which combined together can generate complex mathematical graphics. It isn’t very difficult, it might just be a lot to take in at once. We’ll start off simple.

Starting the Picture Environment

It’s a regular environment, except for the fact that the arguments are supplied differently: with parentheses, instead of brackets. The syntax is:

\begin{picture}{width, height)(xOffset, yOffset) picture commands … \end{picture}

These arguments are not regular LaTeX numbers with units – they refer to the amount of units within the picture. To length that holds this information is \unitlength, which you can change the way you’re used to.

    %Picture with width and height of 80pt
    %But there's nothing in it yes, let's change that!

The xOffset and yOffset set the coordinates of the lower left corner of the picture. So, in the example, the point (0,0) is used for the lower left corner, which means any negative coordinates would not be visible inside the picture.

Putting Graphics on the Page

To put graphics on the page, three very important commands are available.

\put(x, y){object}

Places object at position (x,y). You’ll learn about all the math objects soon.

\multiput(x, y)(deltaX, deltaY){n}{object}

Places n objects, starting at position (x,y), with deltaX and deltaY space between each object and the next.

\qbezier(x1, y1) (x2, y2) (x3, y3)

Places a quadratic Bezier curve using the three data points you provide. Mostly used for drawing graphs. These curves are, sadly enough, beyond the scope of this tutorial.


Changing Thickness

By default, lines have medium thickness. You can change this at any time, by adding one these commands. Such a command has effect until a next one is encountered.




Slightly thicker lines


Slightly thinner lines


Sets a custom line thickness

Math Objects

As promised, here’s a list of all the math objects that can be placed within the picture:



\line(x, y){length}

Creates a line with length length, with direction vector (x,y). A direction vector can only take integers.

\vector(x, y){length}

Also creates a line, but with an arrow at the end.


Creates a circle


Creates a filled circle (a disk).

\oval(width, height)[position]

Creates an oval. The optional argument position can be top, right, bottom or left (t, r, b, l), and determines what part to show.


Creates a rectangular frame around the object that’s inside, with no padding space.

Text or math

You can put any of the LaTeX you learned inside a picture – regular text and fancy math. This, however, only works for single lines.

    \put(0,0){The formula is $x^2 + y^2 = 4$}

Save Boxes

If you want to reuse a certain (complex) graphic multiple times in your picture, you can save it in a save box. This way you can put a graphic in the picture, just by referencing the name under which you saved it. This is a very powerful way of creating pictures, which greatly reduces the time it takes to create them.

To declare a new save box, use


To define it, i.e., tell exactly what’s inside, use

\savebox{name}(width, height)[position]{content}

Then, you can put it in your picture wherever you want, and as many times as you like, using


Do you like my tutorials?
To keep this site running, donate some motivational food!
Chocolate Milk