Inserting Images in LaTeX
Learn how to insert, scale, and format images in LaTeX documents. Covers supported formats, the graphicx package, and image customization.
Images enhance your documents by providing visual information, breaking up text, and illustrating concepts. This guide covers everything you need to know about working with images in LaTeX.
Package required: You must include \usepackage{graphicx}
in your preamble to work with images.
Related topics: Figure positioning | Table creation | Package management
Basic Image Insertion
Simple Image Include
Supported Image Formats
Compiler | Formats Supported |
---|---|
pdfLaTeX | PDF, PNG, JPG/JPEG |
XeLaTeX | PDF, PNG, JPG/JPEG, EPS* |
LuaLaTeX | PDF, PNG, JPG/JPEG, EPS* |
LaTeX (DVI) | EPS, PS |
*EPS requires additional configuration
Best practices for formats:
- PDF: Vector graphics, diagrams, plots
- PNG: Screenshots, images with transparency
- JPG: Photographs, images without transparency
Scaling Images
Width and Height Control
Common Width References
Figure Environment
Basic Figure
Figure Placement Options
Option | Meaning | Priority |
---|---|---|
h | Here (approximately) | Low |
t | Top of page | Medium |
b | Bottom of page | Medium |
p | Page of floats | Low |
H | HERE (exactly)* | Forced |
! | Override LaTeX’s rules | Modifier |
*Requires \usepackage{float}
Multiple Images
Side by Side Images
Grid of Images
Image Transformations
Rotation and Flipping
Clipping and Trimming
Advanced Techniques
Wrapping Text Around Images
Image Paths
Draft Mode
Image Formats and Conversion
Working with Different Formats
Best Practices
Image guidelines:
- Resolution: Use 300 DPI for print, 96-150 DPI for screen
- File size: Optimize images before including them
- Formats: Use vector (PDF) for diagrams, raster (PNG/JPG) for photos
- Naming: Avoid spaces and special characters in filenames
- Organization: Keep images in a dedicated folder
- Captions: Always include descriptive captions
- References: Label all figures for cross-referencing
Troubleshooting
Common image problems:
- Image not found: Check path and filename (case-sensitive)
- Wrong format: Ensure format is supported by your compiler
- Distorted image: Use only width OR height, not both
- Image too large: Scale relative to
\textwidth
- Bad placement: Use
[htbp]
for flexible positioning - Missing package: Add
\usepackage{graphicx}
Quick Reference
Essential Commands
Command | Purpose | Example |
---|---|---|
\includegraphics{} | Insert image | \includegraphics{pic} |
width= | Set width | width=5cm |
height= | Set height | height=3cm |
scale= | Scale factor | scale=0.5 |
angle= | Rotate | angle=90 |
\caption{} | Add caption | \caption{Description} |
\label{} | Add reference | \label{fig:name} |
Figure Template
Next: Master Figure positioning to control exactly where your images appear, or learn about Creating tables for structured data presentation.