Tag Info

Hot answers tagged

26

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 ...


15

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}") ...


10

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 ...


9

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))))) (add-to-list ...


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 ...


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, ...


6

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 ...


6

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 ...


6

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 # ...


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

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

Searching for Author1\|Author2 works for me.


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

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, ...


4

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 " ...


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

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

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 ...


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 ...


3

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).


3

I'm moving my comment here as it gives me more space: But then again, there are quite a lot of Emacs + reftex users reading this site as well. C-c [, runs reftex-citation, you you could just define your own short cut. Here is what I would do ; unset C-z, to be used to make my own C-z prefix (global-unset-key [(control z)]) (global-set-key [(control z) (c)] ...


3

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 ...


3

With all due regard to the fact that this is an old post, but the above solutions did not work for me. As this is still quickly found from a Google search, I thought it best to add here. I kept the line (setq reftex-plug-into-AUCTeX t) and I had to modify J Spen's lambda function (also got flyspell to autoload by adding that mode here). (add-hook ...


2

Oops! A little more digging through the RefTeX manual (pdf link) revealed the variable reftex-no-include-regexps. Documentation says: List of regular expressions to exclude certain input files from parsing. If the name of a file included via \include or \input is matched by any of the regular expressions in this list, that file is not parsed by ...


2

Nowadays (RefTex version 24.3), the function is called with three parameters: label, def-fmt, and ref-style. You can safely ignore the new one, so this should work: (defun reftex-format-cref (label def-fmt ref-style) (format "\\cref{%s}" label)) (setq reftex-format-ref-function 'reftex-format-cref) However, there is a better answer provided in this ...


2

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.


2

this should work: \tableofcontents \chapter{previous chapter} \phantomsection \refstepcounter{chapter} \addcontentsline{toc}{chapter}{\Alph{chapter}~~ the chapter} \label{chap:\thechapter} \chapter{next chapter} see chapter~\ref{chap:2}


2

Since you're using reftex anyways, you can use the reftex function reftex-get-bibfile-list to find all the .bib files associated with your file, and use those as completion targets for find-file: (defun open-current-bib-file () "Visit the bib file for the current document. Only works when reftex is in use, otherwise returns nil." (interactive) (unless ...


2

INITIAL DRAFT (February 19, 2014):   First rough draft. EDIT (February 20, 2014):  Consolidated both functions into just one. Added a variable beg-flag-regexp and revised the logic of the function in relation thereto. The function now examines the beginning regexp to determine the matching ending regexp; and, it will work with the format of ...



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