Discussion:
[AUCTeX] Reftex extra keybindings
Waleed Yousef
2018-07-22 04:43:14 UTC
Permalink
Hello,

I have never been successful in configuring the reftex extra
key-bindings. This is my .emacs part:


(use-package reftex
:init
(setq reftex-extra-bindings t) ;;does not function well!!
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq
reftex-auto-recenter-toc t
reftex-default-bibliography '("~/MyDocuments/Phd/texmf/bibtex/bib/base/publications.bib" "~/MyDocuments/Phd/texmf/bibtex/bib/base/booksIhave.bib")
reftex-bibpath-environment-variables (quote ("BIBINPUTS" "TEXBIB" "~/MyDocuments/Phd/texmf/bibtex/bib/base/"))
reftex-cite-format (quote natbib)
reftex-label-alist (quote(
("axiom" ?x "axm:" "~\\ref{%s}" t ("axiom") -2)
("theorem" ?h "thm:" "~\\ref{%s}" t ("theorem") -3)))
reftex-insert-label-flags (quote ("sftxh" "nil"))
reftex-multiref-punctuation (quote ((44 . ", ") (45 . "--") (43 . ", and ")))
reftex-plug-into-AUCTeX t
reftex-ref-style-default-list (quote ("Default" "Hyperref"))
reftex-sort-bibtex-matches (quote author)
reftex-toc-include-file-boundaries t
reftex-toc-split-windows-fraction 0.2
reftex-toc-split-windows-horizontally t
))
Arash Esbati
2018-07-22 11:33:25 UTC
Permalink
Post by Waleed Yousef
Hello,
I have never been successful in configuring the reftex extra
(use-package reftex
:init
(setq reftex-extra-bindings t) ;;does not function well!!
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq
reftex-auto-recenter-toc t
reftex-default-bibliography '("~/MyDocuments/Phd/texmf/bibtex/bib/base/publications.bib" "~/MyDocuments/Phd/texmf/bibtex/bib/base/booksIhave.bib")
reftex-bibpath-environment-variables (quote ("BIBINPUTS" "TEXBIB" "~/MyDocuments/Phd/texmf/bibtex/bib/base/"))
reftex-cite-format (quote natbib)
reftex-label-alist (quote(
("axiom" ?x "axm:" "~\\ref{%s}" t ("axiom") -2)
("theorem" ?h "thm:" "~\\ref{%s}" t ("theorem") -3)))
reftex-insert-label-flags (quote ("sftxh" "nil"))
reftex-multiref-punctuation (quote ((44 . ", ") (45 . "--") (43 . ", and ")))
reftex-plug-into-AUCTeX t
reftex-ref-style-default-list (quote ("Default" "Hyperref"))
reftex-sort-bibtex-matches (quote author)
reftex-toc-include-file-boundaries t
reftex-toc-split-windows-fraction 0.2
reftex-toc-split-windows-horizontally t
))
I don't use and know `use-package', but the following old fashioned way
works for me:

(setq reftex-extra-bindings t)
(require 'reftex)
(add-hook 'LaTeX-mode-hook #'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)

Note that setting `reftex-extra-bindings' happens before requiring
RefTeX. Maybe you have a (require 'reftex) leftover in your .emacs
before (use-package reftex ...)? Or :init doesn't work as expected?

Best, Arash
Waleed Yousef
2018-07-22 14:19:33 UTC
Permalink
I commented out my use-package def. and used your four lines. When, I
use, e.g., the keybinding C-c s (to search a document) it gives me: C-c
s is undefined!
Post by Arash Esbati
Post by Waleed Yousef
Hello,
I have never been successful in configuring the reftex extra
(use-package reftex
:init
(setq reftex-extra-bindings t) ;;does not function well!!
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq
reftex-auto-recenter-toc t
reftex-default-bibliography '("~/MyDocuments/Phd/texmf/bibtex/bib/base/publications.bib" "~/MyDocuments/Phd/texmf/bibtex/bib/base/booksIhave.bib")
reftex-bibpath-environment-variables (quote ("BIBINPUTS" "TEXBIB" "~/MyDocuments/Phd/texmf/bibtex/bib/base/"))
reftex-cite-format (quote natbib)
reftex-label-alist (quote(
("axiom" ?x "axm:" "~\\ref{%s}" t ("axiom") -2)
("theorem" ?h "thm:" "~\\ref{%s}" t ("theorem") -3)))
reftex-insert-label-flags (quote ("sftxh" "nil"))
reftex-multiref-punctuation (quote ((44 . ", ") (45 . "--") (43 . ", and ")))
reftex-plug-into-AUCTeX t
reftex-ref-style-default-list (quote ("Default" "Hyperref"))
reftex-sort-bibtex-matches (quote author)
reftex-toc-include-file-boundaries t
reftex-toc-split-windows-fraction 0.2
reftex-toc-split-windows-horizontally t
))
I don't use and know `use-package', but the following old fashioned way
(setq reftex-extra-bindings t)
(require 'reftex)
(add-hook 'LaTeX-mode-hook #'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
Note that setting `reftex-extra-bindings' happens before requiring
RefTeX. Maybe you have a (require 'reftex) leftover in your .emacs
before (use-package reftex ...)? Or :init doesn't work as expected?
Best, Arash
Arash Esbati
2018-07-26 18:38:49 UTC
Permalink
Post by Waleed Yousef
Post by Arash Esbati
I don't use and know `use-package', but the following old fashioned way
(setq reftex-extra-bindings t)
(require 'reftex)
(add-hook 'LaTeX-mode-hook #'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
I commented out my use-package def. and used your four lines. When, I
use, e.g., the keybinding C-c s (to search a document) it gives me: C-c
s is undefined!
Then I think you have to debug this issue. Again, I presume there is a
(require 'reftex) line somewhere in your configuration (.emacs or
site-start.el and such) when Emacs starts. You can check this by
starting Emacs from a shell with

emacs -q &

(-q key means load neither ~/.emacs nor default.el) and eval this line
in scratch buffer, i.e. put the cursor after ")" and hit `C-x C-e':

(featurep 'reftex)

If you see t in the minibuffer, then RefTeX is already loaded and the
line

(setq reftex-extra-bindings t)

has no effect.

Best, Arash
Waleed Yousef
2018-07-27 11:40:46 UTC
Permalink
Thanks so much; it is exactly as you expected. It seems that org-ref
loads in the background reftex. So, I just put the line (setq
reftex-extra-bindings t) before both org-ref and reftex.

Now, one more question please: When I do C-c s (to search a whole
document) what is the keybinding for (search again) that exists on the
mouse menu?

Thanks
Post by Arash Esbati
Post by Waleed Yousef
Post by Arash Esbati
I don't use and know `use-package', but the following old fashioned way
(setq reftex-extra-bindings t)
(require 'reftex)
(add-hook 'LaTeX-mode-hook #'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
I commented out my use-package def. and used your four lines. When, I
use, e.g., the keybinding C-c s (to search a document) it gives me: C-c
s is undefined!
Then I think you have to debug this issue. Again, I presume there is a
(require 'reftex) line somewhere in your configuration (.emacs or
site-start.el and such) when Emacs starts. You can check this by
starting Emacs from a shell with
emacs -q &
(-q key means load neither ~/.emacs nor default.el) and eval this line
(featurep 'reftex)
If you see t in the minibuffer, then RefTeX is already loaded and the
line
(setq reftex-extra-bindings t)
has no effect.
Best, Arash
Arash Esbati
2018-08-04 11:39:10 UTC
Permalink
Post by Waleed Yousef
Thanks so much; it is exactly as you expected. It seems that org-ref
loads in the background reftex. So, I just put the line (setq
reftex-extra-bindings t) before both org-ref and reftex.
You're welcome. I suggest you use the customize interface provided by
Emacs and simply move the additions from the end to the beginning of
your init file.
Post by Waleed Yousef
Now, one more question please: When I do C-c s (to search a whole
document) what is the keybinding for (search again) that exists on the
mouse menu?
,----[ C-h f reftex-search-document RET ]
| reftex-search-document is an interactive autoloaded compiled Lisp
| function in ‘reftex-global.el’.
|
| (reftex-search-document &optional REGEXP)
|
| Regexp search through all files of the current document.
| Starts always in the master file. Stops when a match is found.
| To continue searching for next match, use command M-x tags-loop-continue.
| No active TAGS table is required.
`----

`tags-loop-continue' is not bound to a key; you have to define one
yourself.

Best, Arash
Waleed Yousef
2018-08-05 11:32:21 UTC
Permalink
Thanks so much; I have a suggestion. Why hitting C-c s itself repetitively does
not do the job and invoke tags-loop-continue

Thanks so much for your patience.
Post by Arash Esbati
Post by Waleed Yousef
Thanks so much; it is exactly as you expected. It seems that org-ref
loads in the background reftex. So, I just put the line (setq
reftex-extra-bindings t) before both org-ref and reftex.
You're welcome. I suggest you use the customize interface provided by
Emacs and simply move the additions from the end to the beginning of
your init file.
Post by Waleed Yousef
Now, one more question please: When I do C-c s (to search a whole
document) what is the keybinding for (search again) that exists on the
mouse menu?
,----[ C-h f reftex-search-document RET ]
| reftex-search-document is an interactive autoloaded compiled Lisp
| function in ‘reftex-global.el’.
|
| (reftex-search-document &optional REGEXP)
|
| Regexp search through all files of the current document.
| Starts always in the master file. Stops when a match is found.
| To continue searching for next match, use command M-x tags-loop-continue.
| No active TAGS table is required.
`----
`tags-loop-continue' is not bound to a key; you have to define one
yourself.
Best, Arash
Arash Esbati
2018-08-05 19:09:49 UTC
Permalink
Post by Waleed Yousef
Thanks so much; I have a suggestion. Why hitting C-c s itself
repetitively does not do the job and invoke tags-loop-continue
I think in general, this is not the Emacs way to repeat commands. Emacs
comes with a function named `repeat' which you can consider:

,----[ C-h f repeat RET ]
| repeat is an interactive autoloaded Lisp function in ‘repeat.el’.
|
| It is bound to C-x z.
|
| (repeat REPEAT-ARG)
|
| Repeat most recently executed command.
| If REPEAT-ARG is non-nil (interactively, with a prefix argument),
| supply a prefix argument to that command. Otherwise, give the
| command the same prefix argument it was given before, if any.
|
| If this command is invoked by a multi-character key sequence, it
| can then be repeated by repeating the final character of that
| sequence. This behavior can be modified by the global variable
| ‘repeat-on-final-keystroke’.
|
| ‘repeat’ ignores commands bound to input events. Hence the term
| "most recently executed command" shall be read as "most
| recently executed command not bound to an input event".
`----

I haven't tested it.

Best, Arash
Waleed Yousef
2018-09-04 12:46:20 UTC
Permalink
Thanks so much,
I just mean why repeating C-c s does not behave the same way as the
conventional emacs search using C-s ?
Post by Arash Esbati
Post by Waleed Yousef
Thanks so much; I have a suggestion. Why hitting C-c s itself
repetitively does not do the job and invoke tags-loop-continue
I think in general, this is not the Emacs way to repeat commands. Emacs
,----[ C-h f repeat RET ]
| repeat is an interactive autoloaded Lisp function in ‘repeat.el’.
|
| It is bound to C-x z.
|
| (repeat REPEAT-ARG)
|
| Repeat most recently executed command.
| If REPEAT-ARG is non-nil (interactively, with a prefix argument),
| supply a prefix argument to that command. Otherwise, give the
| command the same prefix argument it was given before, if any.
|
| If this command is invoked by a multi-character key sequence, it
| can then be repeated by repeating the final character of that
| sequence. This behavior can be modified by the global variable
| ‘repeat-on-final-keystroke’.
|
| ‘repeat’ ignores commands bound to input events. Hence the term
| "most recently executed command" shall be read as "most
| recently executed command not bound to an input event".
`----
I haven't tested it.
Best, Arash
Loading...