使用auctex跳转到下一个缺失的参考

时间:2012-07-26 17:11:42

标签: emacs latex auctex

我正在使用emacs + auctex满足我所有的TeXing需求,我对工作流程非常满意。但是,有一件事困扰着我。当我编译一个文档(可能包含多个文件)并且缺少引用时auctex会打印出这个烦人的消息

LaTeX Warning: Reference `fig:MyMissingLabel' on page 42 undefined on input line 37.

就是这样。没有跳转到缺失参考的快捷方式,nada!
我知道我可以启用警告调试,但是,如果文档产生其他警告我不想调试¹,这不太合适。

我想要一个defun,将点循环到缺失引用的位置。因此我没有在网上找到任何东西,也许你们其中一个人可以帮忙吗?

提前致谢!

elemakil

[1]例如某些软件包在未加载版本号或其他内容时会报告警告。我不想调试这个。我想纠正我的推荐!

2 个答案:

答案 0 :(得分:0)

AUCTeX中的shorcuts允许您跳转到错误。 缺少的引用是警告。 您可以将警告视为TeX-toggle-debug-warnings绑定到C-c C-t C-w的错误,从而激活您所需的行为。

答案 1 :(得分:0)

这个问题很老了,但这是我的看法。一、定义函数

(defun my-ignore-TeX-warnings (type file line text &rest more)
  (setq ref "LaTeX Warning: Reference")
  (not (string-match-p ref text)))

然后自定义两个变量TeX-ignore-warningsTeX-suppress-ignored-warnings - 例如,

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(TeX-ignore-warnings 'my-ignore-TeX-warnings)
 '(TeX-suppress-ignored-warnings t))

注意:注意上面的警告——也就是说,你应该只有一个 custom-set-variables

将代码放入您的 ~/.emacs 或类似文件中。然后,启用 TeX-toggle-debug-warnings 或通过菜单Command->TeXing options->Debug warnings

使用 C-` 循环遍历错误将包含未定义的引用。可以扩展上面的代码来选择未定义的引用。

你的,

基督徒