0% found this document useful (0 votes)
36 views5 pages

Manual On Images in Latex

Latex informations

Uploaded by

dta_shuva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views5 pages

Manual On Images in Latex

Latex informations

Uploaded by

dta_shuva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

MEAN

Latex
5
Day 5: Working with image file
From time to time, it is necessary to add pictures in the documents. Using LaTeX all
pictures will be indexed automatically and tagged with successive numbers when
using the figure environment and the graphicx package.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
This is a Math Figure
\begin{center}
\includegraphics[width=4cm]{pic}
\end{center}
\end{document}
Run the following code
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics[width=\linewidth]{pic}
\caption{Math Tetrahedron}
\label {Math Tetrahedron}
\end{figure}
\end{document}
Run the following code
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics[width=0.5 \linewidth]{pic}
\caption{Math Tetrahedron}
\label {Math Tetrahedron}
\end{figure}
\end{document}

1
Run the following code
\documentclass{article}
\usepackage{graphicx}
\begin{document}
This is a Math Figure
\begin{figure}[h]
\centering
\includegraphics[width=0.5\linewidth]{pic}
\caption{Math Tetrahedron}
\label{Math Tetrahedron}
\end{figure}
Shown in Figure \ref{Math Tetrahedron} is a tetrahedron.
\end{document}
Run the following code
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics[scale=0.1]{pic}
\caption{Math Tetrahedron}
\label {Math Tetrahedron}
\end{figure}
\end{document}
Run the following code
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics[width=4cm, height=4cm]{pic}
\caption{Math Tetrahedron}
\label {Math Tetrahedron}
\end{figure}
\end{document}
Run the following code
\begin{document}
This is a Math Figure
\begin{figure}[h]
\includegraphics[width=\linewidth]{pic}
\caption{Math Tetrahedron}
\label{Math Tetrahedron}
\end{figure}
Shown in Figure \ref{Math Tetrahedron} is a tetrahedron.
\end{document}

2
Figure Position in LaTeX
h Place the float here, i.e., approximately at the same point it occurs in
the source text (however, not exactly at the spot)
t Position at the top of the page.
b Position at the bottom of the page.
! Override internal parameters LaTeX uses for determining "good" float
positions.
h! Places the float at precisely the location in the LATEX code.

3
Wrap-Figure in LaTeX

\documentclass{article}
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{wrapfig}
\begin{document}
\blindtext

\begin{wrapfigure}{l }{3cm}%use l,o,u,c,r


\includegraphics[width=2.5cm]{pic}
\end{wrapfigure}

\blindtext
\end{document}

\documentclass{article}
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{wrapfig}
\begin{document}
\blindtext

\begin{wrapfigure}{r}{3cm}%use l,o,u,c,r
\includegraphics[width=2.5cm]{pic}
\caption{Math Tetrahedron}
\label{Math Tetrahedron}
\end{wrapfigure}

\blindtext
Shown in Figure \ref{Math Tetrahedron} is a tetrahedron.
\end{document}

4
SubFigure in LaTeX

Using \usepackage{subcaption}, following code will insert float picture named


Capture and located in same directory in two columns.

\documentclass{article}
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{wrapfig}
\usepackage{subcaption}
\begin{document}
\blindtext

\begin{figure}[h!]
\centering
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\linewidth]{pic}
\caption{fig1}
\end{subfigure}
\begin{subfigure}[b]{0.4\linewidth}
\includegraphics[width=\linewidth]{pic}
\caption{fig2}
\label{fig1}
\end{subfigure}
\caption{The same figures. Two times.}
\label{Tetrahedron}
\end{figure}

\blindtext
Shown in Figure \ref{fig1} is a tetrahedron.
\end{document}

Summary
• Use the graphicx package and figure environment to embed pictures
• Pictures will be numbered automatically with graphic package
• Change the width and scale of image with option tag
• Set the position for the image by adding a float option
• If wrap is required, use the wrapfig package and the wrapfigure environment
• If multiple figures are required, use the subcaption package and
the subfigure environment

You might also like