TikZ or EPS: Which Should You Use for LaTeX Figures?
At a glance
- 1. Choose by source
Use TikZ for figures you want to define and maintain in LaTeX; use EPS when you already have an EPS graphic.
- 2. Check your compiler
TikZ works with common LaTeX engines. EPS works directly with a latex-to-dvips workflow, but usually needs conversion for pdfLaTeX.
- 3. Consider maintenance
TikZ keeps figure instructions editable as text; EPS is often easier to include when the figure comes from another program.
- 4. Match the delivery format
For modern PDF output, use PDF for vector artwork or a suitable raster format for photos; convert EPS if required.
TikZ and EPS are not quite equivalent choices: TikZ is a language for describing graphics in your LaTeX source, while EPS is a file format for storing a graphic. The practical choice depends on whether you are making the figure or including one made elsewhere, and on how you compile your document.
For figures built from lines, shapes, diagrams, or mathematical plots, TikZ is often the better fit. For an existing EPS illustration, EPS may be easiest to keep in the project, though a PDF workflow will usually require conversion. Here is how to choose without sacrificing quality or making your document harder to maintain.
What TikZ and EPS provide
TikZ lets you describe graphics with commands in your .tex document or in a separate .tex file. The figure is drawn as part of the typesetting process. Because the labels are LaTeX text, they can use the same fonts and math notation as the surrounding document. You can edit the figure as source text and adjust its styles, dimensions, and labels.
EPS, or Encapsulated PostScript, is a file format commonly used for vector illustrations. It can preserve scalable paths and text, but an EPS file is not the same as the original editable source from the drawing program. EPS files can also contain raster images, so the extension alone does not guarantee that all content will remain sharp at any size.
When to use each
Choose TikZ when you are creating a diagram, a schematic, or a simple plot that benefits from document-matched labels and styling. It is especially useful when you expect to revise the figure alongside the text or want the figure definition tracked with the LaTeX source.
Choose EPS when an illustration already exists in that format, or when a publisher or established workflow specifically asks for EPS. You can often include it without recreating it. If you need to change its geometry or visual design, edit the original file in the program that created it, if that source is available.
For photographs, screenshots, or other continuous-tone images, neither TikZ nor EPS is usually the best starting point. Use an appropriate raster image format, such as JPEG for many photographs or PNG for lossless images, and include it with \includegraphics. For vector artwork in a modern PDF workflow, PDF is often more convenient than EPS.
Compiler compatibility
TikZ works with the common LaTeX engines, including pdflatex, xelatex, and lualatex. It can take longer to compile than simply including a finished image, especially for large or complex figures. If compilation becomes slow, consider saving a TikZ figure separately as a PDF or using TikZ’s externalization facilities.
EPS is native to the traditional latex → DVI → dvips workflow. pdflatex, xelatex, and lualatex produce PDF directly and do not generally include EPS files as-is. In those workflows, convert the EPS to PDF first, or use an installed conversion setup that handles it automatically. Automatic conversion can depend on your TeX distribution, configuration, and permissions for running external programs; it may not work in restricted environments.
A typical modern inclusion after converting drawing.eps to drawing.pdf is (with the graphicx package loaded):
\includegraphics[width=0.7\linewidth]{drawing.pdf}
To use the EPS file directly, compile through the DVI-to-PostScript route instead. Avoid maintaining both EPS and converted PDF by hand if you can regenerate one from the other; that reduces the chance that they drift out of sync.
A small TikZ example
This complete document draws a curve and labels its axes. It can be compiled with pdflatex, xelatex, or lualatex; it needs the tikz package.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[x=1cm,y=1cm]
\draw[->] (0,0) -- (3,0) node[right] {$x$};
\draw[->] (0,0) -- (0,2) node[above] {$y$};
\draw[blue,thick,domain=0:2.5,samples=50]
plot (\x,{0.25*\x*\x});
\end{tikzpicture}
\caption{A quadratic curve drawn with TikZ.}
\end{figure}
\end{document}
The \draw commands define the axes and curve directly in the source. Change the coordinates, style, or labels there, then recompile to update the figure. For more involved plots, pgfplots builds on TikZ and provides axis and plotting features.
Common mistakes
- Assuming EPS is always vector. EPS can include raster content. Check the contents and resolution if the figure looks blurry when enlarged.
- Using EPS with a PDF-producing engine without conversion. Convert it to PDF or use a compatible DVI workflow; merely changing the filename extension does not convert the file.
- Choosing TikZ for every figure. A photograph or complex illustration may be much easier to manage as a standalone image. TikZ is most useful when its source-level editability and integration with LaTeX are valuable.
- Ignoring compile time. A large TikZ figure is redrawn during compilation unless you arrange to reuse a rendered output. Externalizing expensive figures can help, but adds setup and generated files to manage.
- Expecting labels in EPS to match the document automatically. EPS text may use different fonts or sizes. If consistent typography matters, create the labels in LaTeX or carefully check the exported artwork.
A practical rule
For a figure you are designing in LaTeX, start with TikZ. For an existing EPS figure, keep it if it suits your workflow, or convert it to PDF for direct PDF compilation. For other external artwork, use a format appropriate to the content rather than treating TikZ and EPS as the only options.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.