# Seeing figures inside a tex/latex buffer in emacs

Quite often while typing in emacs I will LaTeX a file just to see whether I am including the right figures in the right order. Is there an emacs package that will either:

• show the figure within the latex source file or
• show the figure when the mouse hovers over an \includegraphics command?

The idea is to truly ignore the typesetting while one is typing and to delay the latex iterations as long as possible.

\documentclass{article}
\usepackage{graphicx}

\begin{document}

Some text...

\includegraphics{figure.pdf}

Some more text...

\end{document}


In the example above, I'd like emacs to show me the content of 'figure.pdf' whenever I hover over \includegraphics.

-

## migrated from stackoverflow.comNov 23 '11 at 20:35

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Nov 23 '11 at 20:38

You might want to read the docs for preview-latex, particularly chapter 4 "Simple customization", section "Preview your favourite LaTeX constructs". (Notice: I did not actually check it, and I don't know enough about dvipng to be sure that this would work.) If it works, it does in a weird way: it would typeset a small LaTeX document, bascially with only your \includegraphic command, convert the resulting dvi to png, and put it there. This means that it most probably won't work for jpg/pdf files (and if it will, then only for jpg and if you give the bounding box manually), but might work for eps files. (And this would require typing some keychord instead of hovering your mouse, probably.)
Another idea would be to look into preview-latex source and try to do something similar for jpgs/pdfs. Notice that you'd have to take care of the size of bitmaps; I would imagine using convert to, well, convert them to some reasonable size.