Mercurial > hg > xemacs-beta
comparison man/auctex/auc-tex.texi @ 100:4be1180a9e89 r20-1b2
Import from CVS: tag r20-1b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:15:11 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
99:2d83cbd90d8d | 100:4be1180a9e89 |
---|---|
1 \input texinfo | |
2 @setfilename auctex | |
3 @settitle AUC TeX | |
4 @c footnotestyle separate | |
5 @c paragraphindent 2 | |
6 @comment %**end of header | |
7 @iftex | |
8 @tolerance 10000 | |
9 @end iftex | |
10 | |
11 @c $Id: auc-tex.texi,v 1.1 1997/02/20 02:05:18 steve Exp $ | |
12 | |
13 @finalout | |
14 @titlepage | |
15 @title AUC @TeX{} | |
16 @subtitle A much enhanced La@TeX{} mode for GNU Emacs. | |
17 @subtitle Version 9.7 | |
18 | |
19 @author by Kresten Krab Thorup | |
20 @author updated for 6.1 to 9.7 by Per Abrahamsen | |
21 @page | |
22 @vskip 0pt plus 1filll | |
23 Copyright @copyright{} 1992 Kresten Krab Thorup @* | |
24 Copyright @copyright{} 1993, 1994,1995 Per Abrahamsen | |
25 | |
26 Permission is granted to make and distribute verbatim copies of | |
27 this manual provided the copyright notice and this permission notice | |
28 are preserved on all copies. | |
29 | |
30 @ignore | |
31 Permission is granted to process this file through TeX and print the | |
32 results, provided the printed document carries copying permission | |
33 notice identical to this one except for the removal of this paragraph | |
34 (this paragraph not being relevant to the printed manual). | |
35 @end ignore | |
36 | |
37 Permission is granted to copy and distribute modified versions of this | |
38 manual under the conditions for verbatim copying, provided also that the | |
39 section entitled ``Copying'' is included exactly as in the original, and | |
40 provided that the entire resulting derived work is distributed under the | |
41 terms of a permission notice identical to this one. | |
42 | |
43 Permission is granted to copy and distribute translations of this manual | |
44 into another language, under the above conditions for modified versions, | |
45 except that this permission notice may be stated in a translation | |
46 approved by the Free Software Foundation. | |
47 @end titlepage | |
48 @page | |
49 | |
50 @ifinfo | |
51 @node top, Copying, (dir), (dir) | |
52 @top AUC @TeX{} | |
53 | |
54 AUC @TeX{} is an integrated environment for editing La@TeX{} and | |
55 @TeX{} files.@refill | |
56 | |
57 This file documents AUC @TeX{} version 9.7. | |
58 | |
59 Although AUC @TeX{} contains a large number of features, there are no | |
60 reasons to despair. You can continue to write @TeX{} and La@TeX{} | |
61 documents the way you are used to, and only start using the multiple | |
62 features in small steps. AUC @TeX{} is not monolithic, each feature | |
63 described in this manual is useful by itself, but together they provide | |
64 an environment where you will make very few LaTeX errors, and makes it | |
65 easy to find the errors that may slip through anyway. | |
66 | |
67 If you want to make AUC TeX aware of style files and multi-file | |
68 documents right away, insert the following in your @file{.emacs} file. | |
69 @lisp | |
70 (setq TeX-auto-save t) | |
71 (setq TeX-parse-self t) | |
72 (setq-default TeX-master nil) | |
73 @end lisp | |
74 | |
75 NOTE: This documentation is preliminary. It should however cover most | |
76 important points. Corrections or perhaps rewrites of sections | |
77 are VERY WELCOME.@refill | |
78 | |
79 Kresten Krab Thorup (6.0) @* | |
80 Per Abrahamsen (later updates) | |
81 | |
82 There is a mailing list for discussion about AUC @TeX{} and announcement | |
83 of alpha releases, write to @samp{auc-tex-request@@sunsite.auc.dk} to join | |
84 it. Send contributions to @samp{auc-tex@@sunsite.auc.dk}. | |
85 | |
86 Bug reports, suggestions for new features, and pleas for help should go | |
87 to either @samp{auc-tex_mgr@@iesd.auc.dk} (the AUC @TeX{} managers), or | |
88 to @samp{auc-tex@@sunsite.auc.dk} (the mailing list) if they might have | |
89 general interest. Please use the command @kbd{M-x | |
90 TeX-submit-bug-report} to report bugs if possible.@refill | |
91 | |
92 @end ifinfo | |
93 | |
94 @menu | |
95 * Copying:: Copying | |
96 * Introduction:: Why AUC @TeX{} is good for you. | |
97 * Frequently Used Commands:: Inserting Frequently Used Commands | |
98 * Advanced Features:: Advanced Editing Features | |
99 * Formatting:: Formatting and Printing | |
100 * Multifile:: Multifile Documents | |
101 * Parsing Files:: Automatic Parsing of @TeX{} files. | |
102 * I18n:: Internationalization | |
103 * Automatic:: Automatic Customization | |
104 * Style Files:: Writing Your own Style Support | |
105 * Installation:: How to install AUC @TeX{} | |
106 * History:: The History of AUC @TeX{} | |
107 * Projects:: Wishlist | |
108 * Credit:: Credit | |
109 * Key Index:: Key Index | |
110 * Function Index:: Function Index | |
111 * Variable Index:: Variable Index | |
112 * Concept Index:: Concept Index | |
113 | |
114 @end menu | |
115 | |
116 @node Copying, Introduction, top, top | |
117 @unnumbered Copying | |
118 @cindex Copying | |
119 @cindex Copyright | |
120 @cindex GPL | |
121 @cindex General Public License | |
122 @cindex License | |
123 @cindex Free | |
124 @cindex Free software | |
125 @cindex Distribution | |
126 @cindex Right | |
127 @cindex Warranty | |
128 | |
129 (This text stolen from the @TeX{}info 2.16 distribution). | |
130 | |
131 The programs currently being distributed that relate to AUC @TeX{} | |
132 include lisp files for GNU Emacs. These programs are @dfn{free}; this | |
133 means that everyone is free to use them and free to redistribute them on | |
134 a free basis. The AUC @TeX{} related programs are not in the public | |
135 domain; they are copyrighted and there are restrictions on their | |
136 distribution, but these restrictions are designed to permit everything | |
137 that a good cooperating citizen would want to do. What is not allowed | |
138 is to try to prevent others from further sharing any version of these | |
139 programs that they might get from you.@refill | |
140 | |
141 Specifically, we want to make sure that you have the right to give | |
142 away copies of the programs that relate to AUC @TeX{}, that you receive | |
143 source code or else can get it if you want it, that you can change these | |
144 programs or use pieces of them in new free programs, and that you know | |
145 you can do these things.@refill | |
146 | |
147 To make sure that everyone has such rights, we have to forbid you to | |
148 deprive anyone else of these rights. For example, if you distribute | |
149 copies of the AUC @TeX{} related programs, you must give the recipients all | |
150 the rights that you have. You must make sure that they, too, receive or | |
151 can get the source code. And you must tell them their rights.@refill | |
152 | |
153 Also, for our own protection, we must make certain that everyone finds | |
154 out that there is no warranty for the programs that relate to AUC @TeX{}. | |
155 If these programs are modified by someone else and passed on, we want | |
156 their recipients to know that what they have is not what we distributed, | |
157 so that any problems introduced by others will not reflect on our | |
158 reputation.@refill | |
159 | |
160 The precise conditions of the licenses for the programs currently | |
161 being distributed that relate to AUC @TeX{} are found in the General | |
162 Public Licenses that accompany them.@refill | |
163 | |
164 @node Introduction, Frequently Used Commands, Copying, top | |
165 @include intro.texi | |
166 | |
167 @node Frequently Used Commands, Advanced Features, Introduction, top | |
168 @chapter Inserting Frequently Used Commands | |
169 | |
170 The most commonly used commands/macros of AUC @TeX{} are those which | |
171 simply insert templates for often used @TeX{} and/or La@TeX{} | |
172 constructs, like font changes, handling of environments, etc. | |
173 These features are very simple, and easy to learn, and help you | |
174 avoiding stupid mistakes like mismatched braces, or | |
175 @samp{\begin@{@}}-@samp{\end@{@}} pairs.@refill | |
176 | |
177 @menu | |
178 * Quotes:: Inserting double quotes | |
179 * Font Specifiers:: Inserting Font Specifiers | |
180 * Sectioning:: Inserting chapters, sections, etc. | |
181 * Environments:: Inserting Environment Templates | |
182 @end menu | |
183 | |
184 @node Quotes, Font Specifiers, Frequently Used Commands, Frequently Used Commands | |
185 @section Insertion of Quotes, Dollars, and Braces | |
186 | |
187 @cindex Quotes | |
188 @cindex Double quotes | |
189 @cindex Braces | |
190 @cindex Brackets | |
191 @cindex Dollars | |
192 @cindex Math mode delimiters | |
193 @cindex Matching dollar signs | |
194 @cindex Display math mode | |
195 | |
196 In @TeX{} literal double quotes @samp{"like this"} are seldom used, | |
197 instead two single quotes are used @samp{``like this''}. To help you | |
198 insert these efficiently, AUC @TeX{} allows you to continue to press | |
199 @kbd{"} to insert two single quotes. To get a literal double quote, | |
200 press @kbd{"} twice. | |
201 | |
202 @deffn Command TeX-insert-quote @var{count} | |
203 @kindex " | |
204 (@kbd{"}) Insert the appropriate quote marks for TeX. | |
205 | |
206 Inserts the value of @code{TeX-open-quote} (normally @samp{``}) or | |
207 @code{TeX-close-quote} (normally @samp{''}) depending on the context. | |
208 With prefix argument, always inserts @samp{"} characters.@refill | |
209 @end deffn | |
210 | |
211 @defopt TeX-open-quote | |
212 String inserted by typing @kbd{"} to open a quotation. | |
213 @end defopt | |
214 | |
215 @defopt TeX-close-quote | |
216 String inserted by typing @kbd{"} to open a quotation. | |
217 @end defopt | |
218 | |
219 If you include the style file @file{german} @code{TeX-open-quote} and | |
220 @code{TeX-close-quote} will both be set to @samp{"}. | |
221 | |
222 In AUC @TeX{}, dollar signs should match like they do in @TeX{}. This | |
223 has been partially implemented, we assume dollar signs always match | |
224 within a paragraph. The first @samp{$} you insert in a paragraph will | |
225 do nothing special. The second @samp{$} will match the first. This | |
226 will be indicated by moving the cursor temporarily over the first dollar | |
227 sign. If you enter a dollar sign that matches a double dollar sign | |
228 @samp{$$} AUC @TeX{} will automatically insert two dollar signs. If you | |
229 enter a second dollar sign that matches a single dollar sign, the single | |
230 dollar sign will automatically be converted to a double dollar sign. | |
231 | |
232 @deffn Command TeX-insert-dollar @var{arg} | |
233 @kindex $ | |
234 (@kbd{$}) Insert dollar sign. | |
235 | |
236 Show matching dollar sign if this dollar sign end the @TeX{} math mode. | |
237 Ensure double dollar signs match up correctly by inserting extra | |
238 dollar signs when needed. | |
239 | |
240 With optional @var{arg}, insert that many dollar signs. | |
241 @end deffn | |
242 | |
243 To avoid unbalanced braces, it is useful to insert them pairwise. You | |
244 can do this by typing @kbd{C-c @{}. | |
245 | |
246 @deffn Command TeX-insert-braces | |
247 @kindex C-c @{ | |
248 (@kbd{C-c @{}) Make a pair of braces and position the cursor | |
249 to type inside of them. | |
250 @end deffn | |
251 | |
252 @node Font Specifiers, Sectioning, Quotes, Frequently Used Commands | |
253 @section Inserting Font Specifiers | |
254 | |
255 @cindex Fonts | |
256 @cindex Font macros | |
257 @cindex Changing font | |
258 @cindex Specifying a font | |
259 | |
260 Perhaps the most used keyboard commands of AUC @TeX{} are the short-cuts | |
261 available for easy insertion of font changing macros. They all put the | |
262 font change inside a @TeX{} group, a practice that help preventing | |
263 subtle errors. The most significant advantage of using these command | |
264 instead of typing it in yourself, is that the braces will always match | |
265 correctly. | |
266 | |
267 If you give an argument (that is, type @kbd{C-u}) to the font command, | |
268 the innermost font will be replaced, i.e. the font in the @TeX{} group | |
269 around point will be changed. The following table shows the available | |
270 commands, with @code{@point{}} indicating the position where the text | |
271 will be inserted.@refill | |
272 | |
273 @table @kbd | |
274 @item C-c C-f C-r | |
275 @kindex C-c C-f C-r | |
276 @cindex @code{\textrm} | |
277 Insert roman @r{@{\textrm @point{}@}} text. | |
278 | |
279 @item C-c C-f C-b | |
280 @kindex C-c C-f C-b | |
281 @cindex @code{\textbf} | |
282 Insert @b{bold face} @samp{@{\textbf @point{}@}} text. | |
283 | |
284 @item C-c C-f C-i | |
285 @kindex C-c C-f C-i | |
286 @cindex @code{\textit} | |
287 Insert @i{italics} @samp{@{\textit @point{}\/@}} text. | |
288 | |
289 @item C-c C-f C-e | |
290 @kindex C-c C-f C-e | |
291 @cindex @code{\emph} | |
292 Insert @i{emphasized} @samp{@{\emph @point{}\/@}} text. | |
293 | |
294 @item C-c C-f C-s | |
295 @kindex C-c C-f C-s | |
296 @cindex @code{\textsl} | |
297 Insert @i{slanted} @samp{@{\textsl @point{}\/@}} text. | |
298 | |
299 @item C-c C-f C-t | |
300 @kindex C-c C-f C-t | |
301 @cindex @code{\texttt} | |
302 Insert @t{typewriter} @samp{@{\texttt @point{}@}} text. | |
303 | |
304 @item C-c C-f C-c | |
305 @kindex C-c C-f C-c | |
306 @cindex @code{\textsc} | |
307 Insert @sc{small caps} @samp{@{\textsc @point{}@}} text. | |
308 | |
309 @item C-c C-f C-d | |
310 @kindex C-c C-f C-c | |
311 @cindex Deleting fonts | |
312 Delete the innermost font specification containing point. | |
313 | |
314 @end table | |
315 | |
316 @deffn Command TeX-font @var{arg} | |
317 @kindex C-c C-f | |
318 (@kbd{C-c C-f}) Insert template for font change command. | |
319 | |
320 If @var{replace} is not nil, replace current font. @var{what} | |
321 determines the font to use, as specified by @code{TeX-font-list}. | |
322 @end deffn | |
323 | |
324 @defopt TeX-font-list | |
325 List of fonts used by TeX-font. | |
326 | |
327 Each entry is a list with three elements. The first element is the | |
328 key to activate the font. The second element is the string to insert | |
329 before point, and the third element is the string to insert after | |
330 point. An optional fourth element means always replace if not nil. | |
331 @end defopt | |
332 | |
333 @node Sectioning, Environments, Font Specifiers, Frequently Used Commands | |
334 @section Inserting chapters, sections, etc. | |
335 @cindex Sectioning | |
336 @cindex Sections | |
337 @cindex Chapters | |
338 @cindex @code{\chapter} | |
339 @cindex @code{\section} | |
340 @cindex @code{\subsection} | |
341 @cindex @code{\label} | |
342 | |
343 Insertion of sectioning macros, that is @samp{\chapter}, | |
344 @samp{\section}, @samp{\subsection}, etc. and accompanying | |
345 @samp{\label}'s may be eased by using @kbd{C-c C-s}. This command is | |
346 highly customizable, the following describes the default behavior. | |
347 | |
348 When invoking you will be asked for a section macro to insert. An | |
349 appropriate default is automatically selected by AUC @TeX{}, that is | |
350 either: at the top of the document; the top level sectioning for that | |
351 document style, and any other place: The same as the last occurring | |
352 sectioning command. | |
353 | |
354 Next, you will be asked for the actual name of that section, and | |
355 last you will be asked for a label to be associated with that section. | |
356 The label will be prefixed by the value specified in | |
357 @code{LaTeX-section-hook}. | |
358 | |
359 @deffn Command LaTeX-section @var{arg} | |
360 @kindex C-c C-s | |
361 (@kbd{C-c C-s}) Insert a sectioning command. | |
362 | |
363 Determine the type of section to be inserted, by the argument | |
364 @var{arg}.@refill | |
365 | |
366 @itemize @bullet | |
367 @item | |
368 If @var{arg} is nil or missing, use the current level. | |
369 @item | |
370 If @var{arg} is a list (selected by C-u), go downward one level. | |
371 @item | |
372 If @var{arg} is negative, go up that many levels. | |
373 @item | |
374 If @var{arg} is positive or zero, use absolute level: | |
375 @itemize + | |
376 @item | |
377 0 : part | |
378 @item | |
379 1 : chapter | |
380 @item | |
381 2 : section | |
382 @item | |
383 3 : subsection | |
384 @item | |
385 4 : subsubsection | |
386 @item | |
387 5 : paragraph | |
388 @item | |
389 6 : subparagraph | |
390 @end itemize | |
391 @end itemize | |
392 | |
393 The following variables can be set to customize the function. | |
394 | |
395 @vtable @code | |
396 @item LaTeX-section-hook | |
397 Hooks to be run when inserting a section. | |
398 @item LaTeX-section-label | |
399 Prefix to all section references. | |
400 @end vtable | |
401 | |
402 @end deffn | |
403 | |
404 The precise behavior of @code{LaTeX-section} is defined by the contents | |
405 of @code{LaTeX-section-hook}. | |
406 | |
407 @defopt LaTeX-section-hook | |
408 List of hooks to run when a new section is inserted. | |
409 | |
410 The following variables are set before the hooks are run | |
411 | |
412 @table @var | |
413 @item level | |
414 Numeric section level, default set by prefix arg to @code{LaTeX-section}. | |
415 @item name | |
416 Name of the sectioning command, derived from @var{level}. | |
417 @item title | |
418 The title of the section, default to an empty string. | |
419 @item toc | |
420 Entry for the table of contents list, default nil. | |
421 @item done-mark | |
422 Position of point afterwards, default nil meaning after the inserted | |
423 text. | |
424 @end table | |
425 | |
426 A number of hooks are already defined. Most likely, you will be able to | |
427 get the desired functionality by choosing from these hooks. | |
428 | |
429 @ftable @code | |
430 @item LaTeX-section-heading | |
431 Query the user about the name of the sectioning command. Modifies | |
432 @var{level} and @var{name}. | |
433 @item LaTeX-section-title | |
434 Query the user about the title of the section. Modifies @var{title}. | |
435 @item LaTeX-section-toc | |
436 Query the user for the toc entry. Modifies @var{toc}. | |
437 @item LaTeX-section-section | |
438 Insert La@TeX{} section command according to @var{name}, @var{title}, | |
439 and @var{toc}. If @var{toc} is nil, no toc entry is inserted. If | |
440 @var{toc} or @var{title} are empty strings, @var{done-mark} will be | |
441 placed at the point they should be inserted. | |
442 @item LaTeX-section-label | |
443 Insert a label after the section command. Controlled by the variable | |
444 @code{LaTeX-section-label}. | |
445 @end ftable | |
446 | |
447 To get a full featured @code{LaTeX-section} command, insert | |
448 | |
449 @lisp | |
450 (setq LaTeX-section-hook | |
451 '(LaTeX-section-heading | |
452 LaTeX-section-title | |
453 LaTeX-section-toc | |
454 LaTeX-section-section | |
455 LaTeX-section-label)) | |
456 @end lisp | |
457 | |
458 in your @file{.emacs} file. | |
459 @end defopt | |
460 | |
461 The behavior of @code{LaTeX-section-label} is determined by the | |
462 variable @code{LaTeX-section-label}.@refill | |
463 | |
464 @defopt LaTeX-section-label | |
465 Default prefix when asking for a label. | |
466 | |
467 If it is a string, it is used unchanged for all kinds of sections. | |
468 If it is nil, no label is inserted. | |
469 If it is a list, the list is searched for a member whose car is equal | |
470 to the name of the sectioning command being inserted. The cdr is then | |
471 used as the prefix. If the name is not found, or if the cdr is nil, | |
472 no label is inserted. | |
473 | |
474 @cindex Prefix for labels | |
475 @cindex Label prefix | |
476 @cindex Labels | |
477 By default, chapters have a prefix of @samp{cha:} while sections and | |
478 subsections have a prefix of @samp{sec:}. Labels are not automatically | |
479 inserted for other types of sections. | |
480 @end defopt | |
481 | |
482 @node Environments, , Sectioning, Frequently Used Commands | |
483 @section Inserting Environment Templates | |
484 @cindex Environments | |
485 @cindex @samp{\begin} | |
486 @cindex @samp{\end} | |
487 | |
488 A large apparatus is available that supports insertions of environments, | |
489 that is @samp{\begin@{@}} --- @samp{\end@{@}} pairs. | |
490 | |
491 AUC @TeX{} is aware of most of the actual environments available in a | |
492 specific document. This is achieved by examining your | |
493 @samp{\documentstyle} command, and consulting a precompiled list of | |
494 environments available in a large number of styles. | |
495 | |
496 You insert an environment with @kbd{C-c C-e}, and select an environment | |
497 type. Depending on the environment, AUC @TeX{} may ask more questions | |
498 about the optional parts of the selected environment type. With | |
499 @kbd{C-u C-c C-e} you will change the current environment. | |
500 | |
501 @deffn Command LaTeX-environment @var{arg} | |
502 @kindex C-c C-e | |
503 (@kbd{C-c C-e}) AUC @TeX{} will prompt you for an environment | |
504 to insert. At this prompt, you may press @key{TAB} or @key{SPC} to | |
505 complete a partially written name, and/or to get a list of available | |
506 environments. After selection of a specific environment AUC @TeX{} may | |
507 prompt you for further specifications. | |
508 | |
509 If the optional argument @var{arg} is not-nil (i.e. you have given a | |
510 prefix argument), the current environment is modified and no new | |
511 environment is inserted. | |
512 @end deffn | |
513 | |
514 As a default selection, AUC @TeX{} will suggest the environment last | |
515 inserted or, as the first choice the value of the variable | |
516 @code{LaTeX-default-environment}. | |
517 | |
518 @defopt LaTeX-default-environment | |
519 Default environment to insert when invoking @samp{LaTeX-environment} | |
520 first time. | |
521 @end defopt | |
522 | |
523 If the document is empty, or the cursor is placed at the top of the | |
524 document, AUC @TeX{} will default to insert a `document' environment. | |
525 | |
526 Most of these are described further in the following sections, and you | |
527 may easily specify more, as described in `Customizing environments'. | |
528 | |
529 @menu | |
530 * Floats:: Floats | |
531 * Itemize-like:: Itemize-like | |
532 * Tabular-like:: Tabular-like | |
533 * Customizing environments:: Customizing environments | |
534 @end menu | |
535 | |
536 You can close the current environment with @kbd{C-c ]}, but we suggest | |
537 that you use @kbd{C-c C-e} to insert complete environments instead. | |
538 | |
539 @deffn Command LaTeX-close-environment | |
540 @kindex C-c ] | |
541 (@kbd{C-c ]}) Insert an @samp{\end} that matches the current environment. | |
542 @end deffn | |
543 | |
544 @node Floats, Itemize-like, Environments, Environments | |
545 @subsection Floats | |
546 @cindex Floats | |
547 @cindex Figures | |
548 @cindex Figure environment | |
549 @cindex Tables | |
550 @cindex Table environment | |
551 | |
552 Figures and tables (i.e., floats) may also be inserted using AUC @TeX{}. | |
553 After choosing either `figure' or `table' in the environment list | |
554 described above, you will be prompted for a number of additional things. | |
555 | |
556 @table @var | |
557 @item float-to | |
558 This field is the option of float environments that controls how they are | |
559 placed in the final document. In La@TeX{} this is a sequence of the | |
560 letters @samp{htbp} as described in the La@TeX{} manual. The value will | |
561 default to the value of @code{LaTeX-float}. | |
562 @vindex LaTeX-float | |
563 | |
564 @item caption | |
565 This is the caption of the float. | |
566 | |
567 @item label | |
568 The label of this float. The label will have a default prefix, which is | |
569 controlled by the variables @code{LaTeX-figure-label} and | |
570 @code{LaTeX-table-label}. | |
571 @vindex LaTeX-figure-label | |
572 @vindex LaTeX-table-label | |
573 @cindex Prefix for labels | |
574 @cindex Label prefix | |
575 @cindex Labels | |
576 @end table | |
577 | |
578 Moreover, in the case of a `figure' environment, you will be asked if | |
579 you want to insert a `center' environment inside the figure. | |
580 | |
581 @defopt LaTeX-float | |
582 Default placement for floats. | |
583 @end defopt | |
584 | |
585 @defopt LaTeX-figure-label | |
586 Prefix to use for figure labels. | |
587 @end defopt | |
588 | |
589 @defopt LaTeX-table-label | |
590 Prefix to use for table labels. | |
591 @end defopt | |
592 | |
593 @node Itemize-like, Tabular-like, Floats, Environments | |
594 @subsection Itemize-like | |
595 @cindex Itemize | |
596 @cindex Enumerates | |
597 @cindex Descriptions | |
598 @cindex Items | |
599 @cindex \item | |
600 | |
601 In an itemize-like environment, nodes (i.e., @samp{\item}s) may be | |
602 inserted using @kbd{C-c @key{LFD}}. | |
603 | |
604 @deffn Command LaTeX-insert-item | |
605 @kindex C-c @key{LFD} | |
606 (@kbd{C-c @key{LFD}}) Close the current item, move to the next line and | |
607 insert an appropriate @samp{\item} for the current environment. That is, | |
608 `itemize' and `enumerate' will have @samp{\item } inserted, while | |
609 `description' will have @samp{\item[]} inserted. | |
610 @end deffn | |
611 | |
612 @node Tabular-like, Customizing environments, Itemize-like, Environments | |
613 @subsection Tabular-like | |
614 | |
615 When inserting Tabular-like environments, that is, `tabular' `array' | |
616 etc., you will be prompted for a template for that environment. | |
617 | |
618 @node Customizing environments, , Tabular-like, Environments | |
619 @subsection Customizing environments | |
620 | |
621 @xref{Adding Environments}, for how to customize the list of known | |
622 environments. | |
623 | |
624 @node Advanced Features, Formatting, Frequently Used Commands, top | |
625 @chapter Advanced Editing Features | |
626 @cindex Advanced features | |
627 | |
628 The previous chapter described how to write the main body of the text | |
629 easily and with a minimum of errors. In this chapter we will describe | |
630 some features for entering more specialized sorts of text, and for | |
631 indenting and navigating through the document. | |
632 | |
633 @menu | |
634 * Mathematics:: Entering Mathematics | |
635 * Completion:: Completion | |
636 * Commenting:: Commenting | |
637 * Marking and formatting:: Marking, Formatting and Indenting | |
638 * Outline:: Hiding text | |
639 @end menu | |
640 | |
641 @node Mathematics, Completion, Advanced Features, Advanced Features | |
642 @section Entering Mathematics | |
643 @cindex Mathematics | |
644 @cindex Symbols | |
645 @cindex Abbreviations | |
646 | |
647 @TeX{} is written by a mathematician, and has always contained good | |
648 support for formatting mathematical text. AUC @TeX{} supports this | |
649 tradition, by offering a special minor mode for entering text with many | |
650 mathematic symbols. You can enter this mode by typing @kbd{C-c | |
651 ~}.@refill | |
652 | |
653 @deffn Command LaTeX-math-mode | |
654 @kindex C-c ~ | |
655 (@kbd{C-c ~}) Toggle LaTeX-math-mode. This is a minor mode rebinding | |
656 the key @code{LaTeX-math-abbrev-prefix} to allow easy typing of | |
657 mathematical symbols. @kbd{`} will read a character from the keyboard, | |
658 and insert the symbol as specified in @code{LaTeX-math-list}. If given a | |
659 prefix argument, the symbol will be surrounded by dollar signs.@refill | |
660 @end deffn | |
661 | |
662 You can use another prefix key (instead of @kbd{`}) by setting the | |
663 variable LaTeX-math-abbrev-prefix. | |
664 | |
665 @defopt LaTeX-math-abbrev-prefix | |
666 A string containing the prefix of @code{LaTeX-math-mode} commands; | |
667 This value defaults to @kbd{`}. @refill | |
668 @end defopt | |
669 | |
670 The variable @code{LaTeX-math-list} holds the actual mapping. | |
671 | |
672 @defopt LaTeX-math-list | |
673 A list containing key command mappings to use in @code{LaTeX-math-mode}. | |
674 The car of each element is the key and the cdr is the macro name. | |
675 @end defopt | |
676 | |
677 The AUC @TeX{} distributions includes a reference card for | |
678 @code{LaTeX-math-mode} with a list of all math mode commands. | |
679 | |
680 @node Completion, Commenting, Mathematics, Advanced Features | |
681 @section Completion | |
682 @cindex Completion | |
683 @cindex Expansion | |
684 @cindex Macro expansion | |
685 @cindex Macro completion | |
686 @cindex Macro arguments | |
687 @cindex Arguments to @TeX{} macros | |
688 | |
689 Emacs lisp programmers probably know the @code{lisp-complete-symbol} | |
690 command, usually bound to @kbd{M-@key{TAB}}. Users of the wonderful | |
691 ispell mode know and love the @code{ispell-complete-word} command from | |
692 that package. Similarly, AUC @TeX{} has a @code{TeX-complete-symbol} | |
693 command, usually bound to @kbd{M-@key{TAB}}. Using | |
694 @code{LaTeX-complete-symbol} makes it easier to type and remember the | |
695 names of long La@TeX{} macros. | |
696 | |
697 In order to use @code{TeX-complete-symbol}, you should write a backslash | |
698 and the start of the macro. Typing @kbd{M-@key{TAB}} will now | |
699 complete as much of the macro, as it unambiguously can. For example, if | |
700 you type `@samp{\renewc}' and then `@kbd{M-@key{TAB}}, it will expand | |
701 to `@samp{\renewcommand}'. | |
702 | |
703 @deffn Command TeX-complete-symbol | |
704 @kindex M-@key{TAB} | |
705 (@kbd{M-@key{TAB}}) Complete @TeX{} symbol before point. | |
706 @end deffn | |
707 | |
708 A more direct way to insert a macro is with @code{TeX-insert-macro}, | |
709 bound to @kbd{C-c C-m}. It has the advantage over completion that it | |
710 knows about the argument of most standard La@TeX{} macros, and will | |
711 prompt for them. It also knows about the type of the arguments, so it | |
712 will for example give completion for the argument to @samp{\include}. | |
713 Some examples are listed below. | |
714 | |
715 @deffn Command TeX-insert-macro | |
716 @kindex C-c C-m | |
717 (@kbd{C-c C-m}) Prompt (with completion) for the name of a @TeX{} macro, | |
718 and if AUC @TeX{} knows the macro, prompt for each argument. | |
719 @end deffn | |
720 | |
721 As a default selection, AUC @TeX{} will suggest the macro last inserted | |
722 or, as the first choice the value of the variable | |
723 @code{TeX-default-macro}. | |
724 | |
725 @defopt TeX-default-macro | |
726 Default macro to insert when invoking @code{TeX-insert-macro} first time. | |
727 @end defopt | |
728 | |
729 A faster alternative is to bind the function @code{TeX-electric-macro} | |
730 to @samp{\}. This can be done by setting the variable @code{TeX-electric-escape} | |
731 | |
732 @defopt TeX-electric-escape | |
733 If this is non-nil when AUC @TeX{} is loaded, the @TeX{} escape | |
734 character @samp{\} will be bound to @code{TeX-electric-macro} | |
735 @end defopt | |
736 | |
737 The difference between @code{TeX-insert-macro} and | |
738 @code{TeX-electric-macro} is that space will complete and exit from the | |
739 minibuffer in @code{TeX-electric-macro}. Use @key{TAB} if you merely | |
740 want to complete. | |
741 | |
742 @deffn Command TeX-electric-macro | |
743 Prompt (with completion) for the name of a @TeX{} macro, | |
744 and if AUC @TeX{} knows the macro, prompt for each argument. | |
745 Space will complete and exit. | |
746 @end deffn | |
747 | |
748 By default AUC @TeX{} will put an empty set braces @samp{@{@}} after a | |
749 macro with no arguments to stop it from eating the next whitespace. | |
750 This can be stopped by entering @code{LaTeX-math-mode}, | |
751 @pxref{Mathematics}, or by setting @code{TeX-insert-braces} to nil | |
752 | |
753 @defopt TeX-insert-braces | |
754 If non-nil, append a empty pair of braces after inserting a macro. | |
755 @end defopt | |
756 | |
757 Completions work because AUC @TeX{} can analyze @TeX{} files, and store | |
758 symbols in emacs lisp files for later retrieval. @xref{Automatic}, for | |
759 more information. | |
760 | |
761 @cindex \cite, completion of | |
762 @cindex Bib@TeX{}, completion | |
763 @cindex cite, completion of | |
764 @cindex bibliography, completion | |
765 @cindex citations, completion of | |
766 @cindex \label, completion | |
767 @cindex \ref, completion | |
768 @cindex labels, completion of | |
769 AUC @TeX{} will also make completion for many macro arguments, for | |
770 example existing labels when you enter a @samp{\ref} macro with | |
771 @code{TeX-insert-macro} or @code{TeX-electric-macro}, and Bib@TeX{} | |
772 entries when you enter a @samp{\cite} macro. For this kind of | |
773 completion to work, parsing must be enabled as described in | |
774 @pxref{Parsing Files}. For @samp{\cite} you must also make sure that | |
775 the Bib@TeX{} files have been saved at least once after you enabled | |
776 automatic parsing on save, and that the basename of the Bib@TeX{} file | |
777 does not conflict with the basename of one of @TeX{} files. | |
778 | |
779 @node Commenting, Marking and formatting, Completion, Advanced Features | |
780 @section Commenting | |
781 | |
782 It is often necessary to comment out temporarily a region of @TeX{} or | |
783 La@TeX{} code. This can be done with the commands @kbd{C-c ;} and | |
784 @kbd{C-c %}. @kbd{C-c ;} will comment out all lines in the current | |
785 region, while @kbd{C-c %} will comment out the current paragraph. To | |
786 uncomment, simply type @kbd{C-u - C-c ;} to uncomment all lines in the | |
787 region, or @kbd{C-u - C-c %} uncomment all comment lines around point. | |
788 | |
789 By default, these commands will insert or remove a single @samp{%}. To | |
790 insert more than one, give an argument. @kbd{C-u 5 C-c %} will add five | |
791 @samp{%} to each line, while @kbd{C-u - 5 C-c %} will remove up to 5 | |
792 @samp{%} from each line. | |
793 | |
794 @deffn Command TeX-comment-region @var{count} | |
795 @kindex C-c ; | |
796 (@kbd{C-c ;}) Add or remove @samp{%} from the beginning of each line in | |
797 the current region, as specified by @var{count}. | |
798 @end deffn | |
799 | |
800 @deffn Command TeX-comment-paragraph @var{count} | |
801 @kindex C-c % | |
802 (@kbd{C-c %}) Add or remove @samp{%} from the beginning of each line in | |
803 the current paragraph, as specified by @var{count}. When removing | |
804 @samp{%}'s the paragraph is considered to consist of all preceding and | |
805 succeeding lines starting with a @samp{%}, until the first non-comment | |
806 line. | |
807 @end deffn | |
808 | |
809 @node Marking and formatting, Outline, Commenting, Advanced Features | |
810 @section Marking, Formatting and Indenting | |
811 @cindex Formatting | |
812 @cindex Filling | |
813 @cindex Indenting | |
814 @cindex Reformatting | |
815 @cindex Reindenting | |
816 | |
817 AUC @TeX{} contains very advanced handling of indentation and | |
818 reformatting of the La@TeX{} source. If you have already tried AUC | |
819 @TeX{} with @code{auto-fill-mode} enabled, you may have noted that the | |
820 source is automatically indented and formatted as you write it. More | |
821 over, AUC @TeX{} is able to format sections of text on demand. | |
822 | |
823 It is important to realize, that AUC @TeX{} comes with `formatting' in | |
824 two fashions. Either letting @TeX{} format the file, or letting AUC | |
825 @TeX{} make the ASCII document look better. | |
826 | |
827 Indentation is done by La@TeX{} environments and by @TeX{} groups, that | |
828 is the body of an environment is indented by the value of | |
829 @code{LaTeX-indent-level} (default 2). Also, items of an `itemize-like' | |
830 environment are indented by the value of @code{LaTeX-item-indent}, | |
831 default @minus{}2. This indentation makes it easier to see the | |
832 structure of the document, and to catch errors such as a missing close | |
833 brace. Thus, the indentation is done for precisely the same reasons | |
834 that you would indent ordinary computer programs. | |
835 @vindex LaTeX-indent-level | |
836 @vindex LaTeX-item-indent | |
837 | |
838 The following is a short sample of an itemize environment indented by | |
839 AUC @TeX{}. If more environment are nested, they are indented | |
840 `accumulated' just like most programming languages usually are seen | |
841 indented in nested constructs. | |
842 | |
843 @example | |
844 \begin@{itemize@} | |
845 \item Insertion of templates for logical-structural compositions such as | |
846 environments and sections. | |
847 \item Hot-keys for easy access to certain often used constructs, e.g., | |
848 font changes, accented letters, and mathematical symbols. | |
849 \item Running application programs (such as \TeX), and then parsing | |
850 the output so that errors in the document may be located | |
851 easily. | |
852 \item Support for multi-file documents. | |
853 \item Online help for \AllTeX\ error messages. | |
854 \item Outlining\Dash i.e., manipulating the document as a composition | |
855 of nested/sequential logical constructs. | |
856 \item Instant formatting and indentation of the \ascii-document in | |
857 order to make it easier to read. | |
858 \item `Completion' (and thereby spell-checking) of partially written | |
859 control sequences. | |
860 \end@{itemize@} | |
861 @end example | |
862 | |
863 You can format and indent single lines, paragraphs, environments, or | |
864 sections. | |
865 | |
866 @table @kbd | |
867 @item @key{TAB} | |
868 @kindex @key{TAB} | |
869 @findex LaTeX-indent-line | |
870 @code{LaTeX-indent-line} will indent the current line. | |
871 | |
872 @item @key{LFD} | |
873 @kindex @key{LFD} | |
874 @code{reindent-then-newline-and-indent} indents the current line, and | |
875 then inserts a new line (much like @key{RET}) and move the cursor to an | |
876 appropriate position by the left margin. | |
877 | |
878 @item M-q | |
879 @kindex M-q | |
880 Alias for @kbd{C-c C-q C-p} | |
881 | |
882 @item C-c C-q C-p | |
883 @kindex C-c C-q C-p | |
884 @findex LaTeX-fill-paragraph | |
885 @code{LaTeX-fill-paragraph} will reformat or `fill' the current | |
886 paragraph. | |
887 | |
888 @item C-c C-q C-e | |
889 @kindex C-c C-q C-e | |
890 @findex LaTeX-fill-environment | |
891 @code{LaTeX-fill-environment} will reformat or `fill' the current | |
892 environment. This may e.g. be the `document' environment, in which case | |
893 the entire document will be formatted. | |
894 | |
895 @item C-c C-q C-s | |
896 @kindex C-c C-q C-s | |
897 @findex LaTeX-fill-section | |
898 @code{LaTeX-fill-section} will reformat or `fill' the current | |
899 logical sectional unit. | |
900 | |
901 @item M-g | |
902 @kindex M-g | |
903 Alias for @kbd{C-c C-q C-r} | |
904 | |
905 @item C-c C-q C-r | |
906 @kindex C-c C-q C-r | |
907 @findex LaTeX-fill-region | |
908 @code{LaTeX-fill-region} will format or `fill' the current region. | |
909 @end table | |
910 | |
911 @strong{Warning:} The formatting cannot handle tabular-like | |
912 environments. Those will be completely messed-up if you try to format | |
913 them. | |
914 | |
915 @defopt LaTeX-indent-level | |
916 Number of spaces to add to the indentation for each @samp{\begin} not | |
917 matched by a @samp{\end}.@refill | |
918 @end defopt | |
919 | |
920 @defopt LaTeX-item-indent | |
921 Number of spaces to add to the indentation for @samp{\item}'s in list | |
922 environments.@refill | |
923 @end defopt | |
924 | |
925 @defopt TeX-brace-indent-level | |
926 Number of spaces to add to the indentation for each @samp{@{} not | |
927 matched by a @samp{@}}.@refill | |
928 @end defopt | |
929 | |
930 @node Outline, , Marking and formatting, Advanced Features | |
931 @section Outlining the Document | |
932 @cindex Outlining | |
933 @cindex Headers | |
934 @cindex Sections | |
935 @cindex Overview | |
936 @cindex Folding | |
937 | |
938 GNU Emacs earlier than version 19.19 does not have a useful outline | |
939 mode. If you want to use outlines with old versions of emacs, please | |
940 get the file @file{outln-18.el} from | |
941 @file{sunsite.auc.dk:/packages/auctex/outln-18.el}. It is a port of the | |
942 Emacs 19.19 outline mode to Emacs 18 and Lucid Emacs.@refill | |
943 | |
944 AUC @TeX{} supports the standard outline minor mode using La@TeX{} | |
945 sectioning commands as header lines. @xref{Outline Mode, , Outline | |
946 Mode, emacs, GNU Emacs Manual}. By default | |
947 @code{outline-minor-mode} will use the prefix key @kbd{C-c} which is | |
948 also used by AUC @TeX{}, so it is suggested that you choose another | |
949 prefix key by inserting | |
950 | |
951 @lisp | |
952 (setq outline-minor-mode-prefix "\C-c\C-o") ; Or whatever... | |
953 @end lisp | |
954 | |
955 in your @file{.emacs} file. | |
956 | |
957 You can add your own headings by setting the variable | |
958 @code{TeX-outline-extra}. | |
959 | |
960 @defvar TeX-outline-extra | |
961 List of extra @TeX{} outline levels. | |
962 | |
963 Each element is a list with two entries. The first entry is the regular | |
964 expression matching a header, and the second is the level of the header. | |
965 A @samp{^} is automatically prepended to the regular expressions in the | |
966 list, so they must match text at the beginning of the line. | |
967 | |
968 See @code{LaTeX-section-list} for existing header levels. | |
969 @end defvar | |
970 | |
971 The following example add @samp{\item} and @samp{\bibliography} headers, | |
972 with @samp{\bibliography} at the same outline level as @samp{\section}, | |
973 and @samp{\item} being below @samp{\subparagraph}. | |
974 | |
975 @example | |
976 (setq TeX-outline-extra | |
977 '(("[ \t]*\\\\\\(bib\\)?item\\b" 7) | |
978 ("\\\\bibliography\\b" 2))) | |
979 @end example | |
980 | |
981 You may want to check out the unbundled @file{out-xtra} package for even | |
982 better outline support. It is available from your favorite emacs lisp | |
983 archive. | |
984 | |
985 @node Formatting, Multifile, Advanced Features, top | |
986 @chapter Formatting and Printing | |
987 | |
988 The most powerful features of AUC @TeX{} may be those allowing you to | |
989 run (La)@TeX{} and other external commands like Bib@TeX{} and | |
990 @code{makeindex} from within Emacs, viewing and printing the results, | |
991 and moreover allowing you to @emph{debug} your documents. | |
992 | |
993 @menu | |
994 * Commands:: Invoking external commands. | |
995 * Debugging:: Debugging @TeX{} and La@TeX{} output. | |
996 * Checking:: Checking the document. | |
997 * Control:: Controlling the processes. | |
998 @end menu | |
999 | |
1000 @node Commands, Debugging, Formatting, Formatting | |
1001 @section Executing Commands | |
1002 @cindex Formatting | |
1003 @cindex Running La@TeX{} | |
1004 @cindex Running @TeX{} | |
1005 @cindex La@TeX{} | |
1006 @cindex @TeX{} | |
1007 @cindex Running commands | |
1008 @cindex Default command | |
1009 @cindex Header | |
1010 @cindex Trailer | |
1011 @cindex Setting the header | |
1012 @cindex Setting the trailer | |
1013 @cindex Region | |
1014 @cindex Region file | |
1015 @cindex Setting the default command | |
1016 @cindex Commands | |
1017 @cindex External Commands | |
1018 @cindex Indexing | |
1019 @cindex Making an index | |
1020 @cindex Running @code{makeindex} | |
1021 @cindex @code{makeindex} | |
1022 @cindex Bib@TeX{} | |
1023 @cindex Bibliography | |
1024 @cindex Literature | |
1025 @cindex Running Bib@TeX{} | |
1026 @cindex Making a bibliography | |
1027 @cindex Printing | |
1028 @cindex Writing to a printer | |
1029 @cindex Viewing | |
1030 @cindex Previewing | |
1031 @cindex Starting a previewer | |
1032 | |
1033 Formatting the document with @TeX{} or La@TeX{}, viewing with a | |
1034 previewer, printing the document, running Bib@TeX{}, making an index, or | |
1035 checking the document with @code{lacheck} or @code{chktex} all require | |
1036 running an external command. | |
1037 | |
1038 There are two ways to run an external command, you can either run it on | |
1039 all of the current documents with @code{TeX-command-master}, or on the | |
1040 current region with @code{TeX-command-region}.@refill | |
1041 | |
1042 @deffn Command TeX-command-master | |
1043 @kindex C-c C-c | |
1044 (@kbd{C-c C-c}) Query the user for a command, and run it on the master | |
1045 file associated with the current buffer. The name of the master file is | |
1046 controlled by the variable @code{TeX-master}. The available commands are | |
1047 controlled by the variable @code{TeX-command-list}.@refill | |
1048 @vindex TeX-master | |
1049 @vindex TeX-command-list | |
1050 @end deffn | |
1051 | |
1052 @xref{Installation} for a discussion about @code{TeX-command-list} and | |
1053 @ref{Multifile} for a discussion about @code{TeX-master}. | |
1054 | |
1055 @deffn Command TeX-command-region | |
1056 @kindex C-c C-r | |
1057 (@kbd{C-c C-r}) Query the user for a command, and run it on the ``region | |
1058 file''. Some commands (typically those invoking @TeX{} or La@TeX{}) | |
1059 will write the current region into the region file, after extracting the | |
1060 header and tailer from the master file. If mark is not active, use the | |
1061 old region. The name of the region file is controlled by the variable | |
1062 @code{TeX-region}. The name of the master file is controlled by the | |
1063 variable @code{TeX-master}. The header is all text up to the line | |
1064 matching the regular expression @code{TeX-header-end}. The trailer is | |
1065 all text from the line matching the regular expression | |
1066 @code{TeX-trailer-start}. The available commands are controlled by the | |
1067 variable @code{TeX-command-list}.@refill | |
1068 @vindex TeX-region | |
1069 @vindex TeX-header-end | |
1070 @vindex TeX-trailer-start | |
1071 @vindex TeX-master | |
1072 @vindex TeX-command-list | |
1073 @end deffn | |
1074 | |
1075 AUC @TeX{} will allow one process for each document, plus one process | |
1076 for the region file to be active at the same time. Thus, if you are | |
1077 editing @var{n} different documents, you can have @var{n} plus one | |
1078 processes running at the same time. If the last process you started was | |
1079 on the region, the commands described in @ref{Debugging} and | |
1080 @ref{Control} will work on that process, otherwise they will work on the | |
1081 process associated with the current document. | |
1082 | |
1083 @defopt TeX-region | |
1084 The name of the file for temporarily storing the text when formatting | |
1085 the current region. | |
1086 @end defopt | |
1087 | |
1088 @defopt TeX-header-end | |
1089 A regular expression matching the end of the header. By default, this | |
1090 is @samp{\begin@{document@}} in La@TeX{} mode and @samp{%**end of | |
1091 header} in @TeX{} mode.@refill | |
1092 @end defopt | |
1093 | |
1094 @defopt TeX-trailer-start | |
1095 A regular expression matching the start of the trailer. By default, | |
1096 this is @samp{\end@{document@}} in La@TeX{} mode and @samp{\bye} in | |
1097 @TeX{} mode.@refill | |
1098 @end defopt | |
1099 | |
1100 AUC @TeX{} will try to guess what command you want to invoke, but by | |
1101 default it will assume that you want to run @TeX{} in @TeX{} mode and | |
1102 La@TeX{} in La@TeX{} mode. You can overwrite this by setting the | |
1103 variable @code{TeX-command-default}. | |
1104 | |
1105 @defopt TeX-command-default | |
1106 The default command to run in this buffer. Must be an entry in | |
1107 @code{TeX-command-list}. | |
1108 @end defopt | |
1109 | |
1110 If you want to overwrite the values of @code{TeX-header-end}, | |
1111 @code{TeX-trailer-start}, or @code{TeX-command-default}, you can do that | |
1112 for all files by setting them in either @code{TeX-mode-hook}, | |
1113 @code{plain-TeX-mode-hook}, or @code{LaTeX-mode-hook}. To overwrite | |
1114 them for a single file, define them as file variables (@pxref{File | |
1115 Variables,,,emacs,The Emacs Editor}). You do this by putting special | |
1116 formatted text near the end of the file. | |
1117 @cindex Variables | |
1118 @cindex File Variables | |
1119 @cindex Local Variables | |
1120 | |
1121 @example | |
1122 % Local Variables: | |
1123 % TeX-header-end: "% End-Of-Header" | |
1124 % TeX-trailer-start: "% Start-Of-Trailer" | |
1125 % TeX-command-default: "SliTeX" | |
1126 % End: | |
1127 @end example | |
1128 | |
1129 AUC @TeX{} will try to save any buffers related to the document, and | |
1130 check if the document needs to be reformatted. If the variable | |
1131 @code{TeX-save-query} is non-nil, AUC @TeX{} will query before saving | |
1132 each file. By default AUC @TeX{} will check emacs buffers associated | |
1133 with files in the current directory, in one of the | |
1134 @code{TeX-macro-private} directories, and in the @code{TeX-macro-global} | |
1135 directories. You can change this by setting the variable | |
1136 @code{TeX-check-path}.@refill | |
1137 | |
1138 @defopt TeX-check-path | |
1139 Directory path to search for dependencies. | |
1140 | |
1141 If nil, just check the current file. | |
1142 Used when checking if any files have changed. | |
1143 @end defopt | |
1144 | |
1145 @node Debugging, Checking, Commands, Formatting | |
1146 @section Catching the errors | |
1147 @cindex Debugging | |
1148 @cindex Errors | |
1149 @cindex Parsing errors | |
1150 @cindex Parsing TeX output | |
1151 @cindex Next error | |
1152 @cindex Parsing LaTeX errors | |
1153 @cindex Overfull boxes | |
1154 @cindex Bad boxes | |
1155 @cindex Wonderful boxes | |
1156 | |
1157 Once you've formatted your document you may `debug' it, i.e. browse | |
1158 through the errors (La)@TeX{} reported. | |
1159 | |
1160 @deffn Command TeX-next-error | |
1161 @kindex C-c ` | |
1162 (@kbd{C-c `}) Go to the next error reported by @TeX{}. The view will | |
1163 be split in two, with the cursor placed as close as possible to the | |
1164 error in the top view. In the bottom view, the error message will be | |
1165 displayed along with some explanatory text. | |
1166 @end deffn | |
1167 | |
1168 Normally AUC @TeX{} will only report real errors, but you may as well | |
1169 ask it to report `bad boxes' as well. | |
1170 | |
1171 @deffn Command TeX-toggle-debug-bad-boxes | |
1172 @kindex C-c C-w | |
1173 (@kbd{C-c C-w}) Toggle whether AUC @TeX{} should stop at bad boxes | |
1174 (i.e. over/under full boxes) as well as at normal errors. | |
1175 @end deffn | |
1176 | |
1177 As default, AUC @TeX{} will display that special @samp{*help*} buffer | |
1178 containing the error reported by @TeX{} along with the documentation. | |
1179 There is however an `expert' option, which allows you to display the | |
1180 real @TeX{} output. | |
1181 | |
1182 @defopt TeX-display-help | |
1183 When non-nil AUC @TeX{} will automatically display a help text whenever | |
1184 an error is encountered using @code{TeX-next-error} (@kbd{C-c `}). | |
1185 @end defopt | |
1186 | |
1187 @node Checking, Control, Debugging, Formatting | |
1188 @section Checking for problems | |
1189 @cindex Checking | |
1190 @cindex @code{lacheck} | |
1191 @cindex @code{chktex} | |
1192 @cindex Finding errors | |
1193 @cindex Running @code{lacheck} | |
1194 @cindex Running @code{chktex} | |
1195 @cindex Style | |
1196 @cindex Problems | |
1197 | |
1198 Running @TeX{} or La@TeX{} will only find regular errors in the | |
1199 document, not examples of bad style. Furthermore, description of the | |
1200 errors may often be confusing. The utility @code{lacheck} can be used | |
1201 to find style errors, such as forgetting to escape the space after an | |
1202 abbreviation or using @samp{...} instead of @samp{\ldots} and many other | |
1203 problems like that. You start @code{lacheck} with @kbd{C-c C-c C h e c | |
1204 k @key{RET}}. The result will be a list of errors in the | |
1205 @samp{*compilation*} buffer. You can go through the errors with | |
1206 @kbd{C-x `} (@code{next-error}, @pxref{Compilation,,,emacs,The Emacs | |
1207 Editor}), which will move point to the location of the next | |
1208 error.@refill | |
1209 | |
1210 Another newer program which can be used to find errors is @code{chktex}. | |
1211 It is much more configurable than @code{lacheck}, but doesn't find all | |
1212 the problems @code{lacheck} does, at least in its default configuration. | |
1213 You must install the programs before using them, and for @code{chktex} | |
1214 you must also modify @code{TeX-command-list}. You can get | |
1215 @code{lacheck} from @file{<URL:ftp://sunsite.auc.dk/pub/text/lacheck/>} | |
1216 or alternatively @code{chktex} from | |
1217 @file{<URL:ftp://ftp.dante.de/pub/tex/support/chktex/>}. Search for | |
1218 `chktex' in @file{tex.el} to see how to switch between them.@refill They | |
1219 are | |
1220 | |
1221 @node Control, , Checking, Formatting | |
1222 @section Controlling the output | |
1223 @cindex Controlling the output | |
1224 @cindex Output | |
1225 @cindex Redisplay output | |
1226 @cindex Processes | |
1227 @cindex Killing a process | |
1228 @cindex Finding the master file | |
1229 @cindex Master file | |
1230 @cindex Stopping a process | |
1231 @cindex Current file | |
1232 @cindex Finding the current file | |
1233 | |
1234 A number of commands are available for controlling the output of an | |
1235 application running under AUC @TeX{} | |
1236 | |
1237 @deffn Command TeX-kill-job | |
1238 @kindex C-c C-k | |
1239 (@kbd{C-c C-k}) Kill currently running external application. | |
1240 This may be either of @TeX{}, La@TeX{}, previewer Bib@TeX{} etc. | |
1241 @end deffn | |
1242 | |
1243 @deffn Command TeX-recenter-output-buffer | |
1244 @kindex C-c C-l | |
1245 (@kbd{C-c C-l}) Recenter the output buffer so that the bottom line is | |
1246 visible. | |
1247 @end deffn | |
1248 | |
1249 @deffn Command TeX-home-buffer | |
1250 @kindex C-c ^ | |
1251 (@kbd{C-c ^}) Go to the `master' file in the document associated with | |
1252 the current buffer, or if already there, to the file where the current | |
1253 process was started. | |
1254 @end deffn | |
1255 | |
1256 @node Multifile, Parsing Files, Formatting, top | |
1257 @chapter Multifile Documents | |
1258 @cindex Multifile Documents | |
1259 @cindex Documents | |
1260 @cindex Documents with multiple files | |
1261 @cindex Multiple Files | |
1262 @cindex Many Files | |
1263 @cindex Including | |
1264 @cindex \include | |
1265 @cindex Inputing | |
1266 @cindex \input | |
1267 @cindex Master file | |
1268 | |
1269 You may wish spread a document over many files (as you are likely to do if | |
1270 there are multiple authors, or if you have not yet discovered the power | |
1271 of the outline commands (@pxref{Outline})). This can be done by having a | |
1272 ``master'' file in which you include the various files with the @TeX{} | |
1273 macro @samp{\input} or the La@TeX{} macro @samp{\include}. These | |
1274 files may also include other files themselves. However, to format the | |
1275 document you must run the commands on the top level master file.@refill | |
1276 | |
1277 When you, for example, ask AUC @TeX{} to run a command on the master file, | |
1278 it has no way of knowing the name of the master file. By default, | |
1279 it will assume that the current file is the master file. If you insert | |
1280 the following in your @file{.emacs} file AUC @TeX{} will use a more | |
1281 advanced algorithm. | |
1282 | |
1283 @lisp | |
1284 (setq-default TeX-master nil) ; Query for master file. | |
1285 @end lisp | |
1286 | |
1287 If AUC @TeX{} finds the line indicating the end of the header in a | |
1288 master file (@code{TeX-header-end}), it can figure out for itself that | |
1289 this is a master file. Otherwise, it will ask for the name of the | |
1290 master file associated with the buffer. To avoid asking you again, AUC | |
1291 @TeX{} will automatically insert the name of the master file as a file | |
1292 variable (@pxref{File Variables,,,emacs,The Emacs Editor}). You can | |
1293 also insert the file variable yourself, by putting the following text at | |
1294 the end of your files.@refill | |
1295 @findex TeX-header-end | |
1296 | |
1297 @example | |
1298 % Local Variables: | |
1299 % TeX-master: "master" | |
1300 % End: | |
1301 @end example | |
1302 | |
1303 You should always set this variable to the name of the top level document. If | |
1304 you always use the same name for your top level documents, you can set | |
1305 @code{TeX-master} in your @file{.emacs} file. | |
1306 | |
1307 @lisp | |
1308 (setq-default TeX-master "master") ; All master files called "master". | |
1309 @end lisp | |
1310 | |
1311 @defopt TeX-master | |
1312 The master file associated with the current buffer. If the file being | |
1313 edited is actually included from another file, then you can tell AUC @TeX{} | |
1314 the name of the master file by setting this variable. If there are | |
1315 multiple levels of nesting, specify the top level file.@refill | |
1316 | |
1317 If this variable is @code{nil}, AUC @TeX{} will query you for the | |
1318 name.@refill | |
1319 | |
1320 If the variable is @code{t}, then AUC @TeX{} will assume the file is a master | |
1321 file itself.@refill | |
1322 | |
1323 If the variable is @code{shared}, then AUC @TeX{} will query for the name, | |
1324 but will not change the file.@refill | |
1325 | |
1326 It is suggested that you use the File Variables (@pxref{File | |
1327 Variables,,,emacs,The Emacs Editor}) to set this variable permanently | |
1328 for each file.@refill | |
1329 @end defopt | |
1330 | |
1331 @defopt TeX-one-master | |
1332 Regular expression matching ordinary TeX files. | |
1333 | |
1334 You should set this variable to match the name of all files, for which | |
1335 it is a good idea to append a @code{TeX-master} file variable entry | |
1336 automatically. When AUC @TeX{} adds the name of the master file as a | |
1337 file variable, it does not need to ask next time you edit the file. | |
1338 | |
1339 If you dislike AUC @TeX{} automatically modifying your files, you can | |
1340 set this variable to @samp{"<none>"}. By default, AUC @TeX{} will modify | |
1341 any file with an extension of @samp{.tex}.@refill | |
1342 @end defopt | |
1343 | |
1344 AUC @TeX{} keeps track of macros, environments, labels, and style | |
1345 files that are used in a given document. For this to work with | |
1346 multifile documents, AUC @TeX{} has to have a place to put the | |
1347 information about the files in the document. This is done by having an | |
1348 @file{auto} subdirectory placed in the directory where your document is | |
1349 located. Each time you save a file, AUC @TeX{} will write information | |
1350 about the file into the @file{auto} directory. When you load a file, | |
1351 AUC @TeX{} will read the information in the @file{auto} directory | |
1352 about the file you loaded @emph{and the master file specified by | |
1353 @code{TeX-master}}. Since the master file (perhaps indirectly) includes | |
1354 all other files in the document, AUC @TeX{} will get information from | |
1355 all files in the document. This means that you will get from each file, | |
1356 for example, completion for all labels defined anywhere in the document. | |
1357 | |
1358 AUC TeX will create the @file{auto} directory automatically if | |
1359 @code{TeX-auto-save} is non-nil. Without it, the files in the document | |
1360 will not know anything about each other, except for the name of the | |
1361 master file. @xref{Automatic Local}. | |
1362 | |
1363 @deffn Command TeX-save-document | |
1364 @kindex C-c C-d | |
1365 (@kbd{C-c C-d}) Save all buffers known to belong to the current document. | |
1366 @end deffn | |
1367 | |
1368 @defopt TeX-save-query | |
1369 If non-nil, then query the user before saving each file with | |
1370 @code{TeX-save-document}. | |
1371 @end defopt | |
1372 | |
1373 | |
1374 @node Parsing Files, I18n, Multifile, top | |
1375 @chapter Automatic Parsing of @TeX{} files. | |
1376 @cindex Parsing @TeX{} | |
1377 @cindex Automatic Parsing | |
1378 @cindex Tabs | |
1379 @cindex Tabify | |
1380 @cindex Untabify | |
1381 | |
1382 AUC @TeX{} depends heavily on being able to extract information from the | |
1383 buffers by parsing them. Since parsing the buffer can be somewhat slow, | |
1384 the parsing is initially disabled. You are encouraged to enable them by | |
1385 adding the following lines to your @file{.emacs} file. | |
1386 | |
1387 @lisp | |
1388 (setq TeX-parse-self t) ; Enable parse on load. | |
1389 (setq TeX-auto-save t) ; Enable parse on save. | |
1390 @end lisp | |
1391 | |
1392 The later command will make AUC @TeX{} store the parsed information in | |
1393 an @file{auto} subdirectory in the directory each time the @TeX{} files | |
1394 are stored, @pxref{Automatic Local}. If AUC @TeX{} finds the pre-parsed | |
1395 information when loading a file, it will not need to reparse the buffer. | |
1396 The information in the @file{auto} directory is also useful for | |
1397 multifile documents @pxref{Multifile}, since it allows each file to | |
1398 access the parsed information from all the other files in the document. | |
1399 This is done by first reading the information from the master file, and | |
1400 then recursively the information from each file stored in the master | |
1401 file.@refill | |
1402 | |
1403 The variables can also be done on a per file basis, by changing the file | |
1404 local variables. | |
1405 | |
1406 @example | |
1407 % Local Variables: | |
1408 % TeX-parse-self: t | |
1409 % TeX-auto-save: t | |
1410 % End: | |
1411 @end example | |
1412 | |
1413 Even when you have disabled the automatic parsing, you can force the | |
1414 generation of style information by pressing @kbd{C-c C-n}. This is | |
1415 often the best choice, as you will be able to decide when it is | |
1416 necessary to reparse the file. | |
1417 | |
1418 @defopt TeX-parse-self | |
1419 Parse file after loading it if no style hook is found for it. | |
1420 @end defopt | |
1421 | |
1422 @defopt TeX-auto-save | |
1423 Automatically save style information when saving the buffer. | |
1424 @end defopt | |
1425 | |
1426 @deffn Command TeX-normal-mode @var{arg} | |
1427 @kindex C-c C-n | |
1428 (@kbd{C-c C-n}) Remove all information about this buffer, and apply the | |
1429 style hooks again. Save buffer first including style information. With | |
1430 optional argument, also reload the style hooks. | |
1431 @end deffn | |
1432 | |
1433 When AUC TeX saves your buffer, it will by default convert all tabs in | |
1434 your buffer into spaces. To disable this behaviour, insert the | |
1435 following in your @file{.emacs} file. | |
1436 | |
1437 @lisp | |
1438 (setq TeX-auto-untabify nil) | |
1439 @end lisp | |
1440 | |
1441 @defopt TeX-auto-untabify | |
1442 Automatically remove all tabs from a file before saving it. | |
1443 @end defopt | |
1444 | |
1445 Instead of disabling the parsing entirely, you can also speed it | |
1446 significantly up by limiting the information it will search for (and | |
1447 store) when parsing the buffer. You can do this by setting the default | |
1448 values for the buffer local variables @code{TeX-auto-regexp-list} and | |
1449 @code{TeX-auto-parse-length} in your @file{.emacs} file. | |
1450 | |
1451 @lisp | |
1452 ;; Only parse \documentstyle information. | |
1453 (setq-default TeX-auto-regexp-list 'LaTeX-auto-minimal-regexp-list) | |
1454 ;; The documentstyle command is usually near the beginning. | |
1455 (setq-default TeX-auto-parse-length 2000) | |
1456 @end lisp | |
1457 | |
1458 This example will speed the parsing up significantly, but AUC @TeX{} | |
1459 will no longer be able to provide completion for labels, macros, | |
1460 environments, or bibitems specified in the document, nor will it know | |
1461 what files belong to the document. | |
1462 | |
1463 These variables can also be specified on a per file basis, by changing | |
1464 the file local variables. | |
1465 | |
1466 @example | |
1467 % Local Variables: | |
1468 % TeX-auto-regexp-list: TeX-auto-full-regexp-list | |
1469 % TeX-auto-parse-length: 999999 | |
1470 % End: | |
1471 @end example | |
1472 | |
1473 @defopt TeX-auto-regexp-list | |
1474 List of regular expressions used for parsing the current file. | |
1475 @end defopt | |
1476 | |
1477 @defopt TeX-auto-parse-length | |
1478 Maximal length of TeX file that will be parsed. | |
1479 @end defopt | |
1480 | |
1481 The pre-specified lists of regexps are defined below. You can use these | |
1482 before loading AUC @TeX{} by quoting them, as in the example above. | |
1483 | |
1484 @defvr Constant TeX-auto-empty-regexp-list | |
1485 Parse nothing | |
1486 @end defvr | |
1487 | |
1488 @defvr Constant LaTeX-auto-minimal-regexp-list | |
1489 Only parse documentstyle. | |
1490 @end defvr | |
1491 | |
1492 @defvr Constant LaTeX-auto-label-regexp-list | |
1493 Only parse La@TeX{} labels. | |
1494 @end defvr | |
1495 | |
1496 @defvr Constant LaTeX-auto-regexp-list | |
1497 Parse common La@TeX{} commands. | |
1498 @end defvr | |
1499 | |
1500 @defvr Constant plain-TeX-auto-regexp-list | |
1501 Parse common plain @TeX{} commands. | |
1502 @end defvr | |
1503 | |
1504 @defvr Constant TeX-auto-full-regexp-list | |
1505 Parse all @TeX{} and La@TeX{} commands that AUC @TeX{} can use. | |
1506 @end defvr | |
1507 | |
1508 @node I18n, Automatic, Parsing Files, top | |
1509 @chapter Internationalization | |
1510 @cindex Internationalization | |
1511 @cindex Character set | |
1512 @cindex National letters | |
1513 | |
1514 There are several problems associated with editing non-English @TeX{} | |
1515 with GNU Emacs. Modern versions of GNU Emacs and @TeX{} are usable for | |
1516 European (Latin, Cyrillic, Greek) based languages, but special versions | |
1517 of TeX and Emacs are needed for Korean, Japanese, and Chinese. | |
1518 | |
1519 @menu | |
1520 * European:: Using AUC @TeX{} for European languages. | |
1521 * Japanese:: Japanese @TeX{} | |
1522 @end menu | |
1523 | |
1524 @node European, Japanese, I18n, I18n | |
1525 @section Using AUC @TeX{} for European languages. | |
1526 @cindex Europe | |
1527 @cindex European Characters | |
1528 @cindex ISO 8859 Latin 1 | |
1529 @cindex Latin 1 | |
1530 @cindex ISO 8859 Latin 2 | |
1531 @cindex Latin 2 | |
1532 @cindex ANSI | |
1533 @cindex Denmark | |
1534 @cindex Danish | |
1535 @cindex Holland | |
1536 @cindex Dutch | |
1537 @cindex Germany | |
1538 @cindex Poland | |
1539 | |
1540 First you will need a way to write non-ASCII characters. You can either | |
1541 use macros, or teach @TeX{} about the ISO character sets. I prefer the | |
1542 later, it has the advantage that the usual the standard emacs word | |
1543 movement and case change commands will work. | |
1544 | |
1545 | |
1546 With LaTeX2e, just add @samp{\usepackage[latin1]@{inputenc@}}. With older | |
1547 LaTeX versions, try: | |
1548 | |
1549 @table @file | |
1550 @item isolatin1.sty | |
1551 Support for ISO 8859 Latin 1. Available by ftp from the host | |
1552 @t{ftp.uni-stuttgart.de} as | |
1553 @file{/pub/tex/macros/latex/contrib/misc/isolatin1.sty}. | |
1554 | |
1555 @item latin2.sty | |
1556 Support for ISO 8859 Latin 2. Available by ftp from the host | |
1557 @t{ftp.uni-stuttgart.de} as | |
1558 @file{/pub/tex/macros/latex/contrib/latin2.sty}. | |
1559 @end table | |
1560 | |
1561 To be able to display non-ASCII characters you will need an appropriate | |
1562 font and a version of GNU Emacs capable of displaying 8-bit characters. | |
1563 I believe all emacs versions except plain Emacs 18 are capable of this. | |
1564 For GNU Emacs 19, @pxref{European Display,,,emacs, The GNU Emacs | |
1565 Editor}. Other relevant packages are: | |
1566 | |
1567 @table @file | |
1568 @item remap | |
1569 Supports lots of different 7-bit and 8-bit character sets for GNU Emacs | |
1570 19. Mostly useful if you have seldomly used character sets, or need to | |
1571 use different character set for keyboard, buffer, and display. An | |
1572 overkill if you just need ISO 8859 Latin 1. Currently in alpha test, | |
1573 but available by ftp from the host @t{ftp.iesd.auc.dk} in | |
1574 @file{/packages/auctex/}. | |
1575 | |
1576 To get dead keys for @TeX{}, install remap and insert the following in | |
1577 your @file{.emacs} or @file{site-start.el} file. | |
1578 | |
1579 @lisp | |
1580 (require 'remap) | |
1581 | |
1582 (defvar all-dead-keys "~'`^" | |
1583 "Dead keys used by remap") | |
1584 | |
1585 (remap-define-map "Dead Key" | |
1586 (apply 'append (mapcar 'remap-dead-map all-dead-keys))) | |
1587 | |
1588 (remap-define-map "TeX Dead Key" | |
1589 (remap-map "Dead Key" (remap-add "Ascii" "~TeX"))) | |
1590 | |
1591 (setq remap-setup-alist | |
1592 '(("7-bit" "Raw" "L1" "US" "Ctrl" "~TeX") | |
1593 ("8-bit" "Raw" "L1" "L1" "Ctrl" "Raw") | |
1594 ("Dead/7" "Dead Key" "L1" "US" "Ctrl" "~TeX") | |
1595 ("Dead/8" "Dead Key" "L1" "L1" "Ctrl" "Raw") | |
1596 ("TeX" "TeX Dead Key" "L1" "US" "Ctrl" "Raw"))) | |
1597 @end lisp | |
1598 | |
1599 You can now enable TeX dead keys with | |
1600 @example | |
1601 @kbd{M-x remap-setup-choose RET TeX RET} | |
1602 @end example | |
1603 @end table | |
1604 | |
1605 A compromise is to use use an European character set when editing the | |
1606 file, and convert to @TeX{} macros when reading and writing the files. | |
1607 | |
1608 @table @file | |
1609 @item iso-tex.el | |
1610 @cindex @file{iso-tex.el} | |
1611 This file automatically converts between ISO 8859 Latin 1 encoding and | |
1612 La@TeX{} encodings of West European characters. It is available by ftp | |
1613 from @t{aida.intellektik.informatik.th-darmstadt.de} in the directory | |
1614 @file{/pub/gene/Emacs}. | |
1615 @item iso-cvt.el | |
1616 @cindex @file{iso-cvt.el} | |
1617 Much like @file{iso-tex.el} but is bundled with Emacs 19.23 and later. | |
1618 | |
1619 @item x-compose.el | |
1620 @cindex @file{x-compose.el} | |
1621 Similar package bundled with new versions of XEmacs. | |
1622 | |
1623 @end table | |
1624 | |
1625 AUC @TeX{} supports style files for several languages. Each style file | |
1626 may modify some AUC @TeX{} to better support the language, and will run | |
1627 a language specific hook that will allow you to for example change | |
1628 ispell dictionary, or run code to change the keyboard remapping. The | |
1629 following will for example choose a Danish dictionary for documents | |
1630 including the @file{dk.sty} file. This requires parsing to be enabled, | |
1631 @pxref{Parsing Files}. | |
1632 | |
1633 @lisp | |
1634 (add-hook 'TeX-language-dk-hook | |
1635 (function (lambda () (ispell-change-dictionary "danish")))) | |
1636 @end lisp | |
1637 | |
1638 The following style files are recognized. | |
1639 @table @file | |
1640 @item dk | |
1641 Runs style hook @code{TeX-language-dk-hook}. | |
1642 | |
1643 @item dutch | |
1644 Runs style hook @code{TeX-language-nl-hook}. | |
1645 | |
1646 @item german | |
1647 Runs style hook @code{TeX-language-de-hook}. | |
1648 Gives @samp{"} word syntax and makes the @key{"} key insert a literal | |
1649 @samp{"}. | |
1650 | |
1651 @item plfonts | |
1652 @itemx plhb | |
1653 Runs style hook @code{TeX-language-pl-hook}. | |
1654 Gives @samp{"} word syntax and makes the @key{"} key insert a literal | |
1655 @samp{"}. Pressing @key{"} twice will insert @samp{"<} or @samp{">} | |
1656 depending on context. | |
1657 @end table | |
1658 | |
1659 @node Japanese, , European, I18n | |
1660 @section Japanese @TeX{} | |
1661 @cindex Japan | |
1662 @cindex Japanese | |
1663 @cindex Nippon | |
1664 @cindex NEMACS | |
1665 @cindex MULE | |
1666 @cindex j@TeX{} | |
1667 @cindex jLa@TeX{} | |
1668 | |
1669 To write Japanese text with AUC @TeX{} you need to have versions of | |
1670 @TeX{} and Emacs that support Japanese. There exist at least two | |
1671 variants of @TeX{} for Japanese text, and AUC @TeX{} can be used with | |
1672 both, as well as with the two Japanese-aware Emacses, NEMACS and MULE. | |
1673 | |
1674 To use the Japanese TeX variants, simply enter @code{japanese-tex-mode}, | |
1675 @code{japanese-latex-mode}, or @code{japanese-slitex-mode}, and | |
1676 everything should work. If not, send mail to Shinji Kobayashi | |
1677 (@samp{<koba@@flab.fujitsu.co.jp>}, who kindly donated the code for | |
1678 supporting Japanese in AUC @TeX{}. None of the primary AUC @TeX{} | |
1679 maintainers understand Japanese, so they can not help you. | |
1680 | |
1681 @node Automatic, Style Files, I18n, top | |
1682 @chapter Automatic Customization | |
1683 @cindex Automatic Customization | |
1684 @cindex Extracting @TeX{} symbols | |
1685 @cindex Automatic | |
1686 @cindex @file{auto} directories. | |
1687 @cindex Parsing @TeX{} | |
1688 @cindex @TeX{} parsing | |
1689 @cindex Generating symbols | |
1690 | |
1691 Since AUC @TeX{} is so highly customizable, it makes sense that it is able | |
1692 to customize itself. The automatic customization consists of scanning | |
1693 @TeX{} files and extracting symbols, environments, and things like that. | |
1694 | |
1695 The automatic customization is done on three different levels. The | |
1696 global level is the level shared by all users at your site, and consists | |
1697 of scanning the standard @TeX{} style files, and any extra styles added | |
1698 locally for all users on the site. The private level deals with those | |
1699 style files you have written for your own use, and use in different | |
1700 documents. You may have a @file{~/lib/TeX/} directory where you store | |
1701 useful style files for your own use. The local level is for a specific | |
1702 directory, and deals with writing customization for the files for your | |
1703 normal @TeX{} documents. | |
1704 | |
1705 If compared with the environment variable @code{TEXINPUTS}, the | |
1706 global level corresponds to the directories built into @TeX{}. The | |
1707 private level corresponds to the directories you add yourself, except for | |
1708 @file{.}, which is the local level. | |
1709 | |
1710 @menu | |
1711 * Automatic Global:: Automatic Customization for the Site | |
1712 * Automatic Private:: Automatic Customization for a User | |
1713 * Automatic Local:: Automatic Customization for a Directory | |
1714 @end menu | |
1715 | |
1716 By default AUC @TeX{} will search for customization files in all the | |
1717 global, private, and local style directories, but you can also set the | |
1718 path directly. This is useful if you for example want to add another | |
1719 person's style hooks to your path. Please note that all matching files | |
1720 found in @code{TeX-style-path} are loaded, and all hooks defined in the | |
1721 files will be executed. | |
1722 | |
1723 @defopt TeX-style-path | |
1724 List of directories to search for AUC @TeX{} style files. | |
1725 Each must end with a slash. | |
1726 @end defopt | |
1727 | |
1728 By default, when AUC @TeX{} searches a directory for files, it will | |
1729 recursively search through subdirectories. | |
1730 | |
1731 @defopt TeX-file-recurse | |
1732 If not nil, search @TeX{} directories recursively. | |
1733 @end defopt | |
1734 | |
1735 By default, AUC @TeX{} will ignore files name @file{.}, @file{..}, | |
1736 @file{SCCS}, @file{RCS}, and @file{CVS}. | |
1737 | |
1738 @defopt TeX-ignore-file | |
1739 Regular expression matching file names to ignore. | |
1740 | |
1741 These files or directories will not be considered when searching for | |
1742 @TeX{} files in a directory. | |
1743 @end defopt | |
1744 | |
1745 @node Automatic Global, Automatic Private, Automatic, Automatic | |
1746 @section Automatic Customization for the Site | |
1747 @cindex Global style hook directory | |
1748 @cindex Global macro directory | |
1749 @cindex Site macro directory | |
1750 @cindex Global @TeX{} macro directory | |
1751 @cindex Site @TeX{} macro directory | |
1752 @cindex Global directories | |
1753 @cindex Site information | |
1754 | |
1755 Assuming that the automatic customization at the global level was done | |
1756 when AUC @TeX{} was installed, your choice is now: will you use it? If | |
1757 you use it, you will benefit by having access to all the symbols and | |
1758 environments available for completion purposes. The drawback is slower | |
1759 load time when you edit a new file and perhaps too many confusing | |
1760 symbols when you try to do a completion. | |
1761 | |
1762 You can disable the automatic generated global style hooks by setting | |
1763 the variable @code{TeX-auto-global} to nil. | |
1764 | |
1765 @defopt TeX-macro-global | |
1766 Directories containing the site's @TeX{} style files. | |
1767 @end defopt | |
1768 | |
1769 @defopt TeX-style-global | |
1770 Directory containing hand generated @TeX{} information. | |
1771 Must end with a slash. | |
1772 | |
1773 These correspond to @TeX{} macros shared by all users of a site. | |
1774 @end defopt | |
1775 | |
1776 @defopt TeX-auto-global | |
1777 Directory containing automatically generated information. | |
1778 | |
1779 For storing automatic extracted information about the @TeX{} macros | |
1780 shared by all users of a site. | |
1781 @end defopt | |
1782 | |
1783 @node Automatic Private, Automatic Local, Automatic Global, Automatic | |
1784 @section Automatic Customization for a User | |
1785 @cindex Private style hook directory | |
1786 @cindex Private macro directory | |
1787 @cindex Personal macro directory | |
1788 @cindex Private @TeX{} macro directory | |
1789 @cindex Personal @TeX{} macro directory | |
1790 @cindex Private directories | |
1791 @cindex Personal information | |
1792 | |
1793 You should specify where you store your private @TeX{} macros, so AUC | |
1794 @TeX{} can extract their information. The extracted information will go | |
1795 to the directories listed in @code{TeX-auto-private} | |
1796 | |
1797 Use @kbd{M-x TeX-auto-generate} to extract the information. | |
1798 | |
1799 @defopt TeX-macro-private | |
1800 Directories where you store your personal @TeX{} macros. | |
1801 Each must end with a slash. | |
1802 | |
1803 This defaults to the directories listed in the @samp{TEXINPUTS} and | |
1804 @samp{BIBINPUTS} environment variables. | |
1805 @end defopt | |
1806 | |
1807 @defopt TeX-auto-private | |
1808 List of directories containing automatically generated information. | |
1809 Must end with a slash. | |
1810 | |
1811 These correspond to the personal @TeX{} macros. | |
1812 @end defopt | |
1813 | |
1814 @deffn Command TeX-auto-generate @var{TEX} @var{AUTO} | |
1815 (@kbd{M-x TeX-auto-generate}) Generate style hook for @var{TEX} and | |
1816 store it in @var{AUTO}. If @var{TEX} is a directory, generate style | |
1817 hooks for all files in the directory.@refill | |
1818 @end deffn | |
1819 | |
1820 @defopt TeX-style-private | |
1821 List of directories containing hand generated information. | |
1822 Must end with a slash. | |
1823 | |
1824 These correspond to the personal @TeX{} macros. | |
1825 @end defopt | |
1826 | |
1827 @node Automatic Local, , Automatic Private, Automatic | |
1828 @section Automatic Customization for a Directory | |
1829 @cindex Local style hooks | |
1830 @cindex Updating style hooks | |
1831 @cindex Automatic updating style hooks | |
1832 @cindex Local style hooks | |
1833 @cindex Local style directory | |
1834 | |
1835 AUC @TeX{} can update the style information about a file each time you | |
1836 save it, and it will do this if the directory @code{TeX-auto-local} | |
1837 exist. @code{TeX-auto-local} is by default set to @samp{"auto/"}, so | |
1838 simply creating an @file{auto} directory will enable automatic saving of | |
1839 style information. | |
1840 | |
1841 The advantage of doing this is that macros, labels, etc. defined in any | |
1842 file in a multifile document will be known in all the files in the | |
1843 document. The disadvantage is that saving will be slower. To disable, | |
1844 set @code{TeX-auto-local} to nil. | |
1845 | |
1846 @defopt TeX-style-local | |
1847 Directory containing hand generated @TeX{} information. | |
1848 Must end with a slash. | |
1849 | |
1850 These correspond to @TeX{} macros found in the current directory. | |
1851 @end defopt | |
1852 | |
1853 @defopt TeX-auto-local | |
1854 Directory containing automatically generated @TeX{} information. | |
1855 Must end with a slash. | |
1856 | |
1857 These correspond to @TeX{} macros found in the current directory. | |
1858 @end defopt | |
1859 | |
1860 @node Style Files, Installation, Automatic, top | |
1861 @chapter Writing Your own Style Support | |
1862 @cindex Style files | |
1863 @cindex Style hooks | |
1864 @cindex @file{style} | |
1865 | |
1866 @xref{Automatic} for a discussion about automatically generated global, | |
1867 private, and local style files. The hand generated style files are | |
1868 equivalent, except that they by default are found in @file{style} | |
1869 directories instead of @file{auto} directories. | |
1870 | |
1871 @menu | |
1872 * Simple Style:: A Simple Style File | |
1873 * Adding Macros:: Adding Support for Macros | |
1874 * Adding Environments:: Adding Support for Environments | |
1875 * Adding Other:: Adding Other Information | |
1876 * Hacking the Parser:: Automatic Extraction of New Things | |
1877 @end menu | |
1878 | |
1879 If you write some useful support for a public @TeX{} style file, please | |
1880 send it to us. | |
1881 | |
1882 @node Simple Style, Adding Macros, Style Files, Style Files | |
1883 @section A Simple Style File | |
1884 @cindex @file{book.el} | |
1885 @cindex Sample style file | |
1886 @cindex Style file | |
1887 @cindex Example of a style file. | |
1888 @cindex Style hook | |
1889 @cindex Adding a style hook | |
1890 | |
1891 Here is a simple example of a style file. | |
1892 | |
1893 @lisp | |
1894 ;;; book.el - Special code for book style. | |
1895 | |
1896 (TeX-add-style-hook "book" | |
1897 (function (lambda () (setq LaTeX-largest-level | |
1898 (LaTeX-section-level ("chapter")))))) | |
1899 | |
1900 @end lisp | |
1901 | |
1902 This file specifies that the largest kind of section in a LaTeX document | |
1903 using the book document style is chapter. The interesting thing to | |
1904 notice is that the style file defines an (anonymous) function, and adds it | |
1905 to the list of loaded style hooks by calling @code{TeX-add-style-hook}. | |
1906 | |
1907 The first time the user indirectly tries to access some style specific | |
1908 information, such as the largest sectioning command available, the style | |
1909 hooks for all files directly or indirectly read by the current document | |
1910 is executed. The actual files will only be evaluated once, but the | |
1911 hooks will be called for each buffer using the style file. | |
1912 | |
1913 @defun TeX-add-style-hook @var{style} @var{hook} | |
1914 Add @var{hook} to the list of functions to run when we use the @TeX{} | |
1915 file @var{style}. | |
1916 @end defun | |
1917 | |
1918 @node Adding Macros, Adding Environments, Simple Style, Style Files | |
1919 @section Adding Support for Macros | |
1920 @cindex Adding macros | |
1921 @cindex Macros, adding | |
1922 @cindex Defining macros in style hooks | |
1923 | |
1924 The most common thing to define in a style hook is new symbols (@TeX{} | |
1925 macros). Most likely along with a description of the arguments to the | |
1926 function, since the symbol itself can be defined automatically. | |
1927 | |
1928 Here are a few examples from @file{latex.el}. | |
1929 | |
1930 @lisp | |
1931 (TeX-add-style-hook "latex" | |
1932 (function | |
1933 (lambda () | |
1934 (TeX-add-symbols | |
1935 '("arabic" TeX-arg-counter) | |
1936 '("label" TeX-arg-define-label) | |
1937 '("ref" TeX-arg-label) | |
1938 '("newcommand" TeX-arg-define-macro [ "Number of arguments" ] t) | |
1939 '("newtheorem" TeX-arg-define-environment | |
1940 [ TeX-arg-environment "Numbered like" ] | |
1941 t [ TeX-arg-counter "Within counter" ]))))) | |
1942 @end lisp | |
1943 | |
1944 @defun TeX-add-symbols @var{symbol} @dots{} | |
1945 Add each @var{symbol} to the list of known symbols. | |
1946 @end defun | |
1947 | |
1948 Each argument to @code{TeX-add-symbols} is a list describing one symbol. | |
1949 The head of the list is the name of the symbol, the remaining elements | |
1950 describe each argument. | |
1951 | |
1952 If there are no additional elements, the symbol will be inserted with | |
1953 point inside braces. Otherwise, each argument of this function should | |
1954 match an argument of the @TeX{} macro. What is done depends on the argument | |
1955 type. | |
1956 | |
1957 If a macro is defined multiple times, AUC @TeX{} will chose the one with | |
1958 the longest definition (i.e. the one with the most arguments). | |
1959 | |
1960 Thus, to overwrite | |
1961 @example | |
1962 '("tref" 1) ; one argument | |
1963 @end example | |
1964 you can specify | |
1965 @example | |
1966 '("tref" TeX-arg-label ignore) ; two arguments | |
1967 @end example | |
1968 | |
1969 @code{ignore} is a function that does not do anything, so when you | |
1970 insert a @samp{tref} you will be prompted for a label and no more. | |
1971 | |
1972 @table @code | |
1973 @item string | |
1974 Use the string as a prompt to prompt for the argument. | |
1975 | |
1976 @item number | |
1977 Insert that many braces, leave point inside the first. | |
1978 | |
1979 @item nil | |
1980 Insert empty braces. | |
1981 | |
1982 @item t | |
1983 Insert empty braces, leave point between the braces. | |
1984 | |
1985 @item other symbols | |
1986 Call the symbol as a function. You can define your | |
1987 own hook, or use one of the predefined argument hooks. | |
1988 | |
1989 @item list | |
1990 If the car is a string, insert it as a prompt and the next | |
1991 element as initial input. Otherwise, call the car of the list with | |
1992 the remaining elements as arguments. | |
1993 | |
1994 @item vector | |
1995 Optional argument. If it has more than one element, parse it | |
1996 as a list, otherwise parse the only element as above. Use square | |
1997 brackets instead of curly braces, and is not inserted on empty user | |
1998 input. | |
1999 @end table | |
2000 | |
2001 A lot of argument hooks have already been defined. The first argument to | |
2002 all hooks is a flag indicating if it is an optional argument. It is up | |
2003 to the hook to determine what to do with the remaining arguments, if | |
2004 any. Typically the next argument is used to overwrite the default | |
2005 prompt. | |
2006 | |
2007 @ftable @code | |
2008 @item TeX-arg-conditional | |
2009 Implements if EXPR THEN ELSE. If EXPR evaluates to true, parse THEN as an | |
2010 argument list, else parse ELSE as an argument list. | |
2011 | |
2012 @item TeX-arg-literal | |
2013 Insert its arguments into the buffer. Used for specifying extra syntax | |
2014 for a macro. | |
2015 | |
2016 @item TeX-arg-free | |
2017 Parse its arguments but use no braces when they are inserted. | |
2018 | |
2019 @item TeX-arg-eval | |
2020 Evaluate arguments and insert the result in the buffer. | |
2021 | |
2022 @item TeX-arg-file | |
2023 Prompt for a tex or sty filename, and use it without the extension. Run | |
2024 the file hooks defined for it. | |
2025 | |
2026 @item TeX-arg-label | |
2027 Prompt for a label completing with known labels. | |
2028 | |
2029 @item TeX-arg-macro | |
2030 Prompt for a @TeX{} macro with completion. | |
2031 | |
2032 @item TeX-arg-environment | |
2033 Prompt for a La@TeX{} environment with completion. | |
2034 | |
2035 @item TeX-arg-cite | |
2036 Prompt for a Bib@TeX{} citation. | |
2037 | |
2038 @item TeX-arg-counter | |
2039 Prompt for a La@TeX{} counter. | |
2040 | |
2041 @item TeX-arg-savebox | |
2042 Prompt for a La@TeX{} savebox. | |
2043 | |
2044 @item TeX-arg-file | |
2045 Prompt for a filename in the current directory, and use it without the | |
2046 extension. | |
2047 | |
2048 @item TeX-arg-input-file | |
2049 Prompt for a filename in the current directory, and use it without the | |
2050 extension. Run the style hooks for the file. | |
2051 | |
2052 @item TeX-arg-define-label | |
2053 Prompt for a label completing with known labels. Add label to list of | |
2054 defined labels. | |
2055 | |
2056 @item TeX-arg-define-macro | |
2057 Prompt for a @TeX{} macro with completion. Add macro to list of defined | |
2058 macros. | |
2059 | |
2060 @item TeX-arg-define-environment | |
2061 Prompt for a La@TeX{} environment with completion. Add environment to | |
2062 list of defined environments. | |
2063 | |
2064 @item TeX-arg-define-cite | |
2065 Prompt for a Bib@TeX{} citation. | |
2066 | |
2067 @item TeX-arg-define-counter | |
2068 Prompt for a La@TeX{} counter. | |
2069 | |
2070 @item TeX-arg-define-savebox | |
2071 Prompt for a La@TeX{} savebox. | |
2072 | |
2073 @item TeX-arg-corner | |
2074 Prompt for a La@TeX{} side or corner position with completion. | |
2075 | |
2076 @item TeX-arg-lr | |
2077 Prompt for a La@TeX{} side with completion. | |
2078 | |
2079 @item TeX-arg-tb | |
2080 Prompt for a La@TeX{} side with completion. | |
2081 | |
2082 @item TeX-arg-pagestyle | |
2083 Prompt for a La@TeX{} pagestyle with completion. | |
2084 | |
2085 @item TeX-arg-verb | |
2086 Prompt for delimiter and text. | |
2087 | |
2088 @item TeX-arg-pair | |
2089 Insert a pair of numbers, use arguments for prompt. The numbers are | |
2090 surrounded by parentheses and separated with a comma. | |
2091 | |
2092 @item TeX-arg-size | |
2093 Insert width and height as a pair. No arguments. | |
2094 | |
2095 @item TeX-arg-coordinate | |
2096 Insert x and y coordinates as a pair. No arguments. | |
2097 @end ftable | |
2098 | |
2099 If you add new hooks, you can assume that point is placed directly after | |
2100 the previous argument, or after the macro name if this is the first | |
2101 argument. Please leave point located after the argument you are | |
2102 inserting. If you want point to be located somewhere else after all | |
2103 hooks have been processed, set the value of @code{exit-mark}. It will | |
2104 point nowhere, until the argument hook sets it.@refill | |
2105 | |
2106 @node Adding Environments, Adding Other, Adding Macros, Style Files | |
2107 @section Adding Support for Environments | |
2108 @cindex Adding environments | |
2109 @cindex Environments, adding | |
2110 @cindex Defining environments in style hooks | |
2111 | |
2112 Adding support for environments is very much like adding support for | |
2113 @TeX{} macros, except that each environment normally only takes one | |
2114 argument, an environment hook. The example is again a short version of | |
2115 @file{latex.el}. | |
2116 | |
2117 @lisp | |
2118 (TeX-add-style-hook "latex" | |
2119 (function | |
2120 (lambda () | |
2121 (LaTeX-add-environments | |
2122 '("document" LaTeX-env-document) | |
2123 '("enumerate" LaTeX-env-item) | |
2124 '("itemize" LaTeX-env-item) | |
2125 '("list" LaTeX-env-list))))) | |
2126 @end lisp | |
2127 | |
2128 @findex LaTeX-env-item | |
2129 The only hook that is generally useful is @code{LaTeX-env-item}, which is | |
2130 used for environments that contain items. It is completely up to the | |
2131 environment hook to insert the environment, but the function | |
2132 @code{LaTeX-insert-environment} may be of some help. The hook will be | |
2133 called with the name of the environment as its first argument, and extra | |
2134 arguments can be provided by adding them to a list after the hook. | |
2135 | |
2136 For simple environments with arguments, for example defined with | |
2137 @samp{\newenvironment}, you can make AUC @TeX{} prompt for the arguments | |
2138 by giving the prompt strings in the call to | |
2139 @code{LaTeX-add-environments}. For example, if you have defined a | |
2140 @code{loop} environment with the three arguments @var{from}, @var{to}, | |
2141 and @var{step}, you can add support for them in a style file. | |
2142 | |
2143 @example | |
2144 %% loop.sty | |
2145 | |
2146 \newenvironment@{loop@}[3]@{...@}@{...@} | |
2147 @end example | |
2148 | |
2149 @lisp | |
2150 ;; loop.el | |
2151 | |
2152 (TeX-add-style-hook "loop" | |
2153 (function | |
2154 (lambda () | |
2155 (LaTeX-add-environments | |
2156 '("loop" "From" "To" "Step"))))) | |
2157 @end lisp | |
2158 | |
2159 If an environment is defined multiple times, AUC @TeX{} will chose the | |
2160 one with the longest definition. Thus, if you have an enumerate style | |
2161 file, and want it to replace the standard La@TeX{} enumerate hook above, | |
2162 you could define an @file{enumerate.el} file as follows, and place it in | |
2163 the appropriate style directory. | |
2164 | |
2165 @lisp | |
2166 (TeX-add-style-hook "latex" | |
2167 (function | |
2168 (lambda () | |
2169 (LaTeX-add-environments | |
2170 '("enumerate" LaTeX-env-enumerate foo))))) | |
2171 | |
2172 (defun LaTeX-env-enumerate (environment &optional ignore) ...) | |
2173 @end lisp | |
2174 | |
2175 The symbol @code{foo} will be passed to @code{LaTeX-env-enumerate} as | |
2176 the second argument, but since we only added it to overwrite the | |
2177 definition in @file{latex.el} it is just ignored. | |
2178 | |
2179 @defun LaTeX-add-environments @var{env} @dots{} | |
2180 Add each @var{env} to list of loaded environments. | |
2181 @end defun | |
2182 | |
2183 @defun LaTeX-insert-environment @var{env} [ @var{extra} ] | |
2184 Insert environment of type @var{env}, with optional argument @var{extra}. | |
2185 @end defun | |
2186 | |
2187 @node Adding Other, Hacking the Parser, Adding Environments, Style Files | |
2188 @section Adding Other Information | |
2189 @cindex Adding bibliographies | |
2190 @cindex Bibliographies, adding | |
2191 @cindex Defining bibliographies in style hooks | |
2192 @cindex Adding labels | |
2193 @cindex Labels, adding | |
2194 @cindex Defining labels in style hooks | |
2195 @cindex Adding other information | |
2196 @cindex Other information, adding | |
2197 @cindex Defining other information in style hooks | |
2198 | |
2199 You can also specify bibliographical databases and labels in the style | |
2200 file. This is probably of little use, since this information will | |
2201 usually be automatically generated from the @TeX{} file anyway. | |
2202 | |
2203 @defun LaTeX-add-bibliographies @var{bibliography} @dots{} | |
2204 Add each @var{bibliography} to list of loaded bibliographies. | |
2205 @end defun | |
2206 | |
2207 @defun LaTeX-add-labels @var{label} @dots{} | |
2208 Add each @var{label} to the list of known labels. | |
2209 @end defun | |
2210 | |
2211 @node Hacking the Parser, , Adding Other, Style Files | |
2212 @section Automatic Extraction of New Things | |
2213 @cindex Parsing new macros | |
2214 @cindex @file{macro.tex} | |
2215 @cindex @file{macro.el} | |
2216 @cindex Changing the parser | |
2217 | |
2218 The automatic @TeX{} information extractor works by searching for | |
2219 regular expressions in the @TeX{} files, and storing the matched | |
2220 information. You can add support for new constructs to the parser, | |
2221 something that is needed when you add new commands to define symbols. | |
2222 | |
2223 For example, in the file @file{macro.tex} I define the following macro. | |
2224 | |
2225 @example | |
2226 \newcommand@{\newmacro@}[5]@{% | |
2227 \def#1@{#3\index@{#4@@#5~cite@{#4@}@}\nocite@{#4@}@}% | |
2228 \def#2@{#5\index@{#4@@#5~cite@{#4@}@}\nocite@{#4@}@}% | |
2229 @} | |
2230 @end example | |
2231 | |
2232 AUC @TeX{} will automatically figure out that @samp{newmacro} is a macro | |
2233 that takes five arguments. However, it is not smart enough to | |
2234 automatically see that each time we use the macro, two new macros are | |
2235 defined. We can specify this information in a style hook file. | |
2236 | |
2237 @lisp | |
2238 ;;; macro.el - Special code for my own macro file. | |
2239 | |
2240 ;;; Code: | |
2241 | |
2242 (defvar TeX-newmacro-regexp | |
2243 '("\\\\newmacro@{\\\\\\([a-zA-Z]+\\)@}@{\\\\\\([a-zA-Z]+\\)@}" | |
2244 (1 2) TeX-auto-multi) | |
2245 "Matches \newmacro definitions.") | |
2246 | |
2247 (defvar TeX-auto-multi nil | |
2248 "Temporary for parsing \\newmacro definitions.") | |
2249 | |
2250 (defun TeX-macro-cleanup () | |
2251 ;; Move symbols from `TeX-auto-multi' to `TeX-auto-symbol'. | |
2252 (mapcar (function (lambda (list) | |
2253 (mapcar (function (lambda (symbol) | |
2254 (setq TeX-auto-symbol | |
2255 (cons symbol TeX-auto-symbol)))) | |
2256 list))) | |
2257 TeX-auto-multi)) | |
2258 | |
2259 (defun TeX-macro-prepare () | |
2260 ;; Clear `Tex-auto-multi' before use. | |
2261 (setq TeX-auto-multi nil)) | |
2262 | |
2263 (add-hook 'TeX-auto-prepare-hook 'TeX-macro-prepare) | |
2264 (add-hook 'TeX-auto-cleanup-hook 'TeX-macro-cleanup) | |
2265 | |
2266 (TeX-add-style-hook "macro" | |
2267 (function | |
2268 (lambda () | |
2269 (TeX-auto-add-regexp TeX-newmacro-regexp) | |
2270 (TeX-add-symbols '("newmacro" | |
2271 TeX-arg-macro | |
2272 (TeX-arg-macro "Capitalized macro: \\") | |
2273 t | |
2274 "BibTeX entry: " | |
2275 nil))))) | |
2276 | |
2277 ;;; macro.el ends here | |
2278 @end lisp | |
2279 | |
2280 When this file is first loaded, it adds a new entry to | |
2281 @code{TeX-newmacro-regexp}, and defines a function to be called before | |
2282 the parsing starts, and one to be called after the parsing is done. It | |
2283 also declares a variable to contain the data collected during parsing. | |
2284 Finally, it adds a style hook which describes the @samp{newmacro} macro, | |
2285 as we have seen it before. | |
2286 | |
2287 So the general strategy is: Add a new entry to @code{TeX-newmacro-regexp}. | |
2288 Declare a variable to contain intermediate data during parsing. Add hook | |
2289 to be called before and after parsing. In this case, the hook before | |
2290 parsing just initializes the variable, and the hook after parsing | |
2291 collects the data from the variable, and adds them to the list of symbols | |
2292 found. | |
2293 | |
2294 @defvar TeX-auto-regexp-list | |
2295 List of regular expressions matching @TeX{} macro definitions. | |
2296 | |
2297 The list has the following format ((REGEXP MATCH TABLE) @dots{}), that | |
2298 is, each entry is a list with three elements. | |
2299 | |
2300 REGEXP. Regular expression matching the macro we want to parse. | |
2301 | |
2302 MATCH. A number or list of numbers, each representing one | |
2303 parenthesized subexpression matched by REGEXP. | |
2304 | |
2305 TABLE. The symbol table to store the data. This can be a function, in | |
2306 which case the function is called with the argument MATCH. Use | |
2307 @code{TeX-match-buffer} to get match data. If it is not a function, it | |
2308 is presumed to be the name of a variable containing a list of match | |
2309 data. The matched data (a string if MATCH is a number, a list of | |
2310 strings if MATCH is a list of numbers) is put in front of the table. | |
2311 @end defvar | |
2312 | |
2313 @defvar TeX-auto-prepare-hook nil | |
2314 List of functions to be called before parsing a @TeX{} file. | |
2315 @end defvar | |
2316 | |
2317 @defvar TeX-auto-cleanup-hook nil | |
2318 List of functions to be called after parsing a @TeX{} file. | |
2319 @end defvar | |
2320 | |
2321 @node Installation, History, Style Files, top | |
2322 @include install.texi | |
2323 | |
2324 @node History, Projects, Installation, top | |
2325 @comment node-name, next, previous, up | |
2326 @appendix The History of AUC @TeX{} | |
2327 | |
2328 See the file @file{history.texi} for older changes. | |
2329 | |
2330 @include changes.texi | |
2331 | |
2332 @node Projects, Credit, History, top | |
2333 @comment node-name, next, previous, up | |
2334 @appendix Wishlist | |
2335 | |
2336 This is a list of projects for AUC @TeX{}. Bug reports and requests we | |
2337 can not fix or honor right away will be added to this list. If you have | |
2338 some time for emacs lisp hacking, you are encouraged to try to provide a | |
2339 solution to one of the following problems. It might be a good idea to | |
2340 mail me first, though. | |
2341 | |
2342 @itemize @bullet | |
2343 @item | |
2344 | |
2345 Filling messes up comments, but only at the end of the file. Reported | |
2346 by uergen Reiss <psy3022@@rzbox.uni-wuerzburg.de>. | |
2347 @item | |
2348 @kbd{C-c C-q C-e} doesn't work properly on nested itemize environments. | |
2349 Reported by "Robert B. Love" <rlove@@raptor.rmNUG.ORG>. | |
2350 | |
2351 @item | |
2352 One suggestion for AUC-TeX: I think that the font command C-c C-f C-r, | |
2353 which produces \textrm@{@} in a LaTeX file, should instead produce | |
2354 either \textrm@{@} or \mathrm@{@}, depending on whether one is in math | |
2355 mode or not. --- John Palmieri <palmieri@@math.mit.edu> | |
2356 | |
2357 @item | |
2358 A way to add and overwrite math mode entries in style files, and to | |
2359 decide where they should be. Suggested by Remo Badii <Remo.Badii@@psi.ch>. | |
2360 | |
2361 @item | |
2362 Create template for (first) line of tabular environment. | |
2363 | |
2364 @item | |
2365 I think prompting for the master is the intended behaviour. It | |
2366 corresponds to a `shared' value for TeX-master. | |
2367 | |
2368 There should probably be a `none' value which wouldn't query for the | |
2369 master, but instead disable all features that relies on TeX-master. | |
2370 | |
2371 This default value for TeX-master could then be controled with mapping | |
2372 based on the extension. | |
2373 | |
2374 @item | |
2375 @kbd{C-c '} should alway stay in the current window, also when it find a | |
2376 new file. | |
2377 | |
2378 @item | |
2379 @code{LaTeX-fill-environment} does not indent the closing @samp{\end}. | |
2380 | |
2381 @item | |
2382 Rewrite @file{ltx-help.el} and put it in @file{latex.el}. Fix also: | |
2383 @example | |
2384 From: Denby Wong <DnB@@slip224.qlink.QueensU.CA> | |
2385 | |
2386 1) change documentation regarding where to get the | |
2387 latest version (at CTAN at pip.shsu.edu for me) | |
2388 under info/latex2e-help-texinfo/ | |
2389 | |
2390 2) change or provide choice over which version to | |
2391 use. There are three references to the info | |
2392 node "(latex)" in the file which should be | |
2393 "(latex2e)" for the new file. | |
2394 | |
2395 From: Piet van Oostrum <piet@@cs.ruu.nl> | |
2396 | |
2397 One of the annoying things of latex-help is that if you ask for \LARGE, you | |
2398 get \large if you have case-fold-search=t. This is really info's problem as | |
2399 it doesn't reset it for a search of the node, but it would be easy to stick | |
2400 a (let (case-fold-search) in latex-help. | |
2401 @end example | |
2402 | |
2403 @item | |
2404 It should be possible to insert a default preamble containing | |
2405 e.g. @code{usepackage} declarations, perhaps depending on the document | |
2406 class. | |
2407 | |
2408 @item | |
2409 Multiple argument completion for @samp{\bibliography}. In general, I | |
2410 ought to make @kbd{,} special for these kind of completions. | |
2411 | |
2412 @item | |
2413 Do not overwrite emacs warnings about existing auto-save files when | |
2414 loading a new file. | |
2415 | |
2416 @item | |
2417 Suggest @samp{makindex} when appropriate. | |
2418 | |
2419 @item | |
2420 Maybe the regexp for matching a TeX symbol during parsing should be | |
2421 @samp{"\\\\\\([a-zA-Z]+\\|.\\)"} --- | |
2422 @samp{<thiemann@@informatik.uni-tuebingen.de>} Peter Thiemann. | |
2423 | |
2424 @item | |
2425 AUC TeX should be able to parse La@TeX{}2e @file{.cls} files. Here are | |
2426 the regexps by @samp{<thiemann@@informatik.uni-tuebingen.de>} Peter | |
2427 Thiemann. | |
2428 | |
2429 @example | |
2430 ("\\\\DeclareRobustCommand@{?\\\\\\([a-zA-Z]+\\)@}?\\[\\([0-9]+\\)\\]\ | |
2431 \\[\\([^\]\\\\\n\r]+\\)\\]" | |
2432 (1 2 3) LaTeX-auto-optional) | |
2433 ("\\\\DeclareRobustCommand@{?\\\\\\([a-zA-Z]+\\)@}?\\[\\([0-9]+\\)\\]" | |
2434 (1 2) LaTeX-auto-arguments) | |
2435 ("\\\\DeclareRobustCommand@{?\\\\\\([a-zA-Z]+\\)@}?" 1 TeX-auto-symbol) | |
2436 ("\\\\DeclareFixedFont@{?\\\\\\([a-zA-Z]+\\)@}?" | |
2437 1 TeX-auto-symbol) | |
2438 ("\\\\Declare\\(Text\\|Old\\)FontCommand@{?\\\\\\([a-zA-Z]+\\)@}?" | |
2439 2 TeX-auto-symbol) | |
2440 ("\\\\DeclareMath\\(Symbol\\|Delimiter\\|Accent\\|Radical\\)@{?\\\\\\([a-zA-Z]+\\)@}?" | |
2441 2 TeX-auto-symbol) | |
2442 ;;; it is also valid to declare just a single symbol, e.g. <, | |
2443 ;;; with \DeclareMathSymbol but it is not necessary to register that here | |
2444 ("\\\\DeclareText\\(Command\\|Symbol\\|Accent\\|Composite\\)@{?\\\\\\([a-zA-Z]+\\)@}?" | |
2445 2 TeX-auto-symbol) | |
2446 @end example | |
2447 | |
2448 @item | |
2449 Use index files (when available) to speed up @kbd{C-c C-m include | |
2450 @key{RET}}. | |
2451 | |
2452 @item | |
2453 Option not to calculate very slow completions like for | |
2454 @kbd{C-c C-m include @key{RET}}.@refill | |
2455 | |
2456 @item | |
2457 AUC @TeX{} should not parse verbatim environments. | |
2458 | |
2459 @item | |
2460 Font menu should be created from @code{TeX-font-list}. | |
2461 | |
2462 @item | |
2463 Installation procedure written purely in emacs lisp. | |
2464 | |
2465 @item | |
2466 Format La@TeX{} comment blocks. | |
2467 | |
2468 @item | |
2469 Included PostScript files should also be counted as part of the | |
2470 document. | |
2471 | |
2472 @item | |
2473 The argument to @samp{\verb} may be broken when filling if it contains a | |
2474 space. This should be fixed or documented. Suggested by several | |
2475 people. | |
2476 | |
2477 @item | |
2478 The parser should catch warnings about undefined crossreferences. | |
2479 Suggested by Richard Hirsch @samp{i3080501@@ws.rz.tu-bs.de}. | |
2480 | |
2481 @item | |
2482 A nice hierarchical by-topic organization of all officially documented | |
2483 LaTeX macros, available from the menu bar. | |
2484 | |
2485 @item | |
2486 Make @samp{`} check for math context in @code{LaTeX-math-mode}. and | |
2487 simply self insert if not in a math context. | |
2488 | |
2489 @item | |
2490 Make @code{TeX-insert-dollar} more robust. Currently it can be fooled | |
2491 by @samp{\mbox}'es and escaped double dollar for example. | |
2492 | |
2493 @item | |
2494 La@TeX{} formatting should skip @code{verbatim} environments. | |
2495 | |
2496 @item | |
2497 @code{TeX-command-default} should be set from the master file, if not | |
2498 set locally. Suggested by Peter Whaite @samp{<peta@@cim.mcgill.ca>}. | |
2499 | |
2500 @item | |
2501 Make AUC @TeX{} work with @samp{crypt++}. Suggested by Chris Moore | |
2502 @samp{<Chris.Moore@@src.bae.co.uk>}. | |
2503 | |
2504 @item | |
2505 Fix bug with @code{TeX-show-environment} from hidden document | |
2506 environment. | |
2507 | |
2508 @item | |
2509 Function to check if you are in math mode (between two dollar signs). | |
2510 Suggested by Jan Erik Odegard @samp{<odegard@@dsp.rice.edu>} | |
2511 | |
2512 @item | |
2513 The @samp{Spell} command should apply to all files in a document. Maybe | |
2514 it could try to restrict to files that have been modified since last | |
2515 spell check? Suggested by Ravinder Bhumbla @samp{<rbhumbla@@ucsd.edu>}. | |
2516 | |
2517 @item | |
2518 Make @key{.} check for abbreviations and sentences ending with capital | |
2519 letters. | |
2520 | |
2521 @item | |
2522 Use Emacs 19 minibuffer history to choose between previewers, and other | |
2523 stuff. Suggested by John Interrante | |
2524 @samp{<interran@@uluru.Stanford.EDU>}. | |
2525 | |
2526 @item | |
2527 Make features. | |
2528 | |
2529 A new command @code{TeX-update} (@kbd{C-c C-u}) could be used to create | |
2530 an up-to-date dvi file by repeatedly running Bib@TeX{}, MakeIndex and | |
2531 (La)@TeX{}, until an error occurs or we are done. | |
2532 | |
2533 An alternative is to have an @samp{Update} command that ensures the | |
2534 @samp{dvi} file is up to date. This could be called before printing and | |
2535 previewing. | |
2536 | |
2537 @item | |
2538 Documentation of variables that can be set in a style hook. | |
2539 | |
2540 We need a list of what can safely be done in an ordinary style hook. | |
2541 You can not set a variable that AUC TeX depends on, unless AUC TeX knows | |
2542 that it has to run the style hooks first. | |
2543 | |
2544 Here is the start of such a list. | |
2545 @table @code | |
2546 | |
2547 @item LaTeX-add-environments | |
2548 | |
2549 @item TeX-add-symbols | |
2550 | |
2551 @item LaTeX-add-labels | |
2552 | |
2553 @item LaTeX-add-bibliographies | |
2554 | |
2555 @item LaTeX-largest-level | |
2556 | |
2557 @end table | |
2558 | |
2559 @item | |
2560 Correct indentation for tabular, tabbing, table, math, and array | |
2561 environments. | |
2562 | |
2563 @item | |
2564 Optional special indentation after an @samp{\item}. | |
2565 | |
2566 @example | |
2567 \begin@{itemize@} | |
2568 \item blabalaskdfjlas lajf adf | |
2569 lkfjl af jasl lkf jlsdf jlf | |
2570 \item f lk jldjf lajflkas flf af | |
2571 \end@{itemize@} | |
2572 @end example | |
2573 | |
2574 @item | |
2575 Completion for counters and sboxes. | |
2576 | |
2577 @item | |
2578 Outline should be (better) supported in @TeX{} mode. | |
2579 | |
2580 At least, support headers, trailers, as well as TeX-outline-extra. | |
2581 | |
2582 @item | |
2583 @code{TeX-header-start} and @code{TeX-trailer-end}. | |
2584 | |
2585 We might want these, just for fun (and outlines) | |
2586 | |
2587 @item | |
2588 Plain @TeX{} and La@TeX{} specific header and trailer expressions. | |
2589 | |
2590 We should have a way to globally specify the default value of the header | |
2591 and trailer regexps. | |
2592 | |
2593 @item | |
2594 Add support for original @code{TeX-mode} keybindings. | |
2595 | |
2596 A third initialization file (@file{tex-mode.el}) containing an emulator | |
2597 of the standard @code{TeX-mode} would help convince some people to | |
2598 change to AUC @TeX{}.@refill | |
2599 | |
2600 @item | |
2601 Make @code{TeX-next-error} parse ahead and store the results in a list, | |
2602 using markers to remember buffer positions in order to be more robust | |
2603 with regard to line numbers and changed files. This is what | |
2604 @code{next-error} does. (Or did, until Emacs 19). | |
2605 | |
2606 @item | |
2607 When @code{LaTeX-environment} is given an argument, change the current | |
2608 environment. Be smart about @samp{\item[]} versus @samp{\item } and | |
2609 labels like @samp{fig:} versus @samp{tab:}. | |
2610 | |
2611 @item | |
2612 Check out if lightning completion from Ultra @TeX{} is anything for us. | |
2613 | |
2614 @item | |
2615 Finish the @TeX{}info mode. For one thing, many @TeX{}info mode | |
2616 commands do not accept braces around their arguments. | |
2617 | |
2618 @item | |
2619 BibTeX mode. | |
2620 | |
2621 @item | |
2622 Support for AMSLaTeX style files. | |
2623 | |
2624 @item | |
2625 Hook up the letter environment with `bbdb.el'. | |
2626 | |
2627 @item | |
2628 Make the letter environment hook produce `documentstyle' too. | |
2629 | |
2630 @end itemize | |
2631 | |
2632 @node Credit, Key Index, Projects, top | |
2633 @comment node-name, next, previous, up | |
2634 @appendix Credit | |
2635 | |
2636 A big smile and thanks should go to all the folks who cheered me up, | |
2637 during the long hours of programming@dots{} sorry folks, but I can't help | |
2638 including the list below, of comments I've got@dots{} | |
2639 | |
2640 Kresten Krab Thorup | |
2641 | |
2642 @table @samp | |
2643 @item <monheit@@psych.stanford.edu> | |
2644 I'd like to say that I'm very much enjoying using auc-tex. Thanks for | |
2645 the great package! | |
2646 @item <georgiou@@rex.cs.tulane.edu> | |
2647 I really enjoy working with auc-tex. | |
2648 @item <toy@@soho.crd.ge.com> | |
2649 Thanks for your great package. It's indispensable now! Thanks! | |
2650 @item <ascott@@gara.une.oz.au> | |
2651 Thanks for your time and for what appears to be a great and useful | |
2652 package. Thanks again | |
2653 @item <hal@@alfred.econ.lsa.umich.edu> | |
2654 Thanks for providing auc-tex. | |
2655 @item <simons@@ibiza.karlsruhe.gmd.de> | |
2656 I really enjoy using the new emacs TeX-mode you wrote. I think you did | |
2657 a great job. | |
2658 @item <clipper@@csd.uwo.ca> | |
2659 I am having fun with auc-tex already. | |
2660 @item <ibekhaus@@athena.mit.edu> | |
2661 Thanks for your work on auc-tex, especially the math-minor mode. | |
2662 @item <burt@@dfki.uni-kl.de> | |
2663 I like your auc-tex elisp package for writing LaTeX files - I am | |
2664 especially impressed by the help with error correction. | |
2665 @item <goncal@@cnmvax.uab.es> | |
2666 Thanks so much! | |
2667 @item <bond@@sce.carleton.ca> | |
2668 I >really< like the macro, particularly the hooks for previewing and the | |
2669 error parsing! | |
2670 @item <ascott@@gara.une.oz.au> | |
2671 All in all I am pleased with your package. Thanks a lot. | |
2672 @end table | |
2673 | |
2674 @node Key Index, Function Index, Credit, top | |
2675 @comment node-name, next, previous, up | |
2676 @unnumbered Key Index | |
2677 | |
2678 @printindex ky | |
2679 | |
2680 @node Function Index, Variable Index, Key Index, top | |
2681 @comment node-name, next, previous, up | |
2682 @unnumbered Function Index | |
2683 | |
2684 @printindex fn | |
2685 | |
2686 @node Variable Index, Concept Index, Function Index, top | |
2687 @comment node-name, next, previous, up | |
2688 @unnumbered Variable Index | |
2689 | |
2690 @printindex vr | |
2691 | |
2692 @node Concept Index, , Variable Index, top | |
2693 @comment node-name, next, previous, up | |
2694 @unnumbered Concept Index | |
2695 | |
2696 @printindex cp | |
2697 | |
2698 @summarycontents | |
2699 @contents | |
2700 @bye | |
2701 | |
2702 |