I've been trying to insert an image into LaTeX using the [graphicx] package using TeXworks with very little success. The .PNG image I want to insert is currently just saved in my Windows Pictures library, so I was wondering if I have to have the image saved in a specific location before inserting it?
[Tex/LaTex] Do images have to be saved in a specific location before inserting them into LaTeX
graphicstexworks
Related Solutions
Since the images must go at a specific position, it's not convenient to use a floating environment; you can use \captionof
from the capt-of
or caption
packages to give your figures a caption:
\documentclass[12pt, a4paper, twoside]{article}
\usepackage[margin=1in,bindingoffset=15.5mm,heightrounded]{geometry}
\usepackage[T1]{fontenc}
\usepackage[demo]{graphicx}
\usepackage{caption}
\begin{document}
I have some text here. Then pics.
\clearpage
{
\centering
\includegraphics[scale=0.75, angle=90, width=\textwidth]{hamlet.jpg}
\captionof{figure}{cool picture}
\clearpage
\includegraphics[scale=0.75, angle=270, width=\textwidth]{kinglear.jpg}
\captionof{figure}{cool picture 2}
}
\clearpage
some more text here
\end{document}
The demo
option for graphicx
simply replaces actual figures with black rectangles; do not use that option in your actual document.
Depending on how tou are controlling the size for the images, you could additionally wrap each image and its caption using a minipage
to prevent an undesired page break; something like
\clearpage
\noindent\begin{minipage}{\textwidth}
\centering
\includegraphics[scale=0.75, angle=90, width=\textwidth]{hamlet.jpg}
\captionof{figure}{cool picture}
\end{minipage}
\clearpage
\noindent\begin{minipage}{\textwidth}
\centering
\includegraphics[scale=0.75, angle=270, width=\textwidth]{kinglear.jpg}
\captionof{figure}{cool picture 2}
\end{minipage}
\clearpage
pdf
images has a transparent background, so even with a border, when you include them over a colored background the"white border" disappears. The easiest solution would be to include your figure into a white box with \colorbox{white}{\includegraphics{your-pdf-figure}}
. This way figure's background and border are white.
Update: Missing graphic example for the original answer and some rotating examples for lalebarde's comment.
\documentclass[xcolor=svgnames,mathserif,serif]{beamer}
\usetheme{default}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{frametitle}[default][center]
\definecolor{myblue}{RGB}{47,94,142}
\setbeamercolor{background canvas}{bg=myblue}
\usefonttheme{structuresmallcapsserif}
\setbeamercolor{title}{fg=white}
\setbeamercolor{titlelike}{fg=white}
\setbeamercolor{normal text}{fg=white}
\begin{document}
\begin{frame}{Sample Title}
\begin{center}
\includegraphics{1842.pdf} %why isn't white space appearing?
\colorbox{white}{\includegraphics{1842.pdf}}
\end{center}
\end{frame}
\begin{frame}{Sample Title}
\begin{center}
\colorbox{white}{\includegraphics[angle=90]{1842.pdf}}
\colorbox{white}{\includegraphics[angle=30]{1842.pdf}}
\end{center}
\end{frame}
\begin{frame}{Sample Title}
\begin{center}
\rotatebox{30}{\colorbox{white}{\includegraphics{1842.pdf}}}
\rotatebox{-60}{\colorbox{white}{\includegraphics{1842.pdf}}}
\end{center}
\end{frame}
\end{document}
Note: you can get 1842.pdf sources from here
Best Answer
You have to put the images into a directory that is searched by LaTeX during the compilation. Usually, the easiest is to put it in the same directory as where the
.tex
file is.You can as well use the
\graphicspath
command in your preamble to specify the directories searched for graphics. Remember to put each directory in a second pair of braces, like:(This example is for linux, for Windows, you shall use the correct directory specification. Remember that this will make your document non-portable.)