1 | initial version |
To add an SVG image to a LaTeX file, you can use the svg
package.
Here are the steps:
Install dvisvgm
package if you don't have it installed. This package converts the SVG image to a format that LaTeX can use.
Load the svg
package in your LaTeX document by putting \usepackage{svg}
in your preamble.
Insert the SVG image using the \includesvg
command in your document. For example, to include an SVG image named "example.svg" located in the same directory as your LaTeX document, use \includesvg{example}
.
Compile your LaTeX document with the shell escape command. You can do this by running pdflatex -shell-escape yourfile.tex
in your terminal.
View your PDF document.
Here is an example:
\documentclass{article}
\usepackage{svg}
\begin{document}
\includesvg{example}
\end{document}
Note: The svg
package only works with PDFLaTeX or LuaLaTeX. If you are using XeLaTeX, you may use the svg-extract
package instead.