General ⇒ How do I add a jpeg picture to Latex
How do I add a jpeg picture to Latex
How do I add a jpeg picture to Latex?
What command should I use?
Could somebody tell me the code an detail?
What command should I use?
Could somebody tell me the code an detail?
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
How do I add a jpeg picture to Latex
Hi akira32,
you should load the graphicx package and use \includegraphics. Here is a very basic example:
It may be extended, but that depends on what your requirements are. Do you want the picture placed at an exact position or do you want to let it float? Do you need a caption below the picture? Do you need it to be listed in a list of figures? Do you need a number, a label for referencing?
Concerning \includegraphics you will find more information in the graphicx documentation.
Stefan
you should load the graphicx package and use \includegraphics. Here is a very basic example:
Code: Select all
\documentclass[a4paper,10pt]{article}
\usepackage{graphicx}
\begin{document}
Here is an example:
\begin{center}
\includegraphics{test.jpg}
\end{center}
\end{document}
Concerning \includegraphics you will find more information in the graphicx documentation.
Stefan
LaTeX.org admin
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How do I add a jpeg picture to Latex
As a supplement to the statements of Stefan I want to remark that graphics files in JPG format only can be included when compiling with pdflatex.
Best regards
Thorsten¹
Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
How do I add a jpeg picture to Latex
I write the code as below:
But when I click the button "build output", it appears 4 errors.
The 4 errors are in the jpeg4error.JPG in Attachments.
Code: Select all
\documentclass[a4paper,10pt]{article}
\usepackage{graphicx}
\begin{document}
\begin{center}
\includegraphics{test.jpg}
\end{center}
\end{document}
The 4 errors are in the jpeg4error.JPG in Attachments.
- Attachments
-
- add test.jpg, it appears 4 errors
- jpeg4errors.JPG (47.39 KiB) Viewed 8968 times
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
How do I add a jpeg picture to Latex
Hi akira32,
the example I gave above is a complete compilable document, you should not insert that complete code into your own document. In your document you can insert the picture just by
and if you want to center it then write instead:
Make sure that at the beginning of your document, in your preamble, there's the line
Further the comment of Thorsten is important: use pdflatex, that means use the LaTeX => PDF output profile.
Stefan
the example I gave above is a complete compilable document, you should not insert that complete code into your own document. In your document you can insert the picture just by
Code: Select all
\includegraphics{test.jpg}
Code: Select all
\begin{center}
\includegraphics{test.jpg}
\end{center}
Code: Select all
\usepackage{graphicx}
Stefan
LaTeX.org admin
Re: How do I add a jpeg picture to Latex
Thank you! I add the line of "\includegraphics{test.jpg}" and "\usepackage{graphicx}" in preamble. But when I build the project, it appears a error as the picture attached.
- Attachments
-
- a error in adding jpeg file
- latex_jpg.JPG (13.8 KiB) Viewed 8951 times
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: How do I add a jpeg picture to Latex
It seems that you are not using pdflatex, that's why the .jpg format is not supported.
You should compile directly into pdf format, not to dvi, then it will work. If you use TeXnicCenter, choose the output profile LaTeX => PDF. If you use WinEdit then choose the PDFTeXify (or PDFLaTeX) button. Or tell us, which editor you are using.
Stefan
You should compile directly into pdf format, not to dvi, then it will work. If you use TeXnicCenter, choose the output profile LaTeX => PDF. If you use WinEdit then choose the PDFTeXify (or PDFLaTeX) button. Or tell us, which editor you are using.
Stefan
LaTeX.org admin
How do I add a jpeg picture to Latex
\includegraphics[width=\textwidth , bb= 20 20 575 575]{test.jpg}
I forget add the bounding box. But it still cannot show the jpeg file in my Latex.
Becuase my Latex project is created by my classmate.
I am a beginner. Now I try to create a new report project and try to add the jpeg file.
I forget add the bounding box. But it still cannot show the jpeg file in my Latex.
Becuase my Latex project is created by my classmate.
I am a beginner. Now I try to create a new report project and try to add the jpeg file.
Re: How do I add a jpeg picture to Latex
I add the jpeg file successfuly with the build option of "LaTex=>PS=>PDF".
But the jpeg file becomes a gray-level picture in pdf.
But the jpeg file becomes a gray-level picture in pdf.
- Attachments
-
- test1-gray-level in pdf
- test1-gray.JPG (1.43 KiB) Viewed 8904 times
-
- tes1.jpg colorful (original)
- test.JPG (1.39 KiB) Viewed 8905 times
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
How do I add a jpeg picture to Latex
That's not the right profile. Do really you have not LaTeX=>PDF od didn't you try that?akira32 wrote: I add the jpeg file successfuly with the build option of "LaTex=>PS=>PDF".
With LaTeX=>PDF (that's pdflatex) you will get color and you won't need a bounding box.
Stefan
LaTeX.org admin