Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2020-07-13 04:49:54
Size: 2157
Comment:
Revision 6 as of 2025-08-27 21:05:00
Size: 768
Comment: Fix
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= LaTeX Graphics = = LaTeX graphicx =
Line 3: Line 3:
The process of embedding an image or graphic into a LaTeX document can be done in many ways. '''graphicx''' is a package for inserting graphics.
Line 11: Line 11:
== Basic Usage == == Usage ==
Line 15: Line 15:
\graphicspath{ { ./images/ } { ./charts/ } { ./tables } }
Line 22: Line 21:
----
Line 25: Line 23:
=== Options ===
Line 26: Line 25:
== Graphics Options ==

The most basic tool for embedding an image into a document is `\includegraphics`. There are a number of options to configure the image.
For example:
Line 36: Line 33:


=== Graphics Path ===

To configure where graphics files are looked up, try:

{{{
\usepackage{graphicx}
\graphicspath{ { ./images/ } { ./charts/ } { ./tables } }
}}}

To position a graphic, or to add reference-able labels, or to add captions, create a [[LaTeX/Figures|figure]].
Line 40: Line 50:
== Figures == == See also ==
Line 42: Line 52:
To position an image, and to create a table of figures throughout a document, use figures.



=== Quick Start ===

{{{
\begin{figure}[h]
\includegraphics{foo}
\end{figure}
}}}



=== Positioning Graphics ===

Figures take a mandatory option, like `h` in the example above. Valid values and their meanings are:

||'''Option'''||'''Effect''' ||
||`h` ||Insert here ||
||`H` ||Insert here, exactly ||
||`t` ||Insert at page top ||
||`b` ||Insert at page bottom ||
||`p` ||Insert into a separate page for floating figures ||
||`!` ||Override LaTeX placement algorithm ||



=== Centering a Graphic ===

To center a graphic, simply use `centering` inside the figure.



=== Side-by-Side Graphics ===

To display two images side-by-side, try:

{{{
\begin{figure}
\centering
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics{foo}
\end{subfigure} %
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics{bar}
\end{subfigure}
\end{figure}
}}}



=== Labeling and Captioning a Graphic ===

To label an image, use `\label{my-label}`. The standard practice is to use a label composed as `prefix:identifier`, so that labels of subfigures can be grouped.

To caption an image, use `\caption{my-caption}`.
[[https://ctan.org/pkg/graphicx|CTAN package page]]

LaTeX graphicx

graphicx is a package for inserting graphics.


Usage

\usepackage{graphicx}

% ...

\includegraphics{foo}

Options

For example:

\includegraphics[scale=2.5]{foo}
\includegraphics[width=5cm, height=5cm]{bar}
\includegraphics[angle=90]{baz}

Graphics Path

To configure where graphics files are looked up, try:

\usepackage{graphicx}
\graphicspath{ { ./images/ } { ./charts/ } { ./tables } }

To position a graphic, or to add reference-able labels, or to add captions, create a figure.


See also

CTAN package page


CategoryRicottone

LaTeX/Graphicx (last edited 2025-08-27 21:05:00 by DominicRicottone)