# How to locate figures with x,y specified location in a presentation

I want to fix my figure in slide (latex frame) as per my wish with x,y position specification.

You could use the textpos package for absolute positioning of figures or text boxes.

Here's an example:

\documentclass[demo]{beamer}
\usepackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
\begin{document}
\begin{frame}
\begin{textblock}{20}(40,20)
\includegraphics{file}
\end{textblock}
\end{frame}
\end{document}


with the syntax \begin{textblock}{*width*}(*x-position,y-position*)

• \begin{picture}(50,50) \put(250,0){\hbox{\includegraphics[scale=0.3]{figs/set}}} \end{picture} This works simply to locate picture... Kindly give your suggestion over this code with your code. – Palani Kannan Oct 25 '11 at 14:11
• @PalaniKannan: good! You could make an answer from that code in your comment. – Stefan Kottwitz Oct 25 '11 at 14:13
• @PalaniKannan: with textpos you could use a grid, relative positioning, and positioning on the background, For a simple single placement a picture environment is also fine. – Stefan Kottwitz Oct 25 '11 at 14:17

As far as I remember,

\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{calc}

...

\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south west,inner sep=0pt] at ($(current page.south west)+(2cm,5cm)$) {
\includegraphics{imgfile}
};
\end{tikzpicture}


should place imgfile.pdf at x=2cm and y=5cm from the lower left page corner.

• A more convenient and flexible macro for absolute positioning is given here: tex.stackexchange.com/a/311031 . – AlexG Jun 28 '16 at 8:24
• When I run this, I get " ! LaTeX Error: Cannot determine size of graphic in img.png (no BoundingBox). " – user43326 Aug 16 '18 at 14:46
• Something must be wrong with your img.png. Try example-image. – AlexG Aug 16 '18 at 14:56
• Actually the code works if I compile with pdflatex, but it doesn't if I try to compile with latex. So presumably the issue is not with the image file. – user43326 Aug 16 '18 at 17:11

As suggested by @PalaniKannan you could do the following:

\begin{picture}(50,50)
\put(200,-300){\hbox{\includegraphics[scale=0.3]{file}}}
\end{picture}


This will place the image at position "200 right and 300 down" relative to the top left corner of the current page.

Also have a look at this wiki page.

• This solution works very well, no additional package required, lightweight code. – Tom Jun 5 '17 at 15:22
• This should be the accepted answer. No extra packages required. Thanks! – Vingtoft Oct 9 '17 at 11:00
• I'd rather recommend {50,100} for the start position and [width=0.66\textwidth,height=0.5\textheight,keepaspectratio] for the scaling, but the picture environment is the way to go for simple things. – stefanct Aug 6 '18 at 14:12
• This code is useless for absolute positioning, because the picture environment is placed at the current position. – AlexG Aug 17 '18 at 14:42