graphics
Provides essential functionality for including and manipulating external graphics files within LaTeX documents.
Overview
Serves as a fundamental component for handling graphics in LaTeX, offering a consistent interface for incorporating various image formats and controlling their presentation.
- Supports multiple file formats through different drivers, adapting to various output formats including PDF and DVI.
- Enables basic image manipulations such as scaling, rotation, and positioning.
- Features commands for specifying bounding boxes and controlling image placement.
- Forms the foundation for more specialized graphics-related packages and is essential for creating technical documents, academic papers, and presentations with visual elements.
- Being part of the core LaTeX required set makes it a cornerstone package that most other graphics-related packages build upon.
Getting Started
To use graphics
, include it in your document preamble:
\documentclass{article}
\usepackage{graphics}
For more flexibility with graphics inclusion, you may prefer the extended graphicx
package which provides a more convenient key-value interface:
\documentclass{article}
\usepackage{graphicx}
Examples
Including and scaling an external image file in a LaTeX document.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\section{Including Graphics}
Here is an included image scaled to 50\% of its original size:
\includegraphics[scale=0.5]{example-image}
The \texttt{example-image} is a standard test image available in most \LaTeX{} distributions.
\end{document}
Rotating and positioning an image with specific dimensions.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\section{Rotating and Sizing Graphics}
Here is a rotated image with specific width:
\begin{center}
\includegraphics[width=6cm,angle=45]{example-image}
\end{center}
Rotating graphics is useful for landscape figures or special layout requirements.
\end{document}
Using the graphicx package's clipping and trimming features.
\section{Advanced Graphics Manipulation}
Here is an image with a specific portion displayed:
\begin{center}
\resizebox{8cm}{!}{\rotatebox{30}{\includegraphics{example-image}}}
\end{center}
The \texttt{resizebox} command maintains the aspect ratio when one dimension is set to `!`.