texinfo.tex

来自「这是著名的TCPMP播放器在WINDWOWS,和WINCE下编译通过的源程序.笔」· TEX 代码 · 共 1,901 行 · 第 1/5 页

TEX
1,901
字号
\def\center{\parsearg\centerzzz}
\def\centerzzz #1{{\advance\hsize by -\leftskip
\advance\hsize by -\rightskip
\centerline{#1}}}

% @sp n   outputs n lines of vertical space

\def\sp{\parsearg\spxxx}
\def\spxxx #1{\vskip #1\baselineskip}

% @comment ...line which is ignored...
% @c is the same as @comment
% @ignore ... @end ignore  is another way to write a comment

\def\comment{\begingroup \catcode`\^^M=\other%
\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
\commentxxx}
{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}

\let\c=\comment

% @paragraphindent NCHARS
% We'll use ems for NCHARS, close enough.
% We cannot implement @paragraphindent asis, though.
% 
\def\asisword{asis} % no translation, these are keywords
\def\noneword{none}
%
\def\paragraphindent{\parsearg\doparagraphindent}
\def\doparagraphindent#1{%
  \def\temp{#1}%
  \ifx\temp\asisword
  \else
    \ifx\temp\noneword
      \defaultparindent = 0pt
    \else
      \defaultparindent = #1em
    \fi
  \fi
  \parindent = \defaultparindent
}

% @exampleindent NCHARS
% We'll use ems for NCHARS like @paragraphindent.
% It seems @exampleindent asis isn't necessary, but
% I preserve it to make it similar to @paragraphindent.
\def\exampleindent{\parsearg\doexampleindent}
\def\doexampleindent#1{%
  \def\temp{#1}%
  \ifx\temp\asisword
  \else
    \ifx\temp\noneword
      \lispnarrowing = 0pt
    \else
      \lispnarrowing = #1em
    \fi
  \fi
}

% @asis just yields its argument.  Used with @table, for example.
%
\def\asis#1{#1}

% @math means output in math mode.
% We don't use $'s directly in the definition of \math because control
% sequences like \math are expanded when the toc file is written.  Then,
% we read the toc file back, the $'s will be normal characters (as they
% should be, according to the definition of Texinfo).  So we must use a
% control sequence to switch into and out of math mode.
%
% This isn't quite enough for @math to work properly in indices, but it
% seems unlikely it will ever be needed there.
%
\let\implicitmath = $
\def\math#1{\implicitmath #1\implicitmath}

% @bullet and @minus need the same treatment as @math, just above.
\def\bullet{\implicitmath\ptexbullet\implicitmath}
\def\minus{\implicitmath-\implicitmath}

% @refill is a no-op.
\let\refill=\relax

% If working on a large document in chapters, it is convenient to
% be able to disable indexing, cross-referencing, and contents, for test runs.
% This is done with @novalidate (before @setfilename).
%
\newif\iflinks \linkstrue % by default we want the aux files.
\let\novalidate = \linksfalse

% @setfilename is done at the beginning of every texinfo file.
% So open here the files we need to have open while reading the input.
% This makes it possible to make a .fmt file for texinfo.
\def\setfilename{%
   \iflinks
     \readauxfile
   \fi % \openindices needs to do some work in any case.
   \openindices
   \fixbackslash  % Turn off hack to swallow `\input texinfo'.
   \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
   %
   % If texinfo.cnf is present on the system, read it.
   % Useful for site-wide @afourpaper, etc.
   % Just to be on the safe side, close the input stream before the \input.
   \openin 1 texinfo.cnf
   \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
   \closein1
   \temp
   %
   \comment % Ignore the actual filename.
}

% Called from \setfilename.
%
\def\openindices{%
  \newindex{cp}%
  \newcodeindex{fn}%
  \newcodeindex{vr}%
  \newcodeindex{tp}%
  \newcodeindex{ky}%
  \newcodeindex{pg}%
}

% @bye.
\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}


\message{pdf,}
% adobe `portable' document format
\newcount\tempnum
\newcount\lnkcount
\newtoks\filename
\newcount\filenamelength
\newcount\pgn
\newtoks\toksA
\newtoks\toksB
\newtoks\toksC
\newtoks\toksD
\newbox\boxA
\newcount\countA
\newif\ifpdf
\newif\ifpdfmakepagedest

\ifx\pdfoutput\undefined
  \pdffalse
  \let\pdfmkdest = \gobble
  \let\pdfurl = \gobble
  \let\endlink = \relax
  \let\linkcolor = \relax
  \let\pdfmakeoutlines = \relax
\else
  \pdftrue
  \pdfoutput = 1
  \input pdfcolor
  \def\dopdfimage#1#2#3{%
    \def\imagewidth{#2}%
    \def\imageheight{#3}%
    \ifnum\pdftexversion < 14
      \pdfimage
    \else
      \pdfximage
    \fi
      \ifx\empty\imagewidth\else width \imagewidth \fi
      \ifx\empty\imageheight\else height \imageheight \fi
      {#1.pdf}%
    \ifnum\pdftexversion < 14 \else
      \pdfrefximage \pdflastximage
    \fi}
  \def\pdfmkdest#1{\pdfdest name{#1@} xyz}
  \def\pdfmkpgn#1{#1@}
  \let\linkcolor = \Blue  % was Cyan, but that seems light?
  \def\endlink{\Black\pdfendlink}
  % Adding outlines to PDF; macros for calculating structure of outlines
  % come from Petr Olsak
  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
    \else \csname#1\endcsname \fi}
  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
    \advance\tempnum by1
    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
  \def\pdfmakeoutlines{{%
    \openin 1 \jobname.toc
    \ifeof 1\else\bgroup
      \closein 1 
      \indexnofonts
      \def\tt{}
      \let\_ = \normalunderscore
      % Thanh's hack / proper braces in bookmarks  
      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
      %
      \def\chapentry ##1##2##3{}
      \def\unnumbchapentry ##1##2{}
      \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
      \def\unnumbsecentry ##1##2{}
      \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
      \def\unnumbsubsecentry ##1##2{}
      \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
      \def\unnumbsubsubsecentry ##1##2{}
      \input \jobname.toc
      \def\chapentry ##1##2##3{%
        \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
      \def\unnumbchapentry ##1##2{%
        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
      \def\secentry ##1##2##3##4{%
        \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
      \def\unnumbsecentry ##1##2{%
        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
      \def\subsecentry ##1##2##3##4##5{%
        \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
      \def\unnumbsubsecentry ##1##2{%
        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
      \def\subsubsecentry ##1##2##3##4##5##6{%
        \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
      \def\unnumbsubsubsecentry ##1##2{%
        \pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
      \input \jobname.toc
    \egroup\fi
  }}
  \def\makelinks #1,{%
    \def\params{#1}\def\E{END}%
    \ifx\params\E
      \let\nextmakelinks=\relax
    \else
      \let\nextmakelinks=\makelinks
      \ifnum\lnkcount>0,\fi
      \picknum{#1}%
      \startlink attr{/Border [0 0 0]} 
        goto name{\pdfmkpgn{\the\pgn}}%
      \linkcolor #1%
      \advance\lnkcount by 1%
      \endlink
    \fi
    \nextmakelinks
  }
  \def\picknum#1{\expandafter\pn#1}
  \def\pn#1{%
    \def\p{#1}%
    \ifx\p\lbrace
      \let\nextpn=\ppn
    \else
      \let\nextpn=\ppnn
      \def\first{#1}
    \fi
    \nextpn
  }
  \def\ppn#1{\pgn=#1\gobble}
  \def\ppnn{\pgn=\first}
  \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
    \ifx\PP\D\let\nextsp\relax
    \else\let\nextsp\skipspaces
      \ifx\p\space\else\addtokens{\filename}{\PP}%
        \advance\filenamelength by 1
      \fi
    \fi
    \nextsp}
  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
  \ifnum\pdftexversion < 14
    \let \startlink \pdfannotlink
  \else
    \let \startlink \pdfstartlink
  \fi
  \def\pdfurl#1{%
    \begingroup
      \normalturnoffactive\def\@{@}%
      \leavevmode\Red
      \startlink attr{/Border [0 0 0]}%
        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
        % #1
    \endgroup}
  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  \def\maketoks{%
    \expandafter\poptoks\the\toksA|ENDTOKS|
    \ifx\first0\adn0
    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 
    \else
      \ifnum0=\countA\else\makelink\fi
      \ifx\first.\let\next=\done\else
        \let\next=\maketoks
        \addtokens{\toksB}{\the\toksD}
        \ifx\first,\addtokens{\toksB}{\space}\fi
      \fi
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \next}
  \def\makelink{\addtokens{\toksB}%
    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  \def\pdflink#1{%
    \startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}}
    \linkcolor #1\endlink}
  \def\mkpgn#1{#1@} 
  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
\fi % \ifx\pdfoutput


\message{fonts,}
% Font-change commands.

% Texinfo sort of supports the sans serif font style, which plain TeX does not.
% So we set up a \sf analogous to plain's \rm, etc.
\newfam\sffam
\def\sf{\fam=\sffam \tensf}
\let\li = \sf % Sometimes we call it \li, not \sf.

% We don't need math for this one.
\def\ttsl{\tenttsl}

% Use Computer Modern fonts at \magstephalf (11pt).
\newcount\mainmagstep
\mainmagstep=\magstephalf

% Set the font macro #1 to the font named #2, adding on the
% specified font prefix (normally `cm').
% #3 is the font's design size, #4 is a scale factor
\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}

% Use cm as the default font prefix.
% To specify the font prefix, you must define \fontprefix
% before you read in texinfo.tex.
\ifx\fontprefix\undefined
\def\fontprefix{cm}
\fi
% Support font families that don't use the same naming scheme as CM.
\def\rmshape{r}
\def\rmbshape{bx}               %where the normal face is bold
\def\bfshape{b}
\def\bxshape{bx}
\def\ttshape{tt}
\def\ttbshape{tt}
\def\ttslshape{sltt}
\def\itshape{ti}
\def\itbshape{bxti}
\def\slshape{sl}
\def\slbshape{bxsl}
\def\sfshape{ss}
\def\sfbshape{ss}
\def\scshape{csc}
\def\scbshape{csc}

\ifx\bigger\relax
\let\mainmagstep=\magstep1
\setfont\textrm\rmshape{12}{1000}
\setfont\texttt\ttshape{12}{1000}
\else
\setfont\textrm\rmshape{10}{\mainmagstep}
\setfont\texttt\ttshape{10}{\mainmagstep}
\fi
% Instead of cmb10, you many want to use cmbx10.
% cmbx10 is a prettier font on its own, but cmb10
% looks better when embedded in a line with cmr10.
\setfont\textbf\bfshape{10}{\mainmagstep}
\setfont\textit\itshape{10}{\mainmagstep}
\setfont\textsl\slshape{10}{\mainmagstep}
\setfont\textsf\sfshape{10}{\mainmagstep}
\setfont\textsc\scshape{10}{\mainmagstep}
\setfont\textttsl\ttslshape{10}{\mainmagstep}
\font\texti=cmmi10 scaled \mainmagstep
\font\textsy=cmsy10 scaled \mainmagstep

% A few fonts for @defun, etc.
\setfont\defbf\bxshape{10}{\magstep1} %was 1314
\setfont\deftt\ttshape{10}{\magstep1}
\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}

% Fonts for indices, footnotes, small examples (9pt).
\setfont\smallrm\rmshape{9}{1000}
\setfont\smalltt\ttshape{9}{1000}
\setfont\smallbf\bfshape{10}{900}
\setfont\smallit\itshape{9}{1000}
\setfont\smallsl\slshape{9}{1000}
\setfont\smallsf\sfshape{9}{1000}
\setfont\smallsc\scshape{10}{900}
\setfont\smallttsl\ttslshape{10}{900}
\font\smalli=cmmi9
\font\smallsy=cmsy9

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?