Add bug references.
[bpt/emacs.git] / doc / emacs / text.texi
CommitLineData
8cf51b2c
GM
1@c This is part of the Emacs manual.
2@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
6ed161e1 3@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
8cf51b2c
GM
4@c See file emacs.texi for copying conditions.
5@node Text, Programs, Indentation, Top
6@chapter Commands for Human Languages
7@cindex text
8@cindex manipulating text
9
44d9593e
CY
10 This chapter describes Emacs commands that act on @dfn{text}, by
11which we mean sequences of characters in a human language (as opposed
12to, say, a computer programming language). These commands act in ways
13that take into account the syntactic and stylistic conventions of
14human languages: conventions involving words, sentences, paragraphs,
15and capital letters. There are also commands for @dfn{filling}, which
16means rearranging the lines of a paragraph to be approximately equal
17in length. These commands, while intended primarily for editing text,
18are also often useful for editing programs.
19
20 Emacs has several major modes for editing human-language text. If
21the file contains ordinary text, use Text mode, which customizes Emacs
22in small ways for the syntactic conventions of text. Outline mode
8cf51b2c
GM
23provides special commands for operating on text with an outline
24structure.
25@iftex
26@xref{Outline Mode}.
27@end iftex
28
3a5244ab
CY
29 Emacs has other major modes for text which contains ``embedded''
30commands, such as @TeX{} and La@TeX{} (@pxref{TeX Mode}); HTML, SGML,
31and XML (@pxref{HTML Mode}); and Groff and Nroff (@pxref{Nroff Mode}).
32In addition, you can edit formatted text in WYSIWYG style (``what you
33see is what you get''), using Enriched mode (@pxref{Formatted Text}).
8cf51b2c
GM
34
35@cindex ASCII art
36 If you need to edit pictures made out of text characters (commonly
44d9593e
CY
37referred to as ``ASCII art''), use Picture mode, a special major mode
38for editing such pictures.
8cf51b2c
GM
39@iftex
40@xref{Picture Mode,,, emacs-xtra, Specialized Emacs Features}.
41@end iftex
42@ifnottex
43@xref{Picture Mode}.
44@end ifnottex
45
46
47@cindex skeletons
48@cindex templates
49@cindex autotyping
50@cindex automatic typing
51 The ``automatic typing'' features may be useful when writing text.
52@inforef{Top,, autotype}.
53
54@menu
55* Words:: Moving over and killing words.
56* Sentences:: Moving over and killing sentences.
57* Paragraphs:: Moving over paragraphs.
58* Pages:: Moving over pages.
59* Filling:: Filling or justifying text.
60* Case:: Changing the case of text.
61* Text Mode:: The major modes for editing text files.
62* Outline Mode:: Editing outlines.
63* TeX Mode:: Editing input to the formatter TeX.
64* HTML Mode:: Editing HTML, SGML, and XML files.
65* Nroff Mode:: Editing input to the formatter nroff.
66* Formatted Text:: Editing formatted text directly in WYSIWYG fashion.
67* Text Based Tables:: Editing text-based tables in WYSIWYG fashion.
68@end menu
69
70@node Words
71@section Words
72@cindex words
73@cindex Meta commands and words
74
75 Emacs has commands for moving over or operating on words. By convention,
76the keys for them are all Meta characters.
77
78@table @kbd
79@item M-f
80Move forward over a word (@code{forward-word}).
81@item M-b
82Move backward over a word (@code{backward-word}).
83@item M-d
84Kill up to the end of a word (@code{kill-word}).
85@item M-@key{DEL}
86Kill back to the beginning of a word (@code{backward-kill-word}).
87@item M-@@
88Mark the end of the next word (@code{mark-word}).
89@item M-t
90Transpose two words or drag a word across others
91(@code{transpose-words}).
92@end table
93
94 Notice how these keys form a series that parallels the character-based
95@kbd{C-f}, @kbd{C-b}, @kbd{C-d}, @key{DEL} and @kbd{C-t}. @kbd{M-@@} is
96cognate to @kbd{C-@@}, which is an alias for @kbd{C-@key{SPC}}.
97
98@kindex M-f
99@kindex M-b
100@findex forward-word
101@findex backward-word
102 The commands @kbd{M-f} (@code{forward-word}) and @kbd{M-b}
103(@code{backward-word}) move forward and backward over words. These
44d9593e
CY
104@key{Meta}-based key sequences are analogous to the key sequences
105@kbd{C-f} and @kbd{C-b}, which move over single characters. The
106analogy extends to numeric arguments, which serve as repeat counts.
107@kbd{M-f} with a negative argument moves backward, and @kbd{M-b} with
108a negative argument moves forward. Forward motion stops right after
109the last letter of the word, while backward motion stops right before
110the first letter.
8cf51b2c
GM
111
112@kindex M-d
113@findex kill-word
114 @kbd{M-d} (@code{kill-word}) kills the word after point. To be
115precise, it kills everything from point to the place @kbd{M-f} would
116move to. Thus, if point is in the middle of a word, @kbd{M-d} kills
44d9593e
CY
117just the part after point. If some punctuation comes between point
118and the next word, it is killed along with the word. (If you wish to
119kill only the next word but not the punctuation before it, simply do
120@kbd{M-f} to get the end, and kill the word backwards with
121@kbd{M-@key{DEL}}.) @kbd{M-d} takes arguments just like @kbd{M-f}.
8cf51b2c
GM
122
123@findex backward-kill-word
124@kindex M-DEL
125 @kbd{M-@key{DEL}} (@code{backward-kill-word}) kills the word before
126point. It kills everything from point back to where @kbd{M-b} would
127move to. For instance, if point is after the space in @w{@samp{FOO,
128BAR}}, it kills @w{@samp{FOO, }}. If you wish to kill just
129@samp{FOO}, and not the comma and the space, use @kbd{M-b M-d} instead
130of @kbd{M-@key{DEL}}.
131
132@c Don't index M-t and transpose-words here, they are indexed in
133@c fixit.texi, in the node "Transpose".
134@c @kindex M-t
135@c @findex transpose-words
136 @kbd{M-t} (@code{transpose-words}) exchanges the word before or
137containing point with the following word. The delimiter characters between
138the words do not move. For example, @w{@samp{FOO, BAR}} transposes into
139@w{@samp{BAR, FOO}} rather than @samp{@w{BAR FOO,}}. @xref{Transpose}, for
140more on transposition.
141
142@kindex M-@@
143@findex mark-word
44d9593e
CY
144 To operate on the next @var{n} words with an operation which acts on
145the region, use the command @kbd{M-@@} (@code{mark-word}). This
146command does not move point, but sets the mark where @kbd{M-f} would
147move to. Once the mark is active, each additional @kbd{M-@@} advances
148the mark by one additional word. @kbd{M-@@} also accepts a numeric
149argument that says how many words to scan for the place to put the
150mark.
8cf51b2c
GM
151
152 The word commands' understanding of word boundaries is controlled
153by the syntax table. Any character can, for example, be declared to
154be a word delimiter. @xref{Syntax}.
155
156@node Sentences
157@section Sentences
158@cindex sentences
159@cindex manipulating sentences
160
161 The Emacs commands for manipulating sentences and paragraphs are mostly
162on Meta keys, so as to be like the word-handling commands.
163
164@table @kbd
165@item M-a
166Move back to the beginning of the sentence (@code{backward-sentence}).
167@item M-e
168Move forward to the end of the sentence (@code{forward-sentence}).
169@item M-k
170Kill forward to the end of the sentence (@code{kill-sentence}).
171@item C-x @key{DEL}
172Kill back to the beginning of the sentence (@code{backward-kill-sentence}).
173@end table
174
175@kindex M-a
176@kindex M-e
177@findex backward-sentence
178@findex forward-sentence
179 The commands @kbd{M-a} and @kbd{M-e} (@code{backward-sentence} and
180@code{forward-sentence}) move to the beginning and end of the current
181sentence, respectively. They were chosen to resemble @kbd{C-a} and
182@kbd{C-e}, which move to the beginning and end of a line. Unlike
183them, @kbd{M-a} and @kbd{M-e} move over successive sentences if
184repeated.
185
186 Moving backward over a sentence places point just before the first
187character of the sentence; moving forward places point right after the
188punctuation that ends the sentence. Neither one moves over the
189whitespace at the sentence boundary.
190
191@kindex M-k
8cf51b2c 192@findex kill-sentence
44d9593e
CY
193 Just as @kbd{C-a} and @kbd{C-e} have a kill command, @kbd{C-k}, to
194go with them, @kbd{M-a} and @kbd{M-e} have a corresponding kill
195command: @kbd{M-k} (@code{kill-sentence}) kills from point to the end
196of the sentence. With a positive numeric argument @var{n}, it kills
197the next @var{n} sentences; with a negative argument @minus{}@var{n},
198it kills back to the beginning of the @var{n}th preceding sentence.
199
200@kindex C-x DEL
8cf51b2c 201@findex backward-kill-sentence
44d9593e
CY
202 The @kbd{C-x @key{DEL}} (@code{backward-kill-sentence}) kills back
203to the beginning of a sentence.
8cf51b2c
GM
204
205 The sentence commands assume that you follow the American typist's
206convention of putting two spaces at the end of a sentence; they consider
207a sentence to end wherever there is a @samp{.}, @samp{?} or @samp{!}
208followed by the end of a line or two spaces, with any number of
209@samp{)}, @samp{]}, @samp{'}, or @samp{"} characters allowed in between.
210A sentence also begins or ends wherever a paragraph begins or ends.
211It is useful to follow this convention, because it makes a distinction
212between periods that end a sentence and periods that indicate
213abbreviations; that enables the Emacs sentence commands to distinguish,
214too. These commands do not stop for periods that indicate abbreviations.
215
216@vindex sentence-end-double-space
217 If you want to use just one space between sentences, you can set the
218variable @code{sentence-end-double-space} to @code{nil} to make the
44d9593e 219sentence commands stop for single spaces. However, this has a
8cf51b2c
GM
220drawback: there is no way to distinguish between periods that end
221sentences and those that indicate abbreviations. For convenient and
222reliable editing, we therefore recommend you follow the two-space
223convention. The variable @code{sentence-end-double-space} also
224affects filling (@pxref{Fill Commands}) in related ways.
225
226@vindex sentence-end
227 The variable @code{sentence-end} controls how to recognize the end
44d9593e
CY
228of a sentence. If non-@code{nil}, its value should be a regular
229expression, which is used to match the last few characters of a
230sentence, together with the whitespace following the sentence
231(@pxref{Regexps}). If the value is @code{nil}, the default, then
232Emacs computes sentence ends according to various criteria such as the
233value of @code{sentence-end-double-space}.
8cf51b2c
GM
234
235@vindex sentence-end-without-period
236 Some languages do not use periods to indicate the end of a sentence.
237For example, sentences in Thai end with a double space but without a
238period. Set the variable @code{sentence-end-without-period} to
239@code{t} in such cases.
240
241@node Paragraphs
242@section Paragraphs
243@cindex paragraphs
244@cindex manipulating paragraphs
245@kindex M-@{
246@kindex M-@}
247@findex backward-paragraph
248@findex forward-paragraph
249
250 The Emacs commands for manipulating paragraphs are also on Meta keys.
251
252@table @kbd
253@item M-@{
254Move back to previous paragraph beginning (@code{backward-paragraph}).
255@item M-@}
256Move forward to next paragraph end (@code{forward-paragraph}).
257@item M-h
258Put point and mark around this or next paragraph (@code{mark-paragraph}).
259@end table
260
261 @kbd{M-@{} moves to the beginning of the current or previous
262paragraph, while @kbd{M-@}} moves to the end of the current or next
263paragraph. Blank lines and text-formatter command lines separate
264paragraphs and are not considered part of any paragraph. If there is
265a blank line before the paragraph, @kbd{M-@{} moves to the blank line,
266because that is convenient in practice.
267
268 In Text mode, an indented line is not a paragraph break. If you
269want indented lines to have this effect, use Paragraph-Indent Text
270mode instead. @xref{Text Mode}.
271
272 In major modes for programs, paragraphs begin and end only at blank
273lines. This makes the paragraph commands useful, even though there
274are no paragraphs as such in a program.
275
276 When you have set a fill prefix, then paragraphs are delimited by
277all lines which don't start with the fill prefix. @xref{Filling}.
278
279@kindex M-h
280@findex mark-paragraph
44d9593e
CY
281 When you wish to operate on a paragraph, type @kbd{M-h}
282(@code{mark-paragraph}) to set the region around it. For example,
283@kbd{M-h C-w} kills the paragraph around or after point. @kbd{M-h}
284puts point at the beginning and mark at the end of the paragraph point
285was in. If point is between paragraphs (in a run of blank lines, or
286at a boundary), the paragraph following point is surrounded by point
287and mark. If there are blank lines preceding the first line of the
288paragraph, one of these blank lines is included in the region. If the
289region is already active, the command sets the mark without changing
290point; furthermore, each subsequent @kbd{M-h} further advances the
291mark by one paragraph.
8cf51b2c
GM
292
293@vindex paragraph-start
294@vindex paragraph-separate
295 The precise definition of a paragraph boundary is controlled by the
296variables @code{paragraph-separate} and @code{paragraph-start}. The
297value of @code{paragraph-start} is a regexp that should match any line
298that either starts or separates paragraphs. The value of
299@code{paragraph-separate} is another regexp that should match only lines
300that separate paragraphs without being part of any paragraph (for
301example, blank lines). Lines that start a new paragraph and are
302contained in it must match only @code{paragraph-start}, not
303@code{paragraph-separate}. Each regular expression must match at the
304left margin. For example, in Fundamental mode, @code{paragraph-start}
305is @w{@code{"\f\\|[ \t]*$"}}, and @code{paragraph-separate} is
306@w{@code{"[ \t\f]*$"}}.
307
308 Normally it is desirable for page boundaries to separate paragraphs.
309The default values of these variables recognize the usual separator for
310pages.
311
312@node Pages
313@section Pages
314
315@cindex pages
44d9593e
CY
316@cindex formfeed character
317 Within some text files, text is divided into @dfn{pages}, which are
318delimited by the @dfn{formfeed character} (@acronym{ASCII} code 12,
319sometimes denoted as @key{control-L}). When you print hardcopy for a
320file, the formfeed character forces a page break: each page of the
321file goes on a separate page on paper. Most Emacs commands treat the
322formfeed character just like any other character: you can insert it
323with @kbd{C-q C-l}, and delete it with @key{DEL}. However, since
324pages are often meaningful divisions of the file, Emacs provides
8cf51b2c
GM
325commands to move over them and operate on them.
326
327@table @kbd
328@item C-x [
329Move point to previous page boundary (@code{backward-page}).
330@item C-x ]
331Move point to next page boundary (@code{forward-page}).
332@item C-x C-p
333Put point and mark around this page (or another page) (@code{mark-page}).
334@item C-x l
335Count the lines in this page (@code{count-lines-page}).
336@end table
337
338@kindex C-x [
339@kindex C-x ]
340@findex forward-page
341@findex backward-page
342 The @kbd{C-x [} (@code{backward-page}) command moves point to immediately
343after the previous page delimiter. If point is already right after a page
344delimiter, it skips that one and stops at the previous one. A numeric
345argument serves as a repeat count. The @kbd{C-x ]} (@code{forward-page})
346command moves forward past the next page delimiter.
347
348@kindex C-x C-p
349@findex mark-page
350 The @kbd{C-x C-p} command (@code{mark-page}) puts point at the
351beginning of the current page and the mark at the end. The page
352delimiter at the end is included (the mark follows it). The page
9a1c2249 353delimiter at the front is excluded (point follows it).
8cf51b2c
GM
354
355 @kbd{C-x C-p C-w} is a handy way to kill a page to move it
356elsewhere. If you move to another page delimiter with @kbd{C-x [} and
357@kbd{C-x ]}, then yank the killed page, all the pages will be properly
358delimited once again. The reason @kbd{C-x C-p} includes only the
359following page delimiter in the region is to ensure that.
360
44d9593e
CY
361 A numeric argument to @kbd{C-x C-p} specifies which page to go to,
362relative to the current one. Zero means the current page. One means
8cf51b2c
GM
363the next page, and @minus{}1 means the previous one.
364
365@kindex C-x l
366@findex count-lines-page
367 The @kbd{C-x l} command (@code{count-lines-page}) is good for deciding
368where to break a page in two. It displays in the echo area the total number
369of lines in the current page, and then divides it up into those preceding
370the current line and those following, as in
371
372@example
373Page has 96 (72+25) lines
374@end example
375
376@noindent
377 Notice that the sum is off by one; this is correct if point is not at the
378beginning of a line.
379
380@vindex page-delimiter
381 The variable @code{page-delimiter} controls where pages begin. Its
44d9593e
CY
382value is a regular expression that matches the beginning of a line
383that separates pages (@pxref{Regexps}). The normal value of this
384variable is @code{"^\f"}, which matches a formfeed character at the
385beginning of a line.
8cf51b2c
GM
386
387@node Filling
388@section Filling Text
389@cindex filling text
390
391 @dfn{Filling} text means breaking it up into lines that fit a
392specified width. Emacs does filling in two ways. In Auto Fill mode,
393inserting text with self-inserting characters also automatically fills
394it. There are also explicit fill commands that you can use when editing
395text leaves it unfilled. When you edit formatted text, you can specify
396a style of filling for each portion of the text (@pxref{Formatted
397Text}).
398
399@menu
400* Auto Fill:: Auto Fill mode breaks long lines automatically.
401* Fill Commands:: Commands to refill paragraphs and center lines.
402* Fill Prefix:: Filling paragraphs that are indented
403 or in a comment, etc.
404* Adaptive Fill:: How Emacs can determine the fill prefix automatically.
405* Refill:: Keeping paragraphs filled.
406* Longlines:: Editing text with very long lines.
407@end menu
408
409@node Auto Fill
410@subsection Auto Fill Mode
411@cindex Auto Fill mode
412@cindex mode, Auto Fill
413
414 @dfn{Auto Fill} mode is a minor mode in which lines are broken
415automatically when they become too wide. Breaking happens only when
416you type a @key{SPC} or @key{RET}.
417
418@table @kbd
419@item M-x auto-fill-mode
420Enable or disable Auto Fill mode.
421@item @key{SPC}
422@itemx @key{RET}
423In Auto Fill mode, break lines when appropriate.
424@end table
425
426@findex auto-fill-mode
427 @kbd{M-x auto-fill-mode} turns Auto Fill mode on if it was off, or off
428if it was on. With a positive numeric argument it always turns Auto
429Fill mode on, and with a negative argument always turns it off. You can
430see when Auto Fill mode is in effect by the presence of the word
431@samp{Fill} in the mode line, inside the parentheses. Auto Fill mode is
432a minor mode which is enabled or disabled for each buffer individually.
433@xref{Minor Modes}.
434
435 In Auto Fill mode, lines are broken automatically at spaces when they
436get longer than the desired width. Line breaking and rearrangement
437takes place only when you type @key{SPC} or @key{RET}. If you wish to
438insert a space or newline without permitting line-breaking, type
439@kbd{C-q @key{SPC}} or @kbd{C-q C-j} (recall that a newline is really a
440control-J). Also, @kbd{C-o} inserts a newline without line breaking.
441
442 Auto Fill mode works well with programming-language modes, because it
443indents new lines with @key{TAB}. If a line ending in a comment gets
444too long, the text of the comment is split into two comment lines.
445Optionally, new comment delimiters are inserted at the end of the first
446line and the beginning of the second so that each line is a separate
447comment; the variable @code{comment-multi-line} controls the choice
448(@pxref{Comments}).
449
450 Adaptive filling (@pxref{Adaptive Fill}) works for Auto Filling as
451well as for explicit fill commands. It takes a fill prefix
452automatically from the second or first line of a paragraph.
453
454 Auto Fill mode does not refill entire paragraphs; it can break lines but
455cannot merge lines. So editing in the middle of a paragraph can result in
456a paragraph that is not correctly filled. The easiest way to make the
457paragraph properly filled again is usually with the explicit fill commands.
458@ifnottex
459@xref{Fill Commands}.
460@end ifnottex
461
462 Many users like Auto Fill mode and want to use it in all text files.
463The section on init files says how to arrange this permanently for yourself.
464@xref{Init File}.
465
466@node Fill Commands
467@subsection Explicit Fill Commands
468
469@table @kbd
470@item M-q
ad6d10b1 471Fill current paragraph (@code{fill-paragraph}).
8cf51b2c
GM
472@item C-x f
473Set the fill column (@code{set-fill-column}).
474@item M-x fill-region
475Fill each paragraph in the region (@code{fill-region}).
476@item M-x fill-region-as-paragraph
477Fill the region, considering it as one paragraph.
2e4667d1 478@item M-o M-s
8cf51b2c
GM
479Center a line.
480@end table
481
ad6d10b1 482@kindex M-q
8cf51b2c 483@findex fill-paragraph
ad6d10b1
JL
484 To refill a paragraph, use the command @kbd{M-q}
485(@code{fill-paragraph}). This operates on the paragraph that point is
486inside, or the one after point if point is between paragraphs.
9a1c2249
CY
487Refilling works by removing all the line-breaks, then inserting new
488ones where necessary. When there is an active region, this command
489operates on the text within the region like @code{fill-region}.
8cf51b2c
GM
490
491@findex fill-region
492 To refill many paragraphs, use @kbd{M-x fill-region}, which
493finds the paragraphs in the region and fills each of them.
494
495@findex fill-region-as-paragraph
ad6d10b1
JL
496 @kbd{M-q} and @code{fill-region} use the same criteria as @kbd{M-h}
497for finding paragraph boundaries (@pxref{Paragraphs}). For more
498control, you can use @kbd{M-x fill-region-as-paragraph}, which refills
499everything between point and mark as a single paragraph. This command
500deletes any blank lines within the region, so separate blocks of text
501end up combined into one block.
8cf51b2c
GM
502
503@cindex justification
504 A numeric argument to @kbd{M-q} tells it to @dfn{justify} the text
505as well as filling it. This means that extra spaces are inserted to
506make the right margin line up exactly at the fill column. To remove
507the extra spaces, use @kbd{M-q} with no argument. (Likewise for
ad6d10b1
JL
508@code{fill-region}.) Another way to control justification, and choose
509other styles of filling, is with the @code{justification} text
510property; see @ref{Format Justification}.
8cf51b2c 511
2e4667d1 512@kindex M-o M-s @r{(Text mode)}
8cf51b2c
GM
513@cindex centering
514@findex center-line
2e4667d1 515 The command @kbd{M-o M-s} (@code{center-line}) centers the current line
8cf51b2c
GM
516within the current fill column. With an argument @var{n}, it centers
517@var{n} lines individually and moves past them. This binding is
518made by Text mode and is available only in that and related modes
519(@pxref{Text Mode}).
520
521@vindex fill-column
522@kindex C-x f
523@findex set-fill-column
524 The maximum line width for filling is in the variable
525@code{fill-column}. Altering the value of @code{fill-column} makes it
526local to the current buffer; until that time, the default value is in
527effect. The default is initially 70. @xref{Locals}. The easiest way
528to set @code{fill-column} is to use the command @kbd{C-x f}
529(@code{set-fill-column}). With a numeric argument, it uses that as the
530new fill column. With just @kbd{C-u} as argument, it sets
531@code{fill-column} to the current horizontal position of point.
532
533 Emacs commands normally consider a period followed by two spaces or by
534a newline as the end of a sentence; a period followed by just one space
535indicates an abbreviation and not the end of a sentence. To preserve
536the distinction between these two ways of using a period, the fill
537commands do not break a line after a period followed by just one space.
538
539 If the variable @code{sentence-end-double-space} is @code{nil}, the
540fill commands expect and leave just one space at the end of a sentence.
541Ordinarily this variable is @code{t}, so the fill commands insist on
542two spaces for the end of a sentence, as explained above. @xref{Sentences}.
543
544@vindex colon-double-space
545 If the variable @code{colon-double-space} is non-@code{nil}, the
546fill commands put two spaces after a colon.
547
548@vindex fill-nobreak-predicate
549 The variable @code{fill-nobreak-predicate} is a hook (an abnormal
550hook, @pxref{Hooks}) specifying additional conditions where
551line-breaking is not allowed. Each function is called with no
552arguments, with point at a place where Emacs is considering breaking
553the line. If a function returns a non-@code{nil} value, then that's
554a bad place to break the line. Two standard functions you can use are
555@code{fill-single-word-nobreak-p} (don't break after the first word of
556a sentence or before the last) and @code{fill-french-nobreak-p} (don't
557break after @samp{(} or before @samp{)}, @samp{:} or @samp{?}).
558
559@node Fill Prefix
560@subsection The Fill Prefix
561
562@cindex fill prefix
563 To fill a paragraph in which each line starts with a special marker
564(which might be a few spaces, giving an indented paragraph), you can use
565the @dfn{fill prefix} feature. The fill prefix is a string that Emacs
566expects every line to start with, and which is not included in filling.
567You can specify a fill prefix explicitly; Emacs can also deduce the
568fill prefix automatically (@pxref{Adaptive Fill}).
569
570@table @kbd
571@item C-x .
572Set the fill prefix (@code{set-fill-prefix}).
573@item M-q
ad6d10b1 574Fill a paragraph using current fill prefix (@code{fill-paragraph}).
8cf51b2c
GM
575@item M-x fill-individual-paragraphs
576Fill the region, considering each change of indentation as starting a
577new paragraph.
578@item M-x fill-nonuniform-paragraphs
579Fill the region, considering only paragraph-separator lines as starting
580a new paragraph.
581@end table
582
583@kindex C-x .
584@findex set-fill-prefix
585 To specify a fill prefix for the current buffer, move to a line that
586starts with the desired prefix, put point at the end of the prefix,
587and type @w{@kbd{C-x .}}@: (@code{set-fill-prefix}). (That's a period
588after the @kbd{C-x}.) To turn off the fill prefix, specify an empty
589prefix: type @w{@kbd{C-x .}}@: with point at the beginning of a line.
590
591 When a fill prefix is in effect, the fill commands remove the fill
592prefix from each line of the paragraph before filling and insert it on
593each line after filling. (The beginning of the first line of the
594paragraph is left unchanged, since often that is intentionally
595different.) Auto Fill mode also inserts the fill prefix automatically
596when it makes a new line. The @kbd{C-o} command inserts the fill
597prefix on new lines it creates, when you use it at the beginning of a
598line (@pxref{Blank Lines}). Conversely, the command @kbd{M-^} deletes
599the prefix (if it occurs) after the newline that it deletes
600(@pxref{Indentation}).
601
602 For example, if @code{fill-column} is 40 and you set the fill prefix
603to @samp{;; }, then @kbd{M-q} in the following text
604
605@example
606;; This is an
607;; example of a paragraph
608;; inside a Lisp-style comment.
609@end example
610
611@noindent
612produces this:
613
614@example
615;; This is an example of a paragraph
616;; inside a Lisp-style comment.
617@end example
618
619 Lines that do not start with the fill prefix are considered to start
620paragraphs, both in @kbd{M-q} and the paragraph commands; this gives
621good results for paragraphs with hanging indentation (every line
622indented except the first one). Lines which are blank or indented once
623the prefix is removed also separate or start paragraphs; this is what
624you want if you are writing multi-paragraph comments with a comment
625delimiter on each line.
626
627@findex fill-individual-paragraphs
628 You can use @kbd{M-x fill-individual-paragraphs} to set the fill
629prefix for each paragraph automatically. This command divides the
630region into paragraphs, treating every change in the amount of
631indentation as the start of a new paragraph, and fills each of these
632paragraphs. Thus, all the lines in one ``paragraph'' have the same
633amount of indentation. That indentation serves as the fill prefix for
634that paragraph.
635
636@findex fill-nonuniform-paragraphs
637 @kbd{M-x fill-nonuniform-paragraphs} is a similar command that divides
638the region into paragraphs in a different way. It considers only
639paragraph-separating lines (as defined by @code{paragraph-separate}) as
640starting a new paragraph. Since this means that the lines of one
641paragraph may have different amounts of indentation, the fill prefix
642used is the smallest amount of indentation of any of the lines of the
643paragraph. This gives good results with styles that indent a paragraph's
644first line more or less that the rest of the paragraph.
645
646@vindex fill-prefix
647 The fill prefix is stored in the variable @code{fill-prefix}. Its value
648is a string, or @code{nil} when there is no fill prefix. This is a
649per-buffer variable; altering the variable affects only the current buffer,
650but there is a default value which you can change as well. @xref{Locals}.
651
652 The @code{indentation} text property provides another way to control
653the amount of indentation paragraphs receive. @xref{Format Indentation}.
654
655@node Adaptive Fill
656@subsection Adaptive Filling
657
658@cindex adaptive filling
659 The fill commands can deduce the proper fill prefix for a paragraph
660automatically in certain cases: either whitespace or certain punctuation
661characters at the beginning of a line are propagated to all lines of the
662paragraph.
663
664 If the paragraph has two or more lines, the fill prefix is taken from
665the paragraph's second line, but only if it appears on the first line as
666well.
667
668 If a paragraph has just one line, fill commands @emph{may} take a
669prefix from that line. The decision is complicated because there are
670three reasonable things to do in such a case:
671
672@itemize @bullet
673@item
674Use the first line's prefix on all the lines of the paragraph.
675
676@item
677Indent subsequent lines with whitespace, so that they line up under the
678text that follows the prefix on the first line, but don't actually copy
679the prefix from the first line.
680
681@item
682Don't do anything special with the second and following lines.
683@end itemize
684
685 All three of these styles of formatting are commonly used. So the
686fill commands try to determine what you would like, based on the prefix
687that appears and on the major mode. Here is how.
688
689@vindex adaptive-fill-first-line-regexp
690 If the prefix found on the first line matches
691@code{adaptive-fill-first-line-regexp}, or if it appears to be a
692comment-starting sequence (this depends on the major mode), then the
693prefix found is used for filling the paragraph, provided it would not
694act as a paragraph starter on subsequent lines.
695
696 Otherwise, the prefix found is converted to an equivalent number of
697spaces, and those spaces are used as the fill prefix for the rest of the
698lines, provided they would not act as a paragraph starter on subsequent
699lines.
700
701 In Text mode, and other modes where only blank lines and page
702delimiters separate paragraphs, the prefix chosen by adaptive filling
703never acts as a paragraph starter, so it can always be used for filling.
704
705@vindex adaptive-fill-mode
706@vindex adaptive-fill-regexp
707 The variable @code{adaptive-fill-regexp} determines what kinds of line
708beginnings can serve as a fill prefix: any characters at the start of
709the line that match this regular expression are used. If you set the
710variable @code{adaptive-fill-mode} to @code{nil}, the fill prefix is
711never chosen automatically.
712
713@vindex adaptive-fill-function
714 You can specify more complex ways of choosing a fill prefix
715automatically by setting the variable @code{adaptive-fill-function} to a
716function. This function is called with point after the left margin of a
717line, and it should return the appropriate fill prefix based on that
718line. If it returns @code{nil}, @code{adaptive-fill-regexp} gets
719a chance to find a prefix.
720
721@node Refill
722@subsection Refill Mode
723@cindex refilling text, word processor style
724@cindex modes, Refill
725@cindex Refill minor mode
726
727 Refill minor mode provides support for keeping paragraphs filled as
728you type or modify them in other ways. It provides an effect similar
729to typical word processor behavior. This works by running a
730paragraph-filling command at suitable times.
731
732 To toggle the use of Refill mode in the current buffer, type
733@kbd{M-x refill-mode}. When you are typing text, only characters
734which normally trigger auto filling, like the space character, will
735trigger refilling. This is to avoid making it too slow. Apart from
736self-inserting characters, other commands which modify the text cause
737refilling.
738
739 The current implementation is preliminary and not robust. You can
740get better ``line wrapping'' behavior using Longlines mode.
741@xref{Longlines}. However, Longlines mode has an important
742side-effect: the newlines that it inserts for you are not saved to
743disk, so the files that you make with Longlines mode will appear to be
744completely unfilled if you edit them without Longlines mode.
745
746@node Longlines
747@subsection Long Lines Mode
748@cindex refilling text, word processor style
749@cindex modes, Long Lines
750@cindex word wrap
751@cindex Long Lines minor mode
752
44d9593e
CY
753 Sometimes, you may come across ``unfilled'' text files, which Emacs
754normally displays as a bunch of extremely long lines. Comfortably
755reading and editing such files normally requires ``word wrap'', a
756feature that breaks up each long text line into multiple screen lines
757in a readable manner---by putting the breaks at word boundaries. Many
758text editors, such as those built into many web browsers, perform word
759wrapping by default.
760
761 There are two different minor modes in Emacs that perform word
762wrapping. The first is Visual Line mode, which does it by altering
763the behavior of screen line continuation. @xref{Visual Line Mode},
764for information about Visual Line mode.
8cf51b2c
GM
765
766@findex longlines-mode
44d9593e
CY
767 Instead of using Visual Line mode, you can use a minor mode called
768Long Lines mode. Long Lines mode wraps lines by inserting or deleting
769@dfn{soft newlines} as you type (@pxref{Hard and Soft Newlines}).
770These soft newlines won't show up when you save the buffer into a
771file, or when you copy the text into the kill ring, clipboard, or a
772register. Unlike Visual Line mode, Lone Lines mode breaks long lines
773at the fill column (@pxref{Fill Commands}), rather than the right
774window edge. To enable Long Lines mode, type @kbd{M-x
775longlines-mode}. If the text is full of long lines, this also
776immediately ``wraps'' them all.
8cf51b2c
GM
777
778@findex longlines-auto-wrap
44d9593e
CY
779 The word wrap performed by Long Lines mode is @emph{not} the same as
780ordinary filling (@pxref{Fill Commands}). It does not contract
781multiple spaces into a single space, recognize fill prefixes
782(@pxref{Fill Prefix}), or perform adaptive filling (@pxref{Adaptive
783Fill}). The reason for this is that a wrapped line is still,
784conceptually, a single line. Each soft newline is equivalent to
785exactly one space in that long line, and vice versa. However, you can
786still call filling functions such as @kbd{M-q}, and these will work as
787expected, inserting soft newlines that won't show up on disk or when
788the text is copied. You can even rely entirely on the normal fill
789commands by turning off automatic line wrapping, with @kbd{C-u M-x
790longlines-auto-wrap}. To turn automatic line wrapping back on, type
791@kbd{M-x longlines-auto-wrap}.
8cf51b2c
GM
792
793@findex longlines-show-hard-newlines
794 Type @kbd{RET} to insert a hard newline, one which automatic
795refilling will not remove. If you want to see where all the hard
796newlines are, type @kbd{M-x longlines-show-hard-newlines}. This will
797mark each hard newline with a special symbol. The same command with a
798prefix argument turns this display off.
799
800 Long Lines mode does not change normal text files that are already
801filled, since the existing newlines are considered hard newlines.
802Before Long Lines can do anything, you need to transform each
803paragraph into a long line. One way is to set @code{fill-column} to a
804large number (e.g., @kbd{C-u 9999 C-x f}), re-fill all the paragraphs,
805and then set @code{fill-column} back to its original value.
806
807@node Case
808@section Case Conversion Commands
809@cindex case conversion
810
811 Emacs has commands for converting either a single word or any arbitrary
812range of text to upper case or to lower case.
813
814@table @kbd
815@item M-l
816Convert following word to lower case (@code{downcase-word}).
817@item M-u
818Convert following word to upper case (@code{upcase-word}).
819@item M-c
820Capitalize the following word (@code{capitalize-word}).
821@item C-x C-l
822Convert region to lower case (@code{downcase-region}).
823@item C-x C-u
824Convert region to upper case (@code{upcase-region}).
825@end table
826
827@kindex M-l
828@kindex M-u
829@kindex M-c
830@cindex words, case conversion
831@cindex converting text to upper or lower case
832@cindex capitalizing words
833@findex downcase-word
834@findex upcase-word
835@findex capitalize-word
836 The word conversion commands are the most useful. @kbd{M-l}
837(@code{downcase-word}) converts the word after point to lower case, moving
838past it. Thus, repeating @kbd{M-l} converts successive words.
839@kbd{M-u} (@code{upcase-word}) converts to all capitals instead, while
840@kbd{M-c} (@code{capitalize-word}) puts the first letter of the word
841into upper case and the rest into lower case. All these commands convert
842several words at once if given an argument. They are especially convenient
843for converting a large amount of text from all upper case to mixed case,
844because you can move through the text using @kbd{M-l}, @kbd{M-u} or
845@kbd{M-c} on each word as appropriate, occasionally using @kbd{M-f} instead
846to skip a word.
847
848 When given a negative argument, the word case conversion commands apply
849to the appropriate number of words before point, but do not move point.
850This is convenient when you have just typed a word in the wrong case: you
851can give the case conversion command and continue typing.
852
853 If a word case conversion command is given in the middle of a word,
854it applies only to the part of the word which follows point. (This is
855comparable to what @kbd{M-d} (@code{kill-word}) does.) With a
856negative argument, case conversion applies only to the part of the
857word before point.
858
859@kindex C-x C-l
860@kindex C-x C-u
861@findex downcase-region
862@findex upcase-region
863 The other case conversion commands are @kbd{C-x C-u}
864(@code{upcase-region}) and @kbd{C-x C-l} (@code{downcase-region}), which
865convert everything between point and mark to the specified case. Point and
866mark do not move.
867
868 The region case conversion commands @code{upcase-region} and
869@code{downcase-region} are normally disabled. This means that they ask
870for confirmation if you try to use them. When you confirm, you may
871enable the command, which means it will not ask for confirmation again.
872@xref{Disabling}.
873
874@node Text Mode
875@section Text Mode
876@cindex Text mode
877@cindex mode, Text
878@findex text-mode
879
880 When you edit files of text in a human language, it's more convenient
881to use Text mode rather than Fundamental mode. To enter Text mode, type
882@kbd{M-x text-mode}.
883
884 In Text mode, only blank lines and page delimiters separate
885paragraphs. As a result, paragraphs can be indented, and adaptive
886filling determines what indentation to use when filling a paragraph.
887@xref{Adaptive Fill}.
888
889@kindex TAB @r{(Text mode)}
890 Text mode defines @key{TAB} to run @code{indent-relative}
891(@pxref{Indentation}), so that you can conveniently indent a line like
892the previous line.
893
894 Text mode turns off the features concerned with comments except when
895you explicitly invoke them. It changes the syntax table so that
896single-quotes are considered part of words. However, if a word starts
897with single-quotes, these are treated as a prefix for purposes such as
898capitalization. That is, @kbd{M-c} will convert @samp{'hello'} into
899@samp{'Hello'}, as expected.
900
901@cindex Paragraph-Indent Text mode
902@cindex mode, Paragraph-Indent Text
903@findex paragraph-indent-text-mode
904@findex paragraph-indent-minor-mode
905 If you indent the first lines of paragraphs, then you should use
906Paragraph-Indent Text mode rather than Text mode. In this mode, you
907do not need to have blank lines between paragraphs, because the
908first-line indentation is sufficient to start a paragraph; however
909paragraphs in which every line is indented are not supported. Use
910@kbd{M-x paragraph-indent-text-mode} to enter this mode. Use @kbd{M-x
911paragraph-indent-minor-mode} to enable an equivalent minor mode in
912situations where you can't change the major mode---in mail
913composition, for instance.
914
915@kindex M-TAB @r{(Text mode)}
916 Text mode, and all the modes based on it, define @kbd{M-@key{TAB}}
917as the command @code{ispell-complete-word}, which performs completion
918of the partial word in the buffer before point, using the spelling
919dictionary as the space of possible words. @xref{Spelling}. If your
920window manager defines @kbd{M-@key{TAB}} to switch windows, you can
921type @kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i}.
922
923@vindex text-mode-hook
924 Entering Text mode runs the hook @code{text-mode-hook}. Other major
925modes related to Text mode also run this hook, followed by hooks of
926their own; this includes Paragraph-Indent Text mode, Nroff mode, @TeX{}
927mode, Outline mode, and Mail mode. Hook functions on
928@code{text-mode-hook} can look at the value of @code{major-mode} to see
929which of these modes is actually being entered. @xref{Hooks}.
930
8cf51b2c
GM
931@node Outline Mode
932@section Outline Mode
933@cindex Outline mode
934@cindex mode, Outline
935@cindex invisible lines
936
937@findex outline-mode
938@findex outline-minor-mode
939@vindex outline-minor-mode-prefix
940 Outline mode is a major mode much like Text mode but intended for
941editing outlines. It allows you to make parts of the text temporarily
942invisible so that you can see the outline structure. Type @kbd{M-x
943outline-mode} to switch to Outline mode as the major mode of the current
944buffer.
945
946 When Outline mode makes a line invisible, the line does not appear
947on the screen. The screen appears exactly as if the invisible line
948were deleted, except that an ellipsis (three periods in a row) appears
949at the end of the previous visible line. (Multiple consecutive
950invisible lines produce just one ellipsis.)
951
952 Editing commands that operate on lines, such as @kbd{C-n} and
953@kbd{C-p}, treat the text of the invisible line as part of the previous
954visible line. Killing the ellipsis at the end of a visible line
955really kills all the following invisible lines.
956
957 Outline minor mode provides the same commands as the major mode,
958Outline mode, but you can use it in conjunction with other major modes.
959Type @kbd{M-x outline-minor-mode} to enable the Outline minor mode in
960the current buffer. You can also specify this in the text of a file,
961with a file local variable of the form @samp{mode: outline-minor}
962(@pxref{File Variables}).
963
964@kindex C-c @@ @r{(Outline minor mode)}
965 The major mode, Outline mode, provides special key bindings on the
966@kbd{C-c} prefix. Outline minor mode provides similar bindings with
967@kbd{C-c @@} as the prefix; this is to reduce the conflicts with the
968major mode's special commands. (The variable
969@code{outline-minor-mode-prefix} controls the prefix used.)
970
971@vindex outline-mode-hook
972 Entering Outline mode runs the hook @code{text-mode-hook} followed by
973the hook @code{outline-mode-hook} (@pxref{Hooks}).
974
975@menu
976* Format: Outline Format. What the text of an outline looks like.
977* Motion: Outline Motion. Special commands for moving through
978 outlines.
979* Visibility: Outline Visibility. Commands to control what is visible.
980* Views: Outline Views. Outlines and multiple views.
981* Foldout:: Folding means zooming in on outlines.
982@end menu
983
984@node Outline Format
985@subsection Format of Outlines
986
987@cindex heading lines (Outline mode)
988@cindex body lines (Outline mode)
989 Outline mode assumes that the lines in the buffer are of two types:
990@dfn{heading lines} and @dfn{body lines}. A heading line represents a
991topic in the outline. Heading lines start with one or more stars; the
992number of stars determines the depth of the heading in the outline
993structure. Thus, a heading line with one star is a major topic; all the
994heading lines with two stars between it and the next one-star heading
995are its subtopics; and so on. Any line that is not a heading line is a
996body line. Body lines belong with the preceding heading line. Here is
997an example:
998
999@example
1000* Food
1001This is the body,
1002which says something about the topic of food.
1003
1004** Delicious Food
1005This is the body of the second-level header.
1006
1007** Distasteful Food
1008This could have
1009a body too, with
1010several lines.
1011
1012*** Dormitory Food
1013
1014* Shelter
1015Another first-level topic with its header line.
1016@end example
1017
1018 A heading line together with all following body lines is called
1019collectively an @dfn{entry}. A heading line together with all following
1020deeper heading lines and their body lines is called a @dfn{subtree}.
1021
1022@vindex outline-regexp
1023 You can customize the criterion for distinguishing heading lines by
1024setting the variable @code{outline-regexp}. (The recommended ways to
1025do this are in a major mode function or with a file local variable.)
1026Any line whose beginning has a match for this regexp is considered a
1027heading line. Matches that start within a line (not at the left
1028margin) do not count.
1029
1030 The length of the matching text determines the level of the heading;
1031longer matches make a more deeply nested level. Thus, for example, if
1032a text formatter has commands @samp{@@chapter}, @samp{@@section} and
1033@samp{@@subsection} to divide the document into chapters and sections,
1034you could make those lines count as heading lines by setting
1035@code{outline-regexp} to @samp{"@@chap\\|@@\\(sub\\)*section"}. Note
1036the trick: the two words @samp{chapter} and @samp{section} are equally
1037long, but by defining the regexp to match only @samp{chap} we ensure
1038that the length of the text matched on a chapter heading is shorter,
1039so that Outline mode will know that sections are contained in
1040chapters. This works as long as no other command starts with
1041@samp{@@chap}.
1042
1043@vindex outline-level
1044 You can explicitly specify a rule for calculating the level of a
1045heading line by setting the variable @code{outline-level}. The value
1046of @code{outline-level} should be a function that takes no arguments
1047and returns the level of the current heading. The recommended ways to
1048set this variable are in a major mode command or with a file local
1049variable.
1050
1051@node Outline Motion
1052@subsection Outline Motion Commands
1053
1054 Outline mode provides special motion commands that move backward and
1055forward to heading lines.
1056
1057@table @kbd
1058@item C-c C-n
1059Move point to the next visible heading line
1060(@code{outline-next-visible-heading}).
1061@item C-c C-p
1062Move point to the previous visible heading line
1063(@code{outline-previous-visible-heading}).
1064@item C-c C-f
1065Move point to the next visible heading line at the same level
1066as the one point is on (@code{outline-forward-same-level}).
1067@item C-c C-b
1068Move point to the previous visible heading line at the same level
1069(@code{outline-backward-same-level}).
1070@item C-c C-u
1071Move point up to a lower-level (more inclusive) visible heading line
1072(@code{outline-up-heading}).
1073@end table
1074
1075@findex outline-next-visible-heading
1076@findex outline-previous-visible-heading
1077@kindex C-c C-n @r{(Outline mode)}
1078@kindex C-c C-p @r{(Outline mode)}
1079 @kbd{C-c C-n} (@code{outline-next-visible-heading}) moves down to the next
1080heading line. @kbd{C-c C-p} (@code{outline-previous-visible-heading}) moves
1081similarly backward. Both accept numeric arguments as repeat counts. The
1082names emphasize that invisible headings are skipped, but this is not really
1083a special feature. All editing commands that look for lines ignore the
1084invisible lines automatically.
1085
1086@findex outline-up-heading
1087@findex outline-forward-same-level
1088@findex outline-backward-same-level
1089@kindex C-c C-f @r{(Outline mode)}
1090@kindex C-c C-b @r{(Outline mode)}
1091@kindex C-c C-u @r{(Outline mode)}
1092 More powerful motion commands understand the level structure of headings.
1093@kbd{C-c C-f} (@code{outline-forward-same-level}) and
1094@kbd{C-c C-b} (@code{outline-backward-same-level}) move from one
1095heading line to another visible heading at the same depth in
1096the outline. @kbd{C-c C-u} (@code{outline-up-heading}) moves
1097backward to another heading that is less deeply nested.
1098
1099@node Outline Visibility
1100@subsection Outline Visibility Commands
1101
1102 The other special commands of outline mode are used to make lines visible
1103or invisible. Their names all start with @code{hide} or @code{show}.
1104Most of them fall into pairs of opposites. They are not undoable; instead,
1105you can undo right past them. Making lines visible or invisible is simply
1106not recorded by the undo mechanism.
1107
1108 Many of these commands act on the ``current'' heading line. If
1109point is on a heading line, that is the current heading line; if point
1110is on a body line, the current heading line is the nearest preceding
1111header line.
1112
1113@table @kbd
1114@item C-c C-c
1115Make the current heading line's body invisible (@code{hide-entry}).
1116@item C-c C-e
1117Make the current heading line's body visible (@code{show-entry}).
1118@item C-c C-d
1119Make everything under the current heading invisible, not including the
1120heading itself (@code{hide-subtree}).
1121@item C-c C-s
1122Make everything under the current heading visible, including body,
1123subheadings, and their bodies (@code{show-subtree}).
1124@item C-c C-l
1125Make the body of the current heading line, and of all its subheadings,
1126invisible (@code{hide-leaves}).
1127@item C-c C-k
1128Make all subheadings of the current heading line, at all levels,
1129visible (@code{show-branches}).
1130@item C-c C-i
1131Make immediate subheadings (one level down) of the current heading
1132line visible (@code{show-children}).
1133@item C-c C-t
1134Make all body lines in the buffer invisible (@code{hide-body}).
1135@item C-c C-a
1136Make all lines in the buffer visible (@code{show-all}).
1137@item C-c C-q
1138Hide everything except the top @var{n} levels of heading lines
1139(@code{hide-sublevels}).
1140@item C-c C-o
1141Hide everything except for the heading or body that point is in, plus
1142the headings leading up from there to the top level of the outline
1143(@code{hide-other}).
1144@end table
1145
1146@findex hide-entry
1147@findex show-entry
1148@kindex C-c C-c @r{(Outline mode)}
1149@kindex C-c C-e @r{(Outline mode)}
1150 Two commands that are exact opposites are @kbd{C-c C-c}
1151(@code{hide-entry}) and @kbd{C-c C-e} (@code{show-entry}). They apply
1152to the body lines directly following the current heading line.
1153Subheadings and their bodies are not affected.
1154
1155@findex hide-subtree
1156@findex show-subtree
1157@kindex C-c C-s @r{(Outline mode)}
1158@kindex C-c C-d @r{(Outline mode)}
1159@cindex subtree (Outline mode)
1160 Two more powerful opposites are @kbd{C-c C-d} (@code{hide-subtree})
1161and @kbd{C-c C-s} (@code{show-subtree}). Both apply to the current
1162heading line's @dfn{subtree}: its body, all its subheadings, both
1163direct and indirect, and all of their bodies. In other words, the
1164subtree contains everything following the current heading line, up to
1165and not including the next heading of the same or higher rank.
1166
1167@findex hide-leaves
1168@findex show-branches
1169@kindex C-c C-l @r{(Outline mode)}
1170@kindex C-c C-k @r{(Outline mode)}
1171 Intermediate between a visible subtree and an invisible one is having
1172all the subheadings visible but none of the body. There are two
1173commands for doing this, depending on whether you want to hide the
1174bodies or make the subheadings visible. They are @kbd{C-c C-l}
1175(@code{hide-leaves}) and @kbd{C-c C-k} (@code{show-branches}).
1176
1177@kindex C-c C-i @r{(Outline mode)}
1178@findex show-children
1179 A little weaker than @code{show-branches} is @kbd{C-c C-i}
1180(@code{show-children}). It makes just the direct subheadings
1181visible---those one level down. Deeper subheadings remain invisible, if
1182they were invisible.
1183
1184@findex hide-body
1185@findex show-all
1186@kindex C-c C-t @r{(Outline mode)}
1187@kindex C-c C-a @r{(Outline mode)}
1188 Two commands have a blanket effect on the whole file. @kbd{C-c C-t}
1189(@code{hide-body}) makes all body lines invisible, so that you see just
1190the outline structure (as a special exception, it will not hide lines
1191at the top of the file, preceding the first header line, even though
1192these are technically body lines). @kbd{C-c C-a} (@code{show-all})
1193makes all lines visible. These commands can be thought of as a pair
1194of opposites even though @kbd{C-c C-a} applies to more than just body
1195lines.
1196
1197@findex hide-sublevels
1198@kindex C-c C-q @r{(Outline mode)}
1199 The command @kbd{C-c C-q} (@code{hide-sublevels}) hides all but the
1200top level headings. With a numeric argument @var{n}, it hides everything
1201except the top @var{n} levels of heading lines.
1202
1203@findex hide-other
1204@kindex C-c C-o @r{(Outline mode)}
1205 The command @kbd{C-c C-o} (@code{hide-other}) hides everything except
1206the heading and body text that point is in, plus its parents (the headers
1207leading up from there to top level in the outline) and the top level
1208headings.
1209
1210@findex reveal-mode
1211 When incremental search finds text that is hidden by Outline mode,
1212it makes that part of the buffer visible. If you exit the search
1213at that position, the text remains visible. You can also
1214automatically make text visible as you navigate in it by using
1215@kbd{M-x reveal-mode}.
1216
1217@node Outline Views
1218@subsection Viewing One Outline in Multiple Views
1219
1220@cindex multiple views of outline
1221@cindex views of an outline
1222@cindex outline with multiple views
1223@cindex indirect buffers and outlines
1224 You can display two views of a single outline at the same time, in
1225different windows. To do this, you must create an indirect buffer using
1226@kbd{M-x make-indirect-buffer}. The first argument of this command is
1227the existing outline buffer name, and its second argument is the name to
1228use for the new indirect buffer. @xref{Indirect Buffers}.
1229
1230 Once the indirect buffer exists, you can display it in a window in the
1231normal fashion, with @kbd{C-x 4 b} or other Emacs commands. The Outline
1232mode commands to show and hide parts of the text operate on each buffer
1233independently; as a result, each buffer can have its own view. If you
1234want more than two views on the same outline, create additional indirect
1235buffers.
1236
1237@node Foldout
1238@subsection Folding Editing
1239
1240@cindex folding editing
1241 The Foldout package extends Outline mode and Outline minor mode with
1242``folding'' commands. The idea of folding is that you zoom in on a
1243nested portion of the outline, while hiding its relatives at higher
1244levels.
1245
1246 Consider an Outline mode buffer with all the text and subheadings under
1247level-1 headings hidden. To look at what is hidden under one of these
1248headings, you could use @kbd{C-c C-e} (@kbd{M-x show-entry}) to expose
1249the body, or @kbd{C-c C-i} to expose the child (level-2) headings.
1250
1251@kindex C-c C-z
1252@findex foldout-zoom-subtree
1253 With Foldout, you use @kbd{C-c C-z} (@kbd{M-x foldout-zoom-subtree}).
1254This exposes the body and child subheadings, and narrows the buffer so
1255that only the @w{level-1} heading, the body and the level-2 headings are
1256visible. Now to look under one of the level-2 headings, position the
1257cursor on it and use @kbd{C-c C-z} again. This exposes the level-2 body
1258and its level-3 child subheadings and narrows the buffer again. Zooming
1259in on successive subheadings can be done as much as you like. A string
1260in the mode line shows how deep you've gone.
1261
1262 When zooming in on a heading, to see only the child subheadings specify
1263a numeric argument: @kbd{C-u C-c C-z}. The number of levels of children
1264can be specified too (compare @kbd{M-x show-children}), e.g.@: @kbd{M-2
1265C-c C-z} exposes two levels of child subheadings. Alternatively, the
1266body can be specified with a negative argument: @kbd{M-- C-c C-z}. The
1267whole subtree can be expanded, similarly to @kbd{C-c C-s} (@kbd{M-x
1268show-subtree}), by specifying a zero argument: @kbd{M-0 C-c C-z}.
1269
1270 While you're zoomed in, you can still use Outline mode's exposure and
1271hiding functions without disturbing Foldout. Also, since the buffer is
1272narrowed, ``global'' editing actions will only affect text under the
1273zoomed-in heading. This is useful for restricting changes to a
1274particular chapter or section of your document.
1275
1276@kindex C-c C-x
1277@findex foldout-exit-fold
1278 To unzoom (exit) a fold, use @kbd{C-c C-x} (@kbd{M-x foldout-exit-fold}).
1279This hides all the text and subheadings under the top-level heading and
1280returns you to the previous view of the buffer. Specifying a numeric
1281argument exits that many levels of folds. Specifying a zero argument
1282exits all folds.
1283
1284 To cancel the narrowing of a fold without hiding the text and
1285subheadings, specify a negative argument. For example, @kbd{M--2 C-c
1286C-x} exits two folds and leaves the text and subheadings exposed.
1287
1288 Foldout mode also provides mouse commands for entering and exiting
1289folds, and for showing and hiding text:
1290
1291@table @asis
1292@item @kbd{C-M-Mouse-1} zooms in on the heading clicked on
1293@itemize @asis
1294@item
1295single click: expose body.
1296@item
1297double click: expose subheadings.
1298@item
1299triple click: expose body and subheadings.
1300@item
1301quad click: expose entire subtree.
1302@end itemize
1303@item @kbd{C-M-Mouse-2} exposes text under the heading clicked on
1304@itemize @asis
1305@item
1306single click: expose body.
1307@item
1308double click: expose subheadings.
1309@item
1310triple click: expose body and subheadings.
1311@item
1312quad click: expose entire subtree.
1313@end itemize
1314@item @kbd{C-M-Mouse-3} hides text under the heading clicked on or exits fold
1315@itemize @asis
1316@item
1317single click: hide subtree.
1318@item
1319double click: exit fold and hide text.
1320@item
1321triple click: exit fold without hiding text.
1322@item
1323quad click: exit all folds and hide text.
1324@end itemize
1325@end table
1326
1327@vindex foldout-mouse-modifiers
1328 You can specify different modifier keys (instead of
1329@kbd{Control-Meta-}) by setting @code{foldout-mouse-modifiers}; but if
1330you have already loaded the @file{foldout.el} library, you must reload
1331it in order for this to take effect.
1332
1333 To use the Foldout package, you can type @kbd{M-x load-library
1334@key{RET} foldout @key{RET}}; or you can arrange for to do that
1335automatically by putting this in your @file{.emacs} file:
1336
1337@example
1338(eval-after-load "outline" '(require 'foldout))
1339@end example
1340
1341@node TeX Mode
1342@section @TeX{} Mode
1343@cindex @TeX{} mode
1344@cindex La@TeX{} mode
1345@cindex Sli@TeX{} mode
1346@cindex Doc@TeX{} mode
1347@cindex mode, @TeX{}
1348@cindex mode, La@TeX{}
1349@cindex mode, Sli@TeX{}
1350@cindex mode, Doc@TeX{}
1351@findex tex-mode
1352@findex plain-tex-mode
1353@findex latex-mode
1354@findex slitex-mode
1355@findex doctex-mode
3a5244ab
CY
1356@findex bibtex-mode
1357
1358 Emacs provides special major modes for editing files written in
1359@TeX{} and its related formats. @TeX{} is a powerful text formatter
1360written by Donald Knuth; like GNU Emacs, it is free software.
1361La@TeX{} is a simplified input format for @TeX{}, implemented using
1362@TeX{} macros. Doc@TeX{} is a special file format in which the
1363La@TeX{} sources are written, combining sources with documentation.
1364Sli@TeX{} is an obsolete special form of La@TeX{}.@footnote{It has
1365been replaced by the @samp{slides} document class, which comes with
1366La@TeX{}.}
8cf51b2c
GM
1367
1368@vindex tex-default-mode
1369 @TeX{} mode has four variants: Plain @TeX{} mode, La@TeX{} mode,
3a5244ab
CY
1370Doc@TeX{} mode, and Sli@TeX{} mode. These distinct major modes differ
1371only slightly, and are designed for editing the four different
1372formats. Emacs selects the appropriate mode by looking at the
1373contents of the buffer. (This is done by the @code{tex-mode} command,
1374which is normally called automatically when you visit a @TeX{}-like
1375file. @xref{Choosing Modes}.) If the contents are insufficient to
1376determine this, Emacs chooses the mode specified by the variable
1377@code{tex-default-mode}; its default value is @code{latex-mode}. If
1378Emacs does not guess right, you can select the correct variant of
1379@TeX{} mode using the command @kbd{M-x plain-tex-mode}, @kbd{M-x
1380latex-mode}, @kbd{M-x slitex-mode}, or @kbd{doctex-mode}.
1381
1382 Emacs also provides Bib@TeX{} mode, a major mode for editing
1383Bib@TeX{} files. Bib@TeX{} is a tool for storing and formatting
1384bibliographic references, which is commonly used together with
1385La@TeX{}. In addition, the Ref@TeX{} package provides a minor mode
1386which can be used in conjunction with La@TeX{} mode to manage
1387bibliographic references. @inforef{Top,, reftex}.
8cf51b2c
GM
1388
1389@menu
1390* Editing: TeX Editing. Special commands for editing in TeX mode.
1391* LaTeX: LaTeX Editing. Additional commands for LaTeX input files.
1392* Printing: TeX Print. Commands for printing part of a file with TeX.
1393* Misc: TeX Misc. Customization of TeX mode, and related features.
1394@end menu
1395
1396@node TeX Editing
1397@subsection @TeX{} Editing Commands
1398
8cf51b2c
GM
1399@table @kbd
1400@item "
1401Insert, according to context, either @samp{``} or @samp{"} or
1402@samp{''} (@code{tex-insert-quote}).
1403@item C-j
1404Insert a paragraph break (two newlines) and check the previous
1405paragraph for unbalanced braces or dollar signs
1406(@code{tex-terminate-paragraph}).
1407@item M-x tex-validate-region
1408Check each paragraph in the region for unbalanced braces or dollar signs.
1409@item C-c @{
1410Insert @samp{@{@}} and position point between them (@code{tex-insert-braces}).
1411@item C-c @}
1412Move forward past the next unmatched close brace (@code{up-list}).
1413@end table
1414
1415@findex tex-insert-quote
1416@kindex " @r{(@TeX{} mode)}
3a5244ab
CY
1417 In @TeX{}, the character @samp{"} is not normally used; instead,
1418quotations begin with @samp{``} and end with @samp{''}. For
1419convenience, @TeX{} mode overrides the normal meaning of the key
1420@kbd{"} with a command that inserts a pair of single-quotes or
1421backquotes (@code{tex-insert-quote}). To be precise, it inserts
1422@samp{``} after whitespace or an open brace, @samp{"} after a
1423backslash, and @samp{''} after any other character.
1424
1425 As a special exception, if you type @kbd{"} when the text before
1426point is either @samp{``} or @samp{''}, Emacs replaces that preceding
1427text with a single @samp{"} character. You can therefore type
1428@kbd{""} to insert @samp{"}, should you ever need to do so. (You can
1429also use @kbd{C-q "} to insert this character.)
1430
1431 To disable the @kbd{"} expansion feature, eliminate that binding in
1432the local map (@pxref{Key Bindings}).
8cf51b2c
GM
1433
1434 In @TeX{} mode, @samp{$} has a special syntax code which attempts to
1435understand the way @TeX{} math mode delimiters match. When you insert a
1436@samp{$} that is meant to exit math mode, the position of the matching
1437@samp{$} that entered math mode is displayed for a second. This is the
1438same feature that displays the open brace that matches a close brace that
1439is inserted. However, there is no way to tell whether a @samp{$} enters
1440math mode or leaves it; so when you insert a @samp{$} that enters math
1441mode, the previous @samp{$} position is shown as if it were a match, even
1442though they are actually unrelated.
1443
1444@findex tex-insert-braces
1445@kindex C-c @{ @r{(@TeX{} mode)}
1446@findex up-list
1447@kindex C-c @} @r{(@TeX{} mode)}
1448 @TeX{} uses braces as delimiters that must match. Some users prefer
1449to keep braces balanced at all times, rather than inserting them
1450singly. Use @kbd{C-c @{} (@code{tex-insert-braces}) to insert a pair of
1451braces. It leaves point between the two braces so you can insert the
1452text that belongs inside. Afterward, use the command @kbd{C-c @}}
1453(@code{up-list}) to move forward past the close brace.
1454
1455@findex tex-validate-region
1456@findex tex-terminate-paragraph
1457@kindex C-j @r{(@TeX{} mode)}
1458 There are two commands for checking the matching of braces. @kbd{C-j}
1459(@code{tex-terminate-paragraph}) checks the paragraph before point, and
1460inserts two newlines to start a new paragraph. It outputs a message in
1461the echo area if any mismatch is found. @kbd{M-x tex-validate-region}
1462checks a region, paragraph by paragraph. The errors are listed in the
1463@samp{*Occur*} buffer, and you can use @kbd{C-c C-c} or @kbd{Mouse-2} in
1464that buffer to go to a particular mismatch.
1465
1466 Note that Emacs commands count square brackets and parentheses in
1467@TeX{} mode, not just braces. This is not strictly correct for the
1468purpose of checking @TeX{} syntax. However, parentheses and square
3a5244ab
CY
1469brackets are likely to be used in text as matching delimiters, and it
1470is useful for the various motion commands and automatic match display
1471to work with them.
8cf51b2c
GM
1472
1473@node LaTeX Editing
1474@subsection La@TeX{} Editing Commands
1475
3a5244ab
CY
1476 La@TeX{} mode (and its obsolete variant, Sli@TeX{} mode) provide a
1477few extra features not applicable to plain @TeX{}:
8cf51b2c
GM
1478
1479@table @kbd
1480@item C-c C-o
1481Insert @samp{\begin} and @samp{\end} for La@TeX{} block and position
1482point on a line between them (@code{tex-latex-block}).
1483@item C-c C-e
1484Close the innermost La@TeX{} block not yet closed
1485(@code{tex-close-latex-block}).
1486@end table
1487
1488@findex tex-latex-block
1489@kindex C-c C-o @r{(La@TeX{} mode)}
1490@vindex latex-block-names
1491 In La@TeX{} input, @samp{\begin} and @samp{\end} commands are used to
1492group blocks of text. To insert a @samp{\begin} and a matching
1493@samp{\end} (on a new line following the @samp{\begin}), use @kbd{C-c
1494C-o} (@code{tex-latex-block}). A blank line is inserted between the
1495two, and point is left there. You can use completion when you enter the
1496block type; to specify additional block type names beyond the standard
1497list, set the variable @code{latex-block-names}. For example, here's
1498how to add @samp{theorem}, @samp{corollary}, and @samp{proof}:
1499
1500@example
1501(setq latex-block-names '("theorem" "corollary" "proof"))
1502@end example
1503
1504@findex tex-close-latex-block
1505@kindex C-c C-e @r{(La@TeX{} mode)}
1506 In La@TeX{} input, @samp{\begin} and @samp{\end} commands must
1507balance. You can use @kbd{C-c C-e} (@code{tex-close-latex-block}) to
1508insert automatically a matching @samp{\end} to match the last unmatched
1509@samp{\begin}. It indents the @samp{\end} to match the corresponding
1510@samp{\begin}. It inserts a newline after @samp{\end} if point is at
1511the beginning of a line.
1512
1513@node TeX Print
1514@subsection @TeX{} Printing Commands
1515
1516 You can invoke @TeX{} as an inferior of Emacs on either the entire
1517contents of the buffer or just a region at a time. Running @TeX{} in
1518this way on just one chapter is a good way to see what your changes
1519look like without taking the time to format the entire file.
1520
1521@table @kbd
1522@item C-c C-r
1523Invoke @TeX{} on the current region, together with the buffer's header
1524(@code{tex-region}).
1525@item C-c C-b
1526Invoke @TeX{} on the entire current buffer (@code{tex-buffer}).
1527@item C-c @key{TAB}
1528Invoke Bib@TeX{} on the current file (@code{tex-bibtex-file}).
1529@item C-c C-f
1530Invoke @TeX{} on the current file (@code{tex-file}).
1531@item C-c C-l
1532Recenter the window showing output from the inferior @TeX{} so that
1533the last line can be seen (@code{tex-recenter-output-buffer}).
1534@item C-c C-k
1535Kill the @TeX{} subprocess (@code{tex-kill-job}).
1536@item C-c C-p
1537Print the output from the last @kbd{C-c C-r}, @kbd{C-c C-b}, or @kbd{C-c
1538C-f} command (@code{tex-print}).
1539@item C-c C-v
1540Preview the output from the last @kbd{C-c C-r}, @kbd{C-c C-b}, or @kbd{C-c
1541C-f} command (@code{tex-view}).
1542@item C-c C-q
1543Show the printer queue (@code{tex-show-print-queue}).
1544@item C-c C-c
1545Invoke some other compilation command on the entire current buffer
1546(@code{tex-compile}).
1547@end table
1548
1549@findex tex-buffer
1550@kindex C-c C-b @r{(@TeX{} mode)}
1551@findex tex-print
1552@kindex C-c C-p @r{(@TeX{} mode)}
1553@findex tex-view
1554@kindex C-c C-v @r{(@TeX{} mode)}
1555@findex tex-show-print-queue
1556@kindex C-c C-q @r{(@TeX{} mode)}
1557 You can pass the current buffer through an inferior @TeX{} by means of
1558@kbd{C-c C-b} (@code{tex-buffer}). The formatted output appears in a
1559temporary file; to print it, type @kbd{C-c C-p} (@code{tex-print}).
1560Afterward, you can use @kbd{C-c C-q} (@code{tex-show-print-queue}) to
1561view the progress of your output towards being printed. If your terminal
1562has the ability to display @TeX{} output files, you can preview the
1563output on the terminal with @kbd{C-c C-v} (@code{tex-view}).
1564
1565@cindex @env{TEXINPUTS} environment variable
1566@vindex tex-directory
1567 You can specify the directory to use for running @TeX{} by setting the
1568variable @code{tex-directory}. @code{"."} is the default value. If
1569your environment variable @env{TEXINPUTS} contains relative directory
1570names, or if your files contains @samp{\input} commands with relative
1571file names, then @code{tex-directory} @emph{must} be @code{"."} or you
1572will get the wrong results. Otherwise, it is safe to specify some other
1573directory, such as @code{"/tmp"}.
1574
1575@vindex tex-run-command
1576@vindex latex-run-command
1577@vindex slitex-run-command
1578@vindex tex-dvi-print-command
1579@vindex tex-dvi-view-command
1580@vindex tex-show-queue-command
1581 If you want to specify which shell commands are used in the inferior @TeX{},
1582you can do so by setting the values of the variables @code{tex-run-command},
1583@code{latex-run-command}, @code{slitex-run-command},
1584@code{tex-dvi-print-command}, @code{tex-dvi-view-command}, and
1585@code{tex-show-queue-command}. The default values may
1586(or may not) be appropriate for your system.
1587
1588 Normally, the file name given to these commands comes at the end of
1589the command string; for example, @samp{latex @var{filename}}. In some
1590cases, however, the file name needs to be embedded in the command; an
1591example is when you need to provide the file name as an argument to one
1592command whose output is piped to another. You can specify where to put
1593the file name with @samp{*} in the command string. For example,
1594
1595@example
1596(setq tex-dvi-print-command "dvips -f * | lpr")
1597@end example
1598
1599@findex tex-kill-job
1600@kindex C-c C-k @r{(@TeX{} mode)}
1601@findex tex-recenter-output-buffer
1602@kindex C-c C-l @r{(@TeX{} mode)}
1603 The terminal output from @TeX{}, including any error messages, appears
1604in a buffer called @samp{*tex-shell*}. If @TeX{} gets an error, you can
1605switch to this buffer and feed it input (this works as in Shell mode;
1606@pxref{Interactive Shell}). Without switching to this buffer you can
1607scroll it so that its last line is visible by typing @kbd{C-c
1608C-l}.
1609
1610 Type @kbd{C-c C-k} (@code{tex-kill-job}) to kill the @TeX{} process if
1611you see that its output is no longer useful. Using @kbd{C-c C-b} or
1612@kbd{C-c C-r} also kills any @TeX{} process still running.
1613
1614@findex tex-region
1615@kindex C-c C-r @r{(@TeX{} mode)}
1616 You can also pass an arbitrary region through an inferior @TeX{} by typing
1617@kbd{C-c C-r} (@code{tex-region}). This is tricky, however, because most files
1618of @TeX{} input contain commands at the beginning to set parameters and
1619define macros, without which no later part of the file will format
1620correctly. To solve this problem, @kbd{C-c C-r} allows you to designate a
1621part of the file as containing essential commands; it is included before
1622the specified region as part of the input to @TeX{}. The designated part
1623of the file is called the @dfn{header}.
1624
1625@cindex header (@TeX{} mode)
1626 To indicate the bounds of the header in Plain @TeX{} mode, you insert two
1627special strings in the file. Insert @samp{%**start of header} before the
1628header, and @samp{%**end of header} after it. Each string must appear
1629entirely on one line, but there may be other text on the line before or
1630after. The lines containing the two strings are included in the header.
1631If @samp{%**start of header} does not appear within the first 100 lines of
1632the buffer, @kbd{C-c C-r} assumes that there is no header.
1633
1634 In La@TeX{} mode, the header begins with @samp{\documentclass} or
1635@samp{\documentstyle} and ends with @samp{\begin@{document@}}. These
1636are commands that La@TeX{} requires you to use in any case, so nothing
1637special needs to be done to identify the header.
1638
1639@findex tex-file
1640@kindex C-c C-f @r{(@TeX{} mode)}
1641 The commands (@code{tex-buffer}) and (@code{tex-region}) do all of their
1642work in a temporary directory, and do not have available any of the auxiliary
1643files needed by @TeX{} for cross-references; these commands are generally
1644not suitable for running the final copy in which all of the cross-references
1645need to be correct.
1646
1647 When you want the auxiliary files for cross references, use @kbd{C-c
1648C-f} (@code{tex-file}) which runs @TeX{} on the current buffer's file,
1649in that file's directory. Before running @TeX{}, it offers to save any
1650modified buffers. Generally, you need to use (@code{tex-file}) twice to
1651get the cross-references right.
1652
1653@vindex tex-start-options
1654 The value of the variable @code{tex-start-options} specifies
1655options for the @TeX{} run.
1656
1657@vindex tex-start-commands
1658 The value of the variable @code{tex-start-commands} specifies @TeX{}
1659commands for starting @TeX{}. The default value causes @TeX{} to run
1660in nonstop mode. To run @TeX{} interactively, set the variable to
1661@code{""}.
1662
1663@vindex tex-main-file
1664 Large @TeX{} documents are often split into several files---one main
1665file, plus subfiles. Running @TeX{} on a subfile typically does not
1666work; you have to run it on the main file. In order to make
1667@code{tex-file} useful when you are editing a subfile, you can set the
1668variable @code{tex-main-file} to the name of the main file. Then
1669@code{tex-file} runs @TeX{} on that file.
1670
1671 The most convenient way to use @code{tex-main-file} is to specify it
1672in a local variable list in each of the subfiles. @xref{File
1673Variables}.
1674
1675@findex tex-bibtex-file
1676@kindex C-c TAB @r{(@TeX{} mode)}
1677@vindex tex-bibtex-command
1678 For La@TeX{} files, you can use Bib@TeX{} to process the auxiliary
1679file for the current buffer's file. Bib@TeX{} looks up bibliographic
1680citations in a data base and prepares the cited references for the
1681bibliography section. The command @kbd{C-c @key{TAB}}
1682(@code{tex-bibtex-file}) runs the shell command
1683(@code{tex-bibtex-command}) to produce a @samp{.bbl} file for the
1684current buffer's file. Generally, you need to do @kbd{C-c C-f}
1685(@code{tex-file}) once to generate the @samp{.aux} file, then do
1686@kbd{C-c @key{TAB}} (@code{tex-bibtex-file}), and then repeat @kbd{C-c C-f}
1687(@code{tex-file}) twice more to get the cross-references correct.
1688
1689@findex tex-compile
1690@kindex C-c C-c @r{(@TeX{} mode)}
1691 To invoke some other compilation program on the current @TeX{}
1692buffer, type @kbd{C-c C-c} (@code{tex-compile}). This command knows
1693how to pass arguments to many common programs, including
1694@file{pdflatex}, @file{yap}, @file{xdvi}, and @file{dvips}. You can
1695select your desired compilation program using the standard completion
1696keys (@pxref{Completion}).
1697
1698@node TeX Misc
1699@subsection @TeX{} Mode Miscellany
1700
1701@vindex tex-shell-hook
1702@vindex tex-mode-hook
1703@vindex latex-mode-hook
1704@vindex slitex-mode-hook
1705@vindex plain-tex-mode-hook
1706 Entering any variant of @TeX{} mode runs the hooks
1707@code{text-mode-hook} and @code{tex-mode-hook}. Then it runs either
1708@code{plain-tex-mode-hook}, @code{latex-mode-hook}, or
1709@code{slitex-mode-hook}, whichever is appropriate. Starting the
1710@TeX{} shell runs the hook @code{tex-shell-hook}. @xref{Hooks}.
1711
1712@findex iso-iso2tex
1713@findex iso-tex2iso
1714@findex iso-iso2gtex
1715@findex iso-gtex2iso
1716@cindex Latin-1 @TeX{} encoding
1717@cindex @TeX{} encoding
1718 The commands @kbd{M-x iso-iso2tex}, @kbd{M-x iso-tex2iso}, @kbd{M-x
1719iso-iso2gtex} and @kbd{M-x iso-gtex2iso} can be used to convert
1720between Latin-1 encoded files and @TeX{}-encoded equivalents.
1721@ignore
1722@c Too cryptic to be useful, too cryptic for me to make it better -- rms.
1723 They
1724are included by default in the @code{format-alist} variable, so they
1725can be used with @kbd{M-x format-find-file}, for instance.
1726@end ignore
1727
1728@ignore @c Not worth documenting if it is only for Czech -- rms.
1729@findex tildify-buffer
1730@findex tildify-region
1731@cindex ties, @TeX{}, inserting
1732@cindex hard spaces, @TeX{}, inserting
1733 The commands @kbd{M-x tildify-buffer} and @kbd{M-x tildify-region}
1734insert @samp{~} (@dfn{tie}) characters where they are conventionally
1735required. This is set up for Czech---customize the group
1736@samp{tildify} for other languages or for other sorts of markup.
1737@end ignore
1738
1739@cindex Ref@TeX{} package
1740@cindex references, La@TeX{}
1741@cindex La@TeX{} references
1742 For managing all kinds of references for La@TeX{}, you can use
1743Ref@TeX{}. @inforef{Top,, reftex}.
1744
1745@node HTML Mode
1746@section SGML, XML, and HTML Modes
3a5244ab
CY
1747@cindex SGML mode
1748@cindex HTML mode
1749@cindex XML mode
1750@cindex mode, SGML
1751@cindex mode, HTML
1752@cindex mode, XML
1753@findex sgml-mode
1754@findex html-mode
1755@findex xml-mode
1756
1757 The major modes for SGML, XML, and HTML provide indentation support
1758and commands for operating on tags. XML mode is actually identical to
1759SGML mode (to be precise, @code{xml-mode} is an alias for
1760@code{sgml-mode}), because XML is a strict subset of SGML. HTML mode
1761is a slightly customized variant of SGML mode.
8cf51b2c 1762
3a5244ab
CY
1763@vindex sgml-xml-mode
1764 In XML, every opening tag must have an explicit closing tag. When
1765the variable @code{sgml-xml-mode} is non-@code{nil}, the tag insertion
1766commands described below always insert explicit closing tags as well.
1767When you visit a file, Emacs determines whether it is XML by examining
1768the file contents, and sets @code{sgml-xml-mode} accordingly.
8cf51b2c
GM
1769
1770@table @kbd
1771@item C-c C-n
1772@kindex C-c C-n @r{(SGML mode)}
1773@findex sgml-name-char
1774Interactively specify a special character and insert the SGML
1775@samp{&}-command for that character.
1776
1777@item C-c C-t
1778@kindex C-c C-t @r{(SGML mode)}
1779@findex sgml-tag
1780Interactively specify a tag and its attributes (@code{sgml-tag}).
1781This command asks you for a tag name and for the attribute values,
1782then inserts both the opening tag and the closing tag, leaving point
1783between them.
1784
1785With a prefix argument @var{n}, the command puts the tag around the
9a1c2249
CY
1786@var{n} words already present in the buffer after point. Whenever a
1787region is active, it puts the tag around the region (when Transient
1788Mark mode is off, it does this when a numeric argument of @minus{}1 is
1789supplied.)
8cf51b2c
GM
1790
1791@item C-c C-a
1792@kindex C-c C-a @r{(SGML mode)}
1793@findex sgml-attributes
1794Interactively insert attribute values for the current tag
1795(@code{sgml-attributes}).
1796
1797@item C-c C-f
1798@kindex C-c C-f @r{(SGML mode)}
1799@findex sgml-skip-tag-forward
1800Skip across a balanced tag group (which extends from an opening tag
1801through its corresponding closing tag) (@code{sgml-skip-tag-forward}).
1802A numeric argument acts as a repeat count.
1803
1804@item C-c C-b
1805@kindex C-c C-b @r{(SGML mode)}
1806@findex sgml-skip-tag-backward
1807Skip backward across a balanced tag group (which extends from an
1808opening tag through its corresponding closing tag)
1809(@code{sgml-skip-tag-forward}). A numeric argument acts as a repeat
1810count.
1811
1812@item C-c C-d
1813@kindex C-c C-d @r{(SGML mode)}
1814@findex sgml-delete-tag
1815Delete the tag at or after point, and delete the matching tag too
1816(@code{sgml-delete-tag}). If the tag at or after point is an opening
1817tag, delete the closing tag too; if it is a closing tag, delete the
1818opening tag too.
1819
1820@item C-c ? @var{tag} @key{RET}
1821@kindex C-c ? @r{(SGML mode)}
1822@findex sgml-tag-help
1823Display a description of the meaning of tag @var{tag}
1824(@code{sgml-tag-help}). If the argument @var{tag} is empty, describe
1825the tag at point.
1826
1827@item C-c /
1828@kindex C-c / @r{(SGML mode)}
1829@findex sgml-close-tag
1830Insert a close tag for the innermost unterminated tag
1831(@code{sgml-close-tag}). If called from within a tag or a comment,
1832close this element instead of inserting a close tag.
1833
1834@item C-c 8
1835@kindex C-c 8 @r{(SGML mode)}
1836@findex sgml-name-8bit-mode
1837Toggle a minor mode in which Latin-1 characters insert the
1838corresponding SGML commands that stand for them, instead of the
1839characters themselves (@code{sgml-name-8bit-mode}).
1840
1841@item C-c C-v
1842@kindex C-c C-v @r{(SGML mode)}
1843@findex sgml-validate
1844Run a shell command (which you must specify) to validate the current
1845buffer as SGML (@code{sgml-validate}).
1846
1847@item C-c TAB
1848@kindex C-c TAB @r{(SGML mode)}
1849@findex sgml-tags-invisible
1850Toggle the visibility of existing tags in the buffer. This can be
1851used as a cheap preview.
1852@end table
1853
3a5244ab
CY
1854@cindex nXML mode
1855@cindex mode, nXML
1856@findex nxml-mode
1857@cindex XML schema
1858 Emacs also provides a more advanced mode mode for editing XML
1859documents, called nXML mode (@code{nxml-mode}). nXML mode is aware of
1860many existing XML schema, and uses them to provide completion of XML
1861elements via @kbd{C-@key{RET}} or @kbd{M-@key{TAB}}, as well as
1862``on-the-fly'' validation of XML, with errors highlighted via Font
1863Lock (@pxref{Font Lock}). It is described in its own manual.
1864@xref{Top, nXML Mode,,nxml-mode, nXML Mode}.
8cf51b2c
GM
1865
1866@node Nroff Mode
1867@section Nroff Mode
1868
1869@cindex nroff
1870@findex nroff-mode
1871 Nroff mode is a mode like Text mode but modified to handle nroff commands
1872present in the text. Invoke @kbd{M-x nroff-mode} to enter this mode. It
1873differs from Text mode in only a few ways. All nroff command lines are
1874considered paragraph separators, so that filling will never garble the
1875nroff commands. Pages are separated by @samp{.bp} commands. Comments
1876start with backslash-doublequote. Also, three special commands are
1877provided that are not in Text mode:
1878
1879@findex forward-text-line
1880@findex backward-text-line
1881@findex count-text-lines
1882@kindex M-n @r{(Nroff mode)}
1883@kindex M-p @r{(Nroff mode)}
1884@kindex M-? @r{(Nroff mode)}
1885@table @kbd
1886@item M-n
1887Move to the beginning of the next line that isn't an nroff command
1888(@code{forward-text-line}). An argument is a repeat count.
1889@item M-p
1890Like @kbd{M-n} but move up (@code{backward-text-line}).
1891@item M-?
1892Displays in the echo area the number of text lines (lines that are not
1893nroff commands) in the region (@code{count-text-lines}).
1894@end table
1895
1896@findex electric-nroff-mode
1897 The other feature of Nroff mode is that you can turn on Electric Nroff
1898mode. This is a minor mode that you can turn on or off with @kbd{M-x
1899electric-nroff-mode} (@pxref{Minor Modes}). When the mode is on, each
1900time you use @key{RET} to end a line that contains an nroff command that
1901opens a kind of grouping, the matching nroff command to close that
1902grouping is automatically inserted on the following line. For example,
1903if you are at the beginning of a line and type @kbd{.@: ( b @key{RET}},
1904this inserts the matching command @samp{.)b} on a new line following
1905point.
1906
1907 If you use Outline minor mode with Nroff mode (@pxref{Outline Mode}),
1908heading lines are lines of the form @samp{.H} followed by a number (the
1909header level).
1910
1911@vindex nroff-mode-hook
1912 Entering Nroff mode runs the hook @code{text-mode-hook}, followed by
1913the hook @code{nroff-mode-hook} (@pxref{Hooks}).
1914
1915@node Formatted Text
1916@section Editing Formatted Text
1917
1918@cindex Enriched mode
1919@cindex mode, Enriched
1920@cindex formatted text
1921@cindex WYSIWYG
1922@cindex word processing
1923 @dfn{Enriched mode} is a minor mode for editing files that contain
1924formatted text in WYSIWYG fashion, as in a word processor. Currently,
1925formatted text in Enriched mode can specify fonts, colors, underlining,
1926margins, and types of filling and justification. In the future, we plan
1927to implement other formatting features as well.
1928
1929 Enriched mode is a minor mode (@pxref{Minor Modes}). It is
1930typically used in conjunction with Text mode (@pxref{Text Mode}), but
1931you can also use it with other major modes such as Outline mode and
1932Paragraph-Indent Text mode.
1933
1934@cindex text/enriched MIME format
1935 Potentially, Emacs can store formatted text files in various file
1936formats. Currently, only one format is implemented: @dfn{text/enriched}
1937format, which is defined by the MIME protocol. @xref{Format
1938Conversion,, Format Conversion, elisp, the Emacs Lisp Reference Manual},
1939for details of how Emacs recognizes and converts file formats.
1940
1941 The Emacs distribution contains a formatted text file that can serve as
1942an example. Its name is @file{etc/enriched.doc}. It contains samples
1943illustrating all the features described in this section. It also
1944contains a list of ideas for future enhancements.
1945
1946@menu
1947* Requesting Formatted Text:: Entering and exiting Enriched mode.
1948* Hard and Soft Newlines:: There are two different kinds of newlines.
1949* Editing Format Info:: How to edit text properties.
1950* Faces: Format Faces. Bold, italic, underline, etc.
1951* Color: Format Colors. Changing the color of text.
1952* Indent: Format Indentation. Changing the left and right margins.
1953* Justification: Format Justification.
1954 Centering, setting text flush with the
1955 left or right margin, etc.
9f9695a6 1956* Special: Format Properties. The "special" text properties submenu.
8cf51b2c
GM
1957* Forcing Enriched Mode:: How to force use of Enriched mode.
1958@end menu
1959
1960@node Requesting Formatted Text
1961@subsection Requesting to Edit Formatted Text
1962
1963 Whenever you visit a file that Emacs saved in the text/enriched
1964format, Emacs automatically converts the formatting information in the
1965file into Emacs's own internal format (known as @dfn{text
1966properties}), and turns on Enriched mode.
1967
1968@findex enriched-mode
1969 To create a new file of formatted text, first visit the nonexistent
1970file, then type @kbd{M-x enriched-mode} before you start inserting text.
1971This command turns on Enriched mode. Do this before you begin inserting
1972text, to ensure that the text you insert is handled properly.
1973
1974 More generally, the command @code{enriched-mode} turns Enriched mode
1975on if it was off, and off if it was on. With a prefix argument, this
1976command turns Enriched mode on if the argument is positive, and turns
1977the mode off otherwise.
1978
1979 When you save a buffer while Enriched mode is enabled in it, Emacs
1980automatically converts the text to text/enriched format while writing it
1981into the file. When you visit the file again, Emacs will automatically
1982recognize the format, reconvert the text, and turn on Enriched mode
1983again.
1984
1985@vindex enriched-translations
1986 You can add annotations for saving additional text properties, which
1987Emacs normally does not save, by adding to @code{enriched-translations}.
1988Note that the text/enriched standard requires any non-standard
1989annotations to have names starting with @samp{x-}, as in
1990@samp{x-read-only}. This ensures that they will not conflict with
1991standard annotations that may be added later.
1992
1993 @xref{Text Properties,,, elisp, the Emacs Lisp Reference Manual},
1994for more information about text properties.
1995
1996@node Hard and Soft Newlines
1997@subsection Hard and Soft Newlines
1998@cindex hard newline
1999@cindex soft newline
2000@cindex newlines, hard and soft
2001
2002@cindex use-hard-newlines
2003 In formatted text, Emacs distinguishes between two different kinds of
2004newlines, @dfn{hard} newlines and @dfn{soft} newlines. (You can enable
2005or disable this feature separately in any buffer with the command
2006@code{use-hard-newlines}.)
2007
2008 Hard newlines are used to separate paragraphs, or items in a list, or
2009anywhere that there should always be a line break regardless of the
2010margins. The @key{RET} command (@code{newline}) and @kbd{C-o}
2011(@code{open-line}) insert hard newlines.
2012
2013 Soft newlines are used to make text fit between the margins. All the
2014fill commands, including Auto Fill, insert soft newlines---and they
2015delete only soft newlines.
2016
2017 Although hard and soft newlines look the same, it is important to bear
2018the difference in mind. Do not use @key{RET} to break lines in the
2019middle of filled paragraphs, or else you will get hard newlines that are
2020barriers to further filling. Instead, let Auto Fill mode break lines,
2021so that if the text or the margins change, Emacs can refill the lines
2022properly. @xref{Auto Fill}.
2023
2024 On the other hand, in tables and lists, where the lines should always
2025remain as you type them, you can use @key{RET} to end lines. For these
2026lines, you may also want to set the justification style to
2027@code{unfilled}. @xref{Format Justification}.
2028
2029@node Editing Format Info
2030@subsection Editing Format Information
2031
2032 There are two ways to alter the formatting information for a formatted
2033text file: with keyboard commands, and with the mouse.
2034
2035 The easiest way to add properties to your document is with the Text
2036Properties menu. You can get to this menu in two ways: from the Edit
2037menu in the menu bar (use @kbd{@key{F10} e t} if you have no mouse),
2038or with @kbd{C-Mouse-2} (hold the @key{CTRL} key and press the middle
2039mouse button). There are also keyboard commands described in the
2040following section.
2041
9f9695a6 2042 These items in the Text Properties menu run commands directly:
8cf51b2c
GM
2043
2044@table @code
2045@findex facemenu-remove-face-props
2046@item Remove Face Properties
2047Delete from the region all face and color text properties
2048(@code{facemenu-remove-face-props}).
2049
2050@findex facemenu-remove-all
2051@item Remove Text Properties
2052Delete @emph{all} text properties from the region
2053(@code{facemenu-remove-all}).
2054
2055@findex describe-text-properties
2056@cindex text properties of characters
2057@cindex overlays at character position
2058@cindex widgets at buffer position
2059@cindex buttons at buffer position
2060@item Describe Properties
2061List all the text properties, widgets, buttons, and overlays of the
2062character following point (@code{describe-text-properties}).
2063
2064@item Display Faces
2065Display a list of all the defined faces (@code{list-faces-display}).
2066
2067@item Display Colors
2068Display a list of all the defined colors (@code{list-colors-display}).
2069@end table
2070
9f9695a6
RS
2071@ifinfo
2072 Other items in the Text Properties menu lead to submenus:
2073
2074@menu
2075* Faces: Format Faces. Bold, italic, underline, etc.
2076* Color: Format Colors. Changing the color of text.
2077* Indent: Format Indentation. Changing the left and right margins.
2078* Justification: Format Justification.
2079 Centering, setting text flush with the
2080 left or right margin, etc.
2081* Special: Format Properties. The "special" text properties submenu.
2082@end menu
2083@end ifinfo
2084@ifnotinfo
2085 The rest lead to submenus which are described in the following sections.
2086@end ifnotinfo
2087
8cf51b2c
GM
2088@node Format Faces
2089@subsection Faces in Formatted Text
2090
9f9695a6
RS
2091 The Faces submenu under Text Properties lists various Emacs faces
2092including @code{bold}, @code{italic}, and @code{underline}
2093(@pxref{Faces}). These menu items operate on the region if it is
2094active and nonempty. Otherwise, they specify to use that face for an
2095immediately following self-inserting character. There is also an item
2096@samp{Other} with which you can enter a face name through the
2097minibuffer (@pxref{Standard Faces}).
2098
2099 Instead of the Faces submenu, you can use these keyboard commands:
8cf51b2c
GM
2100
2101@table @kbd
2102@kindex M-o d @r{(Enriched mode)}
2103@findex facemenu-set-default
2104@item M-o d
2105Remove all @code{face} properties from the region (which includes
2106specified colors), or force the following inserted character to have no
2107@code{face} property (@code{facemenu-set-default}).
2108@kindex M-o b @r{(Enriched mode)}
2109@findex facemenu-set-bold
2110@item M-o b
2111Add the face @code{bold} to the region or to the following inserted
2112character (@code{facemenu-set-bold}).
2113@kindex M-o i @r{(Enriched mode)}
2114@findex facemenu-set-italic
2115@item M-o i
2116Add the face @code{italic} to the region or to the following inserted
2117character (@code{facemenu-set-italic}).
2118@kindex M-o l @r{(Enriched mode)}
2119@findex facemenu-set-bold-italic
2120@item M-o l
2121Add the face @code{bold-italic} to the region or to the following
2122inserted character (@code{facemenu-set-bold-italic}).
2123@kindex M-o u @r{(Enriched mode)}
2124@findex facemenu-set-underline
2125@item M-o u
2126Add the face @code{underline} to the region or to the following inserted
2127character (@code{facemenu-set-underline}).
2128@kindex M-o o @r{(Enriched mode)}
2129@findex facemenu-set-face
2130@item M-o o @var{face} @key{RET}
2131Add the face @var{face} to the region or to the following inserted
2132character (@code{facemenu-set-face}).
2133@end table
2134
2135 With a prefix argument, all these commands apply to an immediately
2136following self-inserting character, disregarding the region.
2137
2138 A self-inserting character normally inherits the @code{face}
2139property (and most other text properties) from the preceding character
2140in the buffer. If you use the above commands to specify face for the
2141next self-inserting character, or the next section's commands to
2142specify a foreground or background color for it, then it does not
2143inherit the @code{face} property from the preceding character; instead
2144it uses whatever you specified. It will still inherit other text
2145properties, though.
2146
2147 Strictly speaking, these commands apply only to the first following
2148self-inserting character that you type. But if you insert additional
2149characters after it, they will inherit from the first one. So it
2150appears that these commands apply to all of them.
2151
2152 Enriched mode defines two additional faces: @code{excerpt} and
2153@code{fixed}. These correspond to codes used in the text/enriched file
2154format.
2155
2156 The @code{excerpt} face is intended for quotations. This face is the
2157same as @code{italic} unless you customize it (@pxref{Face Customization}).
2158
2159 The @code{fixed} face means, ``Use a fixed-width font for this part
2160of the text.'' Applying the @code{fixed} face to a part of the text
2161will cause that part of the text to appear in a fixed-width font, even
2162if the default font is variable-width. This applies to Emacs and to
2163other systems that display text/enriched format. So if you
2164specifically want a certain part of the text to use a fixed-width
2165font, you should specify the @code{fixed} face for that part.
2166
2167 By default, the @code{fixed} face looks the same as @code{bold}.
2168This is an attempt to distinguish it from @code{default}. You may
2169wish to customize @code{fixed} to some other fixed-width medium font.
2170@xref{Face Customization}.
2171
2172 If your terminal cannot display different faces, you will not be
2173able to see them, but you can still edit documents containing faces,
2174and even add faces and colors to documents. The faces you specify
2175will be visible when the file is viewed on a terminal that can display
2176them.
2177
2178@node Format Colors
2179@subsection Colors in Formatted Text
2180
2181 You can specify foreground and background colors for portions of the
9a1c2249 2182text. Under Text Properties, there is a submenu for specifying the
9f9695a6
RS
2183foreground color, and a submenu for specifying the background color.
2184Each one lists all the colors that you have used in Enriched mode in
2185the current Emacs session.
8cf51b2c 2186
9a1c2249
CY
2187 If the region is active, the command applies to the text in the
2188region; otherwise, it applies to any immediately following
2189self-inserting input. When Transient Mark mode is off
2190(@pxref{Persistent Mark}), it always applies to the region unless a
2191prefix argument is given, in which case it applies to the following
2192input.
8cf51b2c 2193
9f9695a6
RS
2194 Each of the two color submenus contains one additional item:
2195@samp{Other}. You can use this item to specify a color that is not
2196listed in the menu; it reads the color name with the minibuffer. To
2197display a list of available colors and their names, use the
2198@samp{Display Colors} menu item in the Text Properties menu
2199(@pxref{Editing Format Info}).
8cf51b2c
GM
2200
2201 Any color that you specify in this way, or that is mentioned in a
2202formatted text file that you read in, is added to the corresponding
2203color menu for the duration of the Emacs session.
2204
2205@findex facemenu-set-foreground
2206@findex facemenu-set-background
2207 There are no predefined key bindings for specifying colors, but you can do so
2208with the extended commands @kbd{M-x facemenu-set-foreground} and
2209@kbd{M-x facemenu-set-background}. Both of these commands read the name
2210of the color with the minibuffer.
2211
2212@node Format Indentation
2213@subsection Indentation in Formatted Text
2214
2215 When editing formatted text, you can specify different amounts of
2216indentation for the right or left margin of an entire paragraph or a
2217part of a paragraph. The margins you specify automatically affect the
2218Emacs fill commands (@pxref{Filling}) and line-breaking commands.
2219
9f9695a6
RS
2220 The Indentation submenu of Text Properties provides a convenient
2221interface for specifying these properties. The submenu contains four
2222items:
8cf51b2c
GM
2223
2224@table @code
2225@kindex C-x TAB @r{(Enriched mode)}
2226@findex increase-left-margin
2227@item Indent More
2228Indent the region by 4 columns (@code{increase-left-margin}). In
2229Enriched mode, this command is also available on @kbd{C-x @key{TAB}}; if
2230you supply a numeric argument, that says how many columns to add to the
2231margin (a negative argument reduces the number of columns).
2232
2233@item Indent Less
2234Remove 4 columns of indentation from the region.
2235
2236@item Indent Right More
2237Make the text narrower by indenting 4 columns at the right margin.
2238
2239@item Indent Right Less
2240Remove 4 columns of indentation from the right margin.
2241@end table
2242
2243 You can use these commands repeatedly to increase or decrease the
2244indentation.
2245
2246 The most common way to use them is to change the indentation of an
2247entire paragraph. For other uses, the effects of refilling can be
2248hard to predict, except in some special cases like the one described
2249next.
2250
2251 The most common other use is to format paragraphs with @dfn{hanging
2252indents}, which means that the first line is indented less than
2253subsequent lines. To set up a hanging indent, increase the
2254indentation of the region starting after the first word of the
2255paragraph and running until the end of the paragraph.
2256
2257 Indenting the first line of a paragraph is easier. Set the margin for
2258the whole paragraph where you want it to be for the body of the
2259paragraph, then indent the first line by inserting extra spaces or tabs.
2260
2261@vindex standard-indent
2262 The variable @code{standard-indent} specifies how many columns these
2263commands should add to or subtract from the indentation. The default
2264value is 4. The overall default right margin for Enriched mode is
2265controlled by the variable @code{fill-column}, as usual.
2266
2267@kindex C-c [ @r{(Enriched mode)}
2268@kindex C-c ] @r{(Enriched mode)}
2269@findex set-left-margin
2270@findex set-right-margin
2271 There are also two commands for setting the left or right margin of
2272the region absolutely: @code{set-left-margin} and
2273@code{set-right-margin}. Enriched mode binds these commands to
2274@kbd{C-c [} and @kbd{C-c ]}, respectively. You can specify the
2275margin width either with a numeric argument or in the minibuffer.
2276
2277 Sometimes, as a result of editing, the filling of a paragraph becomes
2278messed up---parts of the paragraph may extend past the left or right
ad6d10b1 2279margins. When this happens, use @kbd{M-q} (@code{fill-paragraph}) to
8cf51b2c
GM
2280refill the paragraph.
2281
2282 The fill prefix, if any, works in addition to the specified paragraph
2283indentation: @kbd{C-x .} does not include the specified indentation's
2284whitespace in the new value for the fill prefix, and the fill commands
2285look for the fill prefix after the indentation on each line. @xref{Fill
2286Prefix}.
2287
2288@node Format Justification
2289@subsection Justification in Formatted Text
2290
2291 When editing formatted text, you can specify various styles of
2292justification for a paragraph. The style you specify automatically
2293affects the Emacs fill commands.
2294
9f9695a6
RS
2295 The Justification submenu of Text Properties provides a convenient
2296interface for specifying the style. The submenu contains five items:
8cf51b2c
GM
2297
2298@table @code
2299@item Left
2300This is the most common style of justification (at least for English).
2301Lines are aligned at the left margin but left uneven at the right.
2302
2303@item Right
2304This aligns each line with the right margin. Spaces and tabs are added
2305on the left, if necessary, to make lines line up on the right.
2306
2307@item Full
2308This justifies the text, aligning both edges of each line. Justified
2309text looks very nice in a printed book, where the spaces can all be
2310adjusted equally, but it does not look as nice with a fixed-width font
2311on the screen. Perhaps a future version of Emacs will be able to adjust
2312the width of spaces in a line to achieve elegant justification.
2313
2314@item Center
2315This centers every line between the current margins.
2316
2317@item Unfilled
2318This turns off filling entirely. Each line will remain as you wrote it;
2319the fill and auto-fill functions will have no effect on text which has
2320this setting. You can, however, still indent the left margin. In
2321unfilled regions, all newlines are treated as hard newlines (@pxref{Hard
2322and Soft Newlines}) .
2323@end table
2324
2325 In Enriched mode, you can also specify justification from the keyboard
2326using the @kbd{M-j} prefix character:
2327
2328@table @kbd
2329@kindex M-j l @r{(Enriched mode)}
2330@findex set-justification-left
2331@item M-j l
2332Make the region left-filled (@code{set-justification-left}).
2333@kindex M-j r @r{(Enriched mode)}
2334@findex set-justification-right
2335@item M-j r
2336Make the region right-filled (@code{set-justification-right}).
2337@kindex M-j b @r{(Enriched mode)}
2338@findex set-justification-full
2339@item M-j b
2340Make the region fully justified (@code{set-justification-full}).
2341@kindex M-j c @r{(Enriched mode)}
2342@kindex M-S @r{(Enriched mode)}
2343@findex set-justification-center
2344@item M-j c
2345@itemx M-S
2346Make the region centered (@code{set-justification-center}).
2347@kindex M-j u @r{(Enriched mode)}
2348@findex set-justification-none
2349@item M-j u
2350Make the region unfilled (@code{set-justification-none}).
2351@end table
2352
2353 Justification styles apply to entire paragraphs. All the
2354justification-changing commands operate on the paragraph containing
2355point, or, if the region is active, on all paragraphs which overlap the
2356region.
2357
2358@vindex default-justification
2359 The default justification style is specified by the variable
2360@code{default-justification}. Its value should be one of the symbols
2361@code{left}, @code{right}, @code{full}, @code{center}, or @code{none}.
2362This is a per-buffer variable. Setting the variable directly affects
2363only the current buffer. However, customizing it in a Custom buffer
2364sets (as always) the default value for buffers that do not override it.
2365@xref{Locals}, and @ref{Easy Customization}.
2366
2367@node Format Properties
2368@subsection Setting Other Text Properties
2369
9f9695a6
RS
2370 The Special Properties submenu of Text Properties can add or remove
2371three other useful text properties: @code{read-only}, @code{invisible}
2372and @code{intangible}. The @code{intangible} property disallows
2373moving point within the text, the @code{invisible} text property hides
2374text from display, and the @code{read-only} property disallows
2375alteration of the text.
8cf51b2c
GM
2376
2377 Each of these special properties has a menu item to add it to the
2378region. The last menu item, @samp{Remove Special}, removes all of these
2379special properties from the text in the region.
2380
2381 Currently, the @code{invisible} and @code{intangible} properties are
2382@emph{not} saved in the text/enriched format. The @code{read-only}
2383property is saved, but it is not a standard part of the text/enriched
2384format, so other editors may not respect it.
2385
2386@node Forcing Enriched Mode
2387@subsection Forcing Enriched Mode
2388
2389 Normally, Emacs knows when you are editing formatted text because it
2390recognizes the special annotations used in the file that you visited.
2391However, sometimes you must take special actions to convert file
2392contents or turn on Enriched mode:
2393
2394@itemize @bullet
2395@item
2396When you visit a file that was created with some other editor, Emacs may
2397not recognize the file as being in the text/enriched format. In this
2398case, when you visit the file you will see the formatting commands
2399rather than the formatted text. Type @kbd{M-x format-decode-buffer} to
2400translate it. This also automatically turns on Enriched mode.
2401
2402@item
2403When you @emph{insert} a file into a buffer, rather than visiting it,
2404Emacs does the necessary conversions on the text which you insert, but
2405it does not enable Enriched mode. If you wish to do that, type @kbd{M-x
2406enriched-mode}.
2407@end itemize
2408
2409 The command @code{format-decode-buffer} translates text in various
2410formats into Emacs's internal format. It asks you to specify the format
2411to translate from; however, normally you can type just @key{RET}, which
2412tells Emacs to guess the format.
2413
2414@findex format-find-file
2415 If you wish to look at a text/enriched file in its raw form, as a
2416sequence of characters rather than as formatted text, use the @kbd{M-x
2417find-file-literally} command. This visits a file, like
2418@code{find-file}, but does not do format conversion. It also inhibits
2419character code conversion (@pxref{Coding Systems}) and automatic
2420uncompression (@pxref{Compressed Files}). To disable format conversion
2421but allow character code conversion and/or automatic uncompression if
2422appropriate, use @code{format-find-file} with suitable arguments.
2423
2424@node Text Based Tables
2425@section Editing Text-based Tables
2426@cindex table mode
2427@cindex text-based tables
2428
2429 Table mode provides an easy and intuitive way to create and edit WYSIWYG
2430text-based tables. Here is an example of such a table:
2431
2432@smallexample
2433@group
2434+-----------------+--------------------------------+-----------------+
2435| Command | Description | Key Binding |
2436+-----------------+--------------------------------+-----------------+
2437| forward-char |Move point right N characters | C-f |
2438| |(left if N is negative). | |
2439| | | |
2440| |On reaching end of buffer, stop | |
2441| |and signal error. | |
2442+-----------------+--------------------------------+-----------------+
2443| backward-char |Move point left N characters | C-b |
2444| |(right if N is negative). | |
2445| | | |
2446| |On attempt to pass beginning or | |
2447| |end of buffer, stop and signal | |
2448| |error. | |
2449+-----------------+--------------------------------+-----------------+
2450@end group
2451@end smallexample
2452
2453 Table mode allows the contents of the table such as this one to be
2454easily manipulated by inserting or deleting characters inside a cell.
2455A cell is effectively a localized rectangular edit region and edits to
2456a cell do not affect the contents of the surrounding cells. If the
2457contents do not fit into a cell, then the cell is automatically
2458expanded in the vertical and/or horizontal directions and the rest of
2459the table is restructured and reformatted in accordance with the
2460growth of the cell.
2461
2462@menu
2463* Table Definition:: What is a text based table.
2464* Table Creation:: How to create a table.
2465* Table Recognition:: How to activate and deactivate tables.
2466* Cell Commands:: Cell-oriented commands in a table.
2467* Cell Justification:: Justifying cell contents.
2468* Row Commands:: Manipulating rows of table cell.
2469* Column Commands:: Manipulating columns of table cell.
2470* Fixed Width Mode:: Fixing cell width.
2471* Table Conversion:: Converting between plain text and tables.
2472* Measuring Tables:: Analyzing table dimension.
2473* Table Misc:: Table miscellany.
2474@end menu
2475
2476@node Table Definition
2477@subsection What is a Text-based Table?
2478
2479 Keep the following examples of valid tables in mind as a reference
2480while you read this section:
2481
2482@example
2483 +--+----+---+ +-+ +--+-----+
2484 | | | | | | | | |
2485 +--+----+---+ +-+ | +--+--+
2486 | | | | | | | |
2487 +--+----+---+ +--+--+ |
2488 | | |
2489 +-----+--+
2490@end example
2491
2492 A table consists of a rectangular frame whose inside is divided into
2493cells. Each cell must be at least one character wide and one
2494character high, not counting its border lines. A cell can be
2495subdivided into multiple rectangular cells, but cells cannot overlap.
2496
2497 The table frame and cell border lines are made of three special
2498characters. These variables specify those characters:
2499
2500@table @code
2501@vindex table-cell-vertical-char
2502@item table-cell-vertical-char
2503Holds the character used for vertical lines. The default value is
2504@samp{|}.
2505
1b2679cf
SM
2506@vindex table-cell-horizontal-chars
2507@item table-cell-horizontal-chars
2508Holds the characters used for horizontal lines. The default value is
2509@samp{"-="}.
8cf51b2c
GM
2510
2511@vindex table-cell-intersection-char
2512@item table-cell-intersection-char
2513Holds the character used at where horizontal line and vertical line
2514meet. The default value is @samp{+}.
2515@end table
2516
2517@noindent
2518Based on this definition, the following five tables are examples of invalid
2519tables:
2520
2521@example
2522 +-----+ +-----+ +--+ +-++--+ ++
2523 | | | | | | | || | ++
2524 | +-+ | | | | | | || |
2525 | | | | +--+ | +--+--+ +-++--+
2526 | +-+ | | | | | | | +-++--+
2527 | | | | | | | | | || |
2528 +-----+ +--+--+ +--+--+ +-++--+
2529 a b c d e
2530@end example
2531
2532From left to right:
2533
2534@enumerate a
2535@item
2536Overlapped cells or non-rectangular cells are not allowed.
2537@item
2538Same as a.
2539@item
2540The border must be rectangular.
2541@item
2542Cells must have a minimum width/height of one character.
2543@item
2544Same as d.
2545@end enumerate
2546
2547@node Table Creation
2548@subsection How to Create a Table?
2549@cindex create a text-based table
2550@cindex table creation
2551
2552@findex table-insert
2553 The command to create a table is @code{table-insert}. When called
2554interactively, it asks for the number of columns, number of rows, cell
2555width and cell height. The number of columns is the number of cells
2556horizontally side by side. The number of rows is the number of cells
2557vertically within the table's height. The cell width is a number of
2558characters that each cell holds, left to right. The cell height is a
2559number of lines each cell holds. The cell width and the cell height
2560can be either an integer (when the value is constant across the table)
2561or a series of integer, separated by spaces or commas, where each
2562number corresponds to the next cell within a row from left to right,
2563or the next cell within a column from top to bottom.
2564
2565@node Table Recognition
2566@subsection Table Recognition
2567@cindex table recognition
2568
2569@findex table-recognize
2570@findex table-unrecognize
2571 Table mode maintains special text properties in the buffer to allow
2572editing in a convenient fashion. When a buffer with tables is saved
2573to its file, these text properties are lost, so when you visit this
2574file again later, Emacs does not see a table, but just formatted text.
2575To resurrect the table text properties, issue the @kbd{M-x
2576table-recognize} command. It scans the current buffer, recognizes
2577valid table cells, and attaches appropriate text properties to allow
2578for table editing. The converse command, @code{table-unrecognize}, is
2579used to remove the special text properties and convert the buffer back
2580to plain text.
2581
2582 Special commands exist to enable or disable tables within a region,
2583enable or disable individual tables, and enable/disable individual
2584cells. These commands are:
2585
2586@table @kbd
2587@findex table-recognize-region
2588@item M-x table-recognize-region
2589Recognize tables within the current region and activate them.
2590@findex table-unrecognize-region
2591@item M-x table-unrecognize-region
2592Deactivate tables within the current region.
2593@findex table-recognize-table
2594@item M-x table-recognize-table
2595Recognize the table under point and activate it.
2596@findex table-unrecognize-table
2597@item M-x table-unrecognize-table
2598Deactivate the table under point.
2599@findex table-recognize-cell
2600@item M-x table-recognize-cell
2601Recognize the cell under point and activate it.
2602@findex table-unrecognize-cell
2603@item M-x table-unrecognize-cell
2604Deactivate the cell under point.
2605@end table
2606
2607 For another way of converting text into tables, see @ref{Table
2608Conversion}.
2609
2610@node Cell Commands
2611@subsection Commands for Table Cells
2612
2613@findex table-forward-cell
2614@findex table-backward-cell
2615 The commands @code{table-forward-cell} and
2616@code{table-backward-cell} move point from the current cell to an
2617adjacent cell forward and backward respectively. The order of the
2618cells is cyclic: when point is in the last cell of a table, typing
2619@kbd{M-x table-forward-cell} moves to the first cell in the table.
2620Likewise @kbd{M-x table-backward-cell} from the first cell in a table
2621moves to the last cell.
2622
2623@findex table-span-cell
2624 The command @code{table-span-cell} merges the current cell with the
2625adjacent cell in a specified direction---right, left, above or below.
2626You specify the direction with the minibuffer. It does not allow
2627merges which don't result in a legitimate cell layout.
2628
2629@findex table-split-cell
2630@cindex text-based tables, split a cell
2631@cindex split table cell
2632 The command @code{table-split-cell} splits the current cell
2633vertically or horizontally. This command is a wrapper to the
2634direction specific commands @code{table-split-cell-vertically} and
2635@code{table-split-cell-horizontally}. You specify the direction with
2636a minibuffer argument.
2637
2638@findex table-split-cell-vertically
2639 The command @code{table-split-cell-vertically} splits the current
2640cell vertically and creates a pair of cells above and below where
2641point is located. The content in the original cell is split as well.
2642
2643@findex table-split-cell-horizontally
2644 The command @code{table-split-cell-horizontally} splits the current
2645cell horizontally and creates a pair of cells right and left of where
2646point is located. If the cell being split is not empty, this asks you
2647how to handle the cell contents. The three options are: @code{split},
2648@code{left}, or @code{right}. @code{split} splits the contents at
2649point literally, while the @code{left} and @code{right} options move
2650the entire contents into the left or right cell respectively.
2651
2652@cindex enlarge a table cell
2653@cindex shrink a table cell
2654 The next four commands enlarge or shrink a cell. They use numeric
2655arguments (@pxref{Arguments}) to specify how many columns or rows to
2656enlarge or shrink a particular table.
2657
2658@table @kbd
2659@findex table-heighten-cell
2660@item M-x table-heighten-cell
2661Enlarge the current cell vertically.
2662@findex table-shorten-cell
2663@item M-x table-shorten-cell
2664Shrink the current cell vertically.
2665@findex table-widen-cell
2666@item M-x table-widen-cell
2667Enlarge the current cell horizontally.
2668@findex table-narrow-cell
2669@item M-x table-narrow-cell
2670Shrink the current cell horizontally.
2671@end table
2672
2673@node Cell Justification
2674@subsection Cell Justification
2675@cindex cell text justification
2676
2677 You can specify text justification for each cell. The justification
2678is remembered independently for each cell and the subsequent editing
2679of cell contents is subject to the specified justification.
2680
2681@findex table-justify
2682 The command @code{table-justify} ask you to specify what to justify:
2683a cell, a column, or a row. If you select cell justification, this
2684command sets the justification only for the current cell. Selecting
2685column or row justification sets the justification for all the cells
2686within a column or row respectively. The command then ask you which
2687kind of justification to apply: @code{left}, @code{center},
2688@code{right}, @code{top}, @code{middle}, @code{bottom}, or
2689@code{none}. Horizontal justification and vertical justification are
2690specified independently. The options @code{left}, @code{center}, and
2691@code{right} specify horizontal justification while the options
2692@code{top}, @code{middle}, @code{bottom}, and @code{none} specify
2693vertical justification. The vertical justification @code{none}
2694effectively removes vertical justification. Horizontal justification
2695must be one of @code{left}, @code{center}, or @code{right}.
2696
2697@vindex table-detect-cell-alignment
2698 Justification information is stored in the buffer as a part of text
2699property. Therefore, this information is ephemeral and does not
2700survive through the loss of the buffer (closing the buffer and
2701revisiting the buffer erase any previous text properties). To
2702countermand for this, the command @code{table-recognize} and other
2703recognition commands (@pxref{Table Recognition}) are equipped with a
2704convenience feature (turned on by default). During table recognition,
2705the contents of a cell are examined to determine which justification
2706was originally applied to the cell and then applies this justification
2707to the cell. This is a speculative algorithm and is therefore not
2708perfect, however, the justification is deduced correctly most of the
2709time. To disable this feature, customize the variable
2710@code{table-detect-cell-alignment} and set it to @code{nil}.
2711
2712@node Row Commands
2713@subsection Commands for Table Rows
2714@cindex table row commands
2715
2716@cindex insert row in table
2717@findex table-insert-row
2718 The command @code{table-insert-row} inserts a row of cells before
2719the current row in a table. The current row where point is located is
2720pushed down after the newly inserted row. A numeric prefix argument
2721specifies the number of rows to insert. Note that in order to insert
2722rows @emph{after} the last row at the bottom of a table, you must
2723place point below the table---that is, outside the table---prior to
2724invoking this command.
2725
2726@cindex delete row in table
2727@findex table-delete-row
2728 The command @code{table-delete-row} deletes a row of cells at point.
2729A numeric prefix argument specifies the number of rows to delete.
2730
2731@node Column Commands
2732@subsection Commands for Table Columns
2733@cindex table column commands
2734
2735@cindex insert column in table
2736@findex table-insert-column
2737 The command @code{table-insert-column} inserts a column of cells to
2738the left of the current row in a table. This pushes the current
2739column to the right. To insert a column to the right side of the
2740rightmost column, place point to the right of the rightmost column,
2741which is outside of the table, prior to invoking this command. A
2742numeric prefix argument specifies the number of columns to insert.
2743
2744@cindex delete column in table
2745 A command @code{table-delete-column} deletes a column of cells at
2746point. A numeric prefix argument specifies the number of columns to
2747delete.
2748
2749@node Fixed Width Mode
2750@subsection Fix Width of Cells
2751@cindex fix width of table cells
2752
2753@findex table-fixed-width-mode
2754 The command @code{table-fixed-width-mode} toggles fixed width mode
2755on and off. When fixed width mode is turned on, editing inside a
2756cell never changes the cell width; when it is off, the cell width
2757expands automatically in order to prevent a word from being folded
2758into multiple lines. By default, fixed width mode is disabled.
2759
2760@node Table Conversion
2761@subsection Conversion Between Plain Text and Tables
2762@cindex text to table
2763@cindex table to text
2764
2765@findex table-capture
2766 The command @code{table-capture} captures plain text in a region and
2767turns it into a table. Unlike @code{table-recognize} (@pxref{Table
2768Recognition}), the original text does not have a table appearance but
2769may hold a logical table structure. For example, some elements
2770separated by known patterns form a two dimensional structure which can
2771be turned into a table.
2772
2773 Here's an example of data that @code{table-capture} can operate on.
2774The numbers are horizontally separated by a comma and vertically
2775separated by a newline character.
2776
2777@example
27781, 2, 3, 4
27795, 6, 7, 8
2780, 9, 10
2781@end example
2782
2783@noindent
2784Invoking @kbd{M-x table-capture} on that text produces this table:
2785
2786@example
2787+-----+-----+-----+-----+
2788|1 |2 |3 |4 |
2789+-----+-----+-----+-----+
2790|5 |6 |7 |8 |
2791+-----+-----+-----+-----+
2792| |9 |10 | |
2793+-----+-----+-----+-----+
2794@end example
2795
2796@noindent
2797The conversion uses @samp{,} for the column delimiter and newline for
2798a row delimiter, cells are left justified, and minimum cell width is
27995.
2800
2801@findex table-release
2802 The command @code{table-release} does the opposite of
2803@code{table-capture}. It releases a table by removing the table frame
2804and cell borders. This leaves the table contents as plain text. One
2805of the useful applications of @code{table-capture} and
2806@code{table-release} is to edit a text in layout. Look at the
2807following three paragraphs (the latter two are indented with header
2808lines):
2809
2810@example
2811@samp{table-capture} is a powerful command, but mastering its
2812power requires some practice. Here are some things it can do:
2813
2814Parse Cell Items By using column delimiter regular
2815 expression and raw delimiter regular
2816 expression, it parses the specified text
2817 area and extracts cell items from
2818 non-table text and then forms a table out
2819 of them.
2820
2821Capture Text Area When no delimiters are specified it
2822 creates a single cell table. The text in
2823 the specified region is placed in that
2824 cell.
2825@end example
2826
2827@noindent
2828Applying @code{table-capture} to a region containing the above three
2829paragraphs, with empty strings for column delimiter regexp and row
2830delimiter regexp, creates a table with a single cell like the
2831following one.
2832
2833@c The first line's right-hand frame in the following two examples
2834@c sticks out to accommodate for the removal of @samp in the
2835@c produced output!!
2836@smallexample
2837@group
2838+-----------------------------------------------------------------+
2839|@samp{table-capture} is a powerful command, but mastering its |
2840|power requires some practice. Here are some things it can do: |
2841| |
2842|Parse Cell Items By using column delimiter regular |
2843| expression and raw delimiter regular |
2844| expression, it parses the specified text |
2845| area and extracts cell items from |
2846| non-table text and then forms a table out |
2847| of them. |
2848| |
2849|Capture Text Area When no delimiters are specified it |
2850| creates a single cell table. The text in |
2851| the specified region is placed in that |
2852| cell. |
2853+-----------------------------------------------------------------+
2854@end group
2855@end smallexample
2856
2857@noindent
2858By splitting the cell appropriately we now have a table consisting of
2859paragraphs occupying its own cell. Each cell can now be edited
2860independently without affecting the layout of other cells.
2861
2862@smallexample
2863+-----------------------------------------------------------------+
2864|@samp{table-capture} is a powerful command, but mastering its |
2865|power requires some practice. Here are some things it can do: |
2866+---------------------+-------------------------------------------+
2867|Parse Cell Items |By using column delimiter regular |
2868| |expression and raw delimiter regular |
2869| |expression, it parses the specified text |
2870| |area and extracts cell items from |
2871| |non-table text and then forms a table out |
2872| |of them. |
2873+---------------------+-------------------------------------------+
2874|Capture Text Area |When no delimiters are specified it |
2875| |creates a single cell table. The text in |
2876| |the specified region is placed in that |
2877| |cell. |
2878+---------------------+-------------------------------------------+
2879@end smallexample
2880
2881@noindent
2882By applying @code{table-release}, which does the opposite process, the
2883contents become once again plain text. @code{table-release} works as
2884a companion command to @code{table-capture}.
2885
2886@node Measuring Tables
2887@subsection Analyzing Table Dimensions
2888@cindex table dimensions
2889
2890@findex table-query-dimension
2891 The command @code{table-query-dimension} analyzes a table structure
2892and reports information regarding its dimensions. In case of the
2893above example table, the @code{table-query-dimension} command displays
2894in echo area:
2895
2896@smallexample
2897Cell: (21w, 6h), Table: (67w, 16h), Dim: (2c, 3r), Total Cells: 5
2898@end smallexample
2899
2900@noindent
2901This indicates that the current cell is 21 character wide and 6 lines
2902high, the entire table is 67 characters wide and 16 lines high. The
2903table has 2 columns and 3 rows. It has a total of 5 cells, since the
2904first row has a spanned cell.
2905
2906@node Table Misc
2907@subsection Table Miscellany
2908
2909@cindex insert string into table cells
2910@findex table-insert-sequence
2911 The command @code{table-insert-sequence} inserts a string into each
2912cell. Each string is a part of a sequence i.e.@: a series of
2913increasing integer numbers.
2914
2915@cindex table in language format
2916@cindex table for HTML and LaTeX
2917@findex table-generate-source
2918 The command @code{table-generate-source} generates a table formatted
2919for a specific markup language. It asks for a language (which must be
2920one of @code{html}, @code{latex}, or @code{cals}), a destination
2921buffer where to put the result, and the table caption (a string), and
2922then inserts the generated table in the proper syntax into the
2923destination buffer. The default destination buffer is
2924@code{table.@var{lang}}, where @var{lang} is the language you
2925specified.
2926
2927@ignore
2928 arch-tag: 8db54ed8-2036-49ca-b0df-23811d03dc70
2929@end ignore