22

I have a vector grahpics file. Could someone please help me embed a image into my LaTeX document ? I have no clue.

3
  • 2
    What kind of vector graphics file?
    – Werner
    Commented Apr 16, 2012 at 4:11
  • Are you using pdfLaTeX or plain LaTeX?
    – Jake
    Commented Apr 16, 2012 at 6:09
  • 1
    Is it possible to use a PDF as a container for a vector graphic and include the PDF then? Or can eps contain vector graphics?
    – Keks Dose
    Commented Apr 16, 2012 at 6:53

3 Answers 3

27

There are several vector graphics format in use these days by vector graphics packages, the most common ones being pdf, eps, and svg.

SVG tends to be the de facto internal working format for most of them these days, and it is a very good format for web applications as most browser will be able to display them natively. However, unfortunately, svg is currently not supported in LaTeX documents.

The historical format for vector graphics in TeX is eps and it is indeed the only format supported by the original latex, even for raster based images (indeed, all these file formats can contain both vector and raster based images).

With the graphicx package, and pdflatex (and newer incarnations such as xelatex and lualatex) you can now include raster files such as jpg, png, and so on, without having to put them in a eps container, and you can also include pdf files, however you lose the ability to include eps files.

Most graphics packages will allow you to export as eps or pdf so you can choose at the time which format you want. Alternatively, you can easily convert from one format to the other with command line tools such as epstopdf.

As for which format is better, this is open for debate, pdf is basically built on eps with more features such as embed fonts, including ttf and otf ones, and compressibility (so a pdf will usually be smaller than an eps) among others. People will usually also have something installed on there computer that reads pdf, whereas, eps may be an issue.

1
1

I guess you may want to export the graphics to the EPS format. EPS is fully supported by TEX in the figure environment. You'll need this in preamble:

\usepackage{epsfig}

Then the figures are added as shown below:

\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{ris00.eps}
\end{figure}
5
  • 7
    What about PDF? Why not use the more general graphicx package?
    – Werner
    Commented Apr 16, 2012 at 4:47
  • 1
    In that case additional \usepackage{epstopdf} does the trick
    – Alexandre
    Commented Apr 16, 2012 at 4:52
  • @Alexandre With the last pdftex, I think you don't need to add \usepackage{epstopdf} Commented Apr 16, 2012 at 5:56
  • 13
    The package epsfig is distributed only for compatibility with legacy documents and should not be used in new documents; graphicx is the real solution.
    – egreg
    Commented Apr 16, 2012 at 5:57
  • @Altermundus: I needed to add: tex.stackexchange.com/a/52026/9237.
    – Speravir
    Commented Apr 16, 2012 at 12:59
1

There is one svg.sty that you have to import into your system latex directory {texmf/tex/latex/svg }. You can then use

  1. \usepackage{svg}
  2. \includesvg[svgpath = images/]{example} or
  3. \includesvg{example} %file name is example without .svg extension.

Refer -

1
  • 7
    The svg package uses inkscape to convert SVG file into PDF file before inclusion in the final document. It requires the -shell-escape option... Commented Jan 28, 2015 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .