If you set LaTeX-includegraphics-read-file
to LaTeX-includegraphics-read-file-relative
, autocompletion with helm
provides this feature:

Setting up AUCTeX
You can either customize LaTeX-includegraphics-read-file
(M-x customize-variable
RET LaTeX-includegraphics-read-file
RET) and select the relative
option or add the following to your init file:
(setq LaTeX-includegraphics-read-file 'LaTeX-includegraphics-read-file-relative)
Installing and setting up helm
You can install helm
from Melpa repository, here are the instructions on how to add it. When you're done, issue M-x list-packages
RET, go to the helm
entry and hit i x.
Now you need to setup helm
. Here is a good starting tutorial. You can choose between a minimal configuration:
(require 'helm-config)
(helm-mode 1)
and an extended configuration:
(require 'helm)
(require 'helm-config)
;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
(global-set-key (kbd "C-c h") 'helm-command-prefix)
(global-unset-key (kbd "C-x c"))
(global-set-key (kbd "M-x") 'helm-M-x) ; This was not present in the suggested extended config
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
(define-key helm-map (kbd "C-z") 'helm-select-action) ; list actions using C-z
(when (executable-find "curl")
(setq helm-google-suggest-use-curl-p t))
(setq helm-split-window-in-side-p t ; open helm buffer inside current window, not occupy whole other window
helm-move-to-line-cycle-in-source t ; move to end or beginning of source when reaching top or bottom of source.
helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp.
helm-scroll-amount 8 ; scroll 8 lines other window using M-<next>/M-<prior>
helm-ff-file-name-history-use-recentf t)
(helm-mode 1)
Please, be aware of the differences between Emacs default completion and helm
's one.
Start using the new feature
Restart Emacs and you'll be ready. In an LaTeX buffer, issue C-c RET includegraphics
RET (note you can exploit helm
autocompletion) and select the picture you want to include. In order to see the preview, as shown at the beginning, press twice the keybinding associated to helm-execute-persistent-action
(C-z by default, or TAB in the above extended configuration) or move up and down in the file list with C-up and C-down (see this answer).