texinfo.tex
上传用户:xiaozhuqw
上传日期:2009-11-15
资源大小:1338k
文件大小:184k
- % don't both fit on one line. In that case, bob suggests starting the
- % dots pretty far over on the line. Unfortunately, a large
- % indentation looks wrong when the entry text itself is broken across
- % lines. So we use a small indentation and put up with long leaders.
- %
- % hangafter is reset to 1 (which is the value we want) at the start
- % of each paragraph, so we need not do anything with that.
- hangindent = 2em
- %
- % When the entry text needs to be broken, just fill out the first line
- % with blank space.
- rightskip = 0pt plus1fil
- %
- % A bit of stretch before each entry for the benefit of balancing columns.
- vskip 0pt plus1pt
- %
- % Start a ``paragraph'' for the index entry so the line breaking
- % parameters we've set above will have an effect.
- noindent
- %
- % Insert the text of the index entry. TeX will do line-breaking on it.
- #1%
- % The following is kludged to not output a line of dots in the index if
- % there are no page numbers. The next person who breaks this will be
- % cursed by a Unix daemon.
- deftempa{{rm }}%
- deftempb{#2}%
- edeftempc{tempa}%
- edeftempd{tempb}%
- ifxtempctempd else%
- %
- % If we must, put the page number on a line of its own, and fill out
- % this line with blank space. (The hfil is overwhelmed with the
- % fill leaders glue in indexdotfill if the page number does fit.)
- hfilpenalty50
- nullnobreakindexdotfill % Have leaders before the page number.
- %
- % The ` ' here is removed by the implicit unskip that TeX does as
- % part of (the primitive) par. Without it, a spurious underfull
- % hbox ensues.
- #2% The page number ends the paragraph.
- fi%
- par
- endgroup}
- % Like dotfill except takes at least 1 em.
- defindexdotfill{cleaders
- hbox{$mathsurround=0pt mkern1.5mu ${it .}$ mkern1.5mu$}hskip 1em plus 1fill}
- defprimary #1{line{#1hfil}}
- newskipsecondaryindent secondaryindent=0.5cm
- defsecondary #1#2{
- {parfillskip=0in parskip=0in
- hangindent =1in hangafter=1
- noindenthskipsecondaryindenthbox{#1}indexdotfill #2par
- }}
- % Define two-column mode, which we use to typeset indexes.
- % Adapted from the TeXbook, page 416, which is to say,
- % the manmac.tex format used to print the TeXbook itself.
- catcode`@=11
- newboxpartialpage
- newdimendoublecolumnhsize
- defbegindoublecolumns{begingroup % ended by enddoublecolumns
- % Grab any single-column material above us.
- output = {%
- %
- % Here is a possibility not foreseen in manmac: if we accumulate a
- % whole lot of material, we might end up calling this output
- % routine twice in a row (see the doublecol-lose test, which is
- % essentially a couple of indexes with @setchapternewpage off). In
- % that case we just ship out what is in partialpage with the normal
- % output routine. Generally, partialpage will be empty when this
- % runs and this will be a no-op. See the indexspread.tex test case.
- ifvoidpartialpage else
- onepageout{pagecontentspartialpage}%
- fi
- %
- globalsetboxpartialpage = vbox{%
- % Unvbox the main output page.
- unvboxPAGE
- kern-topskip kernbaselineskip
- }%
- }%
- eject % run that output routine to set partialpage
- %
- % Use the double-column output routine for subsequent pages.
- output = {doublecolumnout}%
- %
- % Change the page size parameters. We could do this once outside this
- % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
- % format, but then we repeat the same computation. Repeating a couple
- % of assignments once per index is clearly meaningless for the
- % execution time, so we may as well do it in one place.
- %
- % First we halve the line length, less a little for the gutter between
- % the columns. We compute the gutter based on the line length, so it
- % changes automatically with the paper format. The magic constant
- % below is chosen so that the gutter has the same value (well, +-<1pt)
- % as it did when we hard-coded it.
- %
- % We put the result in a separate register, doublecolumhsize, so we
- % can restore it in pagesofar, after hsize itself has (potentially)
- % been clobbered.
- %
- doublecolumnhsize = hsize
- advancedoublecolumnhsize by -.04154hsize
- dividedoublecolumnhsize by 2
- hsize = doublecolumnhsize
- %
- % Double the vsize as well. (We don't need a separate register here,
- % since nobody clobbers vsize.)
- advancevsize by -htpartialpage
- vsize = 2vsize
- }
- % The double-column output routine for all double-column pages except
- % the last.
- %
- defdoublecolumnout{%
- splittopskip=topskip splitmaxdepth=maxdepth
- % Get the available space for the double columns -- the normal
- % (undoubled) page height minus any material left over from the
- % previous page.
- dimen@ = vsize
- dividedimen@ by 2
- %
- % box0 will be the left-hand column, box2 the right.
- setbox0=vsplit255 todimen@ setbox2=vsplit255 todimen@
- onepageoutpagesofar
- unvbox255
- penaltyoutputpenalty
- }
- defpagesofar{%
- % Re-output the contents of the output page -- any previous material,
- % followed by the two boxes we just split, in box0 and box2.
- unvboxpartialpage
- %
- hsize = doublecolumnhsize
- wd0=hsize wd2=hsize
- hbox topagewidth{box0hfilbox2}%
- }
- defenddoublecolumns{%
- output = {%
- % Split the last of the double-column material. Leave it on the
- % current page, no automatic page break.
- balancecolumns
- %
- % If we end up splitting too much material for the current page,
- % though, there will be another page break right after this output
- % invocation ends. Having called balancecolumns once, we do not
- % want to call it again. Therefore, reset output to its normal
- % definition right away. (We hope balancecolumns will never be
- % called on to balance too much material, but if it is, this makes
- % the output somewhat more palatable.)
- globaloutput = {onepageout{pagecontentsPAGE}}%
- }%
- eject
- endgroup % started in begindoublecolumns
- %
- % pagegoal was set to the doubled vsize above, since we restarted
- % the current page. We're now back to normal single-column
- % typesetting, so reset pagegoal to the normal vsize (after the
- % endgroup where vsize got restored).
- pagegoal = vsize
- }
- defbalancecolumns{%
- % Called at the end of the double column material.
- setbox0 = vbox{unvbox255}% like box255 but more efficient, see p.120.
- dimen@ = ht0
- advancedimen@ by topskip
- advancedimen@ by-baselineskip
- dividedimen@ by 2 % target to split to
- %debugmessage{final 2-column material height=theht0, target=thedimen@.}%
- splittopskip = topskip
- % Loop until we get a decent breakpoint.
- {%
- vbadness = 10000
- loop
- globalsetbox3 = copy0
- globalsetbox1 = vsplit3 to dimen@
- ifdimht3>dimen@
- globaladvancedimen@ by 1pt
- repeat
- }%
- %debugmessage{split to thedimen@, column heights: theht1, theht3.}%
- setbox0=vbox todimen@{unvbox1}%
- setbox2=vbox todimen@{unvbox3}%
- %
- pagesofar
- }
- catcode`@ = other
- message{sectioning,}
- % Define chapters, sections, etc.
- newcountchapno
- newcountsecno secno=0
- newcountsubsecno subsecno=0
- newcountsubsubsecno subsubsecno=0
- % This counter is funny since it counts through charcodes of letters A, B, ...
- newcountappendixno appendixno = `@
- defappendixletter{chartheappendixno}
- % Each @chapter defines this as the name of the chapter.
- % page headings and footings can use it. @section does likewise.
- defthischapter{}
- defthissection{}
- newcountabsseclevel % used to calculate proper heading level
- newcountsecbasesecbase=0 % @raise/lowersections modify this count
- % @raisesections: treat @section as chapter, @subsection as section, etc.
- defraisesections{globaladvancesecbase by -1}
- letup=raisesections % original BFox name
- % @lowersections: treat @chapter as section, @section as subsection, etc.
- deflowersections{globaladvancesecbase by 1}
- letdown=lowersections % original BFox name
- % Choose a numbered-heading macro
- % #1 is heading level if unmodified by @raisesections or @lowersections
- % #2 is text for heading
- defnumhead#1#2{absseclevel=secbaseadvanceabsseclevel by #1
- ifcaseabsseclevel
- chapterzzz{#2}
- or
- seczzz{#2}
- or
- numberedsubseczzz{#2}
- or
- numberedsubsubseczzz{#2}
- else
- ifnum absseclevel<0
- chapterzzz{#2}
- else
- numberedsubsubseczzz{#2}
- fi
- fi
- }
- % like numhead, but chooses appendix heading levels
- defapphead#1#2{absseclevel=secbaseadvanceabsseclevel by #1
- ifcaseabsseclevel
- appendixzzz{#2}
- or
- appendixsectionzzz{#2}
- or
- appendixsubseczzz{#2}
- or
- appendixsubsubseczzz{#2}
- else
- ifnum absseclevel<0
- appendixzzz{#2}
- else
- appendixsubsubseczzz{#2}
- fi
- fi
- }
- % like numhead, but chooses numberless heading levels
- defunnmhead#1#2{absseclevel=secbaseadvanceabsseclevel by #1
- ifcaseabsseclevel
- unnumberedzzz{#2}
- or
- unnumberedseczzz{#2}
- or
- unnumberedsubseczzz{#2}
- or
- unnumberedsubsubseczzz{#2}
- else
- ifnum absseclevel<0
- unnumberedzzz{#2}
- else
- unnumberedsubsubseczzz{#2}
- fi
- fi
- }
- % @chapter, @appendix, @unnumbered.
- defthischaptername{No Chapter Title}
- outerdefchapter{parseargchapteryyy}
- defchapteryyy #1{numhead0{#1}} % normally numhead0 calls chapterzzz
- defchapterzzz #1{%
- secno=0 subsecno=0 subsubsecno=0
- globaladvance chapno by 1 message{putwordChapterspace thechapno}%
- chapmacro {#1}{thechapno}%
- gdefthissection{#1}%
- gdefthischaptername{#1}%
- % We don't substitute the actual chapter name into thischapter
- % because we don't want its macros evaluated now.
- xdefthischapter{putwordChapter{} thechapno: noexpandthischaptername}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash chapentry{thetoks0}%
- {thechapno}}}%
- temp
- donoderef
- globalletsection = numberedsec
- globalletsubsection = numberedsubsec
- globalletsubsubsection = numberedsubsubsec
- }
- outerdefappendix{parseargappendixyyy}
- defappendixyyy #1{apphead0{#1}} % normally apphead0 calls appendixzzz
- defappendixzzz #1{%
- secno=0 subsecno=0 subsubsecno=0
- globaladvance appendixno by 1
- message{putwordAppendixspace appendixletter}%
- chapmacro {#1}{putwordAppendix{} appendixletter}%
- gdefthissection{#1}%
- gdefthischaptername{#1}%
- xdefthischapter{putwordAppendix{} appendixletter: noexpandthischaptername}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash chapentry{thetoks0}%
- {putwordAppendix{} appendixletter}}}%
- temp
- appendixnoderef
- globalletsection = appendixsec
- globalletsubsection = appendixsubsec
- globalletsubsubsection = appendixsubsubsec
- }
- % @centerchap is like @unnumbered, but the heading is centered.
- outerdefcenterchap{parseargcenterchapyyy}
- defcenterchapyyy #1{{letunnumbchapmacro=centerchapmacro unnumberedyyy{#1}}}
- % @top is like @unnumbered.
- outerdeftop{parseargunnumberedyyy}
- outerdefunnumbered{parseargunnumberedyyy}
- defunnumberedyyy #1{unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
- defunnumberedzzz #1{%
- secno=0 subsecno=0 subsubsecno=0
- %
- % This used to be simply message{#1}, but TeX fully expands the
- % argument to message. Therefore, if #1 contained @-commands, TeX
- % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
- % expanded @cite (which turns out to cause errors because cite is meant
- % to be executed, not expanded).
- %
- % Anyway, we don't want the fully-expanded definition of @cite to appear
- % as a result of the message, we just want `@cite' itself. We use
- % the<toks register> to achieve this: TeX expands the<toks> only once,
- % simply yielding the contents of <toks register>. (We also do this for
- % the toc entries.)
- toks0 = {#1}message{(thetoks0)}%
- %
- unnumbchapmacro {#1}%
- gdefthischapter{#1}gdefthissection{#1}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash unnumbchapentry{thetoks0}}}%
- temp
- unnumbnoderef
- globalletsection = unnumberedsec
- globalletsubsection = unnumberedsubsec
- globalletsubsubsection = unnumberedsubsubsec
- }
- % Sections.
- outerdefnumberedsec{parseargsecyyy}
- defsecyyy #1{numhead1{#1}} % normally calls seczzz
- defseczzz #1{%
- subsecno=0 subsubsecno=0 globaladvance secno by 1 %
- gdefthissection{#1}secheading {#1}{thechapno}{thesecno}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash secentry{thetoks0}%
- {thechapno}{thesecno}}}%
- temp
- donoderef
- nobreak
- }
- outerdefappendixsection{parseargappendixsecyyy}
- outerdefappendixsec{parseargappendixsecyyy}
- defappendixsecyyy #1{apphead1{#1}} % normally calls appendixsectionzzz
- defappendixsectionzzz #1{%
- subsecno=0 subsubsecno=0 globaladvance secno by 1 %
- gdefthissection{#1}secheading {#1}{appendixletter}{thesecno}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash secentry{thetoks0}%
- {appendixletter}{thesecno}}}%
- temp
- appendixnoderef
- nobreak
- }
- outerdefunnumberedsec{parseargunnumberedsecyyy}
- defunnumberedsecyyy #1{unnmhead1{#1}} % normally calls unnumberedseczzz
- defunnumberedseczzz #1{%
- plainsecheading {#1}gdefthissection{#1}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash unnumbsecentry{thetoks0}}}%
- temp
- unnumbnoderef
- nobreak
- }
- % Subsections.
- outerdefnumberedsubsec{parseargnumberedsubsecyyy}
- defnumberedsubsecyyy #1{numhead2{#1}} % normally calls numberedsubseczzz
- defnumberedsubseczzz #1{%
- gdefthissection{#1}subsubsecno=0 globaladvance subsecno by 1 %
- subsecheading {#1}{thechapno}{thesecno}{thesubsecno}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash subsecentry{thetoks0}%
- {thechapno}{thesecno}{thesubsecno}}}%
- temp
- donoderef
- nobreak
- }
- outerdefappendixsubsec{parseargappendixsubsecyyy}
- defappendixsubsecyyy #1{apphead2{#1}} % normally calls appendixsubseczzz
- defappendixsubseczzz #1{%
- gdefthissection{#1}subsubsecno=0 globaladvance subsecno by 1 %
- subsecheading {#1}{appendixletter}{thesecno}{thesubsecno}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash subsecentry{thetoks0}%
- {appendixletter}{thesecno}{thesubsecno}}}%
- temp
- appendixnoderef
- nobreak
- }
- outerdefunnumberedsubsec{parseargunnumberedsubsecyyy}
- defunnumberedsubsecyyy #1{unnmhead2{#1}} %normally calls unnumberedsubseczzz
- defunnumberedsubseczzz #1{%
- plainsubsecheading {#1}gdefthissection{#1}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash unnumbsubsecentry%
- {thetoks0}}}%
- temp
- unnumbnoderef
- nobreak
- }
- % Subsubsections.
- outerdefnumberedsubsubsec{parseargnumberedsubsubsecyyy}
- defnumberedsubsubsecyyy #1{numhead3{#1}} % normally numberedsubsubseczzz
- defnumberedsubsubseczzz #1{%
- gdefthissection{#1}globaladvance subsubsecno by 1 %
- subsubsecheading {#1}
- {thechapno}{thesecno}{thesubsecno}{thesubsubsecno}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash subsubsecentry{thetoks0}%
- {thechapno}{thesecno}{thesubsecno}{thesubsubsecno}}}%
- temp
- donoderef
- nobreak
- }
- outerdefappendixsubsubsec{parseargappendixsubsubsecyyy}
- defappendixsubsubsecyyy #1{apphead3{#1}} % normally appendixsubsubseczzz
- defappendixsubsubseczzz #1{%
- gdefthissection{#1}globaladvance subsubsecno by 1 %
- subsubsecheading {#1}
- {appendixletter}{thesecno}{thesubsecno}{thesubsubsecno}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash subsubsecentry{thetoks0}%
- {appendixletter}{thesecno}{thesubsecno}{thesubsubsecno}}}%
- temp
- appendixnoderef
- nobreak
- }
- outerdefunnumberedsubsubsec{parseargunnumberedsubsubsecyyy}
- defunnumberedsubsubsecyyy #1{unnmhead3{#1}} %normally unnumberedsubsubseczzz
- defunnumberedsubsubseczzz #1{%
- plainsubsubsecheading {#1}gdefthissection{#1}%
- toks0 = {#1}%
- edeftemp{noexpandwritetocentry{realbackslash unnumbsubsubsecentry%
- {thetoks0}}}%
- temp
- unnumbnoderef
- nobreak
- }
- % These are variants which are not "outer", so they can appear in @ifinfo.
- % Actually, they should now be obsolete; ordinary section commands should work.
- definfotop{parseargunnumberedzzz}
- definfounnumbered{parseargunnumberedzzz}
- definfounnumberedsec{parseargunnumberedseczzz}
- definfounnumberedsubsec{parseargunnumberedsubseczzz}
- definfounnumberedsubsubsec{parseargunnumberedsubsubseczzz}
- definfoappendix{parseargappendixzzz}
- definfoappendixsec{parseargappendixseczzz}
- definfoappendixsubsec{parseargappendixsubseczzz}
- definfoappendixsubsubsec{parseargappendixsubsubseczzz}
- definfochapter{parseargchapterzzz}
- definfosection{parseargsectionzzz}
- definfosubsection{parseargsubsectionzzz}
- definfosubsubsection{parseargsubsubsectionzzz}
- % These macros control what the section commands do, according
- % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
- % Define them by default for a numbered chapter.
- globalletsection = numberedsec
- globalletsubsection = numberedsubsec
- globalletsubsubsection = numberedsubsubsec
- % Define @majorheading, @heading and @subheading
- % NOTE on use of vbox for chapter headings, section headings, and such:
- % 1) We use vbox rather than the earlier line to permit
- % overlong headings to fold.
- % 2) hyphenpenalty is set to 10000 because hyphenation in a
- % heading is obnoxious; this forbids it.
- % 3) Likewise, headings look best if no parindent is used, and
- % if justification is not attempted. Hence raggedright.
- defmajorheading{parseargmajorheadingzzz}
- defmajorheadingzzz #1{%
- {advancechapheadingskip by 10pt chapbreak }%
- {chapfonts vbox{hyphenpenalty=10000tolerance=5000
- parindent=0ptraggedright
- rm #1hfill}}bigskip parpenalty 200}
- defchapheading{parseargchapheadingzzz}
- defchapheadingzzz #1{chapbreak %
- {chapfonts vbox{hyphenpenalty=10000tolerance=5000
- parindent=0ptraggedright
- rm #1hfill}}bigskip parpenalty 200}
- % @heading, @subheading, @subsubheading.
- defheading{parseargplainsecheading}
- defsubheading{parseargplainsubsecheading}
- defsubsubheading{parseargplainsubsubsecheading}
- % These macros generate a chapter, section, etc. heading only
- % (including whitespace, linebreaking, etc. around it),
- % given all the information in convenient, parsed form.
- %%% Args are the skip and penalty (usually negative)
- defdobreak#1#2{parifdimlastskip<#1removelastskippenalty#2vskip#1fi}
- defsetchapterstyle #1 {csname CHAPF#1endcsname}
- %%% Define plain chapter starts, and page on/off switching for it
- % Parameter controlling skip before chapter headings (if needed)
- newskipchapheadingskip
- defchapbreak{dobreak chapheadingskip {-4000}}
- defchappager{parvfillsupereject}
- defchapoddpage{chappager ifoddpageno else hbox to 0pt{} chappagerfi}
- defsetchapternewpage #1 {csname CHAPPAG#1endcsname}
- defCHAPPAGoff{%
- globalletcontentsalignmacro = chappager
- globalletpchapsepmacro=chapbreak
- globalletpagealignmacro=chappager}
- defCHAPPAGon{%
- globalletcontentsalignmacro = chappager
- globalletpchapsepmacro=chappager
- globalletpagealignmacro=chappager
- globaldefHEADINGSon{HEADINGSsingle}}
- defCHAPPAGodd{
- globalletcontentsalignmacro = chapoddpage
- globalletpchapsepmacro=chapoddpage
- globalletpagealignmacro=chapoddpage
- globaldefHEADINGSon{HEADINGSdouble}}
- CHAPPAGon
- defCHAPFplain{
- globalletchapmacro=chfplain
- globalletunnumbchapmacro=unnchfplain
- globalletcenterchapmacro=centerchfplain}
- % Plain chapter opening.
- % #1 is the text, #2 the chapter number or empty if unnumbered.
- defchfplain#1#2{%
- pchapsepmacro
- {%
- chapfonts rm
- defchapnum{#2}%
- setbox0 = hbox{#2ifxchapnumemptyelseenspacefi}%
- vbox{hyphenpenalty=10000 tolerance=5000 parindent=0pt raggedright
- hangindent = wd0 centerparametersmaybe
- unhbox0 #1par}%
- }%
- nobreakbigskip % no page break after a chapter title
- nobreak
- }
- % Plain opening for unnumbered.
- defunnchfplain#1{chfplain{#1}{}}
- % @centerchap -- centered and unnumbered.
- letcenterparametersmaybe = relax
- defcenterchfplain#1{{%
- defcenterparametersmaybe{%
- advancerightskip by 3rightskip
- leftskip = rightskip
- parfillskip = 0pt
- }%
- chfplain{#1}{}%
- }}
- CHAPFplain % The default
- defunnchfopen #1{%
- chapoddpage {chapfonts vbox{hyphenpenalty=10000tolerance=5000
- parindent=0ptraggedright
- rm #1hfill}}bigskip parnobreak
- }
- defchfopen #1#2{chapoddpage {chapfonts
- vbox to 3in{vfil hbox tohsize{hfil #2} hbox tohsize{hfil #1} vfil}}%
- parpenalty 5000 %
- }
- defcenterchfopen #1{%
- chapoddpage {chapfonts vbox{hyphenpenalty=10000tolerance=5000
- parindent=0pt
- hfill {rm #1}hfill}}bigskip parnobreak
- }
- defCHAPFopen{
- globalletchapmacro=chfopen
- globalletunnumbchapmacro=unnchfopen
- globalletcenterchapmacro=centerchfopen}
- % Section titles.
- newskipsecheadingskip
- defsecheadingbreak{dobreak secheadingskip {-1000}}
- defsecheading#1#2#3{sectionheading{sec}{#2.#3}{#1}}
- defplainsecheading#1{sectionheading{sec}{}{#1}}
- % Subsection titles.
- newskip subsecheadingskip
- defsubsecheadingbreak{dobreak subsecheadingskip {-500}}
- defsubsecheading#1#2#3#4{sectionheading{subsec}{#2.#3.#4}{#1}}
- defplainsubsecheading#1{sectionheading{subsec}{}{#1}}
- % Subsubsection titles.
- letsubsubsecheadingskip = subsecheadingskip
- letsubsubsecheadingbreak = subsecheadingbreak
- defsubsubsecheading#1#2#3#4#5{sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
- defplainsubsubsecheading#1{sectionheading{subsubsec}{}{#1}}
- % Print any size section title.
- %
- % #1 is the section type (sec/subsec/subsubsec), #2 is the section
- % number (maybe empty), #3 the text.
- defsectionheading#1#2#3{%
- {%
- expandafteradvancecsname #1headingskipendcsname by parskip
- csname #1headingbreakendcsname
- }%
- {%
- % Switch to the right set of fonts.
- csname #1fontsendcsname rm
- %
- % Only insert the separating space if we have a section number.
- defsecnum{#2}%
- setbox0 = hbox{#2ifxsecnumemptyelseenspacefi}%
- %
- vbox{hyphenpenalty=10000 tolerance=5000 parindent=0pt raggedright
- hangindent = wd0 % zero if no section number
- unhbox0 #3}%
- }%
- ifdimparskip<10pt nobreakkern10ptnobreakkern-parskipfi nobreak
- }
- message{toc,}
- newwritetocfile
- % Write an entry to the toc file, opening it if necessary.
- % Called from @chapter, etc. We supply {folio} at the end of the
- % argument, which will end up as the last argument to the ...entry macro.
- %
- % We open the .toc file here instead of at @setfilename or any other
- % given time so that @contents can be put in the document anywhere.
- %
- newififtocfileopened
- defwritetocentry#1{%
- iftocfileopenedelse
- immediateopenouttocfile = jobname.toc
- globaltocfileopenedtrue
- fi
- iflinks writetocfile{#1{folio}}fi
- }
- newskipcontentsrightmargin contentsrightmargin=1in
- newcountsavepageno
- newcountlastnegativepageno lastnegativepageno = -1
- % Finish up the main text and prepare to read what we've written
- % to tocfile.
- %
- defstartcontents#1{%
- % If @setchapternewpage on, and @headings double, the contents should
- % start on an odd page, unlike chapters. Thus, we maintain
- % contentsalignmacro in parallel with pagealignmacro.
- % From: Torbjorn Granlund <tege@matematik.su.se>
- contentsalignmacro
- immediatecloseouttocfile
- %
- % Don't need to put `Contents' or `Short Contents' in the headline.
- % It is abundantly clear what they are.
- unnumbchapmacro{#1}defthischapter{}%
- savepageno = pageno
- begingroup % Set up to handle contents files properly.
- catcode`\=0 catcode`{=1 catcode`}=2 catcode`@=11
- % We can't do this, because then an actual ^ in a section
- % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
- %catcode`^=7 % to see ^^e4 as "a etc. juha@piuha.ydi.vtt.fi
- raggedbottom % Worry more about breakpoints than the bottom.
- advancehsize by -contentsrightmargin % Don't use the full line length.
- %
- % Roman numerals for page numbers.
- ifnum pageno>0 pageno = lastnegativepageno fi
- }
- % Normal (long) toc.
- defcontents{%
- startcontents{putwordTOC}%
- openin 1 jobname.toc
- ifeof 1 else
- closein 1
- input jobname.toc
- fi
- vfill eject
- contentsalignmacro % in case @setchapternewpage odd is in effect
- endgroup
- lastnegativepageno = pageno
- pageno = savepageno
- }
- % And just the chapters.
- defsummarycontents{%
- startcontents{putwordShortTOC}%
- %
- letchapentry = shortchapentry
- letunnumbchapentry = shortunnumberedentry
- % We want a true roman here for the page numbers.
- secfonts
- letrm=shortcontrm letbf=shortcontbf letsl=shortcontsl
- rm
- hyphenpenalty = 10000
- advancebaselineskip by 1pt % Open it up a little.
- defsecentry ##1##2##3##4{}
- defunnumbsecentry ##1##2{}
- defsubsecentry ##1##2##3##4##5{}
- defunnumbsubsecentry ##1##2{}
- defsubsubsecentry ##1##2##3##4##5##6{}
- defunnumbsubsubsecentry ##1##2{}
- openin 1 jobname.toc
- ifeof 1 else
- closein 1
- input jobname.toc
- fi
- vfill eject
- contentsalignmacro % in case @setchapternewpage odd is in effect
- endgroup
- lastnegativepageno = pageno
- pageno = savepageno
- }
- letshortcontents = summarycontents
- % These macros generate individual entries in the table of contents.
- % The first argument is the chapter or section name.
- % The last argument is the page number.
- % The arguments in between are the chapter number, section number, ...
- % Chapter-level things, for both the long and short contents.
- defchapentry#1#2#3{dochapentry{#2labelspace#1}{#3}}
- % See comments in dochapentry re vbox and related settings
- defshortchapentry#1#2#3{%
- tocentry{shortchaplabel{#2}labelspace #1}{doshortpageno{#3}}%
- }
- % Typeset the label for a chapter or appendix for the short contents.
- % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
- % We could simplify the code here by writing out an appendixentry
- % command in the toc file for appendices, instead of using chapentry
- % for both, but it doesn't seem worth it.
- setbox0 = hbox{shortcontrm putwordAppendix }
- newdimenshortappendixwidth shortappendixwidth = wd0
- defshortchaplabel#1{%
- % We typeset #1 in a box of constant width, regardless of the text of
- % #1, so the chapter titles will come out aligned.
- setbox0 = hbox{#1}%
- dimen0 = ifdimwd0 > shortappendixwidth shortappendixwidth else 0pt fi
- %
- % This space should be plenty, since a single number is .5em, and the
- % widest letter (M) is 1em, at least in the Computer Modern fonts.
- % (This space doesn't include the extra space that gets added after
- % the label; that gets put in by shortchapentry above.)
- advancedimen0 by 1.1em
- hbox to dimen0{#1hfil}%
- }
- defunnumbchapentry#1#2{dochapentry{#1}{#2}}
- defshortunnumberedentry#1#2{tocentry{#1}{doshortpageno{#2}}}
- % Sections.
- defsecentry#1#2#3#4{dosecentry{#2.#3labelspace#1}{#4}}
- defunnumbsecentry#1#2{dosecentry{#1}{#2}}
- % Subsections.
- defsubsecentry#1#2#3#4#5{dosubsecentry{#2.#3.#4labelspace#1}{#5}}
- defunnumbsubsecentry#1#2{dosubsecentry{#1}{#2}}
- % And subsubsections.
- defsubsubsecentry#1#2#3#4#5#6{%
- dosubsubsecentry{#2.#3.#4.#5labelspace#1}{#6}}
- defunnumbsubsubsecentry#1#2{dosubsubsecentry{#1}{#2}}
- % This parameter controls the indentation of the various levels.
- newdimentocindent tocindent = 3pc
- % Now for the actual typesetting. In all these, #1 is the text and #2 is the
- % page number.
- %
- % If the toc has to be broken over pages, we want it to be at chapters
- % if at all possible; hence the penalty.
- defdochapentry#1#2{%
- penalty-300 vskip1baselineskip plus.33baselineskip minus.25baselineskip
- begingroup
- chapentryfonts
- tocentry{#1}{dopageno{#2}}%
- endgroup
- nobreakvskip .25baselineskip plus.1baselineskip
- }
- defdosecentry#1#2{begingroup
- secentryfonts leftskip=tocindent
- tocentry{#1}{dopageno{#2}}%
- endgroup}
- defdosubsecentry#1#2{begingroup
- subsecentryfonts leftskip=2tocindent
- tocentry{#1}{dopageno{#2}}%
- endgroup}
- defdosubsubsecentry#1#2{begingroup
- subsubsecentryfonts leftskip=3tocindent
- tocentry{#1}{dopageno{#2}}%
- endgroup}
- % Final typesetting of a toc entry; we use the same entry macro as for
- % the index entries, but we want to suppress hyphenation here. (We
- % can't do that in the entry macro, since index entries might consist
- % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
- deftocentry#1#2{begingroup
- vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
- % Do not use turnoffactive in these arguments. Since the toc is
- % typeset in cmr, so characters such as _ would come out wrong; we
- % have to do the usual translation tricks.
- entry{#1}{#2}%
- endgroup}
- % Space between chapter (or whatever) number and the title.
- deflabelspace{hskip1em relax}
- defdopageno#1{{rm #1}}
- defdoshortpageno#1{{rm #1}}
- defchapentryfonts{secfonts rm}
- defsecentryfonts{textfonts}
- letsubsecentryfonts = textfonts
- letsubsubsecentryfonts = textfonts
- message{environments,}
- % Since these characters are used in examples, it should be an even number of
- % tt widths. Each tt character is 1en, so two makes it 1em.
- % Furthermore, these definitions must come after we define our fonts.
- newboxdblarrowbox newboxlongdblarrowbox
- newboxpushcharbox newboxbullbox
- newboxequivbox newboxerrorbox
- %{tentt
- %globalsetboxdblarrowbox = hbox to 1em{hfil$Rightarrow$hfil}
- %globalsetboxlongdblarrowbox = hbox to 1em{hfil$mapsto$hfil}
- %globalsetboxpushcharbox = hbox to 1em{hfil$dashv$hfil}
- %globalsetboxequivbox = hbox to 1em{hfil$ptexequiv$hfil}
- % Adapted from the manmac format (p.420 of TeXbook)
- %globalsetboxbullbox = hbox to 1em{kern.15emvrule height .75ex width .85ex
- % depth .1exhfil}
- %}
- % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
- defpoint{$star$}
- defresult{leavevmoderaise.15exhbox to 1em{hfil$Rightarrow$hfil}}
- defexpansion{leavevmoderaise.1exhbox to 1em{hfil$mapsto$hfil}}
- defprint{leavevmodelower.1exhbox to 1em{hfil$dashv$hfil}}
- defequiv{leavevmodelower.1exhbox to 1em{hfil$ptexequiv$hfil}}
- % Adapted from the TeXbook's boxit.
- {tentt globaldimen0 = 3em}% Width of the box.
- dimen2 = .55pt % Thickness of rules
- % The text. (`r' is open on the right, `e' somewhat less so on the left.)
- setbox0 = hbox{kern-.75pt tensf errorkern-1.5pt}
- globalsetboxerrorbox=hbox to dimen0{hfil
- hsize = dimen0 advancehsize by -5.8pt % Space to left+right.
- advancehsize by -2dimen2 % Rules.
- vbox{
- hrule heightdimen2
- hbox{vrule widthdimen2 kern3pt % Space to left of text.
- vtop{kern2.4pt box0 kern2.4pt}% Space above/below.
- kern3ptvrule widthdimen2}% Space to right.
- hrule heightdimen2}
- hfil}
- % The @error{} command.
- deferror{leavevmodelower.7excopyerrorbox}
- % @tex ... @end tex escapes into raw Tex temporarily.
- % One exception: @ is still an escape character, so that @end tex works.
- % But @ or @@ will get a plain tex @ character.
- deftex{begingroup
- catcode `\=0 catcode `{=1 catcode `}=2
- catcode `$=3 catcode `&=4 catcode `#=6
- catcode `^=7 catcode `_=8 catcode `~=13 let~=tie
- catcode `%=14
- catcode 43=12 % plus
- catcode`"=12
- catcode`==12
- catcode`|=12
- catcode`<=12
- catcode`>=12
- escapechar=`\
- %
- letb=ptexb
- letbullet=ptexbullet
- letc=ptexc
- let,=ptexcomma
- let.=ptexdot
- letdots=ptexdots
- letequiv=ptexequiv
- let!=ptexexclam
- leti=ptexi
- let{=ptexlbrace
- let+=tabalign
- let}=ptexrbrace
- let*=ptexstar
- lett=ptext
- %
- defendldots{mathinner{ldotsldotsldotsldots}}%
- defenddots{relaxifmmodeendldotselse$mathsurround=0pt endldots,$fi}%
- def@{@}%
- letEtex=endgroup}
- % Define @lisp ... @endlisp.
- % @lisp does a begingroup so it can rebind things,
- % including the definition of @endlisp (which normally is erroneous).
- % Amount to narrow the margins by for @lisp.
- newskiplispnarrowing lispnarrowing=0.4in
- % This is the definition that ^^M gets inside @lisp, @example, and other
- % such environments. null is better than a space, since it doesn't
- % have any width.
- deflisppar{nullendgraf}
- % Make each space character in the input produce a normal interword
- % space in the output. Don't allow a line break at this space, as this
- % is used only in environments like @example, where each line of input
- % should produce a line of output anyway.
- %
- {obeyspaces %
- gdefsepspaces{obeyspaceslet =tie}}
- % Define obeyedspace to be our active space, whatever it is. This is
- % for use in parsearg.
- {sepspaces%
- globalletobeyedspace= }
- % This space is always present above and below environments.
- newskipenvskipamount envskipamount = 0pt
- % Make spacing and below environment symmetrical. We use parskip here
- % to help in doing that, since in @example-like environments parskip
- % is reset to zero; thus the afterenvbreak inserts no space -- but the
- % start of the next paragraph will insert parskip
- %
- defaboveenvbreak{{advanceenvskipamount by parskip
- endgraf ifdimlastskip<envskipamount
- removelastskip penalty-50 vskipenvskipamount fi}}
- letafterenvbreak = aboveenvbreak
- % nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
- letnonarrowing=relax
- % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
- % environment contents.
- fontcircle=lcircle10
- newdimencircthick
- newdimencartouternewdimencartinner
- newskipnormbskipnewskipnormpskipnewskipnormlskip
- circthick=fontdimen8circle
- %
- defctl{{circlechar'013hskip -6pt}}% 6pt from pl file: 1/2charwidth
- defctr{{hskip 6ptcirclechar'010}}
- defcbl{{circlechar'012hskip -6pt}}
- defcbr{{hskip 6ptcirclechar'011}}
- defcarttop{hbox to cartouter{hskiplskip
- ctlleadershrule heightcircthickhfilctr
- hskiprskip}}
- defcartbot{hbox to cartouter{hskiplskip
- cblleadershrule heightcircthickhfilcbr
- hskiprskip}}
- %
- newskiplskipnewskiprskip
- longdefcartouche{%
- begingroup
- lskip=leftskip rskip=rightskip
- leftskip=0ptrightskip=0pt %we want these *outside*.
- cartinner=hsize advancecartinner by-lskip
- advancecartinner by-rskip
- cartouter=hsize
- advancecartouter by 18.4pt % allow for 3pt kerns on either
- % side, and for 6pt waste from
- % each corner char, and rule thickness
- normbskip=baselineskip normpskip=parskip normlskip=lineskip
- % Flag to tell @lisp, etc., not to narrow margin.
- letnonarrowing=comment
- vboxbgroup
- baselineskip=0ptparskip=0ptlineskip=0pt
- carttop
- hboxbgroup
- hskiplskip
- vrulekern3pt
- vboxbgroup
- hsize=cartinner
- kern3pt
- begingroup
- baselineskip=normbskip
- lineskip=normlskip
- parskip=normpskip
- vskip -parskip
- defEcartouche{%
- endgroup
- kern3pt
- egroup
- kern3ptvrule
- hskiprskip
- egroup
- cartbot
- egroup
- endgroup
- }}
- % This macro is called at the beginning of all the @example variants,
- % inside a group.
- defnonfillstart{%
- aboveenvbreak
- inENV % This group ends at the end of the body
- hfuzz = 12pt % Don't be fussy
- sepspaces % Make spaces be word-separators rather than space tokens.
- singlespace
- letpar = lisppar % don't ignore blank lines
- obeylines % each line of input is a line of output
- parskip = 0pt
- parindent = 0pt
- emergencystretch = 0pt % don't try to avoid overfull boxes
- % @cartouche defines nonarrowing to inhibit narrowing
- % at next level down.
- ifxnonarrowingrelax
- advance leftskip by lispnarrowing
- exdentamount=lispnarrowing
- letexdent=nofillexdent
- letnonarrowing=relax
- fi
- }
- % Define the E... control sequence only if we are inside the particular
- % environment, so the error checking in end will work.
- %
- % To end an @example-like environment, we first end the paragraph (via
- % afterenvbreak's vertical glue), and then the group. That way we keep
- % the zero parskip that the environments set -- parskip glue will be
- % inserted at the beginning of the next paragraph in the document, after
- % the environment.
- %
- defnonfillfinish{afterenvbreakendgroup}
- % @lisp: indented, narrowed, typewriter font.
- deflisp{begingroup
- nonfillstart
- letElisp = nonfillfinish
- tt
- letkbdfont = kbdexamplefont % Allow @kbd to do something special.
- gobble % eat return
- }
- % @example: Same as @lisp.
- defexample{begingroup defEexample{nonfillfinishendgroup}lisp}
- % @small... is usually equivalent to the non-small (@smallbook
- % redefines). We must call example (or whatever) last in the
- % definition, since it reads the return following the @example (or
- % whatever) command.
- %
- % This actually allows (for example) @end display inside an
- % @smalldisplay. Too bad, but makeinfo will catch the error anyway.
- %
- defsmalldisplay{begingroupdefEsmalldisplay{nonfillfinishendgroup}display}
- defsmallexample{begingroupdefEsmallexample{nonfillfinishendgroup}lisp}
- defsmallformat{begingroupdefEsmallformat{nonfillfinishendgroup}format}
- defsmalllisp{begingroupdefEsmalllisp{nonfillfinishendgroup}lisp}
- % Real @smallexample and @smalllisp (when @smallbook): use smaller fonts.
- % Originally contributed by Pavel@xerox.
- defsmalllispx{begingroup
- defEsmalllisp{nonfillfinishendgroup}%
- defEsmallexample{nonfillfinishendgroup}%
- indexfonts
- lisp
- }
- % @display: same as @lisp except keep current font.
- %
- defdisplay{begingroup
- nonfillstart
- letEdisplay = nonfillfinish
- gobble
- }
- % @smalldisplay (when @smallbook): @display plus smaller fonts.
- %
- defsmalldisplayx{begingroup
- defEsmalldisplay{nonfillfinishendgroup}%
- indexfonts rm
- display
- }
- % @format: same as @display except don't narrow margins.
- %
- defformat{begingroup
- letnonarrowing = t
- nonfillstart
- letEformat = nonfillfinish
- gobble
- }
- % @smallformat (when @smallbook): @format plus smaller fonts.
- %
- defsmallformatx{begingroup
- defEsmallformat{nonfillfinishendgroup}%
- indexfonts rm
- format
- }
- % @flushleft (same as @format).
- %
- defflushleft{begingroup defEflushleft{nonfillfinishendgroup}format}
- % @flushright.
- %
- defflushright{begingroup
- letnonarrowing = t
- nonfillstart
- letEflushright = nonfillfinish
- advanceleftskip by 0pt plus 1fill
- gobble
- }
- % @quotation does normal linebreaking (hence we can't use nonfillstart)
- % and narrows the margins.
- %
- defquotation{%
- begingroupinENV %This group ends at the end of the @quotation body
- {parskip=0pt aboveenvbreak}% because aboveenvbreak inserts parskip
- singlespace
- parindent=0pt
- % We have retained a nonzero parskip for the environment, since we're
- % doing normal filling. So to avoid extra space below the environment...
- defEquotation{parskip = 0pt nonfillfinish}%
- %
- % @cartouche defines nonarrowing to inhibit narrowing at next level down.
- ifxnonarrowingrelax
- advanceleftskip by lispnarrowing
- advancerightskip by lispnarrowing
- exdentamount = lispnarrowing
- letnonarrowing = relax
- fi
- }
- message{defuns,}
- % Define formatter for defuns
- % First, allow user to change definition object font (df) internally
- defsetdeffont #1 {csname DEF#1endcsname}
- newskipdefbodyindent defbodyindent=.4in
- newskipdefargsindent defargsindent=50pt
- newskipdeftypemargin deftypemargin=12pt
- newskipdeflastargmargin deflastargmargin=18pt
- newcountparencount
- % define functionparens, which makes ( and ) and & do special things.
- % functionparens affects the group it is contained in.
- defactiveparens{%
- catcode`(=active catcode`)=active catcode`&=active
- catcode`[=active catcode`]=active}
- % Make control sequences which act like normal parenthesis chars.
- letlparen = ( letrparen = )
- {activeparens % Now, smart parens don't turn on until &foo (see amprm)
- % Be sure that we always have a definition for `(', etc. For example,
- % if the fn name has parens in it, boldbrax will not be in effect yet,
- % so TeX would otherwise complain about undefined control sequence.
- globallet(=lparen globallet)=rparen
- globallet[=lbrack globallet]=rbrack
- gdeffunctionparens{boldbraxlet&=amprmparencount=0 }
- gdefboldbrax{let(=opnrlet)=clnrlet[=lbrblet]=rbrb}
- % This is used to turn on special parens
- % but make & act ordinary (given that it's active).
- gdefboldbraxnoamp{let(=opnrlet)=clnrlet[=lbrblet]=rbrblet&=ampnr}
- % Definitions of (, ) and & used in args for functions.
- % This is the definition of ( outside of all parentheses.
- gdefoprm#1 {{rmchar`(}#1 bf let(=opnested
- globaladvanceparencount by 1
- }
- %
- % This is the definition of ( when already inside a level of parens.
- gdefopnested{char`(globaladvanceparencount by 1 }
- %
- gdefclrm{% Print a paren in roman if it is taking us back to depth of 0.
- % also in that case restore the outer-level definition of (.
- ifnum parencount=1 {rm char `)}sl let(=oprm else char `) fi
- globaladvance parencount by -1 }
- % If we encounter &foo, then turn on ()-hacking afterwards
- gdefamprm#1 {{rm}let(=oprm let)=clrm }
- %
- gdefnormalparens{boldbraxlet&=ampnr}
- } % End of definition inside activeparens
- %% These parens (in boldbrax) actually are a little bolder than the
- %% contained text. This is especially needed for [ and ]
- defopnr{{sfchar`(}globaladvanceparencount by 1 }
- defclnr{{sfchar`)}globaladvanceparencount by -1 }
- defampnr{&}
- deflbrb{{bfchar`[}}
- defrbrb{{bfchar`]}}
- % First, defname, which formats the header line itself.
- % #1 should be the function name.
- % #2 should be the type of definition, such as "Function".
- defdefname #1#2{%
- % Get the values of leftskip and rightskip as they were
- % outside the @def...
- dimen2=leftskip
- advancedimen2 by -defbodyindent
- noindent
- setbox0=hbox{hskip deflastargmargin{rm #2}hskip deftypemargin}%
- dimen0=hsize advance dimen0 by -wd0 % compute size for first line
- dimen1=hsize advance dimen1 by -defargsindent %size for continuations
- parshape 2 0in dimen0 defargsindent dimen1
- % Now output arg 2 ("Function" or some such)
- % ending at deftypemargin from the right margin,
- % but stuck inside a box of width 0 so it does not interfere with linebreaking
- {% Adjust hsize to exclude the ambient margins,
- % so that rightline will obey them.
- advance hsize by -dimen2
- rlap{rightline{{rm #2}hskip -1.25pc }}}%
- % Make all lines underfull and no complaints:
- tolerance=10000 hbadness=10000
- advanceleftskip by -defbodyindent
- exdentamount=defbodyindent
- {df #1}enskip % Generate function name
- }
- % Actually process the body of a definition
- % #1 should be the terminating control sequence, such as Edefun.
- % #2 should be the "another name" control sequence, such as defunx.
- % #3 should be the control sequence that actually processes the header,
- % such as defunheader.
- defdefparsebody #1#2#3{begingroupinENV% Environment for definitionbody
- medbreak %
- % Define the end token that this defining construct specifies
- % so that it will exit this group.
- def#1{endgrafendgroupmedbreak}%
- def#2{begingroupobeylinesactiveparensspacesplit#3}%
- parindent=0in
- advanceleftskip by defbodyindent
- exdentamount=defbodyindent
- begingroup %
- catcode 61=active % 61 is `='
- obeylinesactiveparensspacesplit#3}
- % #1 is the E... control sequence to end the definition (which we define).
- % #2 is the ...x control sequence for consecutive fns (which we define).
- % #3 is the control sequence to call to resume processing.
- % #4, delimited by the space, is the class name.
- %
- defdefmethparsebody#1#2#3#4 {begingroupinENV %
- medbreak %
- % Define the end token that this defining construct specifies
- % so that it will exit this group.
- def#1{endgrafendgroupmedbreak}%
- def#2##1 {begingroupobeylinesactiveparensspacesplit{#3{##1}}}%
- parindent=0in
- advanceleftskip by defbodyindent
- exdentamount=defbodyindent
- begingroupobeylinesactiveparensspacesplit{#3{#4}}}
- % @deftypemethod has an extra argument that nothing else does. Sigh.
- % #1 is the E... control sequence to end the definition (which we define).
- % #2 is the ...x control sequence for consecutive fns (which we define).
- % #3 is the control sequence to call to resume processing.
- % #4, delimited by the space, is the class name.
- % #5 is the method's return type.
- %
- defdeftypemethparsebody#1#2#3#4 #5 {begingroupinENV %
- medbreak %
- % Define the end token that this defining construct specifies
- % so that it will exit this group.
- def#1{endgrafendgroupmedbreak}%
- def#2##1 ##2 {begingroupobeylinesactiveparensspacesplit{#3{##1}{##2}}}%
- parindent=0in
- advanceleftskip by defbodyindent
- exdentamount=defbodyindent
- begingroupobeylinesactiveparensspacesplit{#3{#4}{#5}}}
- defdefopparsebody #1#2#3#4#5 {begingroupinENV %
- medbreak %
- % Define the end token that this defining construct specifies
- % so that it will exit this group.
- def#1{endgrafendgroupmedbreak}%
- def#2##1 ##2 {def#4{##1}%
- begingroupobeylinesactiveparensspacesplit{#3{##2}}}%
- parindent=0in
- advanceleftskip by defbodyindent
- exdentamount=defbodyindent
- begingroupobeylinesactiveparensspacesplit{#3{#5}}}
- % These parsing functions are similar to the preceding ones
- % except that they do not make parens into active characters.
- % These are used for "variables" since they have no arguments.
- defdefvarparsebody #1#2#3{begingroupinENV% Environment for definitionbody
- medbreak %
- % Define the end token that this defining construct specifies
- % so that it will exit this group.
- def#1{endgrafendgroupmedbreak}%
- def#2{begingroupobeylinesspacesplit#3}%
- parindent=0in
- advanceleftskip by defbodyindent
- exdentamount=defbodyindent
- begingroup %
- catcode 61=active %
- obeylinesspacesplit#3}
- % This is used for def{tp,vr}parsebody. It could probably be used for
- % some of the others, too, with some judicious conditionals.
- %
- defparsebodycommon#1#2#3{%
- begingroupinENV %
- medbreak %
- % Define the end token that this defining construct specifies
- % so that it will exit this group.
- def#1{endgrafendgroupmedbreak}%
- def#2##1 {begingroupobeylinesspacesplit{#3{##1}}}%
- parindent=0in
- advanceleftskip by defbodyindent
- exdentamount=defbodyindent
- begingroupobeylines
- }
- defdefvrparsebody#1#2#3#4 {%
- parsebodycommon{#1}{#2}{#3}%
- spacesplit{#3{#4}}%
- }
- % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
- % type is just `struct', because we lose the braces in `{struct
- % termios}' when spacesplit reads its undelimited argument. Sigh.
- % letdeftpparsebody=defvrparsebody
- %
- % So, to get around this, we put empty in with the type name. That
- % way, TeX won't find exactly `{...}' as an undelimited argument, and
- % won't strip off the braces.
- %
- defdeftpparsebody #1#2#3#4 {%
- parsebodycommon{#1}{#2}{#3}%
- spacesplit{parsetpheaderline{#3{#4}}}empty
- }
- % Fine, but then we have to eventually remove the empty *and* the
- % braces (if any). That's what this does.
- %
- defremoveemptybracesempty#1relax{#1}
- % After spacesplit has done its work, this is called -- #1 is the final
- % thing to call, #2 the type name (which starts with empty), and #3
- % (which might be empty) the arguments.
- %
- defparsetpheaderline#1#2#3{%
- #1{removeemptybraces#2relax}{#3}%
- }%
- defdefopvarparsebody #1#2#3#4#5 {begingroupinENV %
- medbreak %
- % Define the end token that this defining construct specifies
- % so that it will exit this group.
- def#1{endgrafendgroupmedbreak}%
- def#2##1 ##2 {def#4{##1}%
- begingroupobeylinesspacesplit{#3{##2}}}%
- parindent=0in
- advanceleftskip by defbodyindent
- exdentamount=defbodyindent
- begingroupobeylinesspacesplit{#3{#5}}}
- % Split up #2 at the first space token.
- % call #1 with two arguments:
- % the first is all of #2 before the space token,
- % the second is all of #2 after that space token.
- % If #2 contains no space token, all of it is passed as the first arg
- % and the second is passed as empty.
- {obeylines
- gdefspacesplit#1#2^^M{endgroupspacesplitfoo{#1}#2 relaxspacesplitfoo}%
- longgdefspacesplitfoo#1#2 #3#4spacesplitfoo{%
- ifxrelax #3%
- #1{#2}{}else #1{#2}{#3#4}fi}}
- % So much for the things common to all kinds of definitions.
- % Define @defun.
- % First, define the processing that is wanted for arguments of defun
- % Use this to expand the args and terminate the paragraph they make up
- defdefunargs #1{functionparens sl
- % Expand, preventing hyphenation at `-' chars.
- % Note that groups don't affect changes in hyphenchar.
- hyphenchartensl=0
- #1%
- hyphenchartensl=45
- ifnumparencount=0 else errmessage{Unbalanced parentheses in @def}fi%
- interlinepenalty=10000
- advancerightskip by 0pt plus 1fil
- endgrafnobreakvskip -parskipnobreak
- }
- defdeftypefunargs #1{%
- % Expand, preventing hyphenation at `-' chars.
- % Note that groups don't affect changes in hyphenchar.
- % Use boldbraxnoamp, not functionparens, so that & is not special.
- boldbraxnoamp
- tclose{#1}% avoid code because of side effects on active chars
- interlinepenalty=10000
- advancerightskip by 0pt plus 1fil
- endgrafnobreakvskip -parskipnobreak
- }
- % Do complete processing of one @defun or @defunx line already parsed.
- % @deffn Command forward-char nchars
- defdeffn{defmethparsebodyEdeffndeffnxdeffnheader}
- defdeffnheader #1#2#3{doind {fn}{code{#2}}%
- begingroupdefname {#2}{#1}defunargs{#3}endgroup %
- catcode 61=other % Turn off change made in defparsebody
- }
- % @defun == @deffn Function
- defdefun{defparsebodyEdefundefunxdefunheader}
- defdefunheader #1#2{doind {fn}{code{#1}}% Make entry in function index
- begingroupdefname {#1}{putwordDeffunc}%
- defunargs {#2}endgroup %
- catcode 61=other % Turn off change made in defparsebody
- }
- % @deftypefun int foobar (int @var{foo}, float @var{bar})
- defdeftypefun{defparsebodyEdeftypefundeftypefunxdeftypefunheader}
- % #1 is the data type. #2 is the name and args.
- defdeftypefunheader #1#2{deftypefunheaderx{#1}#2 relax}
- % #1 is the data type, #2 the name, #3 the args.
- defdeftypefunheaderx #1#2 #3relax{%
- doind {fn}{code{#2}}% Make entry in function index
- begingroupdefname {defheaderxcond#1relax$$$#2}{putwordDeftypefun}%
- deftypefunargs {#3}endgroup %
- catcode 61=other % Turn off change made in defparsebody
- }
- % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
- defdeftypefn{defmethparsebodyEdeftypefndeftypefnxdeftypefnheader}
- % defheaderxcond#1relax$$$
- % puts #1 in @code, followed by a space, but does nothing if #1 is null.
- defdefheaderxcond#1#2$$${ifx#1relaxelsecode{#1#2} fi}
- % #1 is the classification. #2 is the data type. #3 is the name and args.
- defdeftypefnheader #1#2#3{deftypefnheaderx{#1}{#2}#3 relax}
- % #1 is the classification, #2 the data type, #3 the name, #4 the args.
- defdeftypefnheaderx #1#2#3 #4relax{%
- doind {fn}{code{#3}}% Make entry in function index
- begingroup
- normalparens % notably, turn off `&' magic, which prevents
- % at least some C++ text from working
- defname {defheaderxcond#2relax$$$#3}{#1}%
- deftypefunargs {#4}endgroup %
- catcode 61=other % Turn off change made in defparsebody
- }
- % @defmac == @deffn Macro
- defdefmac{defparsebodyEdefmacdefmacxdefmacheader}
- defdefmacheader #1#2{doind {fn}{code{#1}}% Make entry in function index
- begingroupdefname {#1}{putwordDefmac}%
- defunargs {#2}endgroup %
- catcode 61=other % Turn off change made in defparsebody
- }
- % @defspec == @deffn Special Form
- defdefspec{defparsebodyEdefspecdefspecxdefspecheader}
- defdefspecheader #1#2{doind {fn}{code{#1}}% Make entry in function index
- begingroupdefname {#1}{putwordDefspec}%
- defunargs {#2}endgroup %
- catcode 61=other % Turn off change made in defparsebody
- }
- % This definition is run if you use @defunx
- % anywhere other than immediately after a @defun or @defunx.
- defdeffnx #1 {errmessage{@deffnx in invalid context}}
- defdefunx #1 {errmessage{@defunx in invalid context}}
- defdefmacx #1 {errmessage{@defmacx in invalid context}}
- defdefspecx #1 {errmessage{@defspecx in invalid context}}
- defdeftypefnx #1 {errmessage{@deftypefnx in invalid context}}
- defdeftypemethodx #1 {errmessage{@deftypemethodx in invalid context}}
- defdeftypefunx #1 {errmessage{@deftypefunx in invalid context}}
- % @defmethod, and so on
- % @defop CATEGORY CLASS OPERATION ARG...
- defdefop #1 {defdefoptype{#1}%
- defopparsebodyEdefopdefopxdefopheaderdefoptype}
- defdefopheader #1#2#3{%
- dosubind {fn}{code{#2}}{putwordon #1}% Make entry in function index
- begingroupdefname {#2}{defoptype{}putwordon #1}%
- defunargs {#3}endgroup %
- }
- % @deftypemethod CLASS RETURN-TYPE METHOD ARG...
- %
- defdeftypemethod{%
- deftypemethparsebodyEdeftypemethoddeftypemethodxdeftypemethodheader}
- %
- % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
- defdeftypemethodheader#1#2#3#4{%
- dosubind{fn}{code{#3}}{putwordon code{#1}}% entry in function index
- begingroup
- defname{defheaderxcond#2relax$$$#3}{putwordMethodon code{#1}}%
- deftypefunargs{#4}%
- endgroup
- }
- % @defmethod == @defop Method
- %
- defdefmethod{defmethparsebodyEdefmethoddefmethodxdefmethodheader}
- %
- % #1 is the class name, #2 the method name, #3 the args.
- defdefmethodheader#1#2#3{%
- dosubind{fn}{code{#2}}{putwordon code{#1}}% entry in function index
- begingroup
- defname{#2}{putwordMethodon code{#1}}%
- defunargs{#3}%
- endgroup
- }
- % @defcv {Class Option} foo-class foo-flag
- defdefcv #1 {defdefcvtype{#1}%
- defopvarparsebodyEdefcvdefcvxdefcvarheaderdefcvtype}
- defdefcvarheader #1#2#3{%
- dosubind {vr}{code{#2}}{putwordof #1}% Make entry in var index
- begingroupdefname {#2}{defcvtype putwordof #1}%
- defvarargs {#3}endgroup %
- }
- % @defivar == @defcv {Instance Variable}
- defdefivar{defvrparsebodyEdefivardefivarxdefivarheader}
- defdefivarheader #1#2#3{%
- dosubind {vr}{code{#2}}{putwordof #1}% Make entry in var index
- begingroupdefname {#2}{putwordDefivar putwordof #1}%
- defvarargs {#3}endgroup %
- }
- % These definitions are run if you use @defmethodx, etc.,
- % anywhere other than immediately after a @defmethod, etc.
- defdefopx #1 {errmessage{@defopx in invalid context}}
- defdefmethodx #1 {errmessage{@defmethodx in invalid context}}
- defdefcvx #1 {errmessage{@defcvx in invalid context}}
- defdefivarx #1 {errmessage{@defivarx in invalid context}}
- % Now @defvar
- % First, define the processing that is wanted for arguments of @defvar.
- % This is actually simple: just print them in roman.
- % This must expand the args and terminate the paragraph they make up
- defdefvarargs #1{normalparens #1%
- interlinepenalty=10000
- endgrafnobreakvskip -parskipnobreak}
- % @defvr Counter foo-count
- defdefvr{defvrparsebodyEdefvrdefvrxdefvrheader}
- defdefvrheader #1#2#3{doind {vr}{code{#2}}%
- begingroupdefname {#2}{#1}defvarargs{#3}endgroup}
- % @defvar == @defvr Variable
- defdefvar{defvarparsebodyEdefvardefvarxdefvarheader}
- defdefvarheader #1#2{doind {vr}{code{#1}}% Make entry in var index
- begingroupdefname {#1}{putwordDefvar}%
- defvarargs {#2}endgroup %
- }
- % @defopt == @defvr {User Option}
- defdefopt{defvarparsebodyEdefoptdefoptxdefoptheader}
- defdefoptheader #1#2{doind {vr}{code{#1}}% Make entry in var index
- begingroupdefname {#1}{putwordDefopt}%
- defvarargs {#2}endgroup %
- }
- % @deftypevar int foobar
- defdeftypevar{defvarparsebodyEdeftypevardeftypevarxdeftypevarheader}
- % #1 is the data type. #2 is the name, perhaps followed by text that
- % is actually part of the data type, which should not be put into the index.
- defdeftypevarheader #1#2{%
- dovarind#2 relax% Make entry in variables index
- begingroupdefname {defheaderxcond#1relax$$$#2}{putwordDeftypevar}%
- interlinepenalty=10000
- endgrafnobreakvskip -parskipnobreak
- endgroup}
- defdovarind#1 #2relax{doind{vr}{code{#1}}}
- % @deftypevr {Global Flag} int enable
- defdeftypevr{defvrparsebodyEdeftypevrdeftypevrxdeftypevrheader}
- defdeftypevrheader #1#2#3{dovarind#3 relax%
- begingroupdefname {defheaderxcond#2relax$$$#3}{#1}
- interlinepenalty=10000
- endgrafnobreakvskip -parskipnobreak
- endgroup}
- % This definition is run if you use @defvarx
- % anywhere other than immediately after a @defvar or @defvarx.
- defdefvrx #1 {errmessage{@defvrx in invalid context}}
- defdefvarx #1 {errmessage{@defvarx in invalid context}}
- defdefoptx #1 {errmessage{@defoptx in invalid context}}
- defdeftypevarx #1 {errmessage{@deftypevarx in invalid context}}
- defdeftypevrx #1 {errmessage{@deftypevrx in invalid context}}
- % Now define @deftp
- % Args are printed in bold, a slight difference from @defvar.
- defdeftpargs #1{bf defvarargs{#1}}
- % @deftp Class window height width ...
- defdeftp{deftpparsebodyEdeftpdeftpxdeftpheader}
- defdeftpheader #1#2#3{doind {tp}{code{#2}}%
- begingroupdefname {#2}{#1}deftpargs{#3}endgroup}
- % This definition is run if you use @deftpx, etc
- % anywhere other than immediately after a @deftp, etc.
- defdeftpx #1 {errmessage{@deftpx in invalid context}}
- message{macros,}
- % @macro.
- % To do this right we need a feature of e-TeX, scantokens,
- % which we arrange to emulate with a temporary file in ordinary TeX.
- ifxeTeXversionundefined
- newwritemacscribble
- defscanmacro#1{%
- begingroup newlinechar`^^M
- % Undo catcode changes of startcontents and doprintindex
- catcode`@=0 catcode`\=12 escapechar=`@
- % Append endinput to make sure that TeX does not see the ending newline.
- toks0={#1endinput}%
- immediateopenoutmacscribble=jobname.tmp
- immediatewritemacscribble{thetoks0}%
- immediatecloseoutmacscribble
- letxeatspaceseatspaces
- input jobname.tmp
- endgroup
- }
- else
- defscanmacro#1{%
- begingroup newlinechar`^^M
- % Undo catcode changes of startcontents and doprintindex
- catcode`@=0 catcode`\=12 escapechar=`@
- letxeatspaceseatspacesscantokens{#1endinput}endgroup}
- fi
- newcountparamno % Count of parameters
- newtoksmacname % Macro name
- newififrecursive % Is it recursive?
- defmacrolist{} % List of all defined macros in the form
- % domacro1domacro2...
- % Utility routines.
- % Thisdoes let #1 = #2, except with csnames.
- defcslet#1#2{%
- expandafterexpandafter
- expandafterlet
- expandafterexpandafter
- csname#1endcsname
- csname#2endcsname}
- % Trim leading and trailing spaces off a string.
- % Concepts from aro-bend problem 15 (see CTAN).
- {catcode`@=11
- gdefeatspaces #1{expandaftertrim@expandafter{#1 }}
- gdeftrim@ #1{trim@@ @#1 @ #1 @ @@}
- gdeftrim@@ #1@ #2@ #3@@{trim@@@empty #2 @}
- defunbrace#1{#1}
- unbrace{gdeftrim@@@ #1 } #2@{#1}
- }
- % Trim a single trailing ^^M off a string.
- {catcode`^^M=12catcode`Q=3%
- gdefeatcr #1{eatcra #1Q^^MQ}%
- gdefeatcra#1^^MQ{eatcrb#1Q}%
- gdefeatcrb#1Q#2Q{#1}%
- }
- % Macro bodies are absorbed as an argument in a context where
- % all characters are catcode 10, 11 or 12, except which is active
- % (as in normal texinfo). It is necessary to change the definition of .
- % It's necessary to have hard CRs when the macro is executed. This is
- % done by making ^^M (endlinechar) catcode 12 when reading the macro
- % body, and then making it the newlinechar in scanmacro.
- defmacrobodyctxt{%
- catcode`~=12
- catcode`^=12
- catcode`_=12
- catcode`|=12
- catcode`<=12
- catcode`>=12
- catcode`+=12
- catcode`{=12
- catcode`}=12
- catcode`@=12
- catcode`^^M=12
- usembodybackslash}
- defmacroargctxt{%
- catcode`~=12
- catcode`^=12
- catcode`_=12
- catcode`|=12
- catcode`<=12
- catcode`>=12
- catcode`+=12
- catcode`@=12
- catcode`\=12}
- % mbodybackslash is the definition of in @macro bodies.
- % It maps foo => csname macarg.fooendcsname => #N
- % where N is the macro parameter number.
- % We define csname macarg.endcsname to be realbackslash, so
- % \ in macro replacement text gets you a backslash.
- {catcode`@=0 @catcode`@=@active
- @gdef@usembodybackslash{@let=@mbodybackslash}
- @gdef@mbodybackslash#1{@csname macarg.#1@endcsname}
- }
- expandafterdefcsname macarg.endcsname{realbackslash}
- defmacro{recursivefalseparseargmacroxxx}
- defrmacro{recursivetrueparseargmacroxxx}
- defmacroxxx#1{%
- getargs{#1}% now macname is the macname and argl the arglist
- ifxarglempty % no arguments
- paramno=0%
- else
- expandafterparsemargdef argl;%
- fi
- if1csname ismacro.themacnameendcsname
- message{Warning: redefining themacname}%
- else
- expandafterifxcsname themacnameendcsname relax
- else errmessage{The name themacnamespace is reserved}fi
- globalcslet{macsave.themacname}{themacname}%
- globalexpandafterletcsname ismacro.themacnameendcsname=1%
- % Add the macroname to macrolist
- toks0 = expandafter{macrolistdo}%
- xdefmacrolist{thetoks0
- expandafternoexpandcsnamethemacnameendcsname}%
- fi
- begingroup macrobodyctxt
- ifrecursive expandafterparsermacbody
- else expandafterparsemacbody
- fi}
- defunmacro{parseargunmacroxxx}
- defunmacroxxx#1{%
- if1csname ismacro.#1endcsname
- globalcslet{#1}{macsave.#1}%
- globalexpandafterlet csname ismacro.#1endcsname=0%
- % Remove the macro name from macrolist
- begingroup
- edeftempa{expandafternoexpandcsname#1endcsname}%
- defdo##1{%
- deftempb{##1}%
- ifxtempatempb
- % remove this
- else
- toks0 = expandafter{newmacrolistdo}%
- edefnewmacrolist{thetoks0expandafternoexpandtempa}%
- fi}%
- defnewmacrolist{}%
- % Execute macro list to define newmacrolist
- macrolist
- globalletmacrolistnewmacrolist
- endgroup
- else
- errmessage{Macro #1 not defined}%
- fi
- }
- % This makes use of the obscure feature that if the last token of a
- % <parameter list> is #, then the preceding argument is delimited by
- % an opening brace, and that opening brace is not consumed.
- defgetargs#1{getargsxxx#1{}}
- defgetargsxxx#1#{getmacname #1 relaxgetmacargs}
- defgetmacname #1 #2relax{macname={#1}}
- defgetmacargs#1{defargl{#1}}
- % Parse the optional {params} list. Set up paramno and paramlist
- % so defmacro knows what to do. Define macarg.blah for each blah
- % in the params list, to be ##N where N is the position in that list.
- % That gets used by mbodybackslash (above).
- % We need to get `macro parameter char #' into several definitions.
- % The technique used is stolen from LaTeX: let hash be something
- % unexpandable, insert that wherever you need a #, and then redefine
- % it to # just before using the token list produced.
- %
- % The same technique is used to protect eatspaces till just before
- % the macro is used.
- defparsemargdef#1;{paramno=0defparamlist{}%
- lethashrelaxletxeatspacesrelaxparsemargdefxxx#1,;,}
- defparsemargdefxxx#1,{%
- if#1;letnext=relax
- else letnext=parsemargdefxxx
- advanceparamno by 1%
- expandafteredefcsname macarg.eatspaces{#1}endcsname
- {xeatspaces{hashtheparamno}}%
- edefparamlist{paramlisthashtheparamno,}%
- finext}
- % These two commands read recursive and nonrecursive macro bodies.
- % (They're different since rec and nonrec macros end differently.)
- longdefparsemacbody#1@end macro%
- {xdeftemp{eatcr{#1}}endgroupdefmacro}%
- longdefparsermacbody#1@end rmacro%
- {xdeftemp{eatcr{#1}}endgroupdefmacro}%
- % This defines the macro itself. There are six cases: recursive and
- % nonrecursive macros of zero, one, and many arguments.
- % Much magic with expandafter here.
- % xdef is used so that macro definitions will survive the file
- % they're defined in; @include reads the file inside a group.
- defdefmacro{%
- lethash=##% convert placeholders to macro parameter chars
- ifrecursive
- ifcaseparamno
- % 0
- expandafterxdefcsnamethemacnameendcsname{%
- noexpandscanmacro{temp}}%
- or % 1
- expandafterxdefcsnamethemacnameendcsname{%
- bgroupnoexpandmacroargctxt
- noexpandbraceorline
- expandafternoexpandcsnamethemacname xxxendcsname}%
- expandafterxdefcsnamethemacname xxxendcsname##1{%
- egroupnoexpandscanmacro{temp}}%
- else % many
- expandafterxdefcsnamethemacnameendcsname{%
- bgroupnoexpandmacroargctxt
- noexpandcsnamethemacname xxendcsname}%
- expandafterxdefcsnamethemacname xxendcsname##1{%
- expandafternoexpandcsnamethemacname xxxendcsname ##1,}%
- expandafterexpandafter
- expandafterxdef
- expandafterexpandafter
- csnamethemacname xxxendcsname
- paramlist{egroupnoexpandscanmacro{temp}}%
- fi
- else
- ifcaseparamno
- % 0
- expandafterxdefcsnamethemacnameendcsname{%
- noexpandnorecurse{themacname}%
- noexpandscanmacro{temp}egroup}%
- or % 1
- expandafterxdefcsnamethemacnameendcsname{%
- bgroupnoexpandmacroargctxt
- noexpandbraceorline
- expandafternoexpandcsnamethemacname xxxendcsname}%
- expandafterxdefcsnamethemacname xxxendcsname##1{%
- egroup
- noexpandnorecurse{themacname}%
- noexpandscanmacro{temp}egroup}%
- else % many
- expandafterxdefcsnamethemacnameendcsname{%
- bgroupnoexpandmacroargctxt
- expandafternoexpandcsnamethemacname xxendcsname}%
- expandafterxdefcsnamethemacname xxendcsname##1{%
- expandafternoexpandcsnamethemacname xxxendcsname ##1,}%
- expandafterexpandafter
- expandafterxdef
- expandafterexpandafter
- csnamethemacname xxxendcsname
- paramlist{%
- egroup
- noexpandnorecurse{themacname}%
- noexpandscanmacro{temp}egroup}%
- fi
- fi}
- defnorecurse#1{bgroupcslet{#1}{macsave.#1}}
- % braceorline decides whether the next nonwhitespace character is a
- % {. If so it reads up to the closing }, if not, it reads the whole
- % line. Whatever was read is then fed to the next control sequence
- % as an argument (by parsebrace or parsearg)
- defbraceorline#1{letnext=#1futureletncharbraceorlinexxx}
- defbraceorlinexxx{%
- ifxncharbgroupelse
- expandafterparsearg
- fi next}
- % We mant to disable all macros during shipout so that they are not
- % expanded by write.
- defturnoffmacros{begingroup defdo##1{letnoexpand##1=relax}%
- edefnext{macrolist}expandafterendgroupnext}
- % @alias.
- defalias#1=#2{gdef#1{#2}}
- message{cross references,}
- newwriteauxfile
- newififhavexrefs % True if xref values are known.
- newififwarnedxrefs % True if we warned once that they aren't known.
- % @inforef is relatively simple.
- definforef #1{inforefzzz #1,,,,**}
- definforefzzz #1,#2,#3,#4**{putwordSee{} putwordInfo{} putwordfile{} file{ignorespaces #3{}},
- node samp{ignorespaces#1{}}}
- % @node's job is to define lastnode.
- defnode{ENVcheckparseargnodezzz}
- defnodezzz#1{nodexxx [#1,]}
- defnodexxx[#1,#2]{gdeflastnode{#1}}
- letnwnode=node
- letlastnode=relax
- % The sectioning commands (@chapter, etc.) call these.
- defdonoderef{%
- ifxlastnoderelaxelse
- expandafterexpandafterexpandaftersetref{lastnode}%
- {Ysectionnumberandtype}%
- globalletlastnode=relax
- fi
- }
- defunnumbnoderef{%
- ifxlastnoderelaxelse
- expandafterexpandafterexpandaftersetref{lastnode}{Ynothing}%
- globalletlastnode=relax
- fi
- }
- defappendixnoderef{%
- ifxlastnoderelaxelse
- expandafterexpandafterexpandaftersetref{lastnode}%
- {Yappendixletterandtype}%
- globalletlastnode=relax
- fi
- }
- % @anchor{NAME} -- define xref target at arbitrary point.
- %
- defanchor#1{setref{#1}{Ynothing}}
- % setref{NAME}{SNT} defines a cross-reference point NAME, namely
- % NAME-title, NAME-pg, and NAME-SNT. Called from foonoderef. We have
- % to set indexdummies so commands such as @code in a section title
- % aren't expanded. It would be nicer not to expand the titles in the
- % first place, but there's so many layers that that is hard to do.
- %
- defsetref#1#2{{%
- indexdummies
- dosetq{#1-title}{Ytitle}%
- dosetq{#1-pg}{Ypagenumber}%
- dosetq{#1-snt}{#2}%
- }}
- % @xref, @pxref, and @ref generate cross-references. For xrefX, #1 is
- % the node name, #2 the name of the Info cross-reference, #3 the printed
- % node name, #4 the name of the Info file, #5 the name of the printed
- % manual. All but the node name can be omitted.
- %
- defpxref#1{putwordsee{} xrefX[#1,,,,,,,]}
- defxref#1{putwordSee{} xrefX[#1,,,,,,,]}
- defref#1{xrefX[#1,,,,,,,]}
- defxrefX[#1,#2,#3,#4,#5,#6]{begingroup
- defprintedmanual{ignorespaces #5}%
- defprintednodename{ignorespaces #3}%
- setbox1=hbox{printedmanual}%
- setbox0=hbox{printednodename}%
- ifdim wd0 = 0pt
- % No printed node name was explicitly given.
- expandafterifxcsname SETxref-automatic-section-titleendcsnamerelax
- % Use the node name inside the square brackets.
- defprintednodename{ignorespaces #1}%
- else
- % Use the actual chapter/section title appear inside
- % the square brackets. Use the real section title if we have it.
- ifdim wd1 > 0pt
- % It is in another manual, so we don't have it.
- defprintednodename{ignorespaces #1}%
- else
- ifhavexrefs
- % We know the real title if we have the xref values.
- defprintednodename{refx{#1-title}{}}%
- else
- % Otherwise just copy the Info node name.
- defprintednodename{ignorespaces #1}%
- fi%
- fi
- fi
- fi
- %
- % If we use unhbox0 and unhbox1 to print the node names, TeX does not
- % insert empty discretionaries after hyphens, which means that it will
- % not find a line break at a hyphen in a node names. Since some manuals
- % are best written with fairly long node names, containing hyphens, this
- % is a loss. Therefore, we give the text of the node name again, so it
- % is as if TeX is seeing it for the first time.
- ifdim wd1 > 0pt
- putwordsection{} ``printednodename'' in cite{printedmanual}%
- else
- % _ (for example) has to be the character _ for the purposes of the
- % control sequence corresponding to the node, but it has to expand
- % into the usual leavevmode...vrule stuff for purposes of
- % printing. So we turnoffactive for the refx-snt, back on for the
- % printing, back off for the refx-pg.
- {normalturnoffactive
- % Only output a following space if the -snt ref is nonempty; for
- % @unnumbered and @anchor, it won't be.
- setbox2 = hbox{ignorespaces refx{#1-snt}{}}%
- ifdim wd2 > 0pt refx{#1-snt}spacefi
- }%
- % [mynode],
- [printednodename],space
- % page 3
- turnoffactive putwordpagetierefx{#1-pg}{}%
- fi
- endgroup}
- % dosetq is the interface for calls from other macros
- % Use normalturnoffactive so that punctuation chars such as underscore
- % and backslash work in node names. (turnoffactive doesn't do .)
- defdosetq#1#2{%
- {letfolio=0
- normalturnoffactive
- edefnext{writeauxfile{internalsetq{#1}{#2}}}%
- iflinks
- next
- fi
- }%
- }
- % internalsetq {foo}{page} expands into
- % CHARACTERS 'xrdef {foo}{...expansion of Ypage...}
- % When the aux file is read, ' is the escape character
- definternalsetq #1#2{'xrdef {#1}{csname #2endcsname}}
- % Things to be expanded by internalsetq
- defYpagenumber{folio}
- defYtitle{thissection}
- defYnothing{}
- defYsectionnumberandtype{%
- ifnumsecno=0 putwordChapterxreftiethechapno %
- else ifnum subsecno=0 putwordSectionxreftiethechapno.thesecno %
- else ifnum subsubsecno=0 %
- putwordSectionxreftiethechapno.thesecno.thesubsecno %
- else %
- putwordSectionxreftiethechapno.thesecno.thesubsecno.thesubsubsecno %
- fi fi fi }
- defYappendixletterandtype{%
- ifnumsecno=0 putwordAppendixxreftie'chartheappendixno{}%
- else ifnum subsecno=0 putwordSectionxreftie'chartheappendixno.thesecno %
- else ifnum subsubsecno=0 %
- putwordSectionxreftie'chartheappendixno.thesecno.thesubsecno %
- else %
- putwordSectionxreftie'chartheappendixno.thesecno.thesubsecno.thesubsubsecno %
- fi fi fi }
- gdefxreftie{'tie}
- % Use TeX 3.0's inputlineno to get the line number, for better error
- % messages, but if we're using an old version of TeX, don't do anything.
- %
- ifxinputlinenothisisundefined
- letlinenumber = empty % Non-3.0.
- else
- deflinenumber{theinputlineno:space}
- fi
- % Define refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
- % If its value is nonempty, SUFFIX is output afterward.
- defrefx#1#2{%
- expandafterifxcsname X#1endcsnamerelax
- % If not defined, say something at least.
- angleleft un-de-finedangleright
- iflinks
- ifhavexrefs
- message{linenumber Undefined cross reference `#1'.}%
- else
- ifwarnedxrefselse
- globalwarnedxrefstrue
- message{Cross reference values unknown; you must run TeX again.}%
- fi
- fi
- fi
- else
- % It's defined, so just use it.
- csname X#1endcsname
- fi
- #2% Output the suffix in any case.
- }
- % This is the macro invoked by entries in the aux file.
- %
- defxrdef#1{begingroup
- % Reenable as an escape while reading the second argument.
- catcode`\ = 0
- afterassignmentendgroup
- expandaftergdefcsname X#1endcsname
- }
- % Read the last existing aux file, if any. No error if none exists.
- defreadauxfile{begingroup
- catcode`^^@=other
- catcode`^^A=other
- catcode`^^B=other
- catcode`^^C=other
- catcode`^^D=other
- catcode`^^E=other
- catcode`^^F=other
- catcode`^^G=other
- catcode`^^H=other
- catcode`^^K=other
- catcode`^^L=other
- catcode`^^N=other
- catcode`^^P=other
- catcode`^^Q=other
- catcode`^^R=other
- catcode`^^S=other
- catcode`^^T=other
- catcode`^^U=other
- catcode`^^V=other
- catcode`^^W=other
- catcode`^^X=other
- catcode`^^Z=other
- catcode`^^[=other
- catcode`^^=other
- catcode`^^]=other
- catcode`^^^=other
- catcode`^^_=other
- catcode`@=other
- catcode`^=other
- % It was suggested to define this as 7, which would allow ^^e4 etc.
- % in xref tags, i.e., node names. But since ^^e4 notation isn't
- % supported in the main text, it doesn't seem desirable. Furthermore,
- % that is not enough: for node names that actually contain a ^
- % character, we would end up writing a line like this: 'xrdef {'hat
- % b-title}{'hat b} and xrdef does a csname...endcsname on the first
- % argument, and hat is not an expandable control sequence. It could
- % all be worked out, but why? Either we support ^^ or we don't.
- %
- % The other change necessary for this was to define auxhat:
- % defauxhat{def^{'hat }}% extra space so ok if followed by letter
- % and then to call auxhat in setq.
- %
- catcode`~=other
- catcode`[=other
- catcode`]=other
- catcode`"=other
- catcode`_=other
- catcode`|=other
- catcode`<=other
- catcode`>=other
- catcode`$=other
- catcode`#=other
- catcode`&=other
- catcode`+=other % avoid + for paranoia even though we've turned it off
- % Make the characters 128-255 be printing characters
- {%
- count 1=128
- defloop{%
- catcodecount 1=other
- advancecount 1 by 1
- ifnum count 1<256 loop fi
- }%
- }%
- % The aux file uses ' as the escape (for now).
- % Turn off as an escape so we do not lose on
- % entries which were dumped with control sequences in their names.
- % For example, 'xrdef {$leq $-fun}{page ...} made by @defun ^^
- % Reference to such entries still does not work the way one would wish,
- % but at least they do not bomb out when the aux file is read in.
- catcode`{=1
- catcode`}=2
- catcode`%=other
- catcode`'=0
- catcode`\=other
- %
- openin 1 jobname.aux
- ifeof 1 else
- closein 1
- input jobname.aux
- globalhavexrefstrue
- globalwarnedobstrue
- fi
- % Open the new aux file. TeX will close it automatically at exit.
- openoutauxfile=jobname.aux
- endgroup}
- % Footnotes.
- newcount footnoteno
- % The trailing space in the following definition for supereject is
- % vital for proper filling; pages come out unaligned when you do a
- % pagealignmacro call if that space before the closing brace is
- % removed. (Generally, numeric constants should always be followed by a
- % space to prevent strange expansion errors.)
- defsupereject{parpenalty -20000footnoteno =0 }
- % @footnotestyle is meaningful for info output only.
- letfootnotestyle=comment
- letptexfootnote=footnote
- {catcode `@=11
- %
- % Auto-number footnotes. Otherwise like plain.
- gdeffootnote{%
- globaladvancefootnoteno by @ne
- edefthisfootno{$^{thefootnoteno}$}%
- %
- % In case the footnote comes at the end of a sentence, preserve the
- % extra spacing after we do the footnote number.
- let@sfempty
- ifhmodeedef@sf{spacefactorthespacefactor}/fi
- %
- % Remove inadvertent blank space before typesetting the footnote number.
- unskip
- thisfootno@sf
- footnotezzz
- }%
- % Don't bother with the trickery in plain.tex to not require the
- % footnote text as a parameter. Our footnotes don't need to be so general.
- %
- % Oh yes, they do; otherwise, @ifset and anything else that uses
- % parseargline fail inside footnotes because the tokens are fixed when
- % the footnote is read. --karl, 16nov96.
- %
- longgdeffootnotezzz{insertfootinsbgroup
- % We want to typeset this text as a normal paragraph, even if the
- % footnote reference occurs in (for example) a display environment.
- % So reset some parameters.
- interlinepenaltyinterfootnotelinepenalty
- splittopskiphtstrutbox % top baseline for broken footnotes
- splitmaxdepthdpstrutbox
- floatingpenalty@MM
- leftskipz@skip
- rightskipz@skip
- spaceskipz@skip
- xspaceskipz@skip
- parindentdefaultparindent
- %
- % Hang the footnote text off the number.
- hang
- textindent{thisfootno}%
- %
- % Don't crash into the line above the footnote text. Since this
- % expands into a box, it must come within the paragraph, lest it
- % provide a place where TeX can split the footnote.
- footstrut
- futureletnextfo@t
- }
- deffo@t{ifcatbgroupnoexpandnext letnextf@@t
- elseletnextf@tfi next}
- deff@@t{bgroupaftergroup@footletnext}
- deff@t#1{#1@foot}
- def@foot{strutegroup}
- }%end catcode `@=11
- % Set the baselineskip to #1, and the lineskip and strut size
- % correspondingly. There is no deep meaning behind these magic numbers
- % used as factors; they just match (closely enough) what Knuth defined.
- %
- deflineskipfactor{.08333}
- defstrutheightpercent{.70833}
- defstrutdepthpercent {.29167}
- %
- defsetleading#1{%
- normalbaselineskip = #1relax
- normallineskip = lineskipfactornormalbaselineskip
- normalbaselines
- setboxstrutbox =hbox{%
- vrule width0pt heightstrutheightpercentbaselineskip
- depth strutdepthpercent baselineskip
- }%
- }
- % @| inserts a changebar to the left of the current line. It should
- % surround any changed text. This approach does *not* work if the
- % change spans more than two lines of output. To handle that, we would
- % have adopt a much more difficult approach (putting marks into the main
- % vertical list for the beginning and end of each change).
- %
- def|{%
- % vadjust can only be used in horizontal mode.
- leavevmode
- %
- % Append this vertical mode material after the current line in the output.
- vadjust{%
- % We want to insert a rule with the height and depth of the current
- % leading; that is exactly what strutbox is supposed to record.
- vskip-baselineskip
- %
- % vadjust-items are inserted at the left edge of the type. So
- % the llap here moves out into the left-hand margin.
- llap{%
- %
- % For a thicker or thinner bar, change the `1pt'.
- vrule heightbaselineskip width1pt
- %
- % This is the space between the bar and the text.
- hskip 12pt
- }%
- }%
- }
- % For a final copy, take out the rectangles
- % that mark overfull boxes (in case you have decided
- % that the text looks ok even though it passes the margin).
- %
- deffinalout{overfullrule=0pt}
- % @image. We use the macros from epsf.tex to support this.
- % If epsf.tex is not installed and @image is used, we complain.
- %
- % Check for and read epsf.tex up front. If we read it only at @image
- % time, we might be inside a group, and then its definitions would get
- % undone and the next image would fail.
- openin 1 = epsf.tex
- ifeof 1 else
- closein 1
- % Do not bother showing banner with post-v2.7 epsf.tex (available in
- % doc/epsf.tex until it shows up on ctan).
- defepsfannounce{toks0 = }%
- input epsf.tex
- fi
- %
- newififwarnednoepsf
- newhelpnoepsfhelp{epsf.tex must be installed for images to
- work. It is also included in the Texinfo distribution, or you can get
- it from ftp://tug.org/tex/epsf.tex.}
- %
- % Only complain once about lack of epsf.tex.
- defimage#1{%
- ifxpdfoutputundefined
- ifxepsfboxundefined
- ifwarnednoepsf else
- errhelp = noepsfhelp
- errmessage{epsf.tex not found, images will be ignored}%
- globalwarnednoepsftrue
- fi
- else
- imagexxx #1,,,finish
- fi
- else
- centerline{pdfimage #1.pdf}%
- fi
- }
- %
- % Arguments to @image:
- % #1 is (mandatory) image filename; we tack on .eps extension.
- % #2 is (optional) width, #3 is (optional) height.
- % #4 is just the usual extra ignored arg for parsing this stuff.
- defimagexxx#1,#2,#3,#4finish{%
- % epsfbox itself resets epsf?size at each figure.
- setbox0 = hbox{ignorespaces #2}ifdimwd0 > 0pt epsfxsize=#2relax fi
- setbox0 = hbox{ignorespaces #3}ifdimwd0 > 0pt epsfysize=#3relax fi
- % If the image is by itself, center it.
- ifvmode
- nobreakmedskip
- nobreak
- centerline{epsfbox{#1.eps}}%
- bigbreak
- else
- % In the middle of a paragraph, no extra space.
- epsfbox{#1.eps}%
- fi
- }
- message{localization,}
- % @documentlanguage is usually given very early, just after
- % @setfilename. If done too late, it may not override everything
- % properly. Single argument is the language abbreviation.
- % It would be nice if we could set up a hyphenation file here.
- %
- defdocumentlanguage{parseargdodocumentlanguage}
- defdodocumentlanguage#1{%
- tex % read txi-??.tex file in plain TeX.
- % Read the file if it exists.
- openin 1 txi-#1.tex
- ifeof1
- errhelp = nolanghelp
- errmessage{Cannot read language file txi-#1.tex}%
- lettemp = relax
- else
- deftemp{input txi-#1.tex }%
- fi
- temp
- endgroup
- }
- newhelpnolanghelp{The given language definition file cannot be found or
- is empty. Maybe you need to install it? In the current directory
- should work if nowhere else does.}
- % @documentencoding should change something in TeX eventually, most
- % likely, but for now just recognize it.
- letdocumentencoding = comment
- % Page size parameters.
- %
- newdimendefaultparindent defaultparindent = 15pt
- chapheadingskip = 15pt plus 4pt minus 2pt
- secheadingskip = 12pt plus 3pt minus 2pt
- subsecheadingskip = 9pt plus 2pt minus 2pt
- % Prevent underfull vbox error messages.
- vbadness = 10000
- % Don't be so finicky about underfull hboxes, either.
- hbadness = 2000
- % Following George Bush, just get rid of widows and orphans.
- widowpenalty=10000
- clubpenalty=10000
- % Use TeX 3.0's emergencystretch to help line breaking, but if we're
- % using an old version of TeX, don't do anything. We want the amount of
- % stretch added to depend on the line length, hence the dependence on
- % hsize. We call this whenever the paper size is set.
- %
- defsetemergencystretch{%
- ifxemergencystretchthisisundefined
- % Allow us to assign to emergencystretch anyway.
- defemergencystretch{dimen0}%
- else
- emergencystretch = hsize
- divideemergencystretch by 40
- fi
- }
- % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
- % 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can
- % set parskip and call setleading for baselineskip.
- %
- definternalpagesizes#1#2#3#4#5#6{%
- voffset = #3relax
- topskip = #6relax
- splittopskip = topskip
- %
- vsize = #1relax
- advancevsize by topskip
- outervsize = vsize
- advanceoutervsize by 2topandbottommargin
- pageheight = vsize
- %
- hsize = #2relax
- outerhsize = hsize
- advanceouterhsize by 0.5in
- pagewidth = hsize
- %
- normaloffset = #4relax
- bindingoffset = #5relax
- %
- parindent = defaultparindent
- setemergencystretch
- }
- % @letterpaper (the default).
- defletterpaper{{globaldefs = 1
- parskip = 3pt plus 2pt minus 1pt
- setleading{13.2pt}%
- %
- % If page is nothing but text, make it come out even.
- internalpagesizes{46baselineskip}{6in}{voffset}{.25in}{bindingoffset}{36pt}%
- }}
- % Use @smallbook to reset parameters for 7x9.5 (or so) format.
- defsmallbook{{globaldefs = 1
- parskip = 2pt plus 1pt
- setleading{12pt}%
- %
- internalpagesizes{7.5in}{5.in}{voffset}{.25in}{bindingoffset}{16pt}%
- %
- lispnarrowing = 0.3in
- tolerance = 700
- hfuzz = 1pt
- contentsrightmargin = 0pt
- deftypemargin = 0pt
- defbodyindent = .5cm
- %
- letsmalldisplay = smalldisplayx
- letsmallexample = smalllispx
- letsmallformat = smallformatx
- letsmalllisp = smalllispx
- }}
- % Use @afourpaper to print on European A4 paper.
- defafourpaper{{globaldefs = 1
- setleading{12pt}%
- parskip = 3pt plus 2pt minus 1pt
- %
- internalpagesizes{53baselineskip}{160mm}{voffset}{4mm}{bindingoffset}{44pt}%
- %
- tolerance = 700
- hfuzz = 1pt
- }}
- % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
- % 29mm, hence bottom margin 28mm, nominal side margin 3cm.
- defafourlatex{{globaldefs = 1
- setleading{13.6pt}%
- %
- afourpaper
- internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}%
- %
- globaldefs = 0
- }}
- % Use @afourwide to print on European A4 paper in wide format.
- defafourwide{%
- afourpaper
- internalpagesizes{9.5in}{6.5in}{hoffset}{normaloffset}{bindingoffset}{7mm}%
- %
- globaldefs = 0
- }
- % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
- % Perhaps we should allow setting the margins, topskip, parskip,
- % and/or leading, also. Or perhaps we should compute them somehow.
- %
- defpagesizes{parseargpagesizesxxx}
- defpagesizesxxx#1{pagesizesyyy #1,,finish}
- defpagesizesyyy#1,#2,#3finish{{%
- setbox0 = hbox{ignorespaces #2}ifdimwd0 > 0pt hsize=#2relax fi
- globaldefs = 1
- %
- parskip = 3pt plus 2pt minus 1pt
- setleading{13.2pt}%
- %
- internalpagesizes{#1}{hsize}{voffset}{normaloffset}{bindingoffset}{44pt}%
- }}
- % Set default to letter.
- %
- letterpaper
- message{and turning on texinfo input format.}
- % Define macros to output various characters with catcode for normal text.
- catcode`"=other
- catcode`~=other
- catcode`^=other
- catcode`_=other
- catcode`|=other
- catcode`<=other
- catcode`>=other
- catcode`+=other
- defnormaldoublequote{"}
- defnormaltilde{~}
- defnormalcaret{^}
- defnormalunderscore{_}
- defnormalverticalbar{|}
- defnormalless{<}
- defnormalgreater{>}
- defnormalplus{+}
- % This macro is used to make a character print one way in ttfont
- % where it can probably just be output, and another way in other fonts,
- % where something hairier probably needs to be done.
- %
- % #1 is what to print if we are indeed using tt; #2 is what to print
- % otherwise. Since all the Computer Modern typewriter fonts have zero
- % interword stretch (and shrink), and it is reasonable to expect all
- % typewriter fonts to have this, we can check that font parameter.
- %
- defifusingtt#1#2{ifdim fontdimen3thefont=0pt #1else #2fi}
- % Turn off all special characters except @
- % (and those which the user can use as if they were ordinary).
- % Most of these we simply print from the tt font, but for some, we can
- % use math or other variants that look better in normal text.
- catcode`"=active
- defactivedoublequote{{ttchar34}}
- let"=activedoublequote
- catcode`~=active
- def~{{ttchar126}}
- chardefhat=`^
- catcode`^=active
- def^{{tt hat}}
- catcode`_=active
- def_{ifusingttnormalunderscore_}
- % Subroutine for the previous macro.
- def_{leavevmode kern.06em vbox{hrule width.3em height.1ex}}
- catcode`|=active
- def|{{ttchar124}}
- chardef less=`<
- catcode`<=active
- def<{{tt less}}
- chardef gtr=`>
- catcode`>=active
- def>{{tt gtr}}
- catcode`+=active
- def+{{tt char 43}}
- %catcode 27=active
- %def^^[{$diamondsuit$}
- % Set up an active definition for =, but don't enable it most of the time.
- {catcode`==active
- globaldef={{tt char 61}}}
- catcode`+=active
- catcode`_=active
- % If a .fmt file is being used, characters that might appear in a file
- % name cannot be active until we have parsed the command line.
- % So turn them off again, and have everyjob (or @setfilename) turn them on.
- % otherifyactive is called near the end of this file.
- defotherifyactive{catcode`+=other catcode`_=other}
- catcode`@=0
- % rawbackslashxx output one backslash character in current font
- globalchardefrawbackslashxx=`\
- %{catcode`\=other
- %@gdef@rawbackslashxx{}}
- % rawbackslash redefines as input to do rawbackslashxx.
- {catcode`\=active
- @gdef@rawbackslash{@let=@rawbackslashxx }}
- % normalbackslash outputs one backslash in fixed width font.
- defnormalbackslash{{ttrawbackslashxx}}
- % Say @foo, not foo, in error messages.
- escapechar=`@
- % catcode 17=0 % Define control-q
- catcode`\=active
- % Used sometimes to turn off (effectively) the active characters
- % even after parsing them.
- @def@turnoffactive{@let"=@normaldoublequote
- @let=@realbackslash
- @let~=@normaltilde
- @let^=@normalcaret
- @let_=@normalunderscore
- @let|=@normalverticalbar
- @let<=@normalless
- @let>=@normalgreater
- @let+=@normalplus}
- @def@normalturnoffactive{@let"=@normaldoublequote
- @let=@normalbackslash
- @let~=@normaltilde
- @let^=@normalcaret
- @let_=@normalunderscore
- @let|=@normalverticalbar
- @let<=@normalless
- @let>=@normalgreater
- @let+=@normalplus}
- % Make _ and + other characters, temporarily.
- % This is canceled by @fixbackslash.
- @otherifyactive
- % If a .fmt file is being used, we don't want the `input texinfo' to show up.
- % That is what eatinput is for; after that, the `' should revert to printing
- % a backslash.
- %
- @gdef@eatinput input texinfo{@fixbackslash}
- @global@let = @eatinput
- % On the other hand, perhaps the file did not have a `input texinfo'. Then
- % the first `{ in the file would cause an error. This macro tries to fix
- % that, assuming it is called before the first `' could plausibly occur.
- % Also back turn on active characters that might appear in the input
- % file name, in case not using a pre-dumped format.
- %
- @gdef@fixbackslash{@ifx@eatinput @let = @normalbackslash @fi
- @catcode`+=@active @catcode`@_=@active}
- % These look ok in all fonts, so just make them not special. The @rm below
- % makes sure that the current font starts out as the newly loaded cmr10
- @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
- @textfonts
- @rm
- @c Local variables:
- @c eval: (add-hook 'write-file-hooks 'time-stamp)
- @c page-delimiter: "^\\message"
- @c time-stamp-start: "def\\texinfoversion{"
- @c time-stamp-format: "%:y-%02m-%02d.%H"
- @c time-stamp-end: "}"
- @c End: