📄 texinfo.tex
字号:
}{\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. \argremovecomment #1\comment\ArgTerm% }%}% First remove any @comment, then any @c comment.\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}% Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.%% \argremovec might leave us with trailing space, e.g.,% @end itemize @c foo% This space token undergoes the same procedure and is eventually removed% by \finishparsearg.%\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty % We cannot use \next here, as it holds the macro to run; % thus we reuse \temp. \let\temp\finishparsearg \else \let\temp\argcheckspaces \fi % Put the space token in: \temp#1 #3\ArgTerm}% If a _delimited_ argument is enclosed in braces, they get stripped; so% to get _exactly_ the rest of the line, we had to prevent such situation.% We prepended an \empty token at the very beginning and we expand it now,% just before passing the control to \next.% (Similarily, we have to think about #3 of \argcheckspacesY above: it is% either the null string, or it ends with \^^M---thus there is no danger% that a pair of braces would be stripped.%% But first, we have to remove the trailing space token.%\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}}% \parseargdef\foo{...}% is roughly equivalent to% \def\foo{\parsearg\Xfoo}% \def\Xfoo#1{...}%% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my% favourite TeX trick. --kasal, 16nov03\def\parseargdef#1{% \expandafter \doparseargdef \csname\string#1\endcsname #1%}\def\doparseargdef#1#2{% \def#2{\parsearg#1}% \def#1##1%}% Several utility definitions with active space:{ \obeyspaces \gdef\obeyedspace{ } % 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. % \gdef\sepspaces{\obeyspaces\let =\tie} % If an index command is used in an @example environment, any spaces % therein should become regular spaces in the raw index file, not the % expansion of \tie (\leavevmode \penalty \@M \ ). \gdef\unsepspaces{\let =\space}}\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}% Define the framework for environments in texinfo.tex. It's used like this:%% \envdef\foo{...}% \def\Efoo{...}%% It's the responsibility of \envdef to insert \begingroup before the% actual body; @end closes the group after calling \Efoo. \envdef also% defines \thisenv, so the current environment is known; @end checks% whether the environment name matches. The \checkenv macro can also be% used to check whether the current environment is the one expected.%% Non-false conditionals (@iftex, @ifset) don't fit into this, so they% are not treated as enviroments; they don't open a group. (The% implementation of @end takes care not to call \endgroup in this% special case.)% At runtime, environments start with this:\def\startenvironment#1{\begingroup\def\thisenv{#1}}% initialize\let\thisenv\empty% ... but they get defined via ``\envdef\foo{...}'':\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}% Check whether we're in the right environment:\def\checkenv#1{% \def\temp{#1}% \ifx\thisenv\temp \else \badenverr \fi}% Evironment mismatch, #1 expected:\def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, not \inenvironment\thisenv}%}\def\inenvironment#1{% \ifx#1\empty out of any environment% \else in environment \expandafter\string#1% \fi}% @end foo executes the definition of \Efoo.% But first, it executes a specialized version of \checkenv%\parseargdef\end{% \if 1\csname iscond.#1\endcsname \else % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup \fi}\newhelp\EMsimple{Press RETURN to continue.}%% Simple single-character @ commands% @@ prints an @% Kludge this until the fonts are right (grr).\def\@{{\tt\char64}}% This is turned off because it was never documented% and you can use @w{...} around a quote to suppress ligatures.%% Define @` and @' to be the same as ` and '%% but suppressing ligatures.%\def\`{{`}}%\def\'{{'}}% Used to generate quoted braces.\def\mylbrace {{\tt\char123}}\def\myrbrace {{\tt\char125}}\let\{=\mylbrace\let\}=\myrbrace\begingroup % Definitions to produce \{ and \} commands for indices, % and @{ and @} for the aux/toc files. \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 \catcode`\! = 0 \catcode`\\ = \other !gdef!lbracecmd[\{]% !gdef!rbracecmd[\}]% !gdef!lbraceatcmd[@{]% !gdef!rbraceatcmd[@}]%!endgroup% @comma{} to avoid , parsing problems.\let\comma = ,% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.\let\, = \c\let\dotaccent = \.\def\ringaccent#1{{\accent23 #1}}\let\tieaccent = \t\let\ubaraccent = \b\let\udotaccent = \d% Other special characters: @questiondown @exclamdown @ordf @ordm% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.\def\questiondown{?`}\def\exclamdown{!`}\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}% Dotless i and dotless j, used for accents.\def\imacro{i}\def\jmacro{j}\def\dotless#1{% \def\temp{#1}% \ifx\temp\imacro \ptexi \else\ifx\temp\jmacro \j \else \errmessage{@dotless can be used only with i or j}% \fi\fi}% The \TeX{} logo, as in plain, but resetting the spacing so that a% period following counts as ending a sentence. (Idea found in latex.)%\edef\TeX{\TeX \spacefactor=1000 }% @LaTeX{} logo. Not quite the same results as the definition in% latex.ltx, since we use a different font for the raised A; it's most% convenient for us to use an explicitly smaller font, rather than using% the \scriptstyle font (since we don't reset \scriptstyle and% \scriptscriptstyle).%\def\LaTeX{% L\kern-.36em {\setbox0=\hbox{T}% \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% \kern-.15em \TeX}% Be sure we're in horizontal mode when doing a tie, since we make space% equivalent to this in @example-like environments. Otherwise, a space% at the beginning of a line will start with \penalty -- and% since \penalty is valid in vertical mode, we'd end up putting the% penalty on the vertical list instead of in the new paragraph.{\catcode`@ = 11 % Avoid using \@M directly, because that causes trouble % if the definition is written into an index file. \global\let\tiepenalty = \@M \gdef\tie{\leavevmode\penalty\tiepenalty\ }}% @: forces normal size whitespace following.\def\:{\spacefactor=1000 }% @* forces a line break.\def\*{\hfil\break\hbox{}\ignorespaces}% @/ allows a line break.\let\/=\allowbreak% @. is an end-of-sentence period.\def\.{.\spacefactor=\endofsentencespacefactor\space}% @! is an end-of-sentence bang.\def\!{!\spacefactor=\endofsentencespacefactor\space}% @? is an end-of-sentence query.\def\?{?\spacefactor=\endofsentencespacefactor\space}% @frenchspacing on|off says whether to put extra space after punctuation.% \def\onword{on}\def\offword{off}%\parseargdef\frenchspacing{% \def\temp{#1}% \ifx\temp\onword \plainfrenchspacing \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% \fi\fi}% @w prevents a word break. Without the \leavevmode, @w at the% beginning of a paragraph, when TeX is still in vertical mode, would% produce a whole line of output instead of starting the paragraph.\def\w#1{\leavevmode\hbox{#1}}% @group ... @end group forces ... to be all on one page, by enclosing% it in a TeX vbox. We use \vtop instead of \vbox to construct the box% to keep its height that of a normal line. According to the rules for% \topskip (p.114 of the TeXbook), the glue inserted is% max (\topskip - \ht (first item), 0). If that height is large,% therefore, no glue is inserted, and the space between the headline and% the text is small, which looks bad.%% Another complication is that the group might be very large. This can% cause the glue on the previous page to be unduly stretched, because it% does not have much material. In this case, it's better to add an% explicit \vfill so that the extra space is at the bottom. The% threshold for doing this is if the group is more than \vfilllimit% percent of a page (\vfilllimit can be changed inside of @tex).%\newbox\groupbox\def\vfilllimit{0.7}%\envdef\group{% \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi \startsavinginserts % \setbox\groupbox = \vtop\bgroup % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after % the `@group' to put extra space in the output. Since @group % should appear on a line by itself (according to the Texinfo % manual), we don't worry about eating any user text. \comment}%% The \vtop produces a box with normal height and large depth; thus, TeX puts% \baselineskip glue before it, and (when the next line of text is done)% \lineskip glue after it. Thus, space below is not quite equal to space% above. But it's pretty close.\def\Egroup{% % To get correct interline space between the last line of the group % and the first line afterwards, we have to propagate \prevdepth. \endgraf % Not \par, as it may have been set to \lisppar. \global\dimen1 = \prevdepth \egroup % End the \vtop. % \dimen0 is the vertical size of the group's box. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox % \dimen2 is how much space is left on the page (more or less). \dimen2 = \pageheight \advance\dimen2 by -\pagetotal % if the group doesn't fit on the current page, and it's a big big % group, force a page break. \ifdim \dimen0 > \dimen2 \ifdim \pagetotal < \vfilllimit\pageheight \page \fi \fi \box\groupbox \prevdepth = \dimen1 \checkinserts}%% TeX puts in an \escapechar (i.e., `@') at the beginning of the help% message, so this ends up printing `@group can only ...'.%\newhelp\groupinvalidhelp{%group can only be used in environments such as @example,^^J%where each line of input produces a line of output.}% @need space-in-mils% forces a page break if there is not space-in-mils remaining.\newdimen\mil \mil=0.001in% Old definition--didn't work.%\parseargdef\need{\par %%% This method tries to make TeX break the page naturally%% if the depth of the box does not fit.%{\baselineskip=0pt%%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak%\prevdepth=-1000pt%}}\parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par % % If the @need value is less than one line space, it's useless. \dimen0 = #1\mil \dimen2 = \ht\strutbox \advance\dimen2 by \dp\strutbox \ifdim\dimen0 > \dimen2 % % Do a \strut just to make the height of this box be normal, so the % normal leading is inserted relative to the preceding line. % And a page break here is fine. \vtop to #1\mil{\strut\vfil}% % % TeX does not even consider page breaks if a penalty added to the % main vertical list is 10000 or more. But in order to see if the % empty box we just added fits on the page, we must make it consider % page breaks. On the other hand, we don't want to actually break the % page after the empty box. So we use a penalty of 9999. % % There is an extremely small chance that TeX will actually break the % page at this \penalty, if there are no other feasible breakpoints in % sight. (If the user is using lots of big @group commands, which % almost-but-not-quite fill up a page, TeX will have a hard time doing % good page breaking, for example.) However, I could not construct an % example where a page broke at this \penalty; if it happens in a real % document, then we can reconsider our strategy. \penalty9999 % % Back up by the size of the box, whether we did a page break or not. \kern -#1\mil % % Do not allow a page break right after this kern. \nobreak \fi}% @br forces paragraph break (and is undocumented).\let\br = \par% @page forces the start of a new page.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -