-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathreftex.info
5992 lines (4904 loc) · 272 KB
/
reftex.info
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
これは reftex.info、reftex.texi より makeinfo バージョン 4.8
によって作成されました。
This manual documents RefTeX (version 4.34a from 2010-08-28), a
package to do labels, references, citations and indices for LaTeX
documents with Emacs.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software
Foundation; with no Invariant Sections, with the Front-Cover texts
being "A GNU Manual", and with the Back-Cover Texts as in (a)
below. A copy of the license is included in the section entitled
"GNU Free Documentation License" in the Emacs manual.
(a) The FSF's Back-Cover Text is: "You have freedom to copy and
modify this GNU Manual, like GNU software. Copies published by
the Free Software Foundation raise funds for GNU development."
This document is part of a collection distributed under the GNU
Free Documentation License. If you want to distribute this
document separately from the collection, you can do so by adding a
copy of the license to the document, as described in section 6 of
the license.
INFO-DIR-SECTION Emacs
START-INFO-DIR-ENTRY
* RefTeX: (reftex). Emacs support for LaTeX cross-references and citations.
END-INFO-DIR-ENTRY
File: reftex.info, Node: Top, Up: (dir)
RefTeX
******
RefTeX is a package for managing Labels, References, Citations and
index entries with GNU Emacs.
This manual documents RefTeX version 4.34a from 2010-08-28, with
RIS, EPrints3 XML, METS, RefDB and EPrints3 citations support.
Don't be discouraged by the size of this manual, which covers RefTeX
in great depth. All you need to know to use RefTeX can be summarized
on two pages (*note RefTeX in a Nutshell::). You can go back later to
other parts of this document when needed.
* Menu:
* Introduction:: Quick-Start information.
* Table of Contents:: A Tool to move around quickly.
* Labels and References:: Creating and referencing labels.
* Citations:: Creating Citations.
* Index Support:: Creating and Checking Index Entries.
* Viewing Cross-References:: Who references or cites what?
* RefTeXs Menu:: The Ref menu in the menubar.
* Key Bindings:: The default key bindings.
* Faces:: Fontification of RefTeX's buffers.
* Multifile Documents:: Document spread over many files.
* Language Support:: How to support other languages.
* Finding Files:: Included TeX files and BibTeX .bib files.
* AUCTeX:: Cooperation with AUCTeX.
* Optimizations:: When RefTeX is too slow.
* Problems and Work-Arounds:: First Aid.
* Imprint:: Author, Web-site, Thanks
* Commands:: Which are the available commands.
* Options:: How to extend and configure RefTeX.
* Keymaps and Hooks:: For customization.
* Changes:: A List of recent changes to RefTeX.
The Index
* Index:: The full index.
--- The Detailed Node Listing ---
Introduction
* Installation:: How to install and activate RefTeX.
* RefTeX in a Nutshell:: A brief summary and quick guide.
Labels and References
* Creating Labels::
* Referencing Labels::
* Builtin Label Environments:: The environments RefTeX knows about.
* Defining Label Environments:: ... and environments it doesn't.
* Reference Info:: View the label corresponding to a \ref.
* Reference Styles:: Macros to be used instead of \ref.
* xr (LaTeX package):: References to external documents.
Defining Label Environments
* Theorem and Axiom:: Defined with `\newenvironment'.
* Quick Equation:: When a macro sets the label type.
* Figure Wrapper:: When a macro argument is a label.
* Adding Magic Words:: Other words for other languages.
* Using \eqref:: How to switch to this AMS-LaTeX macro.
* Non-Standard Environments:: Environments without \begin and \end
* Putting it Together:: How to combine many entries.
Citations
* Creating Citations:: How to create them.
* External Databases:: How to configure and use them.
* Citation Styles:: Natbib, Harvard, Chicago and Co.
* Citation Info:: View the corresponding database entry.
* Chapterbib and Bibunits:: Multiple bibliographies in a Document.
* Citations Outside LaTeX:: How to make citations in Emails etc.
* Database Subsets:: Extract parts of a big database.
Index Support
* Creating Index Entries:: Macros and completion of entries.
* The Index Phrases File:: A special file for global indexing.
* Displaying and Editing the Index:: The index editor.
* Builtin Index Macros:: The index macros RefTeX knows about.
* Defining Index Macros:: ... and macros it doesn't.
The Index Phrases File
* Collecting Phrases:: Collecting from document or external.
* Consistency Checks:: Check for duplicates etc.
* Global Indexing:: The interactive indexing process.
AUCTeX
* AUCTeX-RefTeX Interface:: How both packages work together
* Style Files:: AUCTeX's style files can support RefTeX
* Bib-Cite:: Hypertext reading of a document
Options, Keymaps, Hooks
* Options (Table of Contents)::
* Options (Defining Label Environments)::
* Options (Creating Labels)::
* Options (Referencing Labels)::
* Options (Creating Citations)::
* Options (Index Support)::
* Options (Viewing Cross-References)::
* Options (Finding Files)::
* Options (Optimizations)::
* Options (Fontification)::
* Options (Misc)::
File: reftex.info, Node: Introduction, Next: Table of Contents, Up: Top
1 Introduction
**************
RefTeX is a specialized package for support of labels, references,
citations, and the index in LaTeX. RefTeX wraps itself round four
LaTeX macros: `\label', `\ref', `\cite', and `\index'. Using these
macros usually requires looking up different parts of the document and
searching through BibTeX database files. RefTeX automates these
time-consuming tasks almost entirely. It also provides functions to
display the structure of a document and to move around in this
structure quickly.
*Note Imprint::, for information about who to contact for help, bug
reports or suggestions.
* Menu:
* Installation:: How to install and activate RefTeX.
* RefTeX in a Nutshell:: A brief summary and quick guide.
File: reftex.info, Node: Installation, Next: RefTeX in a Nutshell, Up: Introduction
1.1 Installation
================
RefTeX has been bundled and pre-installed with Emacs since version
20.2. It has also been bundled and pre-installed with XEmacs
19.16-20.x. XEmacs 21.x users want to install the corresponding
plug-in package which is available from the XEmacs FTP site
(ftp://ftp.xemacs.org/pub/xemacs/packages/). See the XEmacs 21.x
documentation on package installation for details.
Users of earlier Emacs distributions (including Emacs 19) or people
craving for new features and bugs can get a copy of the RefTeX
distribution from the maintainer's web page. *Note Imprint::, for more
information. The following instructions will guide you through the
process of installing such a distribution.
1.1.1 Building and Installing
-----------------------------
Note: Currently installation is supported for Emacs only. XEmacs users
might want to refer to the RefTeX package available through the package
system of XEmacs.
Installation with make
......................
In order to install RefTeX, unpack the distribution and edit the header
of the Makefile. Basically, you need to change the path specifications
for Emacs Lisp files and info files. Also, enter the name of your Emacs
executable (usually either `emacs' or `xemacs').
Then, type
make
make install
to compile and install the code and documentation.
Per default RefTeX is installed in its own subdirectory which might
not be on your load path. In this case, add it to load path with a
command like the following, replacing the sample directory with the one
where RefTeX is installed in your case.
(add-to-list 'load-path "/path/to/reftex")
Put this command into your init file before other RefTeX-related
settings.
Installation by Hand
....................
If you want to get your hands dirty, there is also the possibility to
install by manually copying files.
a. Copy the reftex*.el lisp files to a directory on your load path.
Make sure that no old copy of RefTeX shadows these files.
b. Byte compile the files. The sequence of compiling should be:
reftex-var.el, reftex.el, and then all the others.
c. Copy the info file reftex.info to the info directory.
EPrints3 database support
.........................
If you want to use RefTeX with external EPrints3 database, you have to
install EPrints3 search client. You can download it from EPfind web
site (http://epfind.sourceforge.net/).
After installation, make sure that RefTeX can run it - default
command is: `python -m epfind'. If required, configure
`reftex-epfind-command' variable.
RefDB database support
......................
If you want to use RefTeX with external RefDB database, you have to
install RefDB search client. You can download it from RefDB web site
(http://refdb.sourceforge.net/).
After installation, make sure that RefTeX can run it - default
command is: `refdbc -c stdout -C getref'. If required, configure
`reftex-refdbc-command' variable.
1.1.2 Loading RefTeX
--------------------
In order to make the most important functions for entering RefTeX mode
available add the following line to your init file.
(require 'reftex)
1.1.3 Entering RefTeX Mode
--------------------------
To turn RefTeX Mode on and off in a particular buffer, use `M-x
reftex-mode <RET>'. To turn on RefTeX Mode for all LaTeX files, add
the following lines to your `.emacs' file:
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
That's all!
To get started, read the documentation, in particular the summary.
(*note RefTeX in a Nutshell::)
In order to produce a printed version of the documentation, use
`make pdf' to produce a reftex.pdf file. Analogously you can use the
`dvi', `ps', or `html' targets to create DVI, PostScript or HTML files.
1.1.4 Environment
-----------------
RefTeX needs to access all files which are part of a multifile
document, and the BibTeX database files requested by the
`\bibliography' command. To find these files, RefTeX will require a
search path, i.e. a list of directories to check. Normally this list
is stored in the environment variables `TEXINPUTS' and `BIBINPUTS'
which are also used by RefTeX. However, on some systems these
variables do not contain the full search path. If RefTeX does not work
for you because it cannot find some files, *Note Finding Files::.
File: reftex.info, Node: RefTeX in a Nutshell, Prev: Installation, Up: Introduction
1.2 RefTeX in a Nutshell
========================
1. Table of Contents
Typing `C-c =' (`reftex-toc') will show a table of contents of the
document. This buffer can display sections, labels and index
entries defined in the document. From the buffer, you can jump
quickly to every part of your document. Press `?' to get help.
2. Labels and References
RefTeX helps to create unique labels and to find the correct key
for references quickly. It distinguishes labels for different
environments, knows about all standard environments (and many
others), and can be configured to recognize any additional labeled
environments you have defined yourself (variable
`reftex-label-alist').
* Creating Labels
Type `C-c (' (`reftex-label') to insert a label at point.
RefTeX will either
- derive a label from context (default for section labels)
- prompt for a label string (default for figures and
tables) or
- insert a simple label made of a prefix and a number (all
other environments)
Which labels are created how is configurable with the variable
`reftex-insert-label-flags'.
* Referencing Labels
To make a reference, type `C-c )' (`reftex-reference'). This
shows an outline of the document with all labels of a certain
type (figure, equation,...) and some label context.
Selecting a label inserts a `\ref{LABEL}' macro into the
original buffer.
3. Citations
Typing `C-c [' (`reftex-citation') will let you specify a regular
expression to search in current BibTeX database files (as
specified in the `\bibliography' command) and pull out a list of
matches for you to choose from. The list is _formatted_ and
sorted. The selected article is referenced as `\cite{KEY}' (see
the variable `reftex-cite-format' if you want to insert different
macros).
4. Index Support
RefTeX helps to enter index entries. It also compiles all entries
into an alphabetically sorted `*Index*' buffer which you can use
to check and edit the entries. RefTeX knows about the standard
index macros and can be configured to recognize any additional
macros you have defined (`reftex-index-macros'). Multiple indices
are supported.
* Creating Index Entries
To index the current selection or the word at point, type
`C-c /' (`reftex-index-selection-or-word'). The default macro
`reftex-index-default-macro' will be used. For a more
complex entry type `C-c <' (`reftex-index'), select any of
the index macros and enter the arguments with completion.
* The Index Phrases File (Delayed Indexing)
Type `C-c \' (`reftex-index-phrase-selection-or-word') to add
the current word or selection to a special _index phrase
file_. RefTeX can later search the document for occurrences
of these phrases and let you interactively index the matches.
* Displaying and Editing the Index
To display the compiled index in a special buffer, type `C-c
>' (`reftex-display-index'). From that buffer you can check
and edit all entries.
5. Viewing Cross-References
When point is on the KEY argument of a cross-referencing macro
(`\label', `\ref', `\cite', `\bibitem', `\index', and variations)
or inside a BibTeX database entry, you can press `C-c &'
(`reftex-view-crossref') to display corresponding locations in the
document and associated BibTeX database files.
When the enclosing macro is `\cite' or `\ref' and no other message
occupies the echo area, information about the citation or label
will automatically be displayed in the echo area.
6. Multifile Documents
Multifile Documents are fully supported. The included files must
have a file variable `TeX-master' or `tex-main-file' pointing to
the master file. RefTeX provides cross-referencing information
from all parts of the document, and across document borders
(`xr.sty').
7. Document Parsing
RefTeX needs to parse the document in order to find labels and
other information. It does it automatically once and updates its
list internally when `reftex-label' and `reftex-index' are used.
To enforce reparsing, call any of the commands described above
with a raw `C-u' prefix, or press the `r' key in the label
selection buffer, the table of contents buffer, or the index
buffer.
8. AUCTeX
If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it
(see variable `reftex-plug-into-AUCTeX'). AUCTeX contains style
files which trigger appropriate settings in RefTeX, so that for
many of the popular LaTeX packages no additional customizations
will be necessary.
9. Useful Settings
To integrate RefTeX with AUCTeX, use
(setq reftex-plug-into-AUCTeX t)
To make your own LaTeX macro definitions known to RefTeX,
customize the variables
`reftex-label-alist' (for label macros/environments)
`reftex-section-levels' (for sectioning commands)
`reftex-cite-format' (for `\cite'-like macros)
`reftex-index-macros' (for `\index'-like macros)
`reftex-index-default-macro' (to set the default macro)
If you have a large number of macros defined, you may want to write
an AUCTeX style file to support them with both AUCTeX and RefTeX.
10. Where Next?
Go ahead and use RefTeX. Use its menus until you have picked up
the key bindings. For an overview of what you can do in each of
the different special buffers, press `?'. Read the manual if you
get stuck, or if you are curious what else might be available.
The first part of the manual explains in a tutorial way how to use
and customize RefTeX. The second part is a command and variable
reference.
File: reftex.info, Node: Table of Contents, Next: Labels and References, Prev: Introduction, Up: Top
2 Table of Contents
*******************
Pressing the keys `C-c =' pops up a buffer showing the table of
contents of the document. By default, this `*toc*' buffer shows only
the sections of a document. Using the `l' and `i' keys you can display
all labels and index entries defined in the document as well.
With the cursor in any of the lines denoting a location in the
document, simple key strokes will display the corresponding part in
another window, jump to that location, or perform other actions.
Here is a list of special commands in the `*toc*' buffer. A summary
of this information is always available by pressing `?'.
General
.......
`?'
Display a summary of commands.
`0-9, -'
Prefix argument.
Moving around
.............
`n'
Goto next entry in the table of contents.
`p'
Goto previous entry in the table of contents.
`C-c C-n'
Goto next section heading. Useful when many labels and index
entries separate section headings.
`C-c C-p'
Goto previous section heading.
`N z'
Jump to section N, using the prefix arg. For example, `3 z' jumps
to section 3.
Access to document locations
............................
`<SPC>'
Show the corresponding location in another window. This command
does _not_ select that other window.
`<TAB>'
Goto the location in another window.
`<RET>'
Go to the location and hide the `*toc*' buffer. This will restore
the window configuration before `reftex-toc' (`C-c =') was called.
`mouse-2'
Clicking with mouse button 2 on a line has the same effect as
<RET>. See also variable `reftex-highlight-selection', *Note
Options (Fontification)::.
`f'
Toggle follow mode. When follow mode is active, the other window
will always show the location corresponding to the line at point
in the `*toc*' buffer. This is similar to pressing <SPC> after
each cursor motion. The default for this flag can be set with the
variable `reftex-toc-follow-mode'. Note that only context in
files already visited is shown. RefTeX will not visit a file just
for follow mode. See, however, the variable
`reftex-revisit-to-follow'.
`.'
Show calling point in another window. This is the point from where
`reftex-toc' was last called.
Promotion and Demotion
......................
`<'
Promote the current section. This will convert `\section' to
`\chapter', `\subsection' to `\section' etc. If there is an active
region, all sections in the region will be promoted, including the
one at point. To avoid mistakes, RefTeX requires a fresh document
scan before executing this command - if necessary, it will
automatically do this scan and ask the user to repeat the promotion
command.
`>'
Demote the current section. This is the opposite of promotion.
It will convert `\chapter' to `\section' etc. If there is an
active region, all sections in the region will be demoted,
including the one at point.
`M-%'
Rename the label at point. While generally not recommended, this
can be useful when a package like `fancyref' is used where the
label prefix determines the wording of a reference. After a
promotion/demotion it may be necessary to change a few labels from
`sec:xyz' to `cha:xyz' or vice versa. This command can be used to
do this - it launches a query replace to rename the definition and
all references of a label.
Exiting
.......
`q'
Hide the `*toc*' buffer, return to the position where `reftex-toc'
was last called.
`k'
Kill the `*toc*' buffer, return to the position where `reftex-toc'
was last called.
`C-c >'
Switch to the `*Index*' buffer of this document. With prefix `2',
restrict the index to the section at point in the `*toc*' buffer.
Controlling what gets displayed
...............................
`t'
Change the maximum level of toc entries displayed in the `*toc*'
buffer. Without prefix arg, all levels will be included. With
prefix arg (e.g `3 t'), ignore all toc entries with level greater
than ARG (3 in this case). Chapters are level 1, sections are
level 2. The mode line `T<>' indicator shows the current value.
The default depth can be configured with the variable
`reftex-toc-max-level'.
`F'
Toggle the display of the file borders of a multifile document in
the `*toc*' buffer. The default for this flag can be set with the
variable `reftex-toc-include-file-boundaries'.
`l'
Toggle the display of labels in the `*toc*' buffer. The default
for this flag can be set with the variable
`reftex-toc-include-labels'. When called with a prefix argument,
RefTeX will prompt for a label type and include only labels of the
selected type in the `*toc*' buffer. The mode line `L<>'
indicator shows which labels are included.
`i'
Toggle the display of index entries in the `*toc*' buffer. The
default for this flag can be set with the variable
`reftex-toc-include-index-entries'. When called with a prefix
argument, RefTeX will prompt for a specific index and include only
entries in the selected index in the `*toc*' buffer. The mode
line `I<>' indicator shows which index is used.
`c'
Toggle the display of label and index context in the `*toc*'
buffer. The default for this flag can be set with the variable
`reftex-toc-include-context'.
Updating the buffer
...................
`g'
Rebuild the `*toc*' buffer. This does _not_ rescan the document.
`r'
Reparse the LaTeX document and rebuild the `*toc*' buffer. When
`reftex-enable-partial-scans' is non-`nil', rescan only the file
this location is defined in, not the entire document.
`C-u r'
Reparse the _entire_ LaTeX document and rebuild the `*toc*' buffer.
`x'
Switch to the `*toc*' buffer of an external document. When the
current document is using the `xr' package (*note xr (LaTeX
package)::), RefTeX will switch to one of the external documents.
Automatic recentering
.....................
`d'
Toggle the display of a dedicated frame displaying just the `*toc*'
buffer. Follow mode and visiting locations will not work that
frame, but automatic recentering will make this frame always show
your current editing location in the document (see below).
`a'
Toggle the automatic recentering of the `*toc*' buffer. When this
option is on, moving around in the document will cause the `*toc*'
to always highlight the current section. By default, this option
is active while the dedicated `*TOC*' frame exists. See also the
variable `reftex-auto-recenter-toc'.
In order to define additional commands for the `*toc*' buffer, the
keymap `reftex-toc-map' may be used.
If you call `reftex-toc' while the `*toc*' buffer already exists,
the cursor will immediately jump to the right place, i.e. the section
from which `reftex-toc' was called will be highlighted. The command
`C-c -' (`reftex-toc-recenter') will only redisplay the `*toc*' buffer
and highlight the correct line without actually selecting the `*toc*'
window. This can be useful to quickly find out where in the document
you currently are. You can also automate this by asking RefTeX to keep
track of your current editing position in the TOC. The TOC window will
then be updated whenever you stop typing for more than
`reftex-idle-time' seconds. By default this works only with the
dedicated `*TOC*' frame. But you can also force automatic recentering
of the TOC window on the current frame with
(setq reftex-auto-recenter-toc t)
The section macros recognized by RefTeX are all LaTeX section macros
(from `\part' to `\subsubparagraph') and the commands `\addchap' and
`\addsec' from the KOMA-Script classes. Additional macros can be
configured with the variable `reftex-section-levels'. It is also
possible to add certain LaTeX environments to the table of contents.
This is probably only useful for theorem-like environments. *Note
Defining Label Environments::, for an example.
File: reftex.info, Node: Labels and References, Next: Citations, Prev: Table of Contents, Up: Top
3 Labels and References
***********************
LaTeX provides a powerful mechanism to deal with cross-references in a
document. When writing a document, any part of it can be marked with a
label, like `\label{mark}'. LaTeX records the current value of a
certain counter when a label is defined. Later references to this label
(like `\ref{mark}') will produce the recorded value of the counter.
Labels can be used to mark sections, figures, tables, equations,
footnotes, items in enumerate lists etc. LaTeX is context sensitive in
doing this: A label defined in a figure environment automatically
records the figure counter, not the section counter.
Several different environments can share a common counter and
therefore a common label category. For example labels in both
`equation' and `eqnarray' environments record the value of the same
counter - the equation counter.
* Menu:
* Creating Labels::
* Referencing Labels::
* Builtin Label Environments:: The environments RefTeX knows about.
* Defining Label Environments:: ... and environments it doesn't.
* Reference Info:: View the label corresponding to a \ref.
* Reference Styles:: Macros to be used instead of \ref.
* xr (LaTeX package):: References to external documents.
File: reftex.info, Node: Creating Labels, Next: Referencing Labels, Up: Labels and References
3.1 Creating Labels
===================
In order to create a label in a LaTeX document, press `C-c ('
(`reftex-label'). Just like LaTeX, RefTeX is context sensitive and
will figure out the environment it currently is in and adapt the label
to that environment. A label usually consists of a short prefix
indicating the type of the label and a unique mark. RefTeX has three
different modes to create this mark.
1. A label can be derived from context. This means, RefTeX takes the
context of the label definition and constructs a label from
that(1). This works best for section labels, where the section
heading is used to construct a label. In fact, RefTeX's default
settings use this method only for section labels. You will be
asked to confirm the derived label, or edit it.
2. We may also use a simple unique number to identify a label. This
is mostly useful for labels where it is difficult to come up with
a very good descriptive name. RefTeX's default settings use this
method for equations, enumerate items and footnotes. The author
of RefTeX tends to write documents with many equations and finds
it impossible to come up with good names for each of them. These
simple labels are inserted without query, and are therefore very
fast. Good descriptive names are not really necessary as RefTeX
will provide context to reference a label (*note Referencing
Labels::).
3. The third method is to ask the user for a label. This is most
useful for things which are easy to describe briefly and do not
turn up too frequently in a document. RefTeX uses this for
figures and tables. Of course, one can enter the label directly
by typing the full `\label{mark}'. The advantage of using
`reftex-label' anyway is that RefTeX will know that a new label
has been defined. It will then not be necessary to rescan the
document in order to access this label later.
If you want to change the way certain labels are created, check out
the variable `reftex-insert-label-flags' (*note Options (Creating
Labels)::).
If you are using AUCTeX to write your LaTeX documents, you can set
it up to delegate the creation of labels to RefTeX. *Note AUCTeX::, for
more information.
---------- Footnotes ----------
(1) Note that the context may contain constructs which are invalid
in labels. RefTeX will therefore strip the accent from accented
Latin-1 characters and remove everything else which is not valid in
labels. This mechanism is safe, but may not be satisfactory for
non-western languages. Check the following variables if you need to
change things: `reftex-translate-to-ascii-function',
`reftex-derive-label-parameters', `reftex-label-illegal-re',
`reftex-abbrev-parameters'.
File: reftex.info, Node: Referencing Labels, Next: Builtin Label Environments, Prev: Creating Labels, Up: Labels and References
3.2 Referencing Labels
======================
RefTeX scans the document in order to find all labels. To make
referencing labels easier, it assigns to each label a category, the
_label type_ (for example section, table, figure, equation, etc.). In
order to determine the label type, RefTeX parses around each label to
see in what kind of environments it is located. You can speed up the
parsing by using type-specific prefixes for labels and configuring the
variable `reftex-trust-label-prefix'.
Referencing Labels is really at the heart of RefTeX. Press `C-c )'
in order to reference a label (`reftex-reference'). This will start a
selection process and finally insert the complete `\ref{label}' into
the buffer.
First, you can select which reference macro you want to use, e.g.
`\ref' or `\pageref'. Later in the process you have another chance to
make this selection and you can therefore disable this step by
customizing `reftex-ref-macro-prompt' if you find it too intrusive.
*Note Reference Styles::.
Then, RefTeX will determine the label category which is required.
Often that can be figured out from context. For example, if you write
`As shown in eq.' and then press `C-c )', RefTeX knows that an equation
label is going to be referenced. If it cannot figure out what label
category is needed, it will query for one.
You will then be presented with a label selection menu. This is a
special buffer which contains an outline of the document along with all
labels of the given label category. In addition, next to the label
there will be one line of context of the label definition, which is some
text in the buffer near the label definition. Usually this is
sufficient to identify the label. If you are unsure about a certain
label, pressing <SPC> will show the label definition point in another
window.
In order to reference a label, move the cursor to the correct label
and press <RET>. You can also reference several labels with a single
call to `reftex-reference' by marking entries with the `m' key (see
below).
Here is a list of special commands in the selection buffer. A
summary of this information is always available from the selection
process by pressing `?'.
General
.......
`?'
Show a summary of available commands.
`0-9,-'
Prefix argument.
Moving around
.............
`n'
Go to next label.
`p'
Go to previous label.
`b'
Jump back to the position where you last left the selection buffer.
Normally this should get you back to the last referenced label.
`C-c C-n'
Goto next section heading.
`C-c C-p'
Goto previous section heading.
`N z'
Jump to section N, using the prefix arg. For example `3 z' jumps
to section 3.
Displaying Context
..................
`<SPC>'
Show the surroundings of the definition of the current label in
another window. See also the `f' key.
`f'
Toggle follow mode. When follow mode is active, the other window
will always display the full context of the current label. This
is similar to pressing <SPC> after each cursor motion. Note that
only context in files already visited is shown. RefTeX will not
visit a file just for follow mode. See, however, the variable
`reftex-revisit-to-follow'.
`.'
Show insertion point in another window. This is the point from
where you called `reftex-reference'.
Selecting a label and creating the reference
............................................
`<RET>'
Insert a reference to the label at point into the buffer from
which the selection process was started. When entries have been
marked, <RET> references all marked labels.
`mouse-2'
Clicking with mouse button 2 on a label will accept it like <RET>
would. See also variable `reftex-highlight-selection', *Note
Options (Misc)::.
`m - + ,'
Mark the current entry. When several entries have been marked,
pressing `RET' will accept all of them and place them into several
`\ref' macros. The special markers `,-+' also store a separator
to be inserted before the corresponding reference. So marking six
entries with the keys `m , , - , +' will give a reference list
like this (see the variable `reftex-multiref-punctuation')
In eqs. (1), (2), (3)--(4), (5) and (6)
`u'
Unmark a marked entry.
`a'
Accept the marked entries and put all labels as a comma-separated
list into one _single_ `\ref' macro. Some packages like
`saferef.sty' support multiple references in this way.
`l'
Use the last referenced label(s) again. This is equivalent to
moving to that label and pressing <RET>.
`<TAB>'
Enter a label with completion. This may also be a label which
does not yet exist in the document.
`v'
Cycle forward through active reference macros. The selected macro
is displayed by the `S<...>' indicator in the mode line of the
selection buffer. This mechanism comes in handy if you are using
LaTeX packages like `varioref' or `fancyref' and want to use the
special referencing macros they provide (e.g. `\vref' or `\fref')
instead of `\ref'.
`V'
Cycle backward through active reference macros.
Exiting
.......
`q'
Exit the selection process without inserting any reference into the
buffer.
Controlling what gets displayed
...............................
The defaults for the following flags can be configured with the
variable `reftex-label-menu-flags' (*note Options (Referencing
Labels)::).
`c'
Toggle the display of the one-line label definition context in the
selection buffer.
`F'
Toggle the display of the file borders of a multifile document in
the selection buffer.
`t'
Toggle the display of the table of contents in the selection
buffer. With prefix ARG, change the maximum level of toc entries
displayed to ARG. Chapters are level 1, sections are level 2.
`#'
Toggle the display of a label counter in the selection buffer.
`%'
Toggle the display of labels hidden in comments in the selection
buffers. Sometimes, you may have commented out parts of your
document. If these parts contain label definitions, RefTeX can
still display and reference these labels.
Updating the buffer
...................
`g'
Update the menu. This will rebuilt the menu from the internal
label list, but not reparse the document (see `r').
`r'
Reparse the document to update the information on all labels and
rebuild the menu. If the variable `reftex-enable-partial-scans' is
non-`nil' and your document is a multifile document, this will
reparse only a part of the document (the file in which the label at
point was defined).
`C-u r'
Reparse the _entire_ document.
`s'
Switch the label category. After prompting for another label
category, a menu for that category will be shown.
`x'
Reference a label from an external document. With the LaTeX
package `xr' it is possible to reference labels defined in another
document. This key will switch to the label menu of an external
document and let you select a label from there (*note xr: xr
(LaTeX package).).
In order to define additional commands for the selection process, the
keymap `reftex-select-label-map' may be used.
File: reftex.info, Node: Builtin Label Environments, Next: Defining Label Environments, Prev: Referencing Labels, Up: Labels and References
3.3 Builtin Label Environments
==============================
RefTeX needs to be aware of the environments which can be referenced
with a label (i.e. which carry their own counters). By default, RefTeX
recognizes all labeled environments and macros discussed in `The LaTeX
Companion by Goossens, Mittelbach & Samarin, Addison-Wesley 1994.'.
These are:
- `figure', `figure*', `table', `table*', `equation', `eqnarray',
`enumerate', the `\footnote' macro (this is the LaTeX core stuff)
- `align', `gather', `multline', `flalign', `alignat', `xalignat',
`xxalignat', `subequations' (from AMS-LaTeX's `amsmath.sty'
package)
- the `\endnote' macro (from `endnotes.sty')
- `Beqnarray' (`fancybox.sty')
- `floatingfig' (`floatfig.sty')
- `longtable' (`longtable.sty')
- `figwindow', `tabwindow' (`picinpar.sty')
- `SCfigure', `SCtable' (`sidecap.sty')
- `sidewaysfigure', `sidewaystable' (`rotating.sty')
- `subfigure', `subfigure*', the `\subfigure' macro (`subfigure.sty')
- `supertabular' (`supertab.sty')
- `wrapfigure' (`wrapfig.sty')
If you want to use other labeled environments, defined with