A wide variety of drawing programs are available for easily making figures, and it’s easy to create text using LaTeX; but combining the two can be unreasonably difficult.
What programs are best for including LaTeXed labels in figures? There are many options, but none yet seem to be ideal for undergraduates. If you have new information or relevant experience with any of these, please feel free to contribute to this page.
The following options have been suggested. For those that have been tried in the classroom, instructor comments have been included.
Make LaTeX label separately and import into generic illustration program
LaTeX labels can be made separately (e.g., online here or in LaTeXiT), saved as images (select transparent background and use, e.g., gif at 300+ dpi to avoid font issues), and imported into the student’s favorite image editor (e.g., Inkscape), where they can then be combined with the rest of the image.
TikZ
Draw pictures using tex code inside the tex document. Powerful, but complicated so may take a while to learn. Good support can often be found by searching online with the key term “Tikz” and key terms for the drawing task you want to accomplish. TeXample.net has a very helpful gallery of TikZ examples with associated pdf and tex files.
Inkscape
Inkscape is a free, open-source vector graphics editor that has functionality comparable to the commercial Adobe Illustrator. The following 2014 YouTube video explains how to use Inkscape to add LaTeX labels to a figure; testing in 2017 confirms that the strategy works on a Mac, but placing the label well can require trial and error.
Inkscape export LaTeX eps_tex tutorial & idiosyncrasies (YouTube) by Luther Driggers
The Inkscape manual is very helpful for first learning Inkscape.
In the fall of 2010, student researcher Jason Gross wrote,
“Another program that, with a little help, can export to tikz, is Inkscape (https://inkscape.org/ and https://code.google.com/archive/p/inkscape2tikz/ to let it export to tikz, and https://pav.iki.fi/software/textext/ and https://ubuntuforums.org/archive/index.php/t-1001635.html). It’s good for arbitrary vector graphics, but, as far as I can tell, doesn’t let you export text…
“Inkscape + inkscape2tikz + TeXText:
“Great for arbitrary vector graphics. A little support for 3-D. It’s good when you want to draw a diagram by hand, but not care about how the geometry lines up, or not bother with complicated geometrical constructions to get nice-looking annotations (e.g., braces around lines, distance between points). Doesn’t seem to support exporting text as tikz, though TeXText lets you insert LaTeX for export as pdf. Also, it might be able to export it to pstricks (which doesn’t play nice with pdflatex, and instead needs latex -> dvips -> ps2pdf or latex -> dvipdfmx). The export to tikz requires some manual configuration. The most annoying thing is probably lack of text support, but I haven’t played with it much.”
Mohammed Abouzaid reported in the fall of 2010 that the LaTeX labeling extension has stability issues.
Mathcha.io
Mathcha.io is on online editor for documents containing mathematics. It uses LaTeX and lets you insert a canvas within the text and then draw on it using Mathcha.io’s drawing tools. It offers TikZ export for the figures.
Geogebra
Geogebra is dynamic geometry software. Think compass and straightedge constructions, but with the ability to drag points. So, for example, if you construct the circumcenter of a triangle, you can drag the points of the triangle and watch the circumcenter move. The program is much more powerful than this simple example suggests, and includes 3D.
In fall 2010, student researcher Jason Gross wrote,
“Geogebra + export to PGF/TikZ:
Great for geometrical figures. Allows labeling with (almost) arbitrary LaTeX formulas. Does not allow rotation of text (as far as I can tell). Hard, but possible, to do (pseudo-)3D. Requires a bit of manual tweaking afterward to get text, arrows, angles, etc. to show up nicely. Occasionally it’s very silly about how it exports things (e.g., a circle as a plot of y = sqrt(r^2 – x^2), instead of the circle primitive), and it occasionally has overflow errors for some plots. It gives you code which you insert into your .tex file, which is nice in that you don’t get lots of other files hanging around, but not nice in that you have a large block of code that you have to mostly ignore when you’re editing your .tex file. Also, pgf/tikz is a large package, and makes your document TeX slightly slower. The most annoying part is the tweaking that has to be done to make the image in the pdf look like what you draw (it’s not that bad, usually).”
In the fall of 2010, Mohammed Abouzaid had his Real Analysis students use Geogebra. In his initial analysis of the program, he wrote,
- “It took me 5 minutes to get it up and running
- It is Java based, and hence essentially completely cross platform
- It has a relatively intuitive GUI
“Disadvantages are that the Latex code it spits out is a bit buggy, and
that it’s a tool made for one job: creating diagrams to be included in
high school / mid college level math documents. If they want to create
seriously complicated graphics, they’ll have to use something else.”
After using Geogebra with his class, Mohammed reported,
“This year, we introduced students to Geogebra, which has a Tikz export feature. Unfortunately, this proved a less than optimal solution because the code created by Geogebra tended to cause compiling errors (my guess is that this is caused by conflicting versions of Tikz, but I didn’t investigate this enough to be sure).
“Suggestion for future recitations: Instead of exporting to Tikz, export to pdf and use includegraphics. Keep in mind that Geogebra exports full page pdf’s so that the Figure would appear small inside a sea of white unless some corrective measures are taken. For this, one can use the trimming and scaling features of includegraphics (e.g. includegraphics[trim = left bottom right top, clip,scale=2]{picture.pdf}).
“Disadvantages: You cannot readily change the labels or the positions of elements of the figure from within Latex. Instead, you have to go back to your saved Geogebra file, adjust things, and re-export.
“Advantage: It should work for everybody with little trouble (no one had trouble installing Geogebra on their laptop, and they’ve used includegraphics in the first class).
“Given the goals of the course, I see this at the ideal method. It doesn’t force them to interact with Xfig, and it doesn’t lead to complaints about code not working.”
Ipe
In the spring of 2011 Olivier Bernardi wrote,
“The drawing software Ipe is my favorite. It creates beautiful pictures. It is very fast, especially because it has some efficient “snapping tools” (a way of sticking your mouse to objects) and many keyboard shortcuts. It is also perfectly integrated with Latex. Moreover, Ipe can also be used to create slides. This last feature is actually surprisingly efficient (because it combines the power of Latex with a WYSIWYG environment).
“I can only see two small drawbacks with Ipe. First, starting to use Ipe has an initial learning cost because of the keyboard shortcuts (but this would be true of any software probably). Second, Ipe is quite young and the versions have been changing pretty often over the past years (however, there exists a command for updating the figures).”
In the fall of 2011 Kyle Ormsby wrote, “We had problems with ipe this year because they seem to have dropped support for Macs.”
Asymptote
In the fall of 2010, student researcher Jason Gross wrote,
“Another program to consider is asymptote (http://asymptote.sourceforge.net/). It makes its own .asy files as diagrams, and requires an extra step in the compilation/typesetting to convert them to diagrams…
“I’m under the impression that this is the standard for LaTeX diagrams. Simple, but intuitive graphical interface (xasy). It allows rotation of textual labels. You can either make separate diagram files (.asy), which get included, or inline the code (begin{asy} end{asy}). It requires an extra step in the TeXing process (running asymptote), but many LaTeX editors can be configured to do this automatically. (There are probably also packages that do this for you if you run LaTeX with write18 enabled. If not, I can write a bit of code that does this, assuming asymptote is installed and you know where it is.) I haven’t really used it much, so I don’t know much about how it works. I’ve preferred geogebra/pgf/tikz because they don’t require asymptote to TeX your files, and because I like the geometric abilities of geogebra. Asymptote code is probably easier to edit by hand.”
Xfig
Xfig was used for several terms in M.I.T.’s communication-intensive offering of Real Analysis because it’s loaded on all campus computers. It has an unintuitive user interface, so it is no longer used with Real Analysis.
In the fall of 2010, student researcher Jason Gross wrote,
“I haven’t used it much, so I don’t have much to say. It seems to export into the picture environment (or pdf or eps or some others), which is simple, but limited. The interface is very old (it doesn’t take advantage of standard system menus or dialog boxes), and as a result is hard to get used to. It seems to not render your LaTeX formulas, unlike asymptote (which renders your text as LaTeX). It seems powerful, but the interface is very unintuitive and counterproductive (I need to enter the angle that I want to rotate something by, I can’t just drag it. Requiring a middle mouse button (or clicking both buttons simultaneously) to end a path is really annoying, especially on laptops that don’t have a middle mouse button. I can’t figure out how to specify arbitrary colors in the color dialog.) I’m guessing it doesn’t have native installers for windows/mac, which I think all of the other ones do. If you use this to export to pdf/eps, then I’d suggest replacing it with asymptote (which seems slightly less powerful, but I don’t think that’s too much of a problem). If you use this to make LaTeX code, I’d suggest replacing it with geogebra or asymptote.
jfig
In the fall of 2010, student researcher Jason Gross wrote, “An alternative to xfig is jfig (http://tams-www.informatik.uni-hamburg.de/applets/jfig/), which seems like a more modern, java-based version of xfig.”
PSTricks
Write PostScript code inside of LaTeX documents.
XY-Pic
XY-Pic is an object-oriented drawing language. It makes some tasks very easy. For example, Kyle Ormsby reports that xymatrix is the easiest way to produce commutative diagrams. XY-Pic includes TeX boxes
for including LaTeXed labels on the diagrams.
More information
There are many LaTex graphics related articles on the tug.org site which can be accessed here.