# Tag Info

32

There are two ways to make RefTeX find your bibliography. I suggest to use both approaches for robustness. To make RefTeX recognize your bibliography you can add it to the list reftex-default-bibliography. To do this add the following to your .emacs: ;; So that RefTeX finds my bibliography (setq reftex-default-bibliography '("path/to/bibfile.bib")) and ...

17

The variable you need to hook into is reftex-cite-format. Somewhere in my Emacs init file, I have this code: (eval-after-load 'reftex-vars '(progn ;; (also some other reftex-related customizations) (setq reftex-cite-format '((?\C-m . "\\cite[]{%l}") (?f . "\\footcite[][]{%l}") (?t . "\\textcite[]{%l}") ...

12

To skip the selection of the reference style you have to set the variable reftex-ref-macro-prompt to nil, see the RefTeX manual. To do this you can customize that variable or add the following code to your init file: (setq reftex-ref-macro-prompt nil) It has been reported that this solution to use RefTeX with the cleverref package no longer works with ...

11

Add the following code to your init file (eval-after-load "latex" '(TeX-add-style-hook "cleveref" (lambda () (if (boundp 'reftex-ref-style-alist) (add-to-list 'reftex-ref-style-alist '("Cleveref" "cleveref" (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D))))) (reftex-ref-style-activate ...

8

The following (untested!) code should give you the behavior you are looking for. You need to put it in your Emacs initialization file (.emacs or some such, depending on your platform). (defun reftex-format-cref (label def-fmt) (format "\\cref{%s}" label)) (setq reftex-format-ref-function 'reftex-format-cref) (The trivial code for the defun was modified ...

8

I like how you asked "how is it possible to..." instead of "is it possible to...". Because of course it is possible, reftex being awesome and OCD-friendly. :) reftex-renumber-simple-labels is an interactive autoloaded Lisp function. Renumber all simple labels in the document to make them sequentially. So... M-x reftex-renumber-simple-labels RET ...

8

Another way to integrate biblatex and csquotes with RefTeX is via YASnippet. You make a snippet for every citation macro you want to use and have the snippets call reftex-citation. I use a setup where I type "ct" and press Tab and then I get to choose between the two following snippets. For \auctocite: # -*- mode: snippet -*- # name: autocite \autocite # ...

7

Unless you include the relevant parts of your .emacs it's hard to help you. Here's what I got in my .emacs which seems to do what you're after (and I'm also using TeX Live 2011): ; Turn on RefTeX for AUCTeX, http://www.gnu.org/s/auctex/manual/reftex/reftex_5.html (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; Make RefTeX interact with AUCTeX, ...

7

The correct place to fix this is the regular expressions that RefTeX uses to parse the BibTeX file. However, in the version of RefTeX (4.31) that I am looking at it seems that [{(] shows up every place you would expect. EDIT: After poking at it a bit, it seems the issue is that in reftex.el ( and ) are defined as punctuation is the reftex-syntax-table and ...

7

Searching for Author1\|Author2 works for me.

7

The issues you're experiencing are not related to emacs, and they are only indirectly related to cleveref. You need to do the following: In the main figure, interchange the order of \caption and \label: the \caption statement must come before the \label statement. Provide \caption statements for each of the two subfigure environments. Be mindful of the ...

6

Like for any other macro you want to insert in AUCTeX, you should use C-c RET cite RET (or C-c C-m cite RET; for more information about autocompletion in AUCTeX see the quick start or Completion section of the manual). This works also for all other citation macros provided by natbib, biblatex, ect... (\citep, \citealt, \parencite, \textcite, etc...) For ...

5

Looking to the reftex-ref.el source code I found the following (undocumented) solution: add to your .emacs the line (setq reftex-refstyle "\\Cref") Please note that this will make \Cref the default reference command even when the cleveref isn't actually loaded. If you want to skip the selection of the label type as well, you have to pass the argument " ...

5

You can set a master file (main.tex). Thus you can include the following in all .tex files in your project. %%% Local Variables: %%% mode: latex %%% TeX-master: "main" %%% End: after that reflex will find the bibliography from the master (main.tex) file.

5

RefTeX customization -> RefTeX Label Support -> Reftex Defining Label Environments -> Reftex Label Alist. Change Label prefix string (for every entry). Use %f for filename (extension will be stripped); for details, see the documentation in the customization buffer.

5

Why don't you use emacs on windows? It works there. If you are interested in working with bibtex files, there is also jabref which is a nice bibliography manager. It is fully cross-platform.

5

I've figured out the solution, and I'm posting it here for completeness. RefTeX in conjunction with AucTeX can be made aware of labels in all of the documents that make up a multi-document structure of the sort I'm using. One just has to include pointers to the master file in each of the files making up the structure, in this example, main.tex, part1.tex, ...

5

Since you seem to already be using YASnippet it might be better to implement this via YASnippet instead of via AUCTeX. Here is an example of such a snippet: # -*- mode: snippet -*- # name: cleveref \cref # key: rf # -- \cref{${1:label$(unless yas/modified-p (reftex-reference nil 'dont-insert))}}$0 Using this you write "rf" and when you expand it ... 5 Adding %%% reftex-default-bibliography: ("path/to/bibfile.bib") at the end of the end of my file with other commands related to the file looks better to me. 4 Electric super and subscripts uses texmathp to determine when they should be run. This function is controlled by the texmathp-tex-commands variable which you can customize. You will need to call texmathp-compile if you set it outside of the customize interface. Adding the following to your custom-set-variables and restarting Emacs should do the trick. ... 4 You can make the argument optional on the flip side of the command: \makeatletter \def\includeas#1{ \@ifnextchar[{\includeas@opt{#1}}{\includeas@{#1}} } \def\includeas@#1{ \include{#1} } \def\includeas@opt#1[#2]{ \foo{#2} \include{#1} } \makeatother Then you will call it as: Without optional \includeas{filename.tex} With optional ... 4 To get RefTeX to work with csquotes I use this in my .emacs: (eval-after-load "tex" '(TeX-add-style-hook "csquotes" (lambda () (TeX-add-symbols '("textcquote" [ "pre-note (post-note if alone)" ] [ "post-note" ] TeX-arg-cite [ "Punctuation" ] t ignore ignore) '("blockcquote" [ "pre-note (post-note if alone)" ] [ "post-note" ] TeX-arg-cite ... 4 A \ref to the same \label will not give different results. Your \jobname.log file should contain a warning, there were multiply defined labels. The only option is to change the \label. For large documents you just need to come up with a convention that makes sense to you, and would be fairly simple for others to understand. For example, if your ... 4 This requires AUCTeX: (defun mg-LaTeX-find-bibliography () "Visit bibliography file of the current document." (interactive) (let ((length (length (LaTeX-bibliography-list))) bib) (if (= length 1) (progn (setq bib (car (car (LaTeX-bibliography-list)))) (unless (file-name-extension bib) (setq bib (concat bib ".bib"))) ... 4 AUCTeX and RefTeX are two separated and independent packages, one can be used without the other. AUCTeX has some facilities about labels and citations management, RefTeX is much better in doing this. Not everyone uses RefTeX and there has been a change in AUCTeX 11.88 to let users choose which labels should be inserted. This selection is independent from ... 4 Create a directory$HOME/texmf/bibtex/bib and put your bib files there. Then you can use just \bibliography{bug.bib}, since both BibTeX and RefTeX search this directory (with the default settings).

4

A possibility is to tell AUCTeX index is a verbatim-like macro. This isn't really true, but verbatim-like macros ignore brace pairing. Add the following code to your init file and restart Emacs: (eval-after-load "latex" '(add-to-list 'LaTeX-verbatim-macros-with-braces "index"))

4

The command you need here is reftex-citation, which is bound to C-c [ by default. There is more info in the manual Alternatively, you can use helm-bibtex in place of reftex. Helm-bibtex is more powerful, but it lacks a few features that reftex has, such as allowing you to search your records on different fields.

3

I solved this problem by inserting '(reftex-use-external-file-finders t) into my emacs init file. It makes RefTeX use the appropriate command from reftex-external-file-finders to find the file. In my case that is kpsewhich -format=.bib %f. The default is looking in the folders specified in the environment variables BIBINPUT and TEXINPUT. I prefer this ...

3

I'll dare to answer my own question at least regarding workaround for those who need it right here and right now. It drove me nuts that same example worked in one folder and did not in another. And apparently revisiting file doesn't make much difference, so for a clean try, I'd suggest closing Emacs completely. There are 2 bugs I suspect. One is that reftex ...

Only top voted, non community-wiki answers of a minimum length are eligible