I have a bunch of coordinates generated by a program and the text of the bodies of corresponding figures, e.g.:
\includegraphics{abc.png}
\caption{abc}
\label{fig:abc}
I was wondering if there is some way to place a figure at specified absolute coordinates (say, page 1, x = 245px, y=452px).
I have seen this question, but it doesn't work for figures (which don't go into boxes)
As for why I can't just use non-floats, I'm working with existing documents and don't want to go through everything and manually convert to something different. I was thinking maybe something like this would work:
\documentclass{article}
\usepackage{capt-of}
\newcommand{\fakefigure}[1]{
\renewcommand{\label}[1]{}
\renewcommand{\caption}[1]{\captionof{figure}{#1}}
#1
}
\begin{document}
\fakefigure{
\includegraphics{abc.png}
\caption{abc}
\label{fig:abc}
}
\end{document}
And then I could put that in the box from here. But I'm not sure if there are some other commands I need to trap to make that work.
Best Answer
Here's a way of making the
\fakefigure
macro suggested in the question work. Well, at least it survives minimal testing in combination with Werner's answer on absolute placement.The proposed redefinition of
\caption
won't work becausecapt-of
defines\captionof
in terms of\caption
. However, it is possible to first save the definition of\caption
and then use the saved definition when redefining\caption
.I've only allowed for
figure
type elements here. If you need other kinds of floats to be converted to non-floats, you'd want to reinstitute the optional argument provided bycapt-of
.We can then combine this with Mico's suggestion to create the
\fakefigure{}
macro:This then allows us to write something like
to place TeX's standard tiger at an arbitrary position on the page.