📄 texinfo.texinfo
字号:
@comment node-name, next, previous, up@section Generating a Table of Contents@cindex Table of contents@cindex Contents, Table of The commands @code{@@chapter}, @code{@@section}, etc., supply theinformation to make up a table of contents, but they do not cause an actualtable to be generated. To do this, you must use the commands@code{@@contents} and @code{@@summarycontents}.@refill@table @code@item @@contentsThe table of contents command outputs (into a printed manual) a completetable of contents, based on the @code{@@chapter}, @code{@@unnumbered} andother sectioning commands. This command should be used on a line byitself.@refill@item @@summarycontents The summary contents command generates a summary table of contents thatlists only the chapters (and appendices and unnumbered chapters); sections,subsections and subsubsections are omitted. This command should be used ona line by itself. Only large manuals need a summary table ofcontents.@refill@end tableYou can use either one of these commands, or both. Each commandautomatically generates a chapter-like heading at the top of the page.Tables of contents should be generated at the very end of the manual, justbefore the @code{@@bye} command; the tables of contents commands shouldfollow any indices that are output, so that the indices will appear in thecontents.@refill@group@example@var{indices}@dots{}@@summarycontents@@contents@@bye@end example@end groupThe commands @code{@@contents} and @code{@@summarycontents} are ignored when anInfo file is being generated.@node Indices, , Contents, Ending a File@comment node-name, next, previous, up@section Creating Indices@cindex Indices@cindex Creating indicesUsing Texinfo, you can generate printed indices and Info file menus withouthaving to sort and collate entries manually. Texinfo will do this for youautomatically. Each index covers a certain kind of entry (functions, orvariables, or concepts, etc.)@: and lists all of those entries inalphabetical order, together with information on how to find the discussionof each entry. In a printed manual, this information consists of pagenumbers. In an Info file, it consists of a menu item leading to the firstnode referenced.When you are making index entries, it is good practice to think of thedifferent categories under which people may look for something. Differentpeople @emph{do not} think of the same words when they look something up.They think of different words. A helpful index will have items indexedunder all the different words that people may use. For example, someone mightthink it obvious that the two letter names for indices should be listedunder ``Indices, two letter names'', since the word ``Index'' is thegeneral concept. But another reader may remember the specific concept oftwo letter names and search for the entry listed as ``Two letter names forindices''. A good index will have both entries and will help both kinds ofuser.Like typesetting, the construction of an index is a highly skilled,professional art, the subtleties of which are not appreciated until youhave to do it yourself.Normally, six indices are provided for:@itemize @bullet@itemA @dfn{program index} listing names of programs and leading to the placeswhere those programs are documented.@refill@itemA @dfn{function index} listing functions (such as, entry points oflibraries).@refill@itemA @dfn{variables index} listing variables (such as, external variables oflibraries).@refill@itemA @dfn{data type index} listing data types (such as, structures defined inheader files).@refill@itemA @dfn{keystroke index} listing keyboard commands.@refill@itemA @dfn{concept index} listing concepts that are discussed.@refill@end itemize@noindentNot every manual needs all of these. This manual has two indices: aconcept index and an @@-command index (that uses the function index but iscalled a command index in the chapter heading). Two or more indices can becombined into one using the @code{@@synindex} command. @xref{CombiningIndices}.@menu* Index Entries:: Defining the entries of an index* Combining Indices::* Printing Indices & Menus::@end menu@node Index Entries, Combining Indices, , Indices@comment node-name, next, previous, up@subsection Defining the Entries of an Index@cindex Defining the entries of an index@cindex Index entries@cindex Entries for an indexThe data to make an index comes from many individual commands scatteredthroughout the Texinfo source file. Each command says to add one entry toa particular index; after processing, it will give the current page numberor node name as the reference.@table @code@item @@cindex @var{concept}Make an entry in the concept index for @var{concept}, referring to thecurrent page or node.@refill@item @@findex @var{function}Make an entry in the function index for @var{function}, referring to thecurrent page or node.@refill@item @@vindex @var{variable}Make an entry in the variable index for @var{variable}, referring to thecurrent page or node.@refill@item @@pindex @var{program}Make an entry in the program index for @var{program}, referring to thecurrent page or node.@refill@item @@kindex @var{key}Make an entry in the key index for @var{key}, referring to thecurrent page or node.@refill@item @@tindex @var{data type}Make an entry in the data type index for @var{data type}, referring to thecurrent page or node.@refill@end tableIf the same name is indexed on several pages, all the pages are listed inthe printed manual's index. However, @strong{only} the @strong{first} nodereferenced will appear in the index of an Info file. This means that it isbest to write indices in which each entry will refer to only one place in theTexinfo file. Fortunately, this constraint is a feature rather than losssince it means that the index will be easy to use. Otherwise, it can beeasy to create an index which has many pages listed for an entry and youdon't know which one you need.@refillYou are not actually required to use indices for their canonicalpurposes. For example, you might wish to index some C preprocessor macros.You could put them in the function index along with actual functions, justby writing @code{@@findex} commands for them; then, when you print the``function index'', you could give it the title `Function and Macro Index'and all will be consistent for the reader. Or you could put the macros inwith the data types by writing @code{@@tindex} commands for them, and givethat index a suitable title so the reader will understand.@refill@node Combining Indices, Printing Indices & Menus, Index Entries, Indices@comment node-name, next, previous, up@subsection Combining Indices@cindex Combining Indices@cindex Indices, combining themSometimes you will want to combine two disparate indices such as functionsand variables, perhaps because you have few enough of one of them thata separate index for them would look silly.You could put variables into the function index by writing @code{@@findex}commands for them instead of @code{@@vindex} commands, and produce aconsistent manual by printing the function index with the title `Functionand Variable Index' and not printing the `Variable Index' at all; but thisis not a robust procedure. It works only as long as your document is neverincluded in part of or together with another document that is designed tohave a separate variable index; if you did that, the variables from yourdocument and those from the other would not end up together.What you should do instead when you want functions and variables in oneindex is to index the variables with @code{@@vindex} as they should be, butuse the @code{@@synindex} command to redirect these @code{@@vindex}commands to the function index. @code{@@synindex} takes two arguments: thename of an index to redirect, and the name of an index to redirect it to.For this purpose, the indices are given two-letter names:@cindex Two letter names for indices@cindex Indices, two letter names@cindex Names for indices@table @samp@item cpthe concept index@item vrthe variable index@item fnthe function index@item kythe key index@item pgthe program index@item tpthe data type index@end tableThus, @code{@@synindex vr fn} at the front of a Texinfo filewill cause all entries designated for the variable index to go tothe function index instead.@node Printing Indices & Menus, , Combining Indices, Indices@comment node-name, next, previous, up@subsection Printing an Index and Generating Menus@cindex Printing an index@cindex Indices, printing@cindex Generating menus with indices@cindex Menus generated with indicesTo print an index means to include it as part of a manual or Info file.This does not happen automatically just because you use @code{@@cindex} orother index-entry generating commands in the Texinfo file; those just causethe raw data for the index to be accumulated. To print an index, you mustinclude the @code{@@printindex} command at the place in the document whereyou want the index to appear. Also, for the case of the printed manual,you must run a program called @code{texindex} to sort the raw data toproduce a sorted index file, which is what will actually be used to printthe index.@refillThe Texinfo command that is used to print indices is @code{@@printindex}.It takes the two-letter index name (@pxref{Combining Indices}) as anargument without braces, and reads the corresponding sorted index file andformats it appropriately into an index.@refill@ifinfoThe two-letter index names are:@table @samp@item cpthe concept index.@item vrthe variable index.@item fnthe function index.@item kythe key index.@item pgthe program index.@item tpthe data type index.@end table@end ifinfo@code{@@printindex} does not generate a chapter heading for the index.Consequently, you should precede the command with a suitable section orchapter command (usually @code{@@unnumbered}) to supply the chapter headingand put the index into the table of contents. And before that, you willprobably put a @code{@@node} command. For example,@refill@example@@node Variables Index, Concept Index, Function Index, Top@@comment node-name, next, previous, up@@unnumbered Variable Index@@printindex vr@@node Concept Index, , Variables Index, Top@@comment node-name, next, previous, up@@unnumbered Concept Index@@printindex cp@@summarycontents@@contents@@bye@end exampleIn @TeX{}, @code{@@printindex} needs a sorted index file to work from.@TeX{} does not know how to do sorting; this is one of the maindeficiencies of @TeX{}. You must invoke the program @code{texindex} to doso, giving it the names of the raw index files to be sorted as arguments.You do not have to run @code{texindex} on all of them; only the ones youare going to print. (@xref{Printing Hardcopy}, for more information.)@node Structuring, Quotations and Examples, Ending a File, Top@comment node-name, next, previous, up@chapter Node and Chapter Structuring@cindex Node and chapter structuring@cindex Chapter structuring@cindex Node structuring@cindex Structuring of nodes and chapters@findex nodeThe chapter structuring commands divide a document into a hierarchy ofchapters, sections, subsections and subsubsections. These commandsgenerate large headings.In a printed manual, the table of contents is based on the informationspecified by the chapter structuring commands.Although the chapter structuring commands used for creating a printeddocument are entirely different from the node commands for structuring anInfo file, you are likely to use the two kinds of command together sincethe single Texinfo file is usually designed to be read both as an Info fileand as a printed manual. The only time you are likely to use the chapterstructuring commands without using the node structuring commands is if youare writing a document that will never be put into Info format, forexample, a novel, a letter, an article or a memorandum.It is unlikely that you will ever write a Texinfo file that is onlyintended as an on-line Info file and not as a printable document. However,Texinfo is flexible enough so that you can do this if you wish.Although a Texinfo file can be structured in a variety of ways, it isusually structured like a book with chapters, sections, subsections and thelike. This structure can also be visualized as a tree (or rather as anupside down tree) with the root at the top and each level corresponding tochapters or sections or whatnot. In Info format, you reach the nodes oneach level by using the the `Next' and `Previous' pointers in the nodeline. For example, you go from one chapter to the next or previous chapterby using the the pointers to the next and previous chapters. In Info, yougo the level above by using an `Up' pointer and you go to the level belowthrough a `Menu'. In the printed manual, cross references are indicated bypage and section numbers; in the on-line file, cross references arespecified by inline menu items.@groupHere is a diagram that shows a Texinfo file with three chapters; each chapter has two sections.@example top | |
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -