📄 texinfo.texinfo
字号:
@menu* Info on a Region:: Formatting part of a file for Info.* Showing the Structure:: Showing the structure of a file.* Inserting:: Inserting frequently used commands. @end menu@node Info on a Region, Showing the Structure, Texinfo Mode, Texinfo Mode@comment node-name, next, previous, up@section Formatting a Region for Info@cindex Running Info on a region@cindex Info, formatting on a region@findex texinfo-format-regionTo see what part of a Texinfo file will look like after it has beentransformed into an Info file, use the command @kbd{C-c C-f}(@code{texinfo-format-region}). This command formats the current region ofthe Texinfo file for Info and writes it to a temporary buffer called@samp{*Info Region*}.@refillFor @code{texinfo-format-region} to work, the file @strong{must} include aline that has @code{@@setfilename} in its header.@refillThe command is:@table @kbd@item C-c C-f texinfo-format-region@end table@node Showing the Structure, Inserting, Info on a Region, Texinfo Mode @comment node-name, next, previous, up@section Showing the Structure of a File@cindex Showing the structure of a file@cindex Structure of a file, showing it@cindex File structure, showing it@cindex Texinfo file structure, showing itYou can show the structure of a Texinfo file by using the @kbd{C-c C-s}command (@code{texinfo-show-structure}). This command shows the structureof a Texinfo file by listing the lines with the @@-commands for@code{@@node}, @code{@@chapter}, @code{@@section} and the like. Theselines are displayed in another window called the @samp{*Occur*} window. Inthat window, you can position the cursor over one of the lines and use the@kbd{C-c C-c} command (@code{occur-mode-goto-occurrence}), to jump to thecorresponding spot in the Texinfo file.@refillThe two commands are:@table @kbd@item C-c C-s texinfo-show-structure@item C-c C-coccur-mode-goto-occurrence@end tableOften, when you are working on a manual, you will be interested only in thestructure of the current chapter. In this case, you can mark off theregion of the buffer that you are interested in with the @kbd{C-x n}(@code{narrow-to-region}) command and @code{texinfo-show-structure} willwork on only that region. (To see the whole buffer again, use @kbd{C-x w}(@code{widen}).)@refill@node Inserting, , Showing the Structure, Texinfo Mode@comment node-name, next, previous, up@section Inserting Frequently Used Commands@cindex Inserting frequently used commands@cindex Frequently used commands, inserting them@cindex Commands, inserting themTexinfo mode provides commands that insert various frequently used@@-commands into the buffer. You can use these commands to savekeystrokes. And you can insert balanced curly braces with the @kbd{M-@{}command, (@code{texinfo-insert-braces}) and later use the @kbd{M-@}}command (@code{up-list}) to move forward past the closing brace.@refillThe special commands are invoked by typing @kbd{C-c} twice and then thefirst letter of the @@-command.@table @kbd@item C-c C-c ctexinfo-insert-@@code@item C-c C-c d texinfo-insert-@@dfn@item C-c C-c e texinfo-insert-@@end@item C-c C-c i texinfo-insert-@@item@item C-c C-c n texinfo-insert-@@node@item C-c C-c stexinfo-insert-@@samp@item C-c C-c vtexinfo-insert-@@var@item M-@{ texinfo-insert-braces@item M-@} up-list@end tableThis list was generated by analyzing the frequency with which commands wereused in the @cite{GNU Emacs Manual} and the @cite{GDB Manual}. If you wishto add your own insert commands, you can bind a keyboard macro to a key, useabbreviations or extend the code in @file{texinfo.el}.@node Beginning a File, Ending a File, Texinfo Mode, Top@comment node-name, next, previous, up@chapter Beginning a Texinfo File@cindex Beginning a Texinfo file@cindex Texinfo file beginning@cindex File beginningVarious pieces of information have to be provided to Texinfo at thebeginning of a Texinfo file, such as the name of the file, the titleof the document and the like. Generally, the beginning of a Texinfo filehas four parts:@enumerate@item The header, marked by start-of-header and end-of-header lines, thatincludes the commands for naming the Texinfo file and telling @TeX{} whatdefinitions' file to use when processing the file.@item A section, marked by the @code{@@ifinfo} and @code{@@end ifinfo} commands,that contains a short statement of what the file is about, the copyrightnotice and copying permissions. This section appears only in the Info file.@item A section, marked by the @code{@@titlepage} and @code{@@end titlepage}commands, that contains the title page, the copyright page and copyingpermissions. This section appears only in the printed manual.@itemThe @samp{Top} node that contains an extensive menu for the whole Infofile. The contents of this node only appear in the Info file.@end enumerateIf the Texinfo file has a section containing licensing information and awarranty disclaimer, that section usually follows the @samp{Top} node. Thelicensing section will be followed by a preface or else by the firstchapter of the manual.Since the copyright notice and the copying permissions are in sections thatappear only in the Info file or only in the printed manual, thisinformation has to be repeated twice.The following sample shows what is needed.@example\input texinfo @@c -*-texinfo-*-@@comment %**start of header (This is for running Texinfo on a region.)@@setfilename name-of-texinfo-file@@settitle Name of Manual@@setchapternewpage odd@@comment %**end of header (This is for running Texinfo on a region.)@@ifinfoThis file documents @dots{}Copyright @@copyright@{@} year copyright-ownerPermission is granted to @dots{}@@end ifinfo@@titlepage@@sp 10@@center @@titlefont@{Name of Manual When Printed@}@@sp 2@@center Subtitle, If Any@@sp 2@@center Author@@comment The following two commands start the copyright page.@@page@@vskip 0pt plus 1filllCopyright @@copyright@{@} year copyright-ownerPublished by @dots{}Permission is granted to @dots{}@@end titlepage@@node Top, Overview, (dir), (dir)@@menu* First Chapter:: The first chapter is usually an overview.* Second Chapter:: @dots{} <many more menu items here>@@end menu@@node First Chapter, Second Chapter, top, top@@comment node-name, next, previous, up@@chapter First Chapter@@cindex Reference to First Chapter@end example@menu* Header:: Necessary first lines.* Permissions for Info:: Copyright notice and copying permissions.* Titlepage & Copyright Page:: Printed title and copyright pages.* Top Node:: The top node and master menu.* License and Distribution:: The importance of the license. @end menu@node Header, Permissions for Info , Beginning a File, Beginning a File@comment node-name, next, previous, up@section The Texinfo File Header@cindex Header for Texinfo files@cindex Texinfo file headerTexinfo files start with at least three lines that provide Info and @TeX{}with necessary information. If you want to run @TeX{} on just a part ofthe Texinfo File, you also have to mark these heading lines withstart-of-header and end-of-header lines.@refill@menu* First Line:: The first line of a Texinfo file.* Start-of-Header:: Identifying the start of the header.* Setfilename:: Specifying the name of the Info file.* Settitle:: Specifying the title used by the headings.* Setchapternewpage:: Starting chapters on odd numbered pages.* End-of-Header:: Identifying the end of the header.@end menu@node First Line, Start-of-Header, Header, Header@comment node-name, next, previous, up@subsection The First Line of a Texinfo File@cindex First line of a Texinfo file@cindex Beginning line of a Texinfo fileEvery Texinfo file that is to be the top-level input to @TeX{} must beginwith a line that looks like this:@example\input texinfo @@c -*-texinfo-*-@end example@noindentThe line serves two functions:@enumerate@item When the file is processed by @TeX{}, it loads the macros needed forprocessing a Texinfo file. These are in a file called @file{texinfo.tex}which is usually located in the @file{/usr/lib/tex/macros} directory.@refill@item When the file is edited in GNU Emacs, it causes Texinfo mode to be used.@refill@end enumerateThe @samp{\input texinfo} line should be followed by the start-of-headerline. This makes it possible for the command for running @TeX{} on a partof the Texinfo file (@code{texinfo-hardcopy-region}) to operate. Thereason for this is that the @code{texinfo-hardcopy-region} command willlook on the line preceding the start-of-header line for the @samp{\inputtexinfo} line.@node Start-of-Header, Setfilename, First Line, Header@comment node-name, next, previous, up@subsection @samp{start-of-header}@cindex start-of-header@findex start-of-headerThe start-of-header line should immediately follow the first line of theTexinfo file. @ifinfoThe @code{texinfo-hardcopy-region} command will look at theline preceding the start-of-header line to find the @samp{\inputtexinfo} line.@end ifinfoUsually, the start-of-header line looks like this:@example@@comment %**start of header (This is for running Texinfo on a region.)@end exampleThe reason for the odd string of characters (@samp{%**}) is so that the@code{texinfo-hardcopy-region} command does not accidently find somethingthat it shouldn't when it is looking for the header.In the default configuration, the phrase @samp{(This is for running Texinfoon a region.)} is not needed and is just included to make it easier forsomeone reading the Texinfo file.The start-of-header line and the end-of-header line are Texinfo modevariables that you can change.@node Setfilename, Settitle, Start-of-Header, Header@comment node-name, next, previous, up@subsection @@setfilename@cindex Setfilename command@cindex Info file requirement for @@setfilename@findex setfilenameIn order to be made into an Info file, a Texinfo file must contain a linethat looks like this:@example@@setfilename @var{info-file-name}@end example@noindentThis line specifies the name of the Info file to be generated. In fact, therecan be other things in the file before this line, but they are ignored inthe generation of an Info file. The @code{@@setfilename} line is ignoredwhen a printed manual is generated. @node Settitle, Setchapternewpage, Setfilename, Header@comment node-name, next, previous, up@subsection @@settitle@findex settitleIn order to be made into a printed manual file, a Texinfo file must containa line that specifies the title of the manual. Texinfo uses thisinformation during printing to put the title on every other page as aheading; Texinfo puts the current chapter title on the other pages.Texinfo can find the name of the chapter title from the informationprovided by the @code{@@chapter} command, but you must tell it the manualtitle with @code{@@settitle}:@example@@settitle @var{Title}@end example@noindentThis command, on a line by itself, causes @var{title} to be used for the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -