Вопрос

As far as I can tell from the manual, running C-c ? in AUCTeX ought to run texdoc %s on the package name specified. For the vast majority of packages it does, however some just aren't found - M-! texdoc memoir works fine, but C-c ? memoir fails both at detecting the package under point and then at loading the documentation when I type it in manually.

I've been trying to find the variable which controls the invocation of texdoc, but can't. M-: (executable-find "texdoc") returns /usr/bin/texdoc as expected, but that's as far as I got.

Any suggestions would be greatly appreciated...

Это было полезно?

Решение

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)))
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top