home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / info / texinfo.i07 (.txt) < prev    next >
GNU Info File  |  1993-06-12  |  48KB  |  863 lines

  1. This is Info file texinfo, produced by Makeinfo-1.47 from the input
  2. file texinfo2.tex.
  3.    This file documents Texinfo, a documentation system that uses a
  4. single source file to produce both on-line information and a printed
  5. manual.
  6.    Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
  7.    This is the second edition of the Texinfo documentation,
  8. and is consistent with version 2 of `texinfo.tex'.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that
  14. the entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that this permission notice may be stated in a
  19. translation approved by the Foundation.
  20. File: texinfo,  Node: Using Ordinary TeX Commands,  Next: set and clear,  Prev: Conditional Commands,  Up: Conditionals
  21. Using Ordinary TeX Commands
  22. ===========================
  23.    Inside a region delineated by `@iftex' and `@end iftex', you can
  24. embed some PlainTeX commands.  Info will ignore these commands since
  25. they are only in that part of the file which is seen by TeX.  You can
  26. write the TeX commands as you would write them in a normal TeX file,
  27. except that you must replace the `\' used by TeX with an `@'.  For
  28. example, in the `@titlepage' section of a Texinfo file, you can use the
  29. TeX command `@vskip' to format the copyright page.  (The `@titlepage'
  30. command causes Info to ignore the region automatically, as it does with
  31. the `@iftex' command.)
  32.    However, many features of PlainTeX will not work, as they are
  33. overridden by features of Texinfo.
  34.    You can enter PlainTeX completely, and use `\' in the TeX commands,
  35. by delineating a region with the `@tex' and `@end tex' commands.  (The
  36. `@tex' command also causes Info to ignore the region, like the `@iftex'
  37. command.)
  38.    For example, here is a mathematical expression written in PlainTeX:
  39.      @tex
  40.      $$ \chi^2 = \sum_{i=1}^N
  41.                \left (y_i - (a + b x_i)
  42.                \over \sigma_i\right)^2 $$
  43.      @end tex
  44. The output of this example will appear only in a printed manual.  If
  45. you are reading this in Info, you will not see anything after this
  46. paragraph.
  47. File: texinfo,  Node: set and clear,  Prev: Using Ordinary TeX Commands,  Up: Conditionals
  48. `@set' and `@clear'
  49. ===================
  50.    You can direct the Texinfo formatting commands to format or ignore
  51. parts of a Texinfo file with the `@set', `@clear', and related
  52. commands.  For example, you can use this option to create one document
  53. that has two variants, such as a guide book both for tourists and for
  54. natives of an area.  The version for tourists could have extra
  55. information about how to `get around', while the version for natives
  56. would not.
  57.    To create such a document, write a Texinfo file that specifies some
  58. text for one version, some text for the other version, and some text
  59. for both versions.  The Texinfo formatting commands will only affect
  60. the version you designate.
  61.    Use the `@set FLAG' command to turn on, or "set", a FLAG; a "flag"
  62. can be any word.  The format for the command looks like this:
  63.      @set FLAG
  64.    When a FLAG is set, the Texinfo formatting commands will format text
  65. between subsequent pairs of `@ifset FLAG' and `@end ifset' commands.
  66.    For example, here is an extract from a Texinfo file:
  67.      Unless you have good surge suppressors on your
  68.      power line, you should turn off your computer
  69.      before a thunderstorm.
  70.      
  71.      @set enough-time-before-storm
  72.      
  73.      @ifset enough-time-before-storm
  74.      Save all your files, type @kbd{sync} to ensure that
  75.      the operating system copies all data in memory to the hard
  76.      disk, type @kbd{halt}, and then turn off the machine.
  77.      @end ifset
  78.      
  79.      Pull the electric plug from the wall.
  80. In the example, the formatting commands will format the text between
  81. `@ifset enough-time-before-storm' and `@end ifset' because the
  82. `enough-time-before-storm' flag is set.
  83.    Use the `@clear FLAG' command to turn off, or "clear", a flag. 
  84. Clearing a flag is the opposite of setting a flag.  The command looks
  85. like this:
  86.      @clear FLAG
  87.    When FLAG is cleared, then the Texinfo formatting commands do *not*
  88. format the text between `@ifset FLAG' and `@end ifset'; that text is
  89. ignored and does not appear in either printed or Info output.
  90.    Thus, if you clear the `enough-time-before-storm' flag of the
  91. preceding example with `@clear FLAG', the Texinfo formatting commands
  92. ignore the text between the `@ifset enough-time-before-storm' and `@end
  93. ifset' commands.  In the formatted output, that text does not appear;
  94. you see only the line that says, "Pull the electric plug from the
  95. wall", in both printed and Info output.
  96.    If a flag is cleared with an `@clear FLAG' command, then the
  97. formatting commands format text between subsequent pairs of `@ifclear'
  98. and `@end ifclear' commands.  But if the flag is set with `@set FLAG',
  99. then the formatting commands do *not* format text between an `@ifclear'
  100. and an `@end ifclear' command; rather, they ignore that text.  An
  101. `@ifclear' command looks like this:
  102.      @ifclear FLAG
  103.    In brief, the commands are:
  104. `@set FLAG'
  105.      Tell the Texinfo formatting commands that FLAG is set.
  106. `@clear FLAG'
  107.      Tell the Texinfo formatting commands that FLAG is cleared.
  108. `@ifset FLAG'
  109.      If FLAG is set, tell the Texinfo formatting commands to format the
  110.      text up to the following `@end ifset' command.
  111.      If FLAG is cleared, tell the Texinfo formatting commands to ignore
  112.      text up to the following `@end ifset' command.
  113. `@ifclear FLAG'
  114.      If FLAG is set, tell the Texinfo formatting commands to ignore the
  115.      text up to the following `@end ifclear' command.
  116.      If FLAG is cleared, tell the Texinfo formatting commands to format
  117.      the text up to the following `@end ifclear' command.
  118.    Write each of these commands on a line of its own.
  119. File: texinfo,  Node: Format/Print Hardcopy,  Next: Create an Info File,  Prev: Conditionals,  Up: Top
  120. Format and Print Hardcopy
  121. *************************
  122.    There are three major shell commands for making a printed manual
  123. from a Texinfo file: one for converting the Texinfo file into a file
  124. that will be printed, a second for sorting indices, and a third for
  125. printing the formatted document.  When you use the shell commands, you
  126. can either work directly in the operating system shell or work within a
  127. shell inside GNU Emacs.
  128.    If you are using GNU Emacs, you can use commands provided by Texinfo
  129. mode instead of shell commands.  In addition to the three commands to
  130. format a file, sort the indices, and print the result, Texinfo mode
  131. offers key bindings for commands to recenter the output buffer, show the
  132. print queue, and delete a job from the print queue.
  133. * Menu:
  134. * Use TeX::                     Use TeX to format for hardcopy.
  135. * Shell Format & Print::        How to format and print a hardcopy manual
  136.                                  with shell commands.
  137. * Within Emacs::                How to format and print from an Emacs shell.
  138. * Texinfo Mode Printing::       How to format and print in Texinfo mode.
  139. * Compile-Command::             How to print using Emacs's compile command.
  140. * Requirements Summary::        TeX formatting requirements summary.
  141. * Preparing for TeX::           What you need to do to use TeX.
  142. * Overfull hboxes::             What are and what to do with overfull hboxes.
  143. * smallbook::                   Printing small format books and manuals.
  144. File: texinfo,  Node: Use TeX,  Next: Shell Format & Print,  Up: Format/Print Hardcopy
  145. Use TeX
  146. =======
  147.    The typesetting program called TeX is used for formatting a Texinfo
  148. file.(1) TeX is a very powerful typesetting program and, if used right,
  149. does an exceptionally good job. *Note How to Obtain TeX: Obtaining TeX,
  150. for information on how to obtain TeX.
  151.    The `makeinfo', `texinfo-format-region', and `texinfo-format-buffer'
  152. commands read the very same @-commands in the Texinfo file as does TeX,
  153. but process them differently to make an Info file; see *Note Create an
  154. Info File::.
  155.    ---------- Footnotes ----------
  156.    (1)  If you do not have TeX, you can use the `texi2roff' program for
  157. formatting.
  158. File: texinfo,  Node: Shell Format & Print,  Next: Within Emacs,  Prev: Use TeX,  Up: Format/Print Hardcopy
  159. How to Format and Print Using Shell Commands
  160. ============================================
  161.    Format the Texinfo file with the shell command `tex' followed by the
  162. name of the Texinfo file.  This produces a formatted DVI file as well
  163. as several auxiliary files containing indices, cross references, etc. 
  164. The DVI file (for "DeVice Independent" file) can be printed on a wide
  165. variety of printers.
  166.    The `tex' formatting command itself does not sort the indices; it
  167. writes an output file of unsorted index data.  This is a misfeature of
  168. TeX.  Hence, to generate a printed index, you first need a sorted index
  169. to work from.  The `texindex' command sorts indices.(1)
  170.    The `tex' formatting command outputs unsorted index files under
  171. names that obey a standard convention.  These names are the name of
  172. your main input file to the `tex' formatting command, with everything
  173. after the first period thrown away, and the two letter names of indices
  174. added at the end.  For example, the raw index output files for the
  175. input file `foo.texinfo' would be `foo.cp', `foo.vr', `foo.fn',
  176. `foo.tp', `foo.pg' and `foo.ky'.  Those are exactly the arguments to
  177. give to `texindex'.  Or else, you can use `??' as "wild-cards" and give
  178. the command in this form:
  179.      texindex foo.??
  180. This command will run `texindex' on all the unsorted index files,
  181. including any that you have defined yourself using `@defindex' or
  182. `@defcodeindex'.  (You may execute `texindex foo.??' even if there are
  183. similarly named files with two letter extensions that are not index
  184. files, such as `foo.el'.  The `texindex' command reports but otherwise
  185. ignores such files.)
  186.    For each file specified, `texindex' generates a sorted index file
  187. whose name is made by appending `s' to the input file name.  The
  188. `@printindex' command knows to look for a file of that name. `texindex'
  189. does not alter the raw index output file.
  190.    After you have sorted the indices, you need to rerun the `tex'
  191. formatting command on the Texinfo file.  This regenerates a formatted
  192. DVI file with up-to-date index entries.(2)
  193.    To summarize, this is a three step process:
  194.   1. Run the `tex' formatting command on the Texinfo file.  This
  195.      generates the formatted DVI file as well as the raw index files
  196.      with two letter extensions.
  197.   2. Run the shell command `texindex' on the raw index files to sort
  198.      them.  This creates the corresponding sorted index files.
  199.   3. Rerun the `tex' formatting command on the Texinfo file.  This
  200.      regenerates a formatted DVI file with the index entries in the
  201.      correct order.  This second run also corrects the page numbers for
  202.      the cross references.  (The tables of contents are always correct.)
  203.    You need not run `texindex' each time after you run the `tex'
  204. formatting.  If you do not, on the next run, the `tex' formatting
  205. command will use whatever sorted index files happen to exist from the
  206. previous use of `texindex'.  This is usually OK while you are debugging.
  207.    Rather than type the `tex' and `texindex' commands yourself, you can
  208. use `texi2dvi'.  This shell script is designed to simplify the
  209. `tex'--`texindex'--`tex' sequence by figuring out whether index files
  210. and DVI files are up-to-date. It runs `texindex' and `tex' only when
  211. necessary.
  212.    The syntax for `texi2dvi' is like this (where `%' is the shell
  213. prompt):
  214.      % texi2dvi FILENAME...
  215.    Finally, you can print the DVI file with the DVI print command. The
  216. precise command to use depends on the system; `lpr -d' is common.  The
  217. DVI print command may require a file name without any extension or with
  218. a `.dvi' extension.
  219.    The following commands, for example, sort the indices, format, and
  220. print the `Bison Manual' (where `%' is the shell prompt):
  221.      % tex bison.texinfo
  222.      % texindex bison.??
  223.      % tex bison.texinfo
  224.      % lpr -d bison.dvi
  225. (Remember that the shell commands may be different at your site; but
  226. these are commonly used versions.)
  227.    ---------- Footnotes ----------
  228.    (1)  The source file `texindex.c' comes as part of the standard GNU
  229. distribution and is usually installed when Emacs is installed.
  230.    (2)  If you use more than one index and have cross references to an
  231. index other than the first, you must run `tex' *three times* to get
  232. correct output: once to generate raw index data; again (after
  233. `texindex') to output the text of the indices and determine their true
  234. page numbers; and a third time to output correct page numbers in cross
  235. references to them. However, cross references to indices are rare.
  236. File: texinfo,  Node: Within Emacs,  Next: Texinfo Mode Printing,  Prev: Shell Format & Print,  Up: Format/Print Hardcopy
  237. From an Emacs Shell ...
  238. =======================
  239.    You can give formatting and printing commands from a shell within GNU
  240. Emacs.  To create a shell within Emacs, type `M-x shell'.  In this
  241. shell, you can format and print the document.  *Note  How to Format and
  242. Print Using Shell Commands: Shell Format & Print, for details.
  243.    You can switch to and from the shell buffer while `tex' is running
  244. and do other editing.  If you are formatting a long document on a slow
  245. machine, this can be very convenient.
  246.    You can also use `texi2dvi' from an Emacs shell.  For example, here
  247. is how to use `texi2dvi' to format and print the `GCC Internals Manual'
  248. from a shell within Emacs (where `%' is the shell prompt):
  249.      % texi2dvi gcc.texinfo
  250.      % lpr -d gcc.dvi
  251.    *Note Texinfo Mode Printing::, for more information about formatting
  252. and printing in Texinfo mode.
  253. File: texinfo,  Node: Texinfo Mode Printing,  Next: Compile-Command,  Prev: Within Emacs,  Up: Format/Print Hardcopy
  254. Formatting and Printing in Texinfo Mode
  255. =======================================
  256.    Texinfo mode provides several predefined key commands for TeX
  257. formatting and printing.  These include commands for sorting indices,
  258. looking at the printer queue, killing the formatting job, and
  259. recentering the display of the buffer in which the operations occur.
  260. `C-c C-t C-r'
  261. `M-x texinfo-tex-region'
  262.      Run TeX on the current region.
  263. `C-c C-t C-b'
  264. `M-x texinfo-tex-buffer'
  265.      Run TeX on the current buffer.
  266. `C-c C-t C-i'
  267. `M-x texinfo-texindex'
  268.      Sort the indices of a Texinfo file formatted with
  269.      `texinfo-tex-region' or `texinfo-tex-buffer'.
  270. `C-c C-t C-p'
  271. `M-x texinfo-tex-print'
  272.      Print a DVI file that was made with `texinfo-tex-region' or
  273.      `texinfo-tex-buffer'.
  274. `C-c C-t C-q'
  275. `M-x texinfo-show-tex-print-queue'
  276.      Show the print queue.
  277. `C-c C-t C-d'
  278. `M-x texinfo-delete-from-tex-print-queue'
  279.      Delete a job from the print queue; you will be prompted for the job
  280.      number shown by a preceding `C-c C-t C-q' command
  281.      (`texinfo-show-tex-print-queue').
  282. `C-c C-t C-k'
  283. `M-x texinfo-kill-tex-job'
  284.      Kill the currently running TeX job started by `texinfo-tex-region'
  285.      or `texinfo-tex-buffer', or any other process running in the
  286.      Texinfo shell buffer.
  287. `C-c C-t C-x'
  288. `M-x texinfo-quit-tex-job'
  289.      Quit a TeX formatting job that has stopped because of an error by
  290.      sending an x to it.  When you do this, TeX preserves a record of
  291.      what it did in a `.log' file.
  292. `C-c C-t C-l'
  293. `M-x texinfo-recenter-tex-output-buffer'
  294.      Redisplay the shell buffer in which the TeX printing and formatting
  295.      commands are run to show its most recent output.
  296.    Thus, the usual sequence of commands for formatting a buffer is as
  297. follows (with comments to the right):
  298.      C-c C-t C-b             Run TeX on the buffer.
  299.      C-c C-t C-i             Sort the indices.
  300.      C-c C-t C-b             Rerun TeX to regenerate indices.
  301.      C-c C-t C-p             Print the DVI file.
  302.      C-c C-t C-q             Display the printer queue.
  303.    The Texinfo mode TeX formatting commands start a subshell in Emacs
  304. called the `*texinfo-tex-shell*'.  The `texinfo-tex-command',
  305. `texinfo-texindex-command', and `tex-dvi-print-command' commands are
  306. all run in this shell.
  307.    You can watch the commands operate in the `*texinfo-tex-shell*'
  308. buffer, and you can switch to and from and use the
  309. `*texinfo-tex-shell*' buffer as you would any other shell buffer.
  310.    The formatting and print commands depend on the values of several
  311. variables. The default values are:
  312.           Variable                            Default value
  313.      
  314.      texinfo-tex-command                       "tex"
  315.      texinfo-texindex-command                  "texindex"
  316.      texinfo-tex-shell-cd-command              "cd"
  317.      texinfo-tex-dvi-print-command             "lpr -d"
  318.      texinfo-show-tex-queue-command            "lpq"
  319.      texinfo-delete-from-print-queue-command   "lprm"
  320.      texinfo-start-of-header                   "%**start"
  321.      texinfo-end-of-header                     "%**end"
  322.      texinfo-tex-trailer                       "@bye"
  323.    The default values of `texinfo-tex-command' and
  324. `texinfo-texindex-command' are set in the `texnfo-tex.el' file.
  325.    You can change the values of these variables with the `M-x
  326. edit-options' command (*note Editing Variable Values: ( emacs)Edit
  327. Options.), with the `M-x set-variable' command (*note Examining and
  328. Setting Variables: (emacs)Examining.), or with your `.emacs'
  329. initialization file (*note Init File: (emacs)Init File.).
  330. File: texinfo,  Node: Compile-Command,  Next: Requirements Summary,  Prev: Texinfo Mode Printing,  Up: Format/Print Hardcopy
  331. Using the Local Variables List
  332. ==============================
  333.    Yet another way to apply the TeX formatting command to a Texinfo
  334. file is to put that command in a "local variables list" at the end of
  335. the Texinfo file.  You can then specify the TeX formatting command as a
  336. `compile-command' and have Emacs run the TeX formatting command by
  337. typing `M-x compile'.  This creates a special shell called the
  338. `*compilation buffer*' in which Emacs runs the compile command.  For
  339. example, at the end of the `gdb.texinfo' file, after the `@bye', you
  340. would put the following:
  341.      @c Local Variables:
  342.      @c compile-command: "tex gdb.texinfo"
  343.      @c End:
  344. This technique is most often used by programmers who also compile
  345. programs this way; see *Note Compilation: (emacs)Compilation.
  346. File: texinfo,  Node: Requirements Summary,  Next: Preparing for TeX,  Prev: Compile-Command,  Up: Format/Print Hardcopy
  347. TeX Formatting Requirements Summary
  348. ===================================
  349.    Every Texinfo file that is to be input to TeX must begin with a
  350. `\input' command and contain an `@settitle' command:
  351.      \input texinfo
  352.      @settitle NAME-OF-MANUAL
  353. The first command instructs TeX to load the macros it needs to process
  354. a Texinfo file and the second command specifies the title of printed
  355. manual.
  356.    Every Texinfo file must end with a line that terminates TeX
  357. processing and forces out unfinished pages:
  358.      @bye
  359.    Strictly speaking, these three lines are all a Texinfo file needs for
  360. TeX, besides the body.  (The `@setfilename' line is the only line that
  361. a Texinfo file needs for Info formatting.)
  362.    Usually, the file's first line contains an `@c -*-texinfo-*-'
  363. comment that causes Emacs to switch to Texinfo mode when you edit the
  364. file.  In addition, the beginning usually includes an `@setfilename'
  365. for Info formatting, an `@setchapternewpage' command, a title page, a
  366. copyright page, and permissions.  Besides an `@bye', the end of a file
  367. usually includes indices and a table of contents.
  368. For more information, see
  369. *Note `@setchapternewpage': setchapternewpage,
  370. *Note Page Headings: Headings,
  371. *Note Titlepage & Copyright Page::,
  372. *Note Printing Indices & Menus::, and
  373. *Note Contents::.
  374. File: texinfo,  Node: Preparing for TeX,  Next: Overfull hboxes,  Prev: Requirements Summary,  Up: Format/Print Hardcopy
  375. Preparing to Use TeX
  376. ====================
  377. TeX needs to know where to find the `texinfo.tex' file that you have
  378. told it to input with the `\input texinfo' command at the beginning of
  379. the first line.  The `texinfo.tex' file tells TeX how to handle
  380. @-commands.  (`texinfo.tex' is included in the standard GNU
  381. distributions.)
  382.    Usually, the `texinfo.tex' file is put in the default directory that
  383. contains TeX macros (the `/usr/lib/tex/macros' directory) when GNU
  384. Emacs or other GNU software is installed. In this case, TeX will find
  385. the file and you do not need to do anything special. Alternatively, you
  386. can put `texinfo.tex' in the directory in which the Texinfo source file
  387. is located, and TeX will find it there.
  388.    However, you may want to specify the location of the `\input' file
  389. yourself.  One way to do this is to write the complete path for the file
  390. after the `\input' command.  Another way is to set the `TEXINPUTS'
  391. environment variable in your `.cshrc' or `.profile' file.  The
  392. `TEXINPUTS' environment variable will tell TeX where to find the
  393. `texinfo.tex' file and any other file that you might want TeX to use.
  394.    Whether you use a `.cshrc' or `.profile' file depends on whether you
  395. use `csh', `sh', or `bash' for your shell command interpreter.  When
  396. you use `csh', it looks to the `.cshrc' file for initialization
  397. information, and when you use `sh' or `bash', it looks to the
  398. `.profile' file.
  399.    In a `.cshrc' file, you could use the following `csh' command
  400. sequence:
  401.      setenv TEXINPUTS .:/usr/me/mylib:/usr/lib/tex/macros
  402.    In a `.profile' file, you could use the following `sh' command
  403. sequence:
  404.      TEXINPUTS=.:/usr/me/mylib:/usr/lib/tex/macros
  405.      export TEXINPUTS
  406. This would cause TeX to look for `\input' file first in the current
  407. directory, indicated by the `.', then in a hypothetical user's
  408. `me/mylib' directory, and finally in the system library.
  409. File: texinfo,  Node: Overfull hboxes,  Next: smallbook,  Prev: Preparing for TeX,  Up: Format/Print Hardcopy
  410. Overfull "hboxes"
  411. =================
  412.    TeX is sometimes unable to typeset a line without extending it into
  413. the right margin.  This can occur when TeX comes upon what it
  414. interprets as a long word that it cannot hyphenate, such as an
  415. electronic mail network address or a very long title.  When this
  416. happens, TeX prints an error message like this:
  417.      Overfull \hbox (20.76302pt too wide)
  418. (In TeX, lines are in "horizontal boxes", hence the term, "hbox". The
  419. backslash, `\', is the TeX equivalent of `@'.)
  420.    TeX also provides the line number in the Texinfo source file and the
  421. text of the offending line, which is marked at all the places that TeX
  422. knows how to hyphenate words. *Note Catching Errors with TeX
  423. Formatting: Debugging with TeX, for more information about typesetting
  424. errors.
  425.    If the Texinfo file has an overfull hbox, you can rewrite the
  426. sentence so the overfull hbox does not occur, or you can decide to
  427. leave it.  A small excursion into the right margin often does not
  428. matter and may not even be noticeable.
  429.    However, if you do leave an overfull hbox, unless told otherwise,
  430. TeX will print a large, ugly, black rectangle beside the line. This is
  431. so you will notice the location of the problem if you are correcting a
  432. draft.  To prevent such a monstrosity from marring your final printout,
  433. put the following in the beginning of the Texinfo file on a line of its
  434. own, before the `@titlepage' command:
  435.      @finalout
  436. File: texinfo,  Node: smallbook,  Prev: Overfull hboxes,  Up: Format/Print Hardcopy
  437. Printing "Small" Books
  438. ======================
  439.    By default, TeX typesets pages for printing in an 8.5 by 11 inch
  440. format.  However, you can direct TeX to typeset a document in a 7 by
  441. 9.25 inch format that is suitable for bound books by inserting the
  442. following command on a line by itself at the beginning of the Texinfo
  443. file, before the title page:
  444.      @smallbook
  445. (Since regular sized books are often about 7 by 9.25 inches, this
  446. command might better have been called the `@regularbooksize' command,
  447. but it came to be called the `@smallbook' command by comparison to the
  448. 8.5 by 11 inch format.)
  449.    If you write the `@smallbook' command between the start-of-header
  450. and end-of-header lines, the Texinfo mode TeX region formatting
  451. command, `texinfo-tex-region', will format the region in "small" book
  452. size (*note Start of Header::.).
  453.    The Free Software Foundation distributes printed copies of `The GNU
  454. Emacs Manual' and other manuals in the "small" book size. *Note
  455. `@smallexample' and `@smalllisp': smallexample & smalllisp, for
  456. information about commands that make it easier to produce examples for
  457. a smaller manual.
  458. File: texinfo,  Node: Create an Info File,  Next: Install an Info File,  Prev: Format/Print Hardcopy,  Up: Top
  459. Creating an Info File
  460. *********************
  461.    `makeinfo' is a utility that converts a Texinfo file into an Info
  462. file; `texinfo-format-region' and `texinfo-format-buffer' are GNU Emacs
  463. functions that do the same.
  464.    A Texinfo file must possess an `@setfilename' line near its
  465. beginning, otherwise the Info formatting commands will fail.
  466.    For information on installing the Info file in the Info system, see
  467. *Note Install an Info File::.
  468. * Menu:
  469. * makeinfo advantages::         `makeinfo' provides better error checking.
  470. * Running makeinfo::            How to run `makeinfo' from a shell.
  471. * makeinfo options::            Specify fill-column and other options.
  472. * Pointer Validation::          How to check that pointers point somewhere.
  473. * makeinfo in Emacs::           How to run `makeinfo' from Emacs.
  474. * texinfo-format commands::     Two Info formatting commands written
  475.                                   in Emacs Lisp are an alternative
  476.                                   to `makeinfo'.
  477. * Tag and Split Files::         How tagged and split files help Info
  478.                                   to run better.
  479. File: texinfo,  Node: makeinfo advantages,  Next: Running makeinfo,  Up: Create an Info File
  480. `makeinfo' Preferred
  481. ====================
  482.    The `makeinfo' utility creates an Info file from a Texinfo source
  483. file more quickly than either of the Emacs formatting commands and
  484. provides better error messages.  We recommend it.  `makeinfo' is a C
  485. program that is independent of Emacs.  You do not need to run Emacs to
  486. use `makeinfo', which means you can use `makeinfo' on machines that are
  487. too small to run Emacs. You can run `makeinfo' in any one of three
  488. ways: from an operating system shell, from a shell inside Emacs, or by
  489. typing a key command in Texinfo mode in Emacs.
  490.    The `texinfo-format-region' and the `texinfo-format-buffer' commands
  491. are useful if you cannot run `makeinfo'.  Also, in some circumstances,
  492. they format short regions or buffers more quickly than `makeinfo'.
  493. File: texinfo,  Node: Running makeinfo,  Next: makeinfo options,  Prev: makeinfo advantages,  Up: Create an Info File
  494. Running `makeinfo' from a Shell
  495. ===============================
  496.    To create an Info file from a Texinfo file, type `makeinfo' followed
  497. by the name of the Texinfo file.  Thus, to create the Info file for
  498. Bison, type the following at the shell prompt (where `%' is the prompt):
  499.      % makeinfo bison.texinfo
  500.    (You can run a shell inside Emacs by typing `M-x shell'.)
  501.    Sometimes you will want to specify options.  For example, if you wish
  502. to discover which version of `makeinfo' you are using, type:
  503.      % makeinfo --version
  504.    *Note makeinfo options::, for more information.
  505. File: texinfo,  Node: makeinfo options,  Next: Pointer Validation,  Prev: Running makeinfo,  Up: Create an Info File
  506. Options for `makeinfo'
  507. ======================
  508.    The `makeinfo' command takes a number of options.  Most often,
  509. options are used to set the value of the fill column and specify the
  510. footnote style.  Each command line option is a word preceded by `--'(1)
  511. or a letter preceded by `-'.  You can use abbreviations for the option
  512. names as long as they are unique.
  513.    For example, you could use the following command to create an Info
  514. file for `bison.texinfo' in which each line is filled to only 68
  515. columns (where `%' is the prompt):
  516.      % makeinfo --fill-column=68 bison.texinfo
  517.    You can write two or more options in sequence, like this:
  518.      % makeinfo --no-split --fill-column=70 ...
  519. This would keep the Info file together as one possibly very long file
  520. and would also set the fill column to 70.
  521.    The options are:
  522. `-D VAR'
  523.      Cause VAR to be defined.  This is equivalent to `@set VAR' in the
  524.      Texinfo file.
  525. `--error-limit=LIMIT'
  526.      Set the maximum number of errors that `makeinfo' will report
  527.      before exiting (on the assumption that continuing would be
  528.      useless). The default number of errors that can be reported before
  529.      `makeinfo' gives up is 100.
  530. `--fill-column=WIDTH'
  531.      Specify the maximum number of columns in a line; this is the
  532.      right-hand edge of a line.  Paragraphs that are filled will be
  533.      filled to this width.  (Filling is the process of breaking up and
  534.      connecting lines so that lines are the same length as or shorter
  535.      than the number specified as the fill column.  Lines are broken
  536.      between words.)
  537. `--footnote-style=STYLE'
  538.      Set the footnote style to STYLE, either `end' for the end node
  539.      style or `separate' for the separate node style.  The value set by
  540.      this option overrides the value set in a Texinfo file by an
  541.      `@footnotestyle' command.  When the footnote style is `separate',
  542.      `makeinfo' makes a new node containing the footnotes found in the
  543.      current node.  When the footnote style is `end', `makeinfo' places
  544.      the footnote references at the end of the current node.
  545. `-I DIR'
  546.      Add `dir' to the directory search list for finding files that are
  547.      included using the `@include' command.  By default, `makeinfo'
  548.      searches only the current directory.
  549. `--no-headers'
  550.      Do not include menus or node lines in the output.  This results in
  551.      an ASCII file that you cannot read in Info since it does not
  552.      contain the requisite nodes or menus; but you can print such a
  553.      file in a single, typewriter-like font and produce acceptable
  554.      output.
  555. `--no-split'
  556.      Suppress the splitting stage of `makeinfo'.  Normally, large
  557.      output files (where the size is greater than 70k bytes) are split
  558.      into smaller subfiles, each one approximately 50k bytes.  If you
  559.      specify `--no-split', `makeinfo' will not split up the output file.
  560. `--no-pointer-validate'
  561. `--no-validate'
  562.      Suppress the pointer-validation phase of `makeinfo'.  Normally,
  563.      after a Texinfo file is processed, some consistency checks are
  564.      made to ensure that cross references can be resolved, etc. *Note
  565.      Pointer Validation::.
  566. `--no-warn'
  567.      Suppress the output of warning messages.  This does *not* suppress
  568.      the output of error messages, only warnings.  You might want this
  569.      if the file you are creating has examples of Texinfo cross
  570.      references within it, and the nodes that are referenced do not
  571.      actually exist.
  572. `--output=FILE'
  573. `-o FILE'
  574.      Specify that the output should be directed to FILE and not to the
  575.      file name specified in the `@setfilename' command found in the
  576.      texinfo source.  FILE can be the special token `-', which specifies
  577.      standard output.
  578. `--paragraph-indent=INDENT'
  579.      Set the paragraph indentation style to INDENT.  The value set by
  580.      this option overrides the value set in a Texinfo file by an
  581.      `@paragraphindent' command.  The value of INDENT is interpreted as
  582.      follows:
  583.         * If the value of INDENT is `asis', do not change the existing
  584.           indentation at the starts of paragraphs.
  585.         * If the value of INDENT is zero, delete any existing
  586.           indentation.
  587.         * If the value of INDENT is greater than zero, indent each
  588.           paragraph by that number of spaces.
  589. `--reference-limit=LIMIT'
  590.      Set the value of the number of references to a node that
  591.      `makeinfo' will make without reporting a warning.  If a node has
  592.      more than this number of references in it, `makeinfo' will make the
  593.      references but also report a warning.
  594. `-U VAR'
  595.      Cause VAR to be undefined.  This is equivalent to `@clear VAR' in
  596.      the Texinfo file.
  597. `--verbose'
  598.      Cause `makeinfo' to display messages saying what it is doing.
  599.      Normally, `makeinfo' only outputs messages if there are errors or
  600.      warnings.
  601. `--version'
  602.      Report the version number of this copy of `makeinfo'.
  603.    ---------- Footnotes ----------
  604.    (1)  `--' has replaced `+', the old introductory character, to
  605. maintain POSIX.2 compatibility without losing long-named options.
  606. File: texinfo,  Node: Pointer Validation,  Next: makeinfo in Emacs,  Prev: makeinfo options,  Up: Create an Info File
  607. Pointer Validation
  608. ==================
  609.    If you do not suppress pointer-validation (by using the
  610. `--no-pointer-validation' option), `makeinfo' will check the validity
  611. of the final Info file.  Mostly, this means ensuring that nodes you
  612. have referenced really exist.  Here is a complete list of what is
  613. checked:
  614.   1. If a `Next', `Previous', or `Up' node reference is a reference to a
  615.      node in the current file and is not an external reference such as
  616.      to `(dir)', then the referenced node must exist.
  617.   2. In every node, if the `Previous' node is different from the `Up'
  618.      node, then the `Previous' node must also be pointed to by a `Next'
  619.      node.
  620.   3. Every node except the `Top' node must have an `Up' pointer.
  621.   4. The node referenced by an `Up' pointer must contain a reference to
  622.      the current node in some manner other than through a `Next'
  623.      reference. This includes menu entries and cross references.
  624.   5. If the `Next' reference of a node is not the same as the `Next'
  625.      reference of the `Up' reference, then the node referenced by the
  626.      `Next' pointer must have a `Previous' pointer that points back to
  627.      the current node. This rule allows the last node in a section to
  628.      point to the first node of the next chapter.
  629. File: texinfo,  Node: makeinfo in Emacs,  Next: texinfo-format commands,  Prev: Pointer Validation,  Up: Create an Info File
  630. Running `makeinfo' inside Emacs
  631. ===============================
  632.    You can run `makeinfo' in GNU Emacs Texinfo mode by using either the
  633. `makeinfo-region' or the `makeinfo-buffer' commands.  In Texinfo mode,
  634. the commands are bound to `C-c C-m C-r' and `C-c C-m C-b' by default.
  635. `C-c C-m C-r'
  636. `M-x makeinfo-region'
  637.      Format the current region for Info.
  638. `C-c C-m C-b'
  639. `M-x makeinfo-buffer'
  640.      Format the current buffer for Info.
  641.    When you invoke either `makeinfo-region' or `makeinfo-buffer', Emacs
  642. prompts for a file name, offering the name of the visited file as the
  643. default.  You can edit the default file name in the minibuffer if you
  644. wish, before typing RET to start the `makeinfo' process.
  645.    The Emacs `makeinfo-region' and `makeinfo-buffer' commands run the
  646. `makeinfo' program in a temporary shell buffer.  If `makeinfo' finds
  647. any errors, Emacs displays the error messages in the temporary buffer.
  648.    You can parse the error messages by typing `C-x `' (`next-error'). 
  649. This causes Emacs to go to and position the cursor on the line in the
  650. Texinfo source that `makeinfo' thinks caused the error.  *Note Running
  651. `make' or Compilers Generally: (emacs)Compilation, for more information
  652. about using the `next-error' command.
  653.    In addition, you can kill the shell in which the `makeinfo' command
  654. is running or make the shell buffer display its most recent output.
  655. `C-c C-m C-k'
  656. `M-x makeinfo-kill-job'
  657.      Kill the current running `makeinfo' job created by
  658.      `makeinfo-region' or `makeinfo-buffer'.
  659. `C-c C-m C-l'
  660. `M-x makeinfo-recenter-output-buffer'
  661.      Redisplay the `makeinfo' shell buffer to display its most recent
  662.      output.
  663. (Note that the parallel commands for killing and recentering a TeX job
  664. are `C-c C-t C-k' and `C-c C-t C-l'.  *Note Texinfo Mode Printing::.)
  665.    You can specify options for `makeinfo' by setting the
  666. `makeinfo-options' variable with either the `M-x edit-options' or the
  667. `M-x set-variable' command, or by setting the variable in your `.emacs'
  668. initialization file.
  669.    For example, you could write the following in your `.emacs' file:
  670.      (setq makeinfo-options
  671.            "--paragraph-indent=0 --no-split
  672.             --fill-column=70 --verbose")
  673. For more information, see
  674. *Note Editing Variable Values: (emacs)Edit Options,
  675. *Note Examining and Setting Variables: (emacs)Examining,
  676. *Note Init File: (emacs)Init File, and
  677. *Note Options for `makeinfo': makeinfo options.
  678. File: texinfo,  Node: texinfo-format commands,  Next: Tag and Split Files,  Prev: makeinfo in Emacs,  Up: Create an Info File
  679. The `texinfo-format...' Commands
  680. ================================
  681. In GNU Emacs in Texinfo mode, you can format part or all of a Texinfo
  682. file with the `texinfo-format-region' command.  This formats the
  683. current region and displays the formatted text in a temporary buffer
  684. called `*Info Region*'.
  685.    Similarly, you can format a buffer with the `texinfo-format-buffer'
  686. command.  This command creates a new buffer and generates the Info file
  687. in it.  Typing `C-x C-s' will save the Info file under the name
  688. specified by the `@setfilename' line which must be near the beginning
  689. of the Texinfo file.
  690. `C-c C-e C-r'
  691. ``texinfo-format-region''
  692.      Format the current region for Info.
  693. `C-c C-e C-b'
  694. ``texinfo-format-buffer''
  695.      Format the current buffer for Info.
  696.    The `texinfo-format-region' and `texinfo-format-buffer' commands
  697. provide you with some error checking, and other functions can provide
  698. you with further help in finding formatting errors.  These procedures
  699. are described in an appendix; see *Note Catching Mistakes::. However,
  700. the `makeinfo' program is often faster and provides better error
  701. checking (*note makeinfo in Emacs::.).
  702. File: texinfo,  Node: Tag and Split Files,  Prev: texinfo-format commands,  Up: Create an Info File
  703. Tag Files and Split Files
  704. =========================
  705.    If a Texinfo file has more than 30,000 bytes,
  706. `texinfo-format-buffer' automatically creates a tag table for its Info
  707. file;  `makeinfo' always creates a tag table.  With a "tag table", Info
  708. can jump to new nodes more quickly than it can otherwise.
  709.    In addition, if the Texinfo file contains more than about 70,000
  710. bytes, `texinfo-format-buffer' and `makeinfo' split the large Info file
  711. into shorter "indirect" subfiles of about 50,000 bytes each.  Big files
  712. are split into smaller files so that Emacs does not need to make a
  713. large buffer to hold the whole of a large Info file; instead, Emacs
  714. allocates just enough memory for the small, split off file that is
  715. needed at the time.  This way, Emacs avoids wasting memory when you run
  716. Info.  (Before splitting was implemented, Info files were always kept
  717. short and "include files" were designed as a way to create a single,
  718. large printed manual out of the smaller Info files.  *Note Include
  719. Files::, for more information.  Include files are still used for very
  720. large documents, such as `The Emacs Lisp Reference Manual', in which
  721. each chapter is a separate file.)
  722.    When a file is split, Info itself makes use of a shortened version of
  723. the original file that contains just the tag table and references to
  724. the files that were split off.  The split off files are called
  725. "indirect" files.
  726.    The split off files have names that are created by appending `-1',
  727. `-2', `-3' and so on to the file name specified by the `@setfilename'
  728. command.  The shortened version of the original file continues to have
  729. the name specified by `@setfilename'.
  730.    At one stage in writing this document, for example, the Info file
  731. was saved as `test-texinfo' and that file looked like this:
  732.      Info file: test-texinfo,    -*-Text-*-
  733.      produced by texinfo-format-buffer
  734.      from file: new-texinfo-manual.texinfo
  735.      
  736.      ^_
  737.      Indirect:
  738.      test-texinfo-1: 102
  739.      test-texinfo-2: 50422
  740.      test-texinfo-3: 101300
  741.      ^_^L
  742.      Tag table:
  743.      (Indirect)
  744.      Node: overview^?104
  745.      Node: info file^?1271
  746.      Node: printed manual^?4853
  747.      Node: conventions^?6855
  748.      ...
  749. (But `test-texinfo' had far more nodes than are shown here.)  Each of
  750. the split off, indirect files, `test-texinfo-1', `test-texinfo-2', and
  751. `test-texinfo-3', is listed in this file after the line that says
  752. `Indirect:'.  The tag table is listed after the line that says `Tag
  753. table:'.
  754.    In the list of indirect files, the number following the file name
  755. records the cumulative number of bytes in the preceding indirect files,
  756. not counting the file list itself, the tag table, or the permissions
  757. text in each file.  In the tag table, the number following the node name
  758. records the location of the beginning of the node, in bytes from the
  759. beginning.
  760.    If you are using `texinfo-format-buffer' to create Info files, you
  761. may want to run the `Info-validate' command.  (The `makeinfo' command
  762. does such a good job on its own, you do not need `Info-validate'.) 
  763. However, you cannot run the `M-x Info-validate' node-checking command
  764. on indirect files.  For information on how to prevent files from being
  765. split and how to validate the structure of the nodes, see *Note Using
  766. Info-validate::.
  767. File: texinfo,  Node: Install an Info File,  Next: Command List,  Prev: Create an Info File,  Up: Top
  768. Installing an Info File
  769. ***********************
  770.    Info files are usually kept in the `.../emacs/info' directory.  (You
  771. can find the location of this directory within Emacs by typing `C-h i'
  772. to enter Info and then typing `C-x C-f' to see the full pathname to the
  773. `info' directory.)
  774. * Menu:
  775. * Directory file::              The top level menu for all Info files.
  776. * New Info File::               Listing a new info file.
  777. * Other Info Directories::      How to specify Info files that are
  778.                                   located in other directories.
  779. File: texinfo,  Node: Directory file,  Next: New Info File,  Up: Install an Info File
  780. The `dir' File
  781. ==============
  782.    For Info to work, the `info' directory must contain a file that
  783. serves as a top level directory for the Info system.  By convention,
  784. this file is called `dir'.  The `dir' file is itself an Info file.  It
  785. contains the top level menu for all the Info files in the system.  The
  786. menu looks like this:
  787.      * Menu:
  788.      
  789.      * Info:    (info).     Documentation browsing system.
  790.      * Emacs:   (emacs).    The extensible, self-documenting
  791.                             text editor.
  792.      * Texinfo: (texinfo).  With one source file, make
  793.                             either a printed manual using
  794.                             TeX or an Info file.
  795.      ...
  796. Each of these menu entries points to the `Top' node of the Info file
  797. that is named in parentheses.  (The menu entry does not need to specify
  798. the `Top' node, since Info goes to the `Top' node if no node name is
  799. mentioned.  *Note Nodes in Other Info Files: Other Info Files.)
  800.    Thus, the `Info' entry points to the `Top' node of the `info' file
  801. and the `Emacs' entry points to the `Top' node of the `emacs' file.
  802.    In each of the Info files, the `Up' pointer of the `Top' node refers
  803. back to the `dir' file.  For example, the line for the `Top' node of
  804. the Emacs manual looks like this in Info:
  805.      File: emacs  Node: Top, Up: (DIR), Next: Distrib
  806. (Note that in this case, the file name is written in upper case
  807. letters--it can be written in either upper or lower case.  Info has a
  808. feature that it will change the case of the file name to lower case if
  809. it cannot find the name as written.)
  810. File: texinfo,  Node: New Info File,  Next: Other Info Directories,  Prev: Directory file,  Up: Install an Info File
  811. Listing a New Info File
  812. =======================
  813.    To add a new Info file to your system, write a new menu entry to the
  814. menu in the `dir' file by editing the `dir' file by hand.  Also, put the
  815. new Info file in the `.../emacs/info' directory.  For example, if you
  816. were adding documentation for GDB, you would make the following new
  817. entry:
  818.      * GDB: (gdb).           The source-level C debugger.
  819. The first part of the menu entry is the menu entry name; it is followed
  820. by a colon.  The second part is the name of the Info file, in
  821. parentheses; it is followed by a period.  The third part of the entry
  822. is the description of the item.
  823.    Conventionally, the name of an Info file has a `.info' extension.
  824. Thus, you might list the name of the file like this:
  825.      * GDB: (gdb.info).           The source-level C debugger.
  826. However, Info will look for a file with a `.info' extension if it does
  827. not find the file under the name given in the menu.  This means that in
  828. a menu  you can refer to the file `gdb.info' as `gdb', as shown in the
  829. first example.  This looks better.
  830. File: texinfo,  Node: Other Info Directories,  Prev: New Info File,  Up: Install an Info File
  831. Info Files in Other Directories
  832. ===============================
  833.    If an Info file is not in the `info' directory, there are two ways
  834. to specify its location:
  835.    * Write the pathname as the menu's second part, or;
  836.    * Specify the `info' directory name in an environment variable in
  837.      your `.profile' or `.cshrc' initialization file.  (Only you and
  838.      others with the same environment variable will be able to find Info
  839.      files whose location is specified this way.)
  840.    For example, to reach a test file in the `~bob/manuals' directory,
  841. you could add an entry like this to the menu in the `dir' file:
  842.      * Test: (~bob/manuals/info-test).  Bob's own test file.
  843. In this case, the absolute file name of the `info-test' file is written
  844. as the second part of the menu entry.
  845.    Alternatively, you may set the `INFOPATH' environment variable in
  846. your `.cshrc' or `.profile' file.  The `INFOPATH' environment variable
  847. will tell Info where to look.
  848.    If you use `sh' or `bash' for your shell command interpreter, you
  849. must set the `INFOPATH' environment variable in the `.profile'
  850. initialization file; but if you use `csh', you must set the variable in
  851. the `.cshrc' initialization file.  The two files require slightly
  852. different command formats.
  853.    * In a `.cshrc' file, you could set the `INFOPATH' variable as
  854.      follows:
  855.           setenv INFOPATH .:~bob/manuals:/usr/local/emacs/info
  856.    * In a `.profile' file, you would achieve the same effect by writing:
  857.           INFOPATH=.:~bob/manuals:/usr/local/emacs/info
  858.           export INFOPATH
  859. Either form would cause Info to look first in the current directory,
  860. indicated by the `.', then in the `~bob/manuals' directory, and finally
  861. in the `/usr/local/emacs/info' directory (which is the usual location
  862. for the standard Info directory).
  863.