30
30
% Please try the latest version of texinfo.tex before submitting bug
31
31
% reports; you can get the latest version from:
32
% ftp://ftp.gnu.org/pub/gnu/texinfo.tex
32
% ftp://ftp.gnu.org/gnu/texinfo.tex
33
% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
34
% ftp://texinfo.org/tex/texinfo.tex
35
% ftp://us.ctan.org/macros/texinfo/texinfo.tex
36
% (and all CTAN mirrors, finger ctan@us.ctan.org for a list).
33
37
% /home/gd/gnu/doc/texinfo.tex on the GNU machines.
34
% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
35
% ftp://tug.org/tex/texinfo.tex
36
% ftp://ctan.org/macros/texinfo/texinfo.tex
37
% (and all CTAN mirrors, finger ctan@ctan.org for a list).
38
% The texinfo.tex in the texinfo distribution itself could well be out
38
% The texinfo.tex in any given Texinfo distribution could well be out
39
39
% of date, so if that's what you're using, please check.
41
% Send bug reports to bug-texinfo@gnu.org.
42
% Please include a precise test case in each bug report,
43
% including a complete document with which we can reproduce the problem.
40
% Texinfo has a small home page at http://texinfo.org/.
42
% Send bug reports to bug-texinfo@gnu.org. Please include including a
43
% complete document in each bug report with which we can reproduce the
44
% problem. Patches are, of course, greatly appreciated.
45
46
% To process a Texinfo manual with TeX, it's most reliable to use the
46
% texi2dvi shell script that comes with the distribution. For simple
47
% manuals, however, you can get away with:
47
% texi2dvi shell script that comes with the distribution. For a simple
48
% manual foo.texi, however, you can get away with this:
52
% dvips foo.dvi -o # or whatever, to process the dvi file.
53
% dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps.
53
54
% The extra runs of TeX get the cross-reference information correct.
54
55
% Sometimes one run after texindex suffices, and sometimes you need more
55
56
% than two; texi2dvi does it as many times as necessary.
58
% It is possible to adapt texinfo.tex for other languages. You can get
59
% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/.
57
61
\message{Loading texinfo [version \texinfoversion]:}
92
94
\newlinechar = `^^J
94
96
% Set up fixed words for English if not already set.
95
\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
96
\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
97
\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
98
\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
99
\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
100
\ifx\putwordon\undefined \gdef\putwordon{on}\fi
101
\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
102
\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
103
\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
104
\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
105
\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
106
\ifx\putwordShortContents\undefined \gdef\putwordShortContents{Short Contents}\fi
107
\ifx\putwordTableofContents\undefined\gdef\putwordTableofContents{Table of Contents}\fi
97
\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
98
\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
99
\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
100
\ifx\putwordin\undefined \gdef\putwordin{in}\fi
101
\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
102
\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
103
\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
104
\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
105
\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
106
\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
107
\ifx\putwordof\undefined \gdef\putwordof{of}\fi
108
\ifx\putwordon\undefined \gdef\putwordon{on}\fi
109
\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
110
\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
111
\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
112
\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
113
\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
114
\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
115
\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
117
\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
118
\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
119
\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
120
\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
121
\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
122
\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
123
\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
124
\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
125
\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
126
\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
127
\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
128
\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
130
\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
131
\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
132
\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
133
\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
134
\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
135
\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
136
\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
109
138
% Ignore a token.
571
% Go into vertical mode, so we don't make a big box in the middle of a
613
% Ensure vertical mode, so we don't make a big box in the middle of a
575
% Don't add any leading before our big empty box, but allow a page
576
% break, since the best break might be right here.
579
\vtop to #1\mil{\vfil}%
581
% TeX does not even consider page breaks if a penalty added to the
582
% main vertical list is 10000 or more. But in order to see if the
583
% empty box we just added fits on the page, we must make it consider
584
% page breaks. On the other hand, we don't want to actually break the
585
% page after the empty box. So we use a penalty of 9999.
587
% There is an extremely small chance that TeX will actually break the
588
% page at this \penalty, if there are no other feasible breakpoints in
589
% sight. (If the user is using lots of big @group commands, which
590
% almost-but-not-quite fill up a page, TeX will have a hard time doing
591
% good page breaking, for example.) However, I could not construct an
592
% example where a page broke at this \penalty; if it happens in a real
593
% document, then we can reconsider our strategy.
596
% Back up by the size of the box, whether we did a page break or not.
599
% Do not allow a page break right after this kern.
617
% If the @need value is less than one line space, it's useless.
619
\dimen2 = \ht\strutbox
620
\advance\dimen2 by \dp\strutbox
621
\ifdim\dimen0 > \dimen2
623
% Do a \strut just to make the height of this box be normal, so the
624
% normal leading is inserted relative to the preceding line.
625
% And a page break here is fine.
626
\vtop to #1\mil{\strut\vfil}%
628
% TeX does not even consider page breaks if a penalty added to the
629
% main vertical list is 10000 or more. But in order to see if the
630
% empty box we just added fits on the page, we must make it consider
631
% page breaks. On the other hand, we don't want to actually break the
632
% page after the empty box. So we use a penalty of 9999.
634
% There is an extremely small chance that TeX will actually break the
635
% page at this \penalty, if there are no other feasible breakpoints in
636
% sight. (If the user is using lots of big @group commands, which
637
% almost-but-not-quite fill up a page, TeX will have a hard time doing
638
% good page breaking, for example.) However, I could not construct an
639
% example where a page broke at this \penalty; if it happens in a real
640
% document, then we can reconsider our strategy.
643
% Back up by the size of the box, whether we did a page break or not.
646
% Do not allow a page break right after this kern.
603
651
% @br forces paragraph break
708
% @paragraphindent is defined for the Info formatting commands only.
709
\let\paragraphindent=\comment
711
% Prevent errors for section commands.
712
% Used in @ignore and in failing conditionals.
713
\def\ignoresections{%
715
\let\unnumbered=\relax
717
\let\unnumberedsec=\relax
718
\let\unnumberedsection=\relax
719
\let\unnumberedsubsec=\relax
720
\let\unnumberedsubsection=\relax
721
\let\unnumberedsubsubsec=\relax
722
\let\unnumberedsubsubsection=\relax
725
\let\subsubsec=\relax
726
\let\subsection=\relax
727
\let\subsubsection=\relax
729
\let\appendixsec=\relax
730
\let\appendixsection=\relax
731
\let\appendixsubsec=\relax
732
\let\appendixsubsection=\relax
733
\let\appendixsubsubsec=\relax
734
\let\appendixsubsubsection=\relax
736
\let\smallbook=\relax
737
\let\titlepage=\relax
740
% Used in nested conditionals, where we have to parse the Texinfo source
741
% and so want to turn off most commands, in case they are used
744
\def\ignoremorecommands{%
745
\let\defcodeindex = \relax
749
\let\defindex = \relax
750
\let\defivar = \relax
752
\let\defmethod = \relax
755
\let\defspec = \relax
757
\let\deftypefn = \relax
758
\let\deftypefun = \relax
759
\let\deftypevar = \relax
760
\let\deftypevr = \relax
766
\let\printindex = \relax
768
\let\settitle = \relax
769
\let\setchapternewpage = \relax
770
\let\setchapterstyle = \relax
771
\let\everyheading = \relax
772
\let\evenheading = \relax
773
\let\oddheading = \relax
774
\let\everyfooting = \relax
775
\let\evenfooting = \relax
776
\let\oddfooting = \relax
777
\let\headings = \relax
778
\let\include = \relax
779
\let\lowersections = \relax
781
\let\raisesections = \relax
788
% Ignore @ignore ... @end ignore.
790
\def\ignore{\doignore{ignore}}
792
% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
794
\def\ifinfo{\doignore{ifinfo}}
795
\def\ifhtml{\doignore{ifhtml}}
796
\def\ifnottex{\doignore{ifnottex}}
797
\def\html{\doignore{html}}
798
\def\menu{\doignore{menu}}
799
\def\direntry{\doignore{direntry}}
801
% @dircategory CATEGORY -- specify a category of the dir file
802
% which this file should belong to. Ignore this in TeX.
803
\let\dircategory = \comment
805
% Ignore text until a line `@end #1'.
807
\def\doignore#1{\begingroup
808
% Don't complain about control sequences we have declared \outer.
811
% Define a command to swallow text until we reach `@end #1'.
812
% This @ is a catcode 12 token (that is the normal catcode of @ in
813
% this texinfo.tex file). We change the catcode of @ below to match.
814
\long\def\doignoretext##1@end #1{\enddoignore}%
816
% Make sure that spaces turn into tokens that match what \doignoretext wants.
819
% Ignore braces, too, so mismatched braces don't cause trouble.
823
% We must not have @c interpreted as a control sequence.
826
% Make the letter c a comment character so that the rest of the line
827
% will be ignored. This way, the document can have (for example)
829
% and the @end ifinfo will be properly ignored.
830
% (We've just changed @ to catcode 12.)
833
% And now expand that command.
837
% What we do to finish off ignored text.
839
\def\enddoignore{\endgroup\ignorespaces}%
841
\newif\ifwarnedobs\warnedobsfalse
843
\ifwarnedobs\relax\else
844
% We need to warn folks that they may have trouble with TeX 3.0.
845
% This uses \immediate\write16 rather than \message to get newlines.
847
\immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
848
\immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
849
\immediate\write16{If you are running another version of TeX, relax.}
850
\immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
851
\immediate\write16{ Then upgrade your TeX installation if you can.}
852
\immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
853
\immediate\write16{If you are stuck with version 3.0, run the}
854
\immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
855
\immediate\write16{ to use a workaround.}
857
\global\warnedobstrue
861
% **In TeX 3.0, setting text in \nullfont hangs tex. For a
862
% workaround (which requires the file ``dummy.tfm'' to be installed),
863
% uncomment the following line:
864
%%%%%\font\nullfont=dummy\let\obstexwarn=\relax
866
% Ignore text, except that we keep track of conditional commands for
867
% purposes of nesting, up to an `@end #1' command.
869
\def\nestedignore#1{%
871
% We must actually expand the ignored text to look for the @end
872
% command, so that nested ignore constructs work. Thus, we put the
873
% text into a \vbox and then do nothing with the result. To minimize
874
% the change of memory overflow, we follow the approach outlined on
875
% page 401 of the TeXbook: make the current font be a dummy font.
877
\setbox0 = \vbox\bgroup
878
% Don't complain about control sequences we have declared \outer.
881
% Define `@end #1' to end the box, which will in turn undefine the
882
% @end command again.
883
\expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
885
% We are going to be parsing Texinfo commands. Most cause no
886
% trouble when they are used incorrectly, but some commands do
887
% complicated argument parsing or otherwise get confused, so we
890
% We can't do anything about stray @-signs, unfortunately;
891
% they'll produce `undefined control sequence' errors.
894
% Set the current font to be \nullfont, a TeX primitive, and define
895
% all the font commands to also use \nullfont. We don't use
896
% dummy.tfm, as suggested in the TeXbook, because not all sites
897
% might have that installed. Therefore, math mode will still
898
% produce output, but that should be an extremely small amount of
899
% stuff compared to the main input.
902
\let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
903
\let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
904
\let\tensf = \nullfont
905
% Similarly for index fonts (mostly for their use in
907
\let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
908
\let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
909
\let\indsf = \nullfont
911
% Don't complain when characters are missing from the fonts.
912
\tracinglostchars = 0
914
% Don't bother to do space factor calculations.
917
% Don't report underfull hboxes.
920
% Do minimal line-breaking.
921
\pretolerance = 10000
923
% Do not execute instructions in @tex
924
\def\tex{\doignore{tex}}%
925
% Do not execute macro definitions.
926
% `c' is a comment character, so the word `macro' will get cut off.
927
\def\macro{\doignore{ma}}%
930
% @set VAR sets the variable VAR to an empty value.
931
% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
933
% Since we want to separate VAR from REST-OF-LINE (which might be
934
% empty), we can't just use \parsearg; we have to insert a space of our
935
% own to delimit the rest of the line, and then take it out again if we
936
% didn't need it. Make sure the catcode of space is correct to avoid
937
% losing inside @example, for instance.
939
\def\set{\begingroup\catcode` =10
940
\catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
942
\def\setxxx#1{\setyyy#1 \endsetyyy}
943
\def\setyyy#1 #2\endsetyyy{%
945
\ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
946
\else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
950
% Can't use \xdef to pre-expand #2 and save some time, since \temp or
951
% \next or other control sequences that we've defined might get us into
952
% an infinite loop. Consider `@set foo @cite{bar}'.
953
\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
955
% @clear VAR clears (i.e., unsets) the variable VAR.
957
\def\clear{\parsearg\clearxxx}
958
\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
960
% @value{foo} gets the text saved in variable foo.
963
\catcode`\_ = \active
965
% We might end up with active _ or - characters in the argument if
966
% we're called from @code, as @code{@value{foo-bar_}}. So \let any
967
% such active characters to their normal equivalents.
968
\gdef\value{\begingroup
969
\catcode`\-=12 \catcode`\_=12
970
\indexbreaks \let_\normalunderscore
973
\def\valuexxx#1{\expandablevalue{#1}\endgroup}
975
% We have this subroutine so that we can handle at least some @value's
976
% properly in indexes (we \let\value to this in \indexdummies). Ones
977
% whose names contain - or _ still won't work, but we can't do anything
978
% about that. The command has to be fully expandable, since the result
979
% winds up in the index file. This means that if the variable's value
980
% contains other Texinfo commands, it's almost certain it will fail
981
% (although perhaps we could fix that with sufficient work to do a
982
% one-level expansion on the result, instead of complete).
794
% @paragraphindent NCHARS
795
% We'll use ems for NCHARS, close enough.
796
% We cannot implement @paragraphindent asis, though.
984
\def\expandablevalue#1{%
985
\expandafter\ifx\csname SET#1\endcsname\relax
986
{[No value for ``#1'']}%
988
\csname SET#1\endcsname
992
% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
995
\def\ifset{\parsearg\ifsetxxx}
997
\expandafter\ifx\csname SET#1\endcsname\relax
998
\expandafter\ifsetfail
1000
\expandafter\ifsetsucceed
1003
\def\ifsetsucceed{\conditionalsucceed{ifset}}
1004
\def\ifsetfail{\nestedignore{ifset}}
1005
\defineunmatchedend{ifset}
1007
% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
1008
% defined with @set, or has been undefined with @clear.
1010
\def\ifclear{\parsearg\ifclearxxx}
1011
\def\ifclearxxx #1{%
1012
\expandafter\ifx\csname SET#1\endcsname\relax
1013
\expandafter\ifclearsucceed
1015
\expandafter\ifclearfail
1018
\def\ifclearsucceed{\conditionalsucceed{ifclear}}
1019
\def\ifclearfail{\nestedignore{ifclear}}
1020
\defineunmatchedend{ifclear}
1022
% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
1023
% following, through the first @end iftex (etc.). Make `@end iftex'
1024
% (etc.) valid only after an @iftex.
1026
\def\iftex{\conditionalsucceed{iftex}}
1027
\def\ifnothtml{\conditionalsucceed{ifnothtml}}
1028
\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
1029
\defineunmatchedend{iftex}
1030
\defineunmatchedend{ifnothtml}
1031
\defineunmatchedend{ifnotinfo}
1033
% We can't just want to start a group at @iftex (for example) and end it
1034
% at @end iftex, since then @set commands inside the conditional have no
1035
% effect (they'd get reverted at the end of the group). So we must
1036
% define \Eiftex to redefine itself to be its previous value. (We can't
1037
% just define it to fail again with an ``unmatched end'' error, since
1038
% the @ifset might be nested.)
1040
\def\conditionalsucceed#1{%
1042
% Remember the current value of \E#1.
1043
\let\nece{prevE#1} = \nece{E#1}%
1045
% At the `@end #1', redefine \E#1 to be its previous value.
1046
\def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
1051
% We need to expand lots of \csname's, but we don't want to expand the
1052
% control sequences after we've constructed them.
1054
\def\nece#1{\expandafter\noexpand\csname#1\endcsname}
798
\def\asisword{asis} % no translation, these are keywords
801
\def\paragraphindent{\parsearg\doparagraphindent}
802
\def\doparagraphindent#1{%
807
\defaultparindent = 0pt
809
\defaultparindent = #1em
812
\parindent = \defaultparindent
815
% @exampleindent NCHARS
816
% We'll use ems for NCHARS like @paragraphindent.
817
% It seems @exampleindent asis isn't necessary, but
818
% I preserve it to make it similar to @paragraphindent.
819
\def\exampleindent{\parsearg\doexampleindent}
820
\def\doexampleindent#1{%
827
\lispnarrowing = #1em
1056
832
% @asis just yields its argument. Used with @table, for example.
1121
897
\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
901
% adobe `portable' document format
905
\newcount\filenamelength
914
\newif\ifpdfmakepagedest
916
\ifx\pdfoutput\undefined
918
\let\pdfmkdest = \gobble
919
\let\pdfurl = \gobble
920
\let\endlink = \relax
921
\let\linkcolor = \relax
922
\let\pdfmakeoutlines = \relax
927
\def\dopdfimage#1#2#3{%
929
\def\imageheight{#3}%
930
\ifnum\pdftexversion < 14
935
\ifx\empty\imagewidth\else width \imagewidth \fi
936
\ifx\empty\imageheight\else height \imageheight \fi
937
\ifnum\pdftexversion<13
942
\ifnum\pdftexversion < 14 \else
943
\pdfrefximage \pdflastximage
945
\def\pdfmkdest#1{\pdfdest name{#1} xyz}
947
\let\linkcolor = \Blue % was Cyan, but that seems light?
948
\def\endlink{\Black\pdfendlink}
949
% Adding outlines to PDF; macros for calculating structure of outlines
950
% come from Petr Olsak
951
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
952
\else \csname#1\endcsname \fi}
953
\def\advancenumber#1{\tempnum=\expnumber{#1}\relax
955
\expandafter\xdef\csname#1\endcsname{\the\tempnum}}
956
\def\pdfmakeoutlines{{%
957
\openin 1 \jobname.toc
962
\let\_ = \normalunderscore
963
% Thanh's hack / proper braces in bookmarks
964
\edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
965
\edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
967
\def\chapentry ##1##2##3{}
968
\def\unnumbchapentry ##1##2{}
969
\def\secentry ##1##2##3##4{\advancenumber{chap##2}}
970
\def\unnumbsecentry ##1##2{}
971
\def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
972
\def\unnumbsubsecentry ##1##2{}
973
\def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
974
\def\unnumbsubsubsecentry ##1##2{}
976
\def\chapentry ##1##2##3{%
977
\pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
978
\def\unnumbchapentry ##1##2{%
979
\pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
980
\def\secentry ##1##2##3##4{%
981
\pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
982
\def\unnumbsecentry ##1##2{%
983
\pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
984
\def\subsecentry ##1##2##3##4##5{%
985
\pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
986
\def\unnumbsubsecentry ##1##2{%
987
\pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
988
\def\subsubsecentry ##1##2##3##4##5##6{%
989
\pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
990
\def\unnumbsubsubsecentry ##1##2{%
991
\pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
996
\def\params{#1}\def\E{END}%
998
\let\nextmakelinks=\relax
1000
\let\nextmakelinks=\makelinks
1001
\ifnum\lnkcount>0,\fi
1003
\startlink attr{/Border [0 0 0]}
1004
goto name{\pdfmkpgn{\the\pgn}}%
1006
\advance\lnkcount by 1%
1011
\def\picknum#1{\expandafter\pn#1}
1022
\def\ppn#1{\pgn=#1\gobble}
1023
\def\ppnn{\pgn=\first}
1024
\def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
1025
\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1026
\def\skipspaces#1{\def\PP{#1}\def\D{|}%
1027
\ifx\PP\D\let\nextsp\relax
1028
\else\let\nextsp\skipspaces
1029
\ifx\p\space\else\addtokens{\filename}{\PP}%
1030
\advance\filenamelength by 1
1034
\def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
1035
\ifnum\pdftexversion < 14
1036
\let \startlink \pdfannotlink
1038
\let \startlink \pdfstartlink
1042
\normalturnoffactive\def\@{@}%
1043
\let\value=\expandablevalue
1045
\startlink attr{/Border [0 0 0]}%
1046
user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1049
\def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
1050
\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
1051
\def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
1052
\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
1054
\expandafter\poptoks\the\toksA|ENDTOKS|
1056
\else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
1057
\else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
1058
\else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
1060
\ifnum0=\countA\else\makelink\fi
1061
\ifx\first.\let\next=\done\else
1063
\addtokens{\toksB}{\the\toksD}
1064
\ifx\first,\addtokens{\toksB}{\space}\fi
1066
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
1068
\def\makelink{\addtokens{\toksB}%
1069
{\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1071
\startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}}
1072
\linkcolor #1\endlink}
1074
\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1075
\fi % \ifx\pdfoutput
1124
1078
\message{fonts,}
1125
1079
% Font-change commands.
2273
\message{conditionals,}
2274
% Prevent errors for section commands.
2275
% Used in @ignore and in failing conditionals.
2276
\def\ignoresections{%
2278
\let\unnumbered=\relax
2280
\let\unnumberedsec=\relax
2281
\let\unnumberedsection=\relax
2282
\let\unnumberedsubsec=\relax
2283
\let\unnumberedsubsection=\relax
2284
\let\unnumberedsubsubsec=\relax
2285
\let\unnumberedsubsubsection=\relax
2288
\let\subsubsec=\relax
2289
\let\subsection=\relax
2290
\let\subsubsection=\relax
2291
\let\appendix=\relax
2292
\let\appendixsec=\relax
2293
\let\appendixsection=\relax
2294
\let\appendixsubsec=\relax
2295
\let\appendixsubsection=\relax
2296
\let\appendixsubsubsec=\relax
2297
\let\appendixsubsubsection=\relax
2298
\let\contents=\relax
2299
\let\smallbook=\relax
2300
\let\titlepage=\relax
2303
% Used in nested conditionals, where we have to parse the Texinfo source
2304
% and so want to turn off most commands, in case they are used
2307
\def\ignoremorecommands{%
2308
\let\defcodeindex = \relax
2311
\let\deffnx = \relax
2312
\let\defindex = \relax
2313
\let\defivar = \relax
2314
\let\defmac = \relax
2315
\let\defmethod = \relax
2317
\let\defopt = \relax
2318
\let\defspec = \relax
2320
\let\deftypefn = \relax
2321
\let\deftypefun = \relax
2322
\let\deftypeivar = \relax
2323
\let\deftypeop = \relax
2324
\let\deftypevar = \relax
2325
\let\deftypevr = \relax
2327
\let\defvar = \relax
2331
\let\printindex = \relax
2333
\let\settitle = \relax
2334
\let\setchapternewpage = \relax
2335
\let\setchapterstyle = \relax
2336
\let\everyheading = \relax
2337
\let\evenheading = \relax
2338
\let\oddheading = \relax
2339
\let\everyfooting = \relax
2340
\let\evenfooting = \relax
2341
\let\oddfooting = \relax
2342
\let\headings = \relax
2343
\let\include = \relax
2344
\let\lowersections = \relax
2346
\let\raisesections = \relax
2353
% Ignore @ignore ... @end ignore.
2355
\def\ignore{\doignore{ignore}}
2357
% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
2359
\def\ifinfo{\doignore{ifinfo}}
2360
\def\ifhtml{\doignore{ifhtml}}
2361
\def\ifnottex{\doignore{ifnottex}}
2362
\def\html{\doignore{html}}
2363
\def\menu{\doignore{menu}}
2364
\def\direntry{\doignore{direntry}}
2366
% @dircategory CATEGORY -- specify a category of the dir file
2367
% which this file should belong to. Ignore this in TeX.
2368
\let\dircategory = \comment
2370
% Ignore text until a line `@end #1'.
2372
\def\doignore#1{\begingroup
2373
% Don't complain about control sequences we have declared \outer.
2376
% Define a command to swallow text until we reach `@end #1'.
2377
% This @ is a catcode 12 token (that is the normal catcode of @ in
2378
% this texinfo.tex file). We change the catcode of @ below to match.
2379
\long\def\doignoretext##1@end #1{\enddoignore}%
2381
% Make sure that spaces turn into tokens that match what \doignoretext wants.
2384
% Ignore braces, too, so mismatched braces don't cause trouble.
2388
% We must not have @c interpreted as a control sequence.
2391
% Make the letter c a comment character so that the rest of the line
2392
% will be ignored. This way, the document can have (for example)
2394
% and the @end ifinfo will be properly ignored.
2395
% (We've just changed @ to catcode 12.)
2398
% And now expand that command.
2402
% What we do to finish off ignored text.
2404
\def\enddoignore{\endgroup\ignorespaces}%
2406
\newif\ifwarnedobs\warnedobsfalse
2408
\ifwarnedobs\relax\else
2409
% We need to warn folks that they may have trouble with TeX 3.0.
2410
% This uses \immediate\write16 rather than \message to get newlines.
2411
\immediate\write16{}
2412
\immediate\write16{WARNING: for users of Unix TeX 3.0!}
2413
\immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
2414
\immediate\write16{If you are running another version of TeX, relax.}
2415
\immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
2416
\immediate\write16{ Then upgrade your TeX installation if you can.}
2417
\immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)}
2418
\immediate\write16{If you are stuck with version 3.0, run the}
2419
\immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
2420
\immediate\write16{ to use a workaround.}
2421
\immediate\write16{}
2422
\global\warnedobstrue
2426
% **In TeX 3.0, setting text in \nullfont hangs tex. For a
2427
% workaround (which requires the file ``dummy.tfm'' to be installed),
2428
% uncomment the following line:
2429
%%%%%\font\nullfont=dummy\let\obstexwarn=\relax
2431
% Ignore text, except that we keep track of conditional commands for
2432
% purposes of nesting, up to an `@end #1' command.
2434
\def\nestedignore#1{%
2436
% We must actually expand the ignored text to look for the @end
2437
% command, so that nested ignore constructs work. Thus, we put the
2438
% text into a \vbox and then do nothing with the result. To minimize
2439
% the change of memory overflow, we follow the approach outlined on
2440
% page 401 of the TeXbook: make the current font be a dummy font.
2442
\setbox0 = \vbox\bgroup
2443
% Don't complain about control sequences we have declared \outer.
2446
% Define `@end #1' to end the box, which will in turn undefine the
2447
% @end command again.
2448
\expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
2450
% We are going to be parsing Texinfo commands. Most cause no
2451
% trouble when they are used incorrectly, but some commands do
2452
% complicated argument parsing or otherwise get confused, so we
2455
% We can't do anything about stray @-signs, unfortunately;
2456
% they'll produce `undefined control sequence' errors.
2459
% Set the current font to be \nullfont, a TeX primitive, and define
2460
% all the font commands to also use \nullfont. We don't use
2461
% dummy.tfm, as suggested in the TeXbook, because not all sites
2462
% might have that installed. Therefore, math mode will still
2463
% produce output, but that should be an extremely small amount of
2464
% stuff compared to the main input.
2467
\let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
2468
\let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
2469
\let\tensf=\nullfont
2470
% Similarly for index fonts (mostly for their use in smallexample).
2471
\let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
2472
\let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
2473
\let\smallsf=\nullfont
2475
% Don't complain when characters are missing from the fonts.
2476
\tracinglostchars = 0
2478
% Don't bother to do space factor calculations.
2481
% Don't report underfull hboxes.
2484
% Do minimal line-breaking.
2485
\pretolerance = 10000
2487
% Do not execute instructions in @tex
2488
\def\tex{\doignore{tex}}%
2489
% Do not execute macro definitions.
2490
% `c' is a comment character, so the word `macro' will get cut off.
2491
\def\macro{\doignore{ma}}%
2494
% @set VAR sets the variable VAR to an empty value.
2495
% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
2497
% Since we want to separate VAR from REST-OF-LINE (which might be
2498
% empty), we can't just use \parsearg; we have to insert a space of our
2499
% own to delimit the rest of the line, and then take it out again if we
2500
% didn't need it. Make sure the catcode of space is correct to avoid
2501
% losing inside @example, for instance.
2503
\def\set{\begingroup\catcode` =10
2504
\catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
2506
\def\setxxx#1{\setyyy#1 \endsetyyy}
2507
\def\setyyy#1 #2\endsetyyy{%
2509
\ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
2510
\else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
2514
% Can't use \xdef to pre-expand #2 and save some time, since \temp or
2515
% \next or other control sequences that we've defined might get us into
2516
% an infinite loop. Consider `@set foo @cite{bar}'.
2517
\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
2519
% @clear VAR clears (i.e., unsets) the variable VAR.
2521
\def\clear{\parsearg\clearxxx}
2522
\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
2524
% @value{foo} gets the text saved in variable foo.
2526
\catcode`\_ = \active
2528
% We might end up with active _ or - characters in the argument if
2529
% we're called from @code, as @code{@value{foo-bar_}}. So \let any
2530
% such active characters to their normal equivalents.
2531
\gdef\value{\begingroup
2532
\catcode`\-=12 \catcode`\_=12
2533
\indexbreaks \let_\normalunderscore
2536
\def\valuexxx#1{\expandablevalue{#1}\endgroup}
2538
% We have this subroutine so that we can handle at least some @value's
2539
% properly in indexes (we \let\value to this in \indexdummies). Ones
2540
% whose names contain - or _ still won't work, but we can't do anything
2541
% about that. The command has to be fully expandable, since the result
2542
% winds up in the index file. This means that if the variable's value
2543
% contains other Texinfo commands, it's almost certain it will fail
2544
% (although perhaps we could fix that with sufficient work to do a
2545
% one-level expansion on the result, instead of complete).
2547
\def\expandablevalue#1{%
2548
\expandafter\ifx\csname SET#1\endcsname\relax
2549
{[No value for ``#1'']}%
2551
\csname SET#1\endcsname
2555
% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
2558
\def\ifset{\parsearg\ifsetxxx}
2560
\expandafter\ifx\csname SET#1\endcsname\relax
2561
\expandafter\ifsetfail
2563
\expandafter\ifsetsucceed
2566
\def\ifsetsucceed{\conditionalsucceed{ifset}}
2567
\def\ifsetfail{\nestedignore{ifset}}
2568
\defineunmatchedend{ifset}
2570
% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
2571
% defined with @set, or has been undefined with @clear.
2573
\def\ifclear{\parsearg\ifclearxxx}
2574
\def\ifclearxxx #1{%
2575
\expandafter\ifx\csname SET#1\endcsname\relax
2576
\expandafter\ifclearsucceed
2578
\expandafter\ifclearfail
2581
\def\ifclearsucceed{\conditionalsucceed{ifclear}}
2582
\def\ifclearfail{\nestedignore{ifclear}}
2583
\defineunmatchedend{ifclear}
2585
% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
2586
% following, through the first @end iftex (etc.). Make `@end iftex'
2587
% (etc.) valid only after an @iftex.
2589
\def\iftex{\conditionalsucceed{iftex}}
2590
\def\ifnothtml{\conditionalsucceed{ifnothtml}}
2591
\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
2592
\defineunmatchedend{iftex}
2593
\defineunmatchedend{ifnothtml}
2594
\defineunmatchedend{ifnotinfo}
2596
% We can't just want to start a group at @iftex (for example) and end it
2597
% at @end iftex, since then @set commands inside the conditional have no
2598
% effect (they'd get reverted at the end of the group). So we must
2599
% define \Eiftex to redefine itself to be its previous value. (We can't
2600
% just define it to fail again with an ``unmatched end'' error, since
2601
% the @ifset might be nested.)
2603
\def\conditionalsucceed#1{%
2605
% Remember the current value of \E#1.
2606
\let\nece{prevE#1} = \nece{E#1}%
2608
% At the `@end #1', redefine \E#1 to be its previous value.
2609
\def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
2614
% We need to expand lots of \csname's, but we don't want to expand the
2615
% control sequences after we've constructed them.
2617
\def\nece#1{\expandafter\noexpand\csname#1\endcsname}
2619
% @defininfoenclose.
2620
\let\definfoenclose=\comment
2292
2623
\message{indexing,}
2293
2624
% Index generation facilities
2317
2648
% @defindex foo == \newindex{foo}
2319
2650
\def\defindex{\parsearg\newindex}
2321
2652
% Define @defcodeindex, like @defindex except put all entries in @code.
2654
\def\defcodeindex{\parsearg\newcodeindex}
2323
2656
\def\newcodeindex#1{%
2325
2658
\expandafter\newwrite \csname#1indfile\endcsname
2326
2659
\openout \csname#1indfile\endcsname \jobname.#1
2328
2661
\expandafter\xdef\csname#1index\endcsname{%
2329
\noexpand\docodeindex{#1}}
2662
\noexpand\docodeindex{#1}}%
2332
\def\defcodeindex{\parsearg\newcodeindex}
2334
2666
% @synindex foo bar makes index foo feed into index bar.
2335
2667
% Do this instead of @defindex foo if you don't want it as a separate index.
2336
% The \closeout helps reduce unnecessary open files; the limit on the
2337
% Acorn RISC OS is a mere 16 files.
2338
\def\synindex#1 #2 {%
2339
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2340
\expandafter\closeout\csname#1indfile\endcsname
2341
\expandafter\let\csname#1indfile\endcsname=\synindexfoo
2342
\expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2343
\noexpand\doindex{#2}}%
2346
2669
% @syncodeindex foo bar similar, but put all entries made for index foo
2347
2670
% inside @code.
2348
\def\syncodeindex#1 #2 {%
2349
\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
2350
\expandafter\closeout\csname#1indfile\endcsname
2351
\expandafter\let\csname#1indfile\endcsname=\synindexfoo
2352
\expandafter\xdef\csname#1index\endcsname{% define \xxxindex
2353
\noexpand\docodeindex{#2}}%
2672
\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
2673
\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
2675
% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
2676
% #3 the target index (bar).
2677
\def\dosynindex#1#2#3{%
2678
% Only do \closeout if we haven't already done it, else we'll end up
2679
% closing the target index.
2680
\expandafter \ifx\csname donesynindex#2\endcsname \undefined
2681
% The \closeout helps reduce unnecessary open files; the limit on the
2682
% Acorn RISC OS is a mere 16 files.
2683
\expandafter\closeout\csname#2indfile\endcsname
2684
\expandafter\let\csname\donesynindex#2\endcsname = 1
2686
% redefine \fooindfile:
2687
\expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
2688
\expandafter\let\csname#2indfile\endcsname=\temp
2689
% redefine \fooindex:
2690
\expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
2356
2693
% Define \doindex, the driver for all \fooindex macros.
2958
3319
% This counter is funny since it counts through charcodes of letters A, B, ...
2959
3320
\newcount\appendixno \appendixno = `\@
2960
\def\appendixletter{\char\the\appendixno}
3321
% \def\appendixletter{\char\the\appendixno}
3322
% We do the following for the sake of pdftex, which needs the actual
3323
% letter in the expansion, not just typeset.
3324
\def\appendixletter{%
3325
\ifnum\appendixno=`A A%
3326
\else\ifnum\appendixno=`B B%
3327
\else\ifnum\appendixno=`C C%
3328
\else\ifnum\appendixno=`D D%
3329
\else\ifnum\appendixno=`E E%
3330
\else\ifnum\appendixno=`F F%
3331
\else\ifnum\appendixno=`G G%
3332
\else\ifnum\appendixno=`H H%
3333
\else\ifnum\appendixno=`I I%
3334
\else\ifnum\appendixno=`J J%
3335
\else\ifnum\appendixno=`K K%
3336
\else\ifnum\appendixno=`L L%
3337
\else\ifnum\appendixno=`M M%
3338
\else\ifnum\appendixno=`N N%
3339
\else\ifnum\appendixno=`O O%
3340
\else\ifnum\appendixno=`P P%
3341
\else\ifnum\appendixno=`Q Q%
3342
\else\ifnum\appendixno=`R R%
3343
\else\ifnum\appendixno=`S S%
3344
\else\ifnum\appendixno=`T T%
3345
\else\ifnum\appendixno=`U U%
3346
\else\ifnum\appendixno=`V V%
3347
\else\ifnum\appendixno=`W W%
3348
\else\ifnum\appendixno=`X X%
3349
\else\ifnum\appendixno=`Y Y%
3350
\else\ifnum\appendixno=`Z Z%
3351
% The \the is necessary, despite appearances, because \appendixletter is
3352
% expanded while writing the .toc file. \char\appendixno is not
3353
% expandable, thus it is written literally, thus all appendixes come out
3354
% with the same letter (or @) in the toc without it.
3355
\else\char\the\appendixno
3356
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
3357
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
2962
3359
% Each @chapter defines this as the name of the chapter.
2963
3360
% page headings and footings can use it. @section does likewise.
4376
% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
4377
% If we want to allow any <char> as delimiter,
4378
% we need the curly braces so that makeinfo sees the @verb command, eg:
4379
% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
4381
% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
4383
% [Knuth] p. 344; only we need to do '@' too
4385
\do\ \do\\\do\@\do\{\do\}\do\$\do\&%
4386
\do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
4389
\def\uncatcodespecials{%
4390
\def\do##1{\catcode`##1=12}\dospecials}
4392
% [Knuth] pp. 380,381,391
4393
% Disable Spanish ligatures ?` and !` of \tt font
4395
\catcode`\`=\active\gdef`{\relax\lq}
4398
% Setup for the @verb command.
4400
% Eight spaces for a tab
4402
\catcode`\^^I=\active
4403
\gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
4407
\tt % easiest (and conventionally used) font for verbatim
4408
\def\par{\leavevmode\endgraf}%
4411
% Respect line breaks,
4412
% print special symbols as themselves, and
4413
% make each space count
4414
% must do in this order:
4415
\obeylines \uncatcodespecials \sepspaces
4418
% Setup for the @verbatim environment
4420
% Real tab expansion
4421
\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
4423
\def\starttabbox{\setbox0=\hbox\bgroup}
4425
\catcode`\^^I=\active
4427
\catcode`\^^I=\active
4428
\def^^I{\leavevmode\egroup
4429
\dimen0=\wd0 % the width so far, or since the previous tab
4430
\divide\dimen0 by\tabw
4431
\multiply\dimen0 by\tabw % compute previous multiple of \tabw
4432
\advance\dimen0 by\tabw % advance to next multiple of \tabw
4433
\wd0=\dimen0 \box0 \starttabbox
4437
\def\setupverbatim{%
4438
% Easiest (and conventionally used) font for verbatim
4440
\def\par{\leavevmode\egroup\box0\endgraf}%
4443
% Respect line breaks,
4444
% print special symbols as themselves, and
4445
% make each space count
4446
% must do in this order:
4447
\obeylines \uncatcodespecials \sepspaces
4448
\everypar{\starttabbox}%
4451
% Do the @verb magic: verbatim text is quoted by unique
4452
% delimiter characters. Before first delimiter expect a
4453
% right brace, after last delimiter expect closing brace:
4455
% \def\doverb'{'<char>#1<char>'}'{#1}
4457
% [Knuth] p. 382; only eat outer {}
4459
\catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
4460
\gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
4463
\def\verb{\begingroup\setupverb\doverb}
4466
% Do the @verbatim magic: define the macro \doverbatim so that
4467
% the (first) argument ends when '@end verbatim' is reached, ie:
4469
% \def\doverbatim#1@end verbatim{#1}
4471
% For Texinfo it's a lot easier than for LaTeX,
4472
% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
4473
% we need not redefine '\', '{' and '}'
4475
% Inspired by LaTeX's verbatim command set [latex.ltx]
4476
%% Include LaTeX hack for completeness -- never know
4478
%% \catcode`|=0 \catcode`[=1
4479
%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
4480
%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
4481
%% #1|endgroup|def|Everbatim[]|end[verbatim]]
4485
\gdef\doverbatim#1@end verbatim{#1\end{verbatim}}
4489
\def\Everbatim{\nonfillfinish\endgroup}%
4492
\advance\leftskip by -\defbodyindent
4493
\begingroup\setupverbatim\doverbatim
4496
% @verbatiminclude FILE - insert text of file in verbatim environment.
4498
% Allow normal characters that we make active in the argument (a file name).
4499
\def\verbatiminclude{%
4509
\parsearg\doverbatiminclude
4511
\def\setupverbatiminclude{%
4514
\advance\leftskip by -\defbodyindent
4515
\begingroup\setupverbatim
4518
\def\doverbatiminclude#1{%
4519
% Restore active chars for included file.
4523
\expandafter\expandafter\setupverbatiminclude\input\thisfile
4524
\endgroup\nonfillfinish\endgroup
3957
4528
\message{defuns,}
3958
% Define formatter for defuns
3959
% First, allow user to change definition object font (\df) internally
4531
% Allow user to change definition object font (\df) internally
3960
4532
\def\setdeffont #1 {\csname DEF#1\endcsname}
3962
4534
\newskip\defbodyindent \defbodyindent=.4in
4462
5059
\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
4463
5060
\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
4465
% This definition is run if you use @deftpx, etc
4466
% anywhere other than immediately after a @deftp, etc.
4468
\def\deftpx #1 {\errmessage{@deftpx in invalid context}}
5062
% These definitions are used if you use @defunx (etc.)
5063
% anywhere other than immediately after a @defun or @defunx.
5065
\def\defcvx#1 {\errmessage{@defcvx in invalid context}}
5066
\def\deffnx#1 {\errmessage{@deffnx in invalid context}}
5067
\def\defivarx#1 {\errmessage{@defivarx in invalid context}}
5068
\def\defmacx#1 {\errmessage{@defmacx in invalid context}}
5069
\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
5070
\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
5071
\def\defopx#1 {\errmessage{@defopx in invalid context}}
5072
\def\defspecx#1 {\errmessage{@defspecx in invalid context}}
5073
\def\deftpx#1 {\errmessage{@deftpx in invalid context}}
5074
\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
5075
\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
5076
\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
5077
\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
5078
\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
5079
\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
5080
\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
5081
\def\defunx#1 {\errmessage{@defunx in invalid context}}
5082
\def\defvarx#1 {\errmessage{@defvarx in invalid context}}
5083
\def\defvrx#1 {\errmessage{@defvrx in invalid context}}
4471
5086
\message{macros,}
4474
% To do this right we need a feature of e-TeX, \scantokens,
5089
% To do this right we need a feature of e-TeX, \scantokens,
4475
5090
% which we arrange to emulate with a temporary file in ordinary TeX.
4476
5091
\ifx\eTeXversion\undefined
4477
5092
\newwrite\macscribble
4478
5093
\def\scanmacro#1{%
4479
5094
\begingroup \newlinechar`\^^M
5095
% Undo catcode changes of \startcontents and \doprintindex
5096
\catcode`\@=0 \catcode`\\=12 \escapechar=`\@
5097
% Append \endinput to make sure that TeX does not see the ending newline.
5098
\toks0={#1\endinput}%
4480
5099
\immediate\openout\macscribble=\jobname.tmp
4481
\immediate\write\macscribble{#1}%
5100
\immediate\write\macscribble{\the\toks0}%
4482
5101
\immediate\closeout\macscribble
4483
5102
\let\xeatspaces\eatspaces
4484
5103
\input \jobname.tmp
5174
5860
% #2 is (optional) width, #3 is (optional) height.
5175
5861
% #4 is just the usual extra ignored arg for parsing this stuff.
5176
5862
\def\imagexxx#1,#2,#3,#4\finish{%
5177
% \epsfbox itself resets \epsf?size at each figure.
5178
\setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5179
\setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5180
% If the image is by itself, center it.
5184
\centerline{\epsfbox{#1.eps}}%
5192
\message{paper sizes,}
5193
% And other related parameters.
5864
\centerline{\dopdfimage{#1}{#2}{#3}}%
5866
% \epsfbox itself resets \epsf?size at each figure.
5867
\setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5868
\setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5870
\catcode`\^^M = 5 % in case we're inside an example
5871
\normalturnoffactive % allow _ et al. in names
5872
% If the image is by itself, center it.
5875
% Usually we'll have text after the image which will insert
5876
% \parskip glue, so insert it here too to equalize the space
5878
\nobreak\vskip\parskip
5880
\centerline{\epsfbox{#1.eps}}%
5883
% In the middle of a paragraph, no extra space.
5891
\message{localization,}
5894
% @documentlanguage is usually given very early, just after
5895
% @setfilename. If done too late, it may not override everything
5896
% properly. Single argument is the language abbreviation.
5897
% It would be nice if we could set up a hyphenation file here.
5899
\def\documentlanguage{\parsearg\dodocumentlanguage}
5900
\def\dodocumentlanguage#1{%
5901
\tex % read txi-??.tex file in plain TeX.
5902
% Read the file if it exists.
5903
\openin 1 txi-#1.tex
5905
\errhelp = \nolanghelp
5906
\errmessage{Cannot read language file txi-#1.tex}%
5909
\def\temp{\input txi-#1.tex }%
5914
\newhelp\nolanghelp{The given language definition file cannot be found or
5915
is empty. Maybe you need to install it? In the current directory
5916
should work if nowhere else does.}
5919
% @documentencoding should change something in TeX eventually, most
5920
% likely, but for now just recognize it.
5921
\let\documentencoding = \comment
5924
% Page size parameters.
5195
5926
\newdimen\defaultparindent \defaultparindent = 15pt
5197
5928
\chapheadingskip = 15pt plus 4pt minus 2pt