I am new to latex. I want to import a picture but failing. The picture is .jpg format.
1 Answer
If pdflatex
, xelatex
or lualatex
is used to compile .tex
file. You can use graphicx
package to insert .jpg
image file.
% pdflatex xelatex lualatex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=.5\textwidth]{example-image.jpg}
\caption{title}
\end{figure}
\end{document}
If you use latex
to compile. I suggest you convert .jpg
to .eps
. ImageMagick can help you to convert.
convert example-image.jpg example-image.eps
% latex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=.5\textwidth]{example-image.eps}
\caption{title}
\end{figure}
\end{document}
-
.jpg
images must be taken into account by the compilation engine.pdflatex
accepts them whilelatex
refuses them.– gigiairJan 19 at 10:38 -
\includegraphics
from thegraphicx
package will do. // Also please provide a minimum working example (MWE) to show your error.