1\documentclass[12pt]{article}
2\usepackage{graphicx}
3\usepackage{subcaption}
4\usepackage{float}
5\usepackage{wrapfig}
6
7\title{Figures in LaTeX}
8\author{sublimated}
9\date{}
10
11\begin{document}
12\maketitle
13
14\section{Basic Figure}
15
16\begin{figure}[h]
17 \centering
18 \fbox{\parbox{0.6\textwidth}{\centering\vspace{2cm}[placeholder image]\vspace{2cm}}}
19 \caption{A basic figure with a caption.}
20 \label{fig:basic}
21\end{figure}
22
23Cross-reference: see Figure~\ref{fig:basic}.
24
25\section{Figure Placement}
26
27LaTeX uses placement specifiers:
28\begin{description}
29 \item[\texttt{h}] Here --- at this position in the text
30 \item[\texttt{t}] Top of the page
31 \item[\texttt{b}] Bottom of the page
32 \item[\texttt{p}] On a dedicated floats page
33 \item[\texttt{H}] Exactly here (requires \texttt{float} package)
34\end{description}
35
36Use \verb|[htbp]| for maximum flexibility. Use \verb|[H]| to force exact placement.
37
38\section{Subfigures}
39
40\begin{figure}[h]
41 \centering
42 \begin{subfigure}[b]{0.45\textwidth}
43 \centering
44 \fbox{\parbox{\textwidth}{\centering\vspace{1.5cm}(a) Before\vspace{1.5cm}}}
45 \caption{Before optimization}
46 \label{fig:before}
47 \end{subfigure}
48 \hfill
49 \begin{subfigure}[b]{0.45\textwidth}
50 \centering
51 \fbox{\parbox{\textwidth}{\centering\vspace{1.5cm}(b) After\vspace{1.5cm}}}
52 \caption{After optimization}
53 \label{fig:after}
54 \end{subfigure}
55 \caption{Side-by-side comparison. See \subref{fig:before} vs \subref{fig:after}.}
56 \label{fig:comparison}
57\end{figure}
58
59\section{Figure with Image File}
60
61When working with sublimated, images in the same folder are resolved automatically:
62
63\begin{verbatim}
64\begin{figure}[h]
65 \centering
66 \includegraphics[width=0.8\textwidth]{results-plot.png}
67 \caption{Experimental results.}
68 \label{fig:results}
69\end{figure}
70\end{verbatim}
71
72Supported formats: PNG, JPEG, PDF (vector), EPS (with conversion).
73
74\section{Multiple Cross-References}
75
76Figures~\ref{fig:basic} and \ref{fig:comparison} show different approaches.
77Subfigure~\ref{fig:before} shows the baseline while \ref{fig:after} shows the improvement.
78
79\end{document}