Starting from version 11.89, AUCTeX binds by default C-c ? to TeX-documentation-texdoc
, which does exactly what is asked.
For previous versions of AUCTeX, see the original answer below.
I find TeX-doc
(the function bound to C-c ?) overly complicated: in the case of memoir
class it never calls texdoc memoir
because the doc file is named memman.pdf
instead of memoir.pdf
. That should be fixed upstream.
For the time being, you can use this much simpler function which blindly runs texdoc <symbol-at-point>
without further checks:
(defun mg-TeX-doc ()
"Search documentation with texdoc for symbol at point."
(interactive)
(call-process "texdoc" nil 0 nil "--view" (thing-at-point 'symbol)))
You can bind it to C-c ? if you want to replace standard TeX-doc
with the following code:
(eval-after-load "tex"
'(progn
(define-key TeX-mode-map (kbd "C-c ?") 'mg-TeX-doc)))