aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-12-04 13:55:36 +0800
committerChong Yidong2011-12-04 13:55:36 +0800
commita24bf23e0f6e5cea917b77cc455314cdcc31be5b (patch)
treeb9e3c91a4d24c3ea84b2310af01f5c04945d34aa
parenta92f50ad7eb6137d050b7e2d1d2a92ee140759fb (diff)
downloademacs-a24bf23e0f6e5cea917b77cc455314cdcc31be5b.tar.gz
emacs-a24bf23e0f6e5cea917b77cc455314cdcc31be5b.zip
More updates to Text chapter of Emacs manual.
* text.texi (Nroff Mode): Mention what nroff is. (Text Based Tables, Table Recognition): Don't say "Table mode" since it's not a major or minor mode. (Text Based Tables): Reduce the size of the example. (Table Definition): Clarify definitions. (Table Creation): Add key table. (Cell Commands): Use kbd for commands. (Table Rows and Columns): Combine nodes Row Commands and Column Commands. (Fixed Width Mode): Node deleted; contents moved to parent. (Table Conversion): Shorten example. (Measuring Tables): Merge into Table Misc.
-rw-r--r--doc/emacs/ChangeLog15
-rw-r--r--doc/emacs/emacs.texi7
-rw-r--r--doc/emacs/text.texi572
3 files changed, 249 insertions, 345 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index d16443ccf31..e55c1026786 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,18 @@
12011-12-04 Chong Yidong <cyd@gnu.org>
2
3 * text.texi (Nroff Mode): Mention what nroff is.
4 (Text Based Tables, Table Recognition): Don't say "Table mode"
5 since it's not a major or minor mode.
6 (Text Based Tables): Reduce the size of the example.
7 (Table Definition): Clarify definitions.
8 (Table Creation): Add key table.
9 (Cell Commands): Use kbd for commands.
10 (Table Rows and Columns): Combine nodes Row Commands and Column
11 Commands.
12 (Fixed Width Mode): Node deleted; contents moved to parent.
13 (Table Conversion): Shorten example.
14 (Measuring Tables): Merge into Table Misc.
15
12011-12-03 Chong Yidong <cyd@gnu.org> 162011-12-03 Chong Yidong <cyd@gnu.org>
2 17
3 * text.texi (TeX Mode): Mention AUCTeX package. 18 * text.texi (TeX Mode): Mention AUCTeX package.
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index aca3735ff03..5905c7a65b2 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -39,7 +39,7 @@ developing GNU and promoting software freedom.''
39@c in general, keep the following line commented out, unless doing a 39@c in general, keep the following line commented out, unless doing a
40@c copy of this manual that will be published. The manual should go 40@c copy of this manual that will be published. The manual should go
41@c onto the distribution in the full, 8.5 x 11" size. 41@c onto the distribution in the full, 8.5 x 11" size.
42@c @smallbook 42@smallbook
43 43
44@ifset smallbook 44@ifset smallbook
45@smallbook 45@smallbook
@@ -602,11 +602,8 @@ Editing Text-based Tables
602* Table Recognition:: How to activate and deactivate tables. 602* Table Recognition:: How to activate and deactivate tables.
603* Cell Commands:: Cell-oriented commands in a table. 603* Cell Commands:: Cell-oriented commands in a table.
604* Cell Justification:: Justifying cell contents. 604* Cell Justification:: Justifying cell contents.
605* Row Commands:: Manipulating rows of table cell. 605* Table Rows and Columns:: Inserting and deleting rows and columns.
606* Column Commands:: Manipulating columns of table cell.
607* Fixed Width Mode:: Fixing cell width.
608* Table Conversion:: Converting between plain text and tables. 606* Table Conversion:: Converting between plain text and tables.
609* Measuring Tables:: Analyzing table dimension.
610* Table Misc:: Table miscellany. 607* Table Misc:: Table miscellany.
611 608
612Editing Programs 609Editing Programs
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 8f353961afb..72b793246f1 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -1298,8 +1298,8 @@ more information, see the documentation string for the command
1298@code{bibtex-mode}. 1298@code{bibtex-mode}.
1299 1299
1300@item 1300@item
1301The Ref@TeX{} package provides a minor mode which can be used in 1301The Ref@TeX{} package provides a minor mode which can be used with
1302conjunction with La@TeX{} mode to manage bibliographic references. 1302La@TeX{} mode to manage bibliographic references.
1303@ifinfo 1303@ifinfo
1304@xref{Top,The Ref@TeX{} Manual,,reftex}. 1304@xref{Top,The Ref@TeX{} Manual,,reftex}.
1305@end ifinfo 1305@end ifinfo
@@ -1781,13 +1781,16 @@ always insert explicit closing tags as well.
1781 1781
1782@cindex nroff 1782@cindex nroff
1783@findex nroff-mode 1783@findex nroff-mode
1784 Nroff mode is a mode like Text mode but modified to handle nroff commands 1784@vindex nroff-mode-hook
1785present in the text. Invoke @kbd{M-x nroff-mode} to enter this mode. It 1785 Nroff mode is a major mode derived from Text mode, which is
1786differs from Text mode in only a few ways. All nroff command lines are 1786specialized for editing nroff files (e.g.@: Unix man pages). Type
1787considered paragraph separators, so that filling will never garble the 1787@kbd{M-x nroff-mode} to enter this mode. Entering Nroff mode runs the
1788nroff commands. Pages are separated by @samp{.bp} commands. Comments 1788hook @code{text-mode-hook}, followed by @code{nroff-mode-hook}
1789start with backslash-doublequote. Also, three special commands are 1789(@pxref{Hooks}).
1790provided that are not in Text mode: 1790
1791 In Nroff mode, nroff command lines are treated as paragraph
1792separators, pages are separated by @samp{.bp} commands, and comments
1793start with backslash-doublequote. It also defines these commands:
1791 1794
1792@findex forward-text-line 1795@findex forward-text-line
1793@findex backward-text-line 1796@findex backward-text-line
@@ -1807,23 +1810,16 @@ nroff commands) in the region (@code{count-text-lines}).
1807@end table 1810@end table
1808 1811
1809@findex electric-nroff-mode 1812@findex electric-nroff-mode
1810 The other feature of Nroff mode is that you can turn on Electric Nroff 1813 Electric Nroff mode is a buffer-local minor mode that can be used
1811mode. This is a minor mode that you can turn on or off with @kbd{M-x 1814with Nroff mode. To toggle this minor mode, type @kbd{M-x
1812electric-nroff-mode} (@pxref{Minor Modes}). When the mode is on, each 1815electric-nroff-mode} (@pxref{Minor Modes}). When the mode is on, each
1813time you use @key{RET} to end a line that contains an nroff command that 1816time you type @key{RET} to end a line containing an nroff command that
1814opens a kind of grouping, the matching nroff command to close that 1817opens a kind of grouping, the nroff command to close that grouping is
1815grouping is automatically inserted on the following line. For example, 1818automatically inserted on the following line.
1816if you are at the beginning of a line and type @kbd{.@: ( b @key{RET}},
1817this inserts the matching command @samp{.)b} on a new line following
1818point.
1819 1819
1820 If you use Outline minor mode with Nroff mode (@pxref{Outline Mode}), 1820 If you use Outline minor mode with Nroff mode (@pxref{Outline
1821heading lines are lines of the form @samp{.H} followed by a number (the 1821Mode}), heading lines are lines of the form @samp{.H} followed by a
1822header level). 1822number (the header level).
1823
1824@vindex nroff-mode-hook
1825 Entering Nroff mode runs the hook @code{text-mode-hook}, followed by
1826the hook @code{nroff-mode-hook} (@pxref{Hooks}).
1827 1823
1828@node Enriched Text 1824@node Enriched Text
1829@section Enriched Text 1825@section Enriched Text
@@ -2149,18 +2145,16 @@ hides text), and @code{intangible} (which disallows moving point
2149within the text). The @samp{Remove Special} menu item removes all of 2145within the text). The @samp{Remove Special} menu item removes all of
2150these special properties from the text in the region. 2146these special properties from the text in the region.
2151 2147
2152 The @code{invisible} and @code{intangible} properties are @emph{not} 2148 The @code{invisible} and @code{intangible} properties are not saved
2153saved in the text/enriched format. The @code{read-only} property is 2149in the @samp{text/enriched} format.
2154saved, but it is not a standard part of the text/enriched format, so
2155other editors may not respect it.
2156 2150
2157@node Text Based Tables 2151@node Text Based Tables
2158@section Editing Text-based Tables 2152@section Editing Text-based Tables
2159@cindex table mode 2153@cindex table mode
2160@cindex text-based tables 2154@cindex text-based tables
2161 2155
2162 Table mode provides an easy and intuitive way to create and edit 2156 The @code{table} package provides commands to easily edit text-based
2163text-based tables. Here is an example of such a table: 2157tables. Here is an example of what such a table looks like:
2164 2158
2165@smallexample 2159@smallexample
2166@group 2160@group
@@ -2170,27 +2164,23 @@ text-based tables. Here is an example of such a table:
2170| forward-char |Move point right N characters | C-f | 2164| forward-char |Move point right N characters | C-f |
2171| |(left if N is negative). | | 2165| |(left if N is negative). | |
2172| | | | 2166| | | |
2173| |On reaching end of buffer, stop | |
2174| |and signal error. | |
2175+-----------------+--------------------------------+-----------------+ 2167+-----------------+--------------------------------+-----------------+
2176| backward-char |Move point left N characters | C-b | 2168| backward-char |Move point left N characters | C-b |
2177| |(right if N is negative). | | 2169| |(right if N is negative). | |
2178| | | | 2170| | | |
2179| |On attempt to pass beginning or | |
2180| |end of buffer, stop and signal | |
2181| |error. | |
2182+-----------------+--------------------------------+-----------------+ 2171+-----------------+--------------------------------+-----------------+
2183@end group 2172@end group
2184@end smallexample 2173@end smallexample
2185 2174
2186 Table mode allows the contents of the table such as this one to be 2175 When Emacs recognizes such a stretch of text as a table
2187easily manipulated by inserting or deleting characters inside a cell. 2176(@pxref{Table Recognition}), editing the contents of each table cell
2188A cell is effectively a localized rectangular edit region and edits to 2177will automatically resize the table, whenever the contents become too
2189a cell do not affect the contents of the surrounding cells. If the 2178large to fit in the cell. You can use the commands defined in the
2190contents do not fit into a cell, then the cell is automatically 2179following sections for navigating and editing the table layout.
2191expanded in the vertical and/or horizontal directions and the rest of 2180
2192the table is restructured and reformatted in accordance with the 2181@findex table-fixed-width-mode
2193growth of the cell. 2182 To toggle the automatic table resizing feature, type @kbd{M-x
2183table-fixed-width-mode}.
2194 2184
2195@menu 2185@menu
2196* Table Definition:: What is a text based table. 2186* Table Definition:: What is a text based table.
@@ -2198,102 +2188,87 @@ growth of the cell.
2198* Table Recognition:: How to activate and deactivate tables. 2188* Table Recognition:: How to activate and deactivate tables.
2199* Cell Commands:: Cell-oriented commands in a table. 2189* Cell Commands:: Cell-oriented commands in a table.
2200* Cell Justification:: Justifying cell contents. 2190* Cell Justification:: Justifying cell contents.
2201* Row Commands:: Manipulating rows of table cell. 2191* Table Rows and Columns:: Inserting and deleting rows and columns.
2202* Column Commands:: Manipulating columns of table cell.
2203* Fixed Width Mode:: Fixing cell width.
2204* Table Conversion:: Converting between plain text and tables. 2192* Table Conversion:: Converting between plain text and tables.
2205* Measuring Tables:: Analyzing table dimension.
2206* Table Misc:: Table miscellany. 2193* Table Misc:: Table miscellany.
2207@end menu 2194@end menu
2208 2195
2209@node Table Definition 2196@node Table Definition
2210@subsection What is a Text-based Table? 2197@subsection What is a Text-based Table?
2198@cindex cells, for text-based tables
2211 2199
2212 Keep the following examples of valid tables in mind as a reference 2200 A @dfn{table} consists of a rectangular text area which is divided
2213while you read this section: 2201into @dfn{cells}. Each cell must be at least one character wide and
2214 2202one character high, not counting its border lines. A cell can be
2215@example 2203subdivided into more cells, but they cannot overlap.
2216 +--+----+---+ +-+ +--+-----+
2217 | | | | | | | | |
2218 +--+----+---+ +-+ | +--+--+
2219 | | | | | | | |
2220 +--+----+---+ +--+--+ |
2221 | | |
2222 +-----+--+
2223@end example
2224
2225 A table consists of a rectangular frame whose inside is divided into
2226cells. Each cell must be at least one character wide and one
2227character high, not counting its border lines. A cell can be
2228subdivided into multiple rectangular cells, but cells cannot overlap.
2229 2204
2230 The table frame and cell border lines are made of three special 2205 Cell border lines are drawn with three special characters, specified
2231characters. These variables specify those characters: 2206by the following variables:
2232 2207
2233@table @code 2208@table @code
2234@vindex table-cell-vertical-char 2209@vindex table-cell-vertical-char
2235@item table-cell-vertical-char 2210@item table-cell-vertical-char
2236Holds the character used for vertical lines. The default value is 2211The character used for vertical lines. The default is @samp{|}.
2237@samp{|}.
2238 2212
2239@vindex table-cell-horizontal-chars 2213@vindex table-cell-horizontal-chars
2240@item table-cell-horizontal-chars 2214@item table-cell-horizontal-chars
2241Holds the characters used for horizontal lines. The default value is 2215The characters used for horizontal lines. The default is @samp{"-="}.
2242@samp{"-="}.
2243 2216
2244@vindex table-cell-intersection-char 2217@vindex table-cell-intersection-char
2245@item table-cell-intersection-char 2218@item table-cell-intersection-char
2246Holds the character used at where horizontal line and vertical line 2219The character used for the intersection of horizontal and vertical
2247meet. The default value is @samp{+}. 2220lines. The default is @samp{+}.
2248@end table 2221@end table
2249 2222
2250@noindent 2223@noindent
2251Based on this definition, the following five tables are examples of invalid 2224The following are examples of @emph{invalid} tables:
2252tables:
2253 2225
2254@example 2226@example
2255 +-----+ +-----+ +--+ +-++--+ ++ 2227 +-----+ +--+ +-++--+
2256 | | | | | | | || | ++ 2228 | | | | | || |
2257 | +-+ | | | | | | || | 2229 | | | | | || |
2258 | | | | +--+ | +--+--+ +-++--+ 2230 +--+ | +--+--+ +-++--+
2259 | +-+ | | | | | | | +-++--+ 2231 | | | | | | +-++--+
2260 | | | | | | | | | || | 2232 | | | | | | | || |
2261 +-----+ +--+--+ +--+--+ +-++--+ 2233 +--+--+ +--+--+ +-++--+
2262 a b c d e 2234 a b c
2263@end example 2235@end example
2264 2236
2237@noindent
2265From left to right: 2238From left to right:
2266 2239
2267@enumerate a 2240@enumerate a
2268@item 2241@item
2269Overlapped cells or non-rectangular cells are not allowed. 2242Overlapped cells or non-rectangular cells are not allowed.
2270@item 2243@item
2271Same as a.
2272@item
2273The border must be rectangular. 2244The border must be rectangular.
2274@item 2245@item
2275Cells must have a minimum width/height of one character. 2246Cells must have a minimum width/height of one character.
2276@item
2277Same as d.
2278@end enumerate 2247@end enumerate
2279 2248
2280@node Table Creation 2249@node Table Creation
2281@subsection How to Create a Table? 2250@subsection Creating a Table
2282@cindex create a text-based table 2251@cindex create a text-based table
2283@cindex table creation 2252@cindex table creation
2284 2253
2285@findex table-insert 2254@findex table-insert
2286 The command to create a table is @code{table-insert}. When called 2255 To create a text-based table from scratch, type @kbd{M-x
2287interactively, it asks for the number of columns, number of rows, cell 2256table-insert}. This command prompts for the number of table columns,
2288width and cell height. The number of columns is the number of cells 2257the number of table rows, cell width and cell height. The cell width
2289horizontally side by side. The number of rows is the number of cells 2258and cell height do not include the cell borders; each can be specified
2290vertically within the table's height. The cell width is a number of 2259as a single integer (which means each cell is given the same
2291characters that each cell holds, left to right. The cell height is a 2260width/height), or as a sequence of integers separated by spaces or
2292number of lines each cell holds. The cell width and the cell height 2261commas (which specify the width/height of the individual table
2293can be either an integer (when the value is constant across the table) 2262columns/rows, counting from left to right for table columns and from
2294or a series of integer, separated by spaces or commas, where each 2263top to bottom for table rows). The specified table is then inserted
2295number corresponds to the next cell within a row from left to right, 2264at point.
2296or the next cell within a column from top to bottom. 2265
2266 The table inserted by @kbd{M-x table-insert} contains special text
2267properties, which tell Emacs to treat it specially as a text-based
2268table. If you save the buffer to a file and visit it again later,
2269those properties are lost, and the table appears to Emacs as an
2270ordinary piece of text. See the next section, for how to convert it
2271back into a table.
2297 2272
2298@node Table Recognition 2273@node Table Recognition
2299@subsection Table Recognition 2274@subsection Table Recognition
@@ -2301,103 +2276,97 @@ or the next cell within a column from top to bottom.
2301 2276
2302@findex table-recognize 2277@findex table-recognize
2303@findex table-unrecognize 2278@findex table-unrecognize
2304 Table mode maintains special text properties in the buffer to allow 2279 Existing text-based tables in a buffer, which lack the special text
2305editing in a convenient fashion. When a buffer with tables is saved 2280properties applied by @kbd{M-x table-insert}, are not treated
2306to its file, these text properties are lost, so when you visit this 2281specially as tables. To apply those text properties, type @kbd{M-x
2307file again later, Emacs does not see a table, but just formatted text. 2282table-recognize}. This command scans the current buffer,
2308To resurrect the table text properties, issue the @kbd{M-x 2283@dfn{recognizes} valid table cells, and applies the relevant text
2309table-recognize} command. It scans the current buffer, recognizes 2284properties. Conversely, type @kbd{M-x table-unrecognize} to
2310valid table cells, and attaches appropriate text properties to allow 2285@dfn{unrecognize} all tables in the current buffer, removing the
2311for table editing. The converse command, @code{table-unrecognize}, is 2286special text properties and converting tables back to plain text.
2312used to remove the special text properties and convert the buffer back 2287
2313to plain text. 2288 You can also use the following commands to selectively recognize or
2314 2289unrecognize tables:
2315 Special commands exist to enable or disable tables within a region,
2316enable or disable individual tables, and enable/disable individual
2317cells. These commands are:
2318 2290
2319@table @kbd 2291@table @kbd
2320@findex table-recognize-region 2292@findex table-recognize-region
2321@item M-x table-recognize-region 2293@item M-x table-recognize-region
2322Recognize tables within the current region and activate them. 2294Recognize tables within the current region.
2295
2323@findex table-unrecognize-region 2296@findex table-unrecognize-region
2324@item M-x table-unrecognize-region 2297@item M-x table-unrecognize-region
2325Deactivate tables within the current region. 2298Unrecognize tables within the current region.
2299
2326@findex table-recognize-table 2300@findex table-recognize-table
2327@item M-x table-recognize-table 2301@item M-x table-recognize-table
2328Recognize the table at point and activate it. 2302Recognize the table at point and activate it.
2303
2329@findex table-unrecognize-table 2304@findex table-unrecognize-table
2330@item M-x table-unrecognize-table 2305@item M-x table-unrecognize-table
2331Deactivate the table at point. 2306Deactivate the table at point.
2307
2332@findex table-recognize-cell 2308@findex table-recognize-cell
2333@item M-x table-recognize-cell 2309@item M-x table-recognize-cell
2334Recognize the cell at point and activate it. 2310Recognize the cell at point and activate it.
2311
2335@findex table-unrecognize-cell 2312@findex table-unrecognize-cell
2336@item M-x table-unrecognize-cell 2313@item M-x table-unrecognize-cell
2337Deactivate the cell at point. 2314Deactivate the cell at point.
2338@end table 2315@end table
2339 2316
2340 For another way of converting text into tables, see @ref{Table 2317 @xref{Table Conversion}, for another way to recognize a table.
2341Conversion}.
2342 2318
2343@node Cell Commands 2319@node Cell Commands
2344@subsection Commands for Table Cells 2320@subsection Commands for Table Cells
2345 2321
2346@findex table-forward-cell 2322@findex table-forward-cell
2347@findex table-backward-cell 2323@findex table-backward-cell
2348 The commands @code{table-forward-cell} and 2324 The commands @kbd{M-x table-forward-cell} and @kbd{M-x
2349@code{table-backward-cell} move point from the current cell to an 2325table-backward-cell} move point from the current cell to an adjacent
2350adjacent cell forward and backward respectively. The order of the 2326cell. The order is cyclic: when point is in the last cell of a table,
2351cells is cyclic: when point is in the last cell of a table, typing 2327@kbd{M-x table-forward-cell} moves to the first cell. Likewise, when
2352@kbd{M-x table-forward-cell} moves to the first cell in the table. 2328point is on the first cell, @kbd{M-x table-backward-cell} moves to the
2353Likewise @kbd{M-x table-backward-cell} from the first cell in a table 2329last cell.
2354moves to the last cell.
2355 2330
2356@findex table-span-cell 2331@findex table-span-cell
2357 The command @code{table-span-cell} merges the current cell with the 2332 @kbd{M-x table-span-cell} prompts for a direction---right, left,
2358adjacent cell in a specified direction---right, left, above or below. 2333above, or below---and merges the current cell with the adjacent cell
2359You specify the direction with the minibuffer. It does not allow 2334in that direction. This command signals an error if the merge would
2360merges which don't result in a legitimate cell layout. 2335result in an illegitimate cell layout.
2361 2336
2362@findex table-split-cell 2337@findex table-split-cell
2363@cindex text-based tables, split a cell
2364@cindex split table cell
2365 The command @code{table-split-cell} splits the current cell
2366vertically or horizontally. This command is a wrapper to the
2367direction specific commands @code{table-split-cell-vertically} and
2368@code{table-split-cell-horizontally}. You specify the direction with
2369a minibuffer argument.
2370
2371@findex table-split-cell-vertically 2338@findex table-split-cell-vertically
2372 The command @code{table-split-cell-vertically} splits the current
2373cell vertically and creates a pair of cells above and below where
2374point is located. The content in the original cell is split as well.
2375
2376@findex table-split-cell-horizontally 2339@findex table-split-cell-horizontally
2377 The command @code{table-split-cell-horizontally} splits the current 2340@cindex text-based tables, splitting cells
2378cell horizontally and creates a pair of cells right and left of where 2341@cindex splitting table cells
2379point is located. If the cell being split is not empty, this asks you 2342 @kbd{M-x table-split-cell} splits the current cell vertically or
2380how to handle the cell contents. The three options are: @code{split}, 2343horizontally, prompting for the direction with the minibuffer. The
2381@code{left}, or @code{right}. @code{split} splits the contents at 2344commands @kbd{M-x table-split-cell-vertically} and @kbd{M-x
2382point literally, while the @code{left} and @code{right} options move 2345table-split-cell-horizontally} split in a specific direction. When
2383the entire contents into the left or right cell respectively. 2346splitting vertically, the old cell contents are automatically split
2384 2347between the two new cells. When splitting horizontally, you are
2385@cindex enlarge a table cell 2348prompted for how to divide the cell contents, if the cell is
2386@cindex shrink a table cell 2349non-empty; the options are @samp{split} (divide the contents at
2387 The next four commands enlarge or shrink a cell. They use numeric 2350point), @samp{left} (put all the contents in the left cell), and
2388arguments (@pxref{Arguments}) to specify how many columns or rows to 2351@samp{right} (put all the contents in the right cell).
2389enlarge or shrink a particular table. 2352
2353 The following commands enlarge or shrink a cell. By default, they
2354resize by one row or column; if a numeric argument is supplied, that
2355specifies the number of rows or columns to resize by.
2390 2356
2391@table @kbd 2357@table @kbd
2392@findex table-heighten-cell 2358@findex table-heighten-cell
2393@item M-x table-heighten-cell 2359@item M-x table-heighten-cell
2394Enlarge the current cell vertically. 2360Enlarge the current cell vertically.
2361
2395@findex table-shorten-cell 2362@findex table-shorten-cell
2396@item M-x table-shorten-cell 2363@item M-x table-shorten-cell
2397Shrink the current cell vertically. 2364Shrink the current cell vertically.
2365
2398@findex table-widen-cell 2366@findex table-widen-cell
2399@item M-x table-widen-cell 2367@item M-x table-widen-cell
2400Enlarge the current cell horizontally. 2368Enlarge the current cell horizontally.
2369
2401@findex table-narrow-cell 2370@findex table-narrow-cell
2402@item M-x table-narrow-cell 2371@item M-x table-narrow-cell
2403Shrink the current cell horizontally. 2372Shrink the current cell horizontally.
@@ -2405,107 +2374,76 @@ Shrink the current cell horizontally.
2405 2374
2406@node Cell Justification 2375@node Cell Justification
2407@subsection Cell Justification 2376@subsection Cell Justification
2408@cindex cell text justification 2377@cindex justification in text-based tables
2409 2378
2410 You can specify text justification for each cell. The justification 2379 The command @kbd{M-x table-justify} imposes @dfn{justification} on
2411is remembered independently for each cell and the subsequent editing 2380one or more cells in a text-based table. Justification determines how
2412of cell contents is subject to the specified justification. 2381the text in the cell is aligned, relative to the edges of the cell.
2382Each cell in a table can be separately justified.
2413 2383
2414@findex table-justify 2384@findex table-justify
2415 The command @code{table-justify} ask you to specify what to justify: 2385 @kbd{M-x table-justify} first prompts for what to justify; the
2416a cell, a column, or a row. If you select cell justification, this 2386options are @samp{cell} (just the current cell), @samp{column} (all
2417command sets the justification only for the current cell. Selecting 2387cells in the current table column) and @samp{row} (all cells in the
2418column or row justification sets the justification for all the cells 2388current table row). The command then prompts for the justification
2419within a column or row respectively. The command then ask you which 2389style; the options are @code{left}, @code{center}, @code{right},
2420kind of justification to apply: @code{left}, @code{center}, 2390@code{top}, @code{middle}, @code{bottom}, or @code{none} (meaning no
2421@code{right}, @code{top}, @code{middle}, @code{bottom}, or 2391vertical justification).
2422@code{none}. Horizontal justification and vertical justification are 2392
2423specified independently. The options @code{left}, @code{center}, and 2393 Horizontal and vertical justification styles are specified
2424@code{right} specify horizontal justification while the options 2394independently, and both types can be in effect simultaneously; for
2425@code{top}, @code{middle}, @code{bottom}, and @code{none} specify 2395instance, you can call @kbd{M-x table-justify} twice, once to specify
2426vertical justification. The vertical justification @code{none} 2396@code{right} justification and once to specify @code{bottom}
2427effectively removes vertical justification. Horizontal justification 2397justification, to align the contents of a cell to the bottom right.
2428must be one of @code{left}, @code{center}, or @code{right}.
2429 2398
2430@vindex table-detect-cell-alignment 2399@vindex table-detect-cell-alignment
2431 Justification information is stored in the buffer as a part of text 2400 The justification style is stored in the buffer as a text property,
2432property. Therefore, this information is ephemeral and does not 2401and is lost when you kill the buffer or exit Emacs. However, the
2433survive through the loss of the buffer (closing the buffer and 2402table recognition commands, such as @kbd{M-x table-recognize}
2434revisiting the buffer erase any previous text properties). To 2403(@pxref{Table Recognition}), attempt to determine and re-apply each
2435countermand for this, the command @code{table-recognize} and other 2404cell's justification style, by examining its contents. To disable
2436recognition commands (@pxref{Table Recognition}) are equipped with a 2405this feature, change the variable @code{table-detect-cell-alignment}
2437convenience feature (turned on by default). During table recognition, 2406to @code{nil}.
2438the contents of a cell are examined to determine which justification 2407
2439was originally applied to the cell and then applies this justification 2408@node Table Rows and Columns
2440to the cell. This is a speculative algorithm and is therefore not 2409@subsection Table Rows and Columns
2441perfect, however, the justification is deduced correctly most of the 2410@cindex inserting rows and columns in text-based tables
2442time. To disable this feature, customize the variable 2411
2443@code{table-detect-cell-alignment} and set it to @code{nil}.
2444
2445@node Row Commands
2446@subsection Commands for Table Rows
2447@cindex table row commands
2448
2449@cindex insert row in table
2450@findex table-insert-row 2412@findex table-insert-row
2451 The command @code{table-insert-row} inserts a row of cells before 2413 @kbd{M-x table-insert-row} inserts a row of cells before the current
2452the current row in a table. The current row where point is located is 2414table row. The current row, together with point, is pushed down past
2453pushed down after the newly inserted row. A numeric prefix argument 2415the new row. To insert rows after the last row at the bottom of a
2454specifies the number of rows to insert. Note that in order to insert 2416table, invoke this command with point below the table, just below the
2455rows @emph{after} the last row at the bottom of a table, you must 2417bottom edge. A numeric prefix argument specifies the number of rows
2456place point below the table---that is, outside the table---prior to 2418to insert.
2457invoking this command.
2458
2459@cindex delete row in table
2460@findex table-delete-row
2461 The command @code{table-delete-row} deletes a row of cells at point.
2462A numeric prefix argument specifies the number of rows to delete.
2463
2464@node Column Commands
2465@subsection Commands for Table Columns
2466@cindex table column commands
2467
2468@cindex insert column in table
2469@findex table-insert-column
2470 The command @code{table-insert-column} inserts a column of cells to
2471the left of the current row in a table. This pushes the current
2472column to the right. To insert a column to the right side of the
2473rightmost column, place point to the right of the rightmost column,
2474which is outside of the table, prior to invoking this command. A
2475numeric prefix argument specifies the number of columns to insert.
2476
2477@cindex delete column in table
2478 A command @code{table-delete-column} deletes a column of cells at
2479point. A numeric prefix argument specifies the number of columns to
2480delete.
2481
2482@node Fixed Width Mode
2483@subsection Fix Width of Cells
2484@cindex fix width of table cells
2485 2419
2486@findex table-fixed-width-mode 2420@findex table-insert-column
2487 The command @code{table-fixed-width-mode} toggles fixed width mode 2421 Similarly, @kbd{M-x table-insert-column} inserts a column of cells
2488on and off. When fixed width mode is turned on, editing inside a 2422to the left of the current table column. To insert a column to the
2489cell never changes the cell width; when it is off, the cell width 2423right side of the rightmost column, invoke this command with point to
2490expands automatically in order to prevent a word from being folded 2424the right of the rightmost column, outside the table. A numeric
2491into multiple lines. By default, fixed width mode is disabled. 2425prefix argument specifies the number of columns to insert.
2426
2427@cindex deleting rows and column in text-based tables
2428 @kbd{M-x table-delete-column} deletes the column of cells at point.
2429Similarly, @kbd{M-x table-delete-row} deletes the row of cells at
2430point. A numeric prefix argument to either command specifies the
2431number of columns or rows to delete.
2492 2432
2493@node Table Conversion 2433@node Table Conversion
2494@subsection Conversion Between Plain Text and Tables 2434@subsection Converting Between Plain Text and Tables
2495@cindex text to table 2435@cindex text to table
2496@cindex table to text 2436@cindex table to text
2497 2437
2498@findex table-capture 2438@findex table-capture
2499 The command @code{table-capture} captures plain text in a region and 2439 The command @kbd{M-x table-capture} captures plain text in a region
2500turns it into a table. Unlike @code{table-recognize} (@pxref{Table 2440and turns it into a table. Unlike @kbd{M-x table-recognize}
2501Recognition}), the original text does not have a table appearance but 2441(@pxref{Table Recognition}), the original text does not need to have a
2502may hold a logical table structure. For example, some elements 2442table appearance; it only needs to have a logical table-like
2503separated by known patterns form a two dimensional structure which can 2443structure.
2504be turned into a table.
2505 2444
2506 Here's an example of data that @code{table-capture} can operate on. 2445 For example, suppose we have the following numbers, which are
2507The numbers are horizontally separated by a comma and vertically 2446divided into three lines and separated horizontally by commas:
2508separated by a newline character.
2509 2447
2510@example 2448@example
25111, 2, 3, 4 24491, 2, 3, 4
@@ -2526,136 +2464,92 @@ Invoking @kbd{M-x table-capture} on that text produces this table:
2526+-----+-----+-----+-----+ 2464+-----+-----+-----+-----+
2527@end example 2465@end example
2528 2466
2529@noindent
2530The conversion uses @samp{,} for the column delimiter and newline for
2531a row delimiter, cells are left justified, and minimum cell width is
25325.
2533
2534@findex table-release 2467@findex table-release
2535 The command @code{table-release} does the opposite of 2468 @kbd{M-x table-release} does the opposite: it converts a table back
2536@code{table-capture}. It releases a table by removing the table frame 2469to plain text, removing its cell borders.
2537and cell borders. This leaves the table contents as plain text. One 2470
2538of the useful applications of @code{table-capture} and 2471 One application of this pair of commands is to edit a text in
2539@code{table-release} is to edit a text in layout. Look at the 2472layout. Look at the following three paragraphs (the latter two are
2540following three paragraphs (the latter two are indented with header 2473indented with header lines):
2541lines):
2542 2474
2543@example 2475@example
2544table-capture is a powerful command. 2476table-capture is a powerful command.
2545Here are some things it can do: 2477Here are some things it can do:
2546 2478
2547Parse Cell Items By using column delimiter regular 2479Parse Cell Items Using row and column delimiter regexps,
2548 expression and raw delimiter regular 2480 it parses the specified text area and
2549 expression, it parses the specified text 2481 extracts cell items into a table.
2550 area and extracts cell items from
2551 non-table text and then forms a table out
2552 of them.
2553
2554Capture Text Area When no delimiters are specified it
2555 creates a single cell table. The text in
2556 the specified region is placed in that
2557 cell.
2558@end example 2482@end example
2559 2483
2560@noindent 2484@noindent
2561Applying @code{table-capture} to a region containing the above three 2485Applying @code{table-capture} to a region containing the above text,
2562paragraphs, with empty strings for column delimiter regexp and row 2486with empty strings for the column and row delimiter regexps, creates a
2563delimiter regexp, creates a table with a single cell like the 2487table with a single cell like the following one.
2564following one. 2488
2565
2566@c The first line's right-hand frame in the following two examples
2567@c sticks out to accommodate for the removal of @samp in the
2568@c produced output!!
2569@smallexample 2489@smallexample
2570@group 2490@group
2571+-------------------------------------------------------------+ 2491+----------------------------------------------------------+
2572|table-capture is a powerful command. | 2492|table-capture is a powerful command. |
2573|Here are some things it can do: | 2493|Here are some things it can do: |
2574| | 2494| |
2575|Parse Cell Items By using column delimiter regular | 2495|Parse Cell Items Using row and column delimiter regexps,|
2576| expression and raw delimiter regular | 2496| it parses the specified text area and |
2577| expression, it parses the specified text | 2497| extracts cell items into a table. |
2578| area and extracts cell items from | 2498+----------------------------------------------------------+
2579| non-table text and then forms a table out |
2580| of them. |
2581| |
2582|Capture Text Area When no delimiters are specified it |
2583| creates a single cell table. The text in |
2584| the specified region is placed in that |
2585| cell. |
2586+-------------------------------------------------------------+
2587@end group 2499@end group
2588@end smallexample 2500@end smallexample
2589 2501
2590@noindent 2502@noindent
2591By splitting the cell appropriately we now have a table consisting of 2503We can then use the cell splitting commands (@pxref{Cell Commands}) to
2592paragraphs occupying its own cell. Each cell can now be edited 2504subdivide the table so that each paragraph occupies a cell:
2593independently without affecting the layout of other cells.
2594 2505
2595@smallexample 2506@smallexample
2596+--------------------------------------------------------------+ 2507+----------------------------------------------------------+
2597|table-capture is a powerful command. | 2508|table-capture is a powerful command. |
2598|Here are some things it can do: | 2509|Here are some things it can do: |
2599+------------------+-------------------------------------------+ 2510+-----------------+----------------------------------------+
2600|Parse Cell Items |By using column delimiter regular | 2511|Parse Cell Items | Using row and column delimiter regexps,|
2601| |expression and raw delimiter regular | 2512| | it parses the specified text area and |
2602| |expression, it parses the specified text | 2513| | extracts cell items into a table. |
2603| |area and extracts cell items from | 2514+-----------------+----------------------------------------+
2604| |non-table text and then forms a table out |
2605| |of them. |
2606+------------------+-------------------------------------------+
2607|Capture Text Area |When no delimiters are specified it |
2608| |creates a single cell table. The text in |
2609| |the specified region is placed in that |
2610| |cell. |
2611+------------------+-------------------------------------------+
2612@end smallexample 2515@end smallexample
2613 2516
2614@noindent 2517@noindent
2615By applying @code{table-release}, which does the opposite process, the 2518Each cell can now be edited independently without affecting the layout
2616contents become once again plain text. @code{table-release} works as 2519of other cells. When finished, we can invoke @kbd{M-x table-release}
2617a companion command to @code{table-capture}. 2520to convert the table back to plain text.
2618 2521
2619@node Measuring Tables 2522@node Table Misc
2620@subsection Analyzing Table Dimensions 2523@subsection Table Miscellany
2621@cindex table dimensions
2622 2524
2525@cindex table dimensions
2623@findex table-query-dimension 2526@findex table-query-dimension
2624 The command @code{table-query-dimension} analyzes a table structure 2527 The command @code{table-query-dimension} reports the layout of the
2625and reports information regarding its dimensions. In case of the 2528table and table cell at point. Here is an example of its output:
2626above example table, the @code{table-query-dimension} command displays
2627in echo area:
2628 2529
2629@smallexample 2530@smallexample
2630Cell: (21w, 6h), Table: (67w, 16h), Dim: (2c, 3r), Total Cells: 5 2531Cell: (21w, 6h), Table: (67w, 16h), Dim: (2c, 3r), Total Cells: 5
2631@end smallexample 2532@end smallexample
2632 2533
2633@noindent 2534@noindent
2634This indicates that the current cell is 21 character wide and 6 lines 2535This indicates that the current cell is 21 characters wide and 6 lines
2635high, the entire table is 67 characters wide and 16 lines high. The 2536high, the table is 67 characters wide and 16 lines high with 2 columns
2636table has 2 columns and 3 rows. It has a total of 5 cells, since the 2537and 3 rows, and a total of 5 cells.
2637first row has a spanned cell.
2638 2538
2639@node Table Misc
2640@subsection Table Miscellany
2641
2642@cindex insert string into table cells
2643@findex table-insert-sequence 2539@findex table-insert-sequence
2644 The command @code{table-insert-sequence} inserts a string into each 2540 @kbd{M-x table-insert-sequence} inserts a string into each cell.
2645cell. Each string is a part of a sequence i.e.@: a series of 2541Each string is a part of a sequence i.e.@: a series of increasing
2646increasing integer numbers. 2542integer numbers.
2647 2543
2648@cindex table in language format
2649@cindex table for HTML and LaTeX 2544@cindex table for HTML and LaTeX
2650@findex table-generate-source 2545@findex table-generate-source
2651 The command @code{table-generate-source} generates a table formatted 2546 @kbd{M-x table-generate-source} generates a table formatted for a
2652for a specific markup language. It asks for a language (which must be 2547specific markup language. It asks for a language (which must be one
2653one of @code{html}, @code{latex}, or @code{cals}), a destination 2548of @code{html}, @code{latex}, or @code{cals}), a destination buffer in
2654buffer where to put the result, and the table caption (a string), and 2549which to put the result, and a table caption, and then inserts the
2655then inserts the generated table in the proper syntax into the 2550generated table into the specified buffer. The default destination
2656destination buffer. The default destination buffer is 2551buffer is @code{table.@var{lang}}, where @var{lang} is the language
2657@code{table.@var{lang}}, where @var{lang} is the language you 2552you specified.
2658specified.
2659 2553
2660@node Two-Column 2554@node Two-Column
2661@section Two-Column Editing 2555@section Two-Column Editing
@@ -2663,11 +2557,9 @@ specified.
2663@cindex splitting columns 2557@cindex splitting columns
2664@cindex columns, splitting 2558@cindex columns, splitting
2665 2559
2666 Two-column mode lets you conveniently edit two side-by-side columns of 2560 Two-column mode lets you conveniently edit two side-by-side columns
2667text. It uses two side-by-side windows, each showing its own 2561of text. It uses two side-by-side windows, each showing its own
2668buffer. 2562buffer. There are three ways to enter two-column mode:
2669
2670 There are three ways to enter two-column mode:
2671 2563
2672@table @asis 2564@table @asis
2673@item @kbd{@key{F2} 2} or @kbd{C-x 6 2} 2565@item @kbd{@key{F2} 2} or @kbd{C-x 6 2}