Working with Images in LaTeX
Comprehensive guide to including, positioning, and formatting images in LaTeX. Learn professional techniques for graphics, subfigures, and advanced image layouts.
Master the art of including and formatting images in LaTeX documents. This comprehensive guide covers everything from basic image inclusion to advanced layouts, optimization, and professional formatting techniques.
Prerequisites: Basic LaTeX knowledge and the graphicx package
Time to complete: 25-30 minutes
Difficulty: Intermediate
What you’ll learn: Image formats, positioning, sizing, captions, subfigures, wrapping text, and advanced techniques
Understanding Image Basics
Supported Image Formats
LaTeX supports different image formats depending on the compiler:
Supported formats:
- PDF - Vector graphics, best quality
- PNG - Lossless compression, good for diagrams
- JPG/JPEG - Lossy compression, good for photos
- EPS - With epstopdf package
Supported formats:
- PDF - Vector graphics, best quality
- PNG - Lossless compression, good for diagrams
- JPG/JPEG - Lossy compression, good for photos
- EPS - With epstopdf package
Supported formats:
- All pdfLaTeX formats
- SVG - With svg package
- Additional formats via system tools
Supported formats:
- EPS - Encapsulated PostScript
- PS - PostScript
Basic Image Inclusion
Figure Environments
Basic Figures with Captions
Advanced Caption Formatting
Multiple Images
Side-by-Side Images
Grid Layouts
Text Wrapping
Wrapping Text Around Images
Image Transformations
Scaling and Rotating
Special Effects
Advanced Techniques
Dynamic Image Paths
External Graphics Tools
Optimizing Images
File Size Management
Best practices for image optimization:
-
Choose the right format:
- PDF: Vector graphics, diagrams, plots
- PNG: Screenshots, diagrams with text
- JPG: Photographs, complex images
-
Optimize before including:
-
Use appropriate resolution:
- Print: 300 DPI
- Screen: 72-96 DPI
- Web: 72 DPI
Performance Tips
Troubleshooting
Common Issues and Solutions
Common image problems:
-
“File not found” errors:
-
Wrong image size:
-
Figure placement issues:
-
Overflow into margins:
Debug Mode
Best Practices Checklist
✅ Image workflow checklist:
- Choose appropriate file format
- Optimize file size before inclusion
- Use relative widths (
\textwidth
) - Always include captions
- Add meaningful labels
- Test different positions
- Check output at final resolution
- Verify all images are included in repository
- Use consistent naming convention
- Document image sources
Complete Example
Next Steps
Now that you’ve mastered image handling:
Creating Tables
Learn to create professional tables
TikZ Graphics
Create diagrams with TikZ
Managing Large Documents
Handle images in multi-file projects
Troubleshooting
Fix common image-related errors
Pro tip: Always keep high-resolution originals of your images. You can create lower-resolution versions for drafts and switch to high-resolution for final output using conditional inclusion.