If I insert an image into a latex file (via \includegraphics) auctex lets me select the file and inserts the filename.

However using this dialogue, I can only choose the filename and cannot see previews of images as in file chooser dialogues of usual GUI programs.

How can I get this in emacs too? I.e. have image thumbnail previews when selecting an image for my tex file.

Edit I just discovered icicles mode which generates thumbnails for find-file. However it doesn't seem to work with auctex and completion in \includegraphics out of the box.

  • If you use helm and set LaTeX-includegraphics-read-file to LaTeX-includegraphics-read-file-relative you'll have previews. Let me know if this satisfies you and I'll write an answer.
    – giordano
    Commented Jul 15, 2015 at 11:45
  • I don't know how to set it up so I didn't try it, but it sounds as it would satisfiy my needs (if it is not too slow and if the thumbnails are not too small)
    – student
    Commented Jul 15, 2015 at 18:32

1 Answer 1


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

enter image description here

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).

  • Great answer, thanks a lot! The only annoying thing is that you have to press tab twice (and afterwards another shortcut to go back). Ideally the previews should show up just when the point is over the corresponding filename in the file list (so that you can just navigate up and down the file list and instantly see the corresponding previews without pressing any additional keys)
    – student
    Commented Jul 16, 2015 at 11:19
  • I think you should ask this a feature request to helm project, but I'm not sure it'll be implemented.
    – giordano
    Commented Jul 17, 2015 at 9:47
  • It seems be helm helm-follow mode what is needed. Just press C-c C-f when beeing in helm-find-file menu, then you can browse through your files with preview. However can I activate helm follow mode as default when entering the helm find file menu? I.E. that I don't need to press C-c C-f?
    – student
    Commented Aug 1, 2015 at 9:44
  • I'd suggest you to ask this as a new question ;-)
    – giordano
    Commented Aug 2, 2015 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.