⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preview.dtx.svn-base

📁 moses开源的机器翻译系统
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
   \@gobbletwo}%    \end{macrocode}% \end{macro}% \begin{macro}{\pr@insert}% \begin{macro}{\pr@mark}% \begin{macro}{\pr@marks}%   We don't want insertions to end up on our lists.  So we disable%   them right now by replacing them with the following:%    \begin{macrocode}\def\pr@insert{\begingroup\afterassignment\pr@insertii\count@}\def\pr@insertii{\endgroup\setbox\pr@box\vbox}%    \end{macrocode}% Similar things hold for marks.%    \begin{macrocode}\def\pr@mark{{\afterassignment}\toks@}\def\pr@marks{{\aftergroup\pr@mark\afterassignment}\count@}%    \end{macrocode}% \end{macro}% \end{macro}% \end{macro}% \begin{macro}{\pr@box}% \begin{macro}{\pr@startbox}%   Previews will be stored in \cmd{\box}\cmd{\pr@box}.%   \cmd{\pr@startbox} gets two arguments: code to execute immediately%   before the following stuff, code to execute afterwards.  You have%   to cater for \cmd{\pr@endbox} being called at the right time%   yourself.  We will use a \cmd{\vsplit} on the box later in order%   to remove any leading glues, penalties and similar stuff.  For%   this reason we start off the box with an optimal break point.%    \begin{macrocode}\newbox\pr@box\long\def\pr@startbox#1#2{%  \ifpr@outer    \toks@{#2}%    \edef\pr@cleanup{\the\toks@}%    \setbox\pr@box\vbox\bgroup    \break    \pr@outerfalse\@arrayparboxrestore    \let\insert\pr@insert    \let\mark\pr@mark    \let\marks\pr@marks    \expandafter\expandafter\expandafter    \pr@ship@start    \expandafter\@firstofone  \else     \expandafter \@gobble  \fi{#1}}%    \end{macrocode}% \end{macro}% \end{macro}% \begin{macro}{\pr@endbox}%   Cleaning up also is straightforward.  If we have to watch the%   bounding \TeX\ box, we want to remove spurious skips.  We also%   want to unwrap a possible single line paragraph, so that the box%   is not full line length.  We use \cmd{\vsplit} to clean up leading%   glue and stuff, and we make some attempt of removing trailing%   ones.  After that, we wrap up the box including possible material%   from \cmd{\AtBeginDvi}.  If the |psfixbb| option is active, we%   adorn the upper left and lower right corners with copies of%   \cmd{\pr@markerbox}.  The first few lines cater for \LaTeX\ hiding%   things like like the code for \cmd{\paragraph} in \cmd{\everypar}.%    \begin{macrocode}\def\pr@endbox{%   \let\reserved@a\relax   \ifvmode \edef\reserved@a{\the\everypar}%      \ifx\reserved@a\@empty\else            \dimen@\prevdepth            \noindent\par            \setbox\z@\lastbox\unskip\unpenalty            \prevdepth\dimen@            \setbox\z@\hbox\bgroup\penalty-\maxdimen\unhbox\z@              \ifnum\lastpenalty=-\maxdimen\egroup              \else\egroup\box\z@ \fi\fi\fi   \ifhmode \par\unskip\setbox\z@\lastbox     \nointerlineskip\hbox{\unhbox\z@\/}%   \else \unskip\unpenalty\unskip \fi   \egroup   \setbox\pr@box\vbox{%       \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@       \@begindvi       \nointerlineskip       \splittopskip\z@skip\setbox\z@\vsplit\pr@box to\z@       \unvbox\z@       \nointerlineskip       %\color@setgroup       \box\pr@box       %\color@endgroup     }%%    \end{macrocode}% \begin{macro}{\pr@ship@end}%   \label{sec:prshipend}At this point, \cmd{\pr@ship@end} gets%   called.  You must not under any circumstances change |\box\pr@box|%   in any way that would add typeset material at the front of it,%   except for PostScript header specials, since the front of%   |\box\pr@box| may contains stuff from \cmd{\AtBeginDvi}.%   \cmd{\pr@ship@end} contains two types of code additions: stuff%   that adds to |\box\pr@box|, like the |labels| option does, and%   stuff that measures out things or otherwise takes a look at the%   finished |\box\pr@box|, like the |auctex| or |showbox| option do.%   The former should use \cmd{pr@addto@front} for adding to this%   hook, the latter use \cmd{g@addto@macro} for adding at the end of%   this hook.%%   Note that we shift the output box up by its height via%   \cmd{\voffset}.  This has three reasons: first we make sure that%   no package-inflicted non-zero value of \cmd{\voffset} or%   \cmd{\hoffset} will have any influence on the positioning of our%   box.  Second we shift the box such that its basepoint will exactly%   be at the (1in,1in)~mark defined by \TeX.  That way we can%   properly take ascenders into account.  And the third reason is%   that \TeX\ treats a \cmd{\hbox} and a \cmd{\vbox} differently with%   regard to the treating of its depth.%    \begin{macrocode}   \pr@ship@end   {\let\protect\noexpand   \voffset=-\ht\pr@box   \hoffset=\z@   \c@page=\pr@snippet   \pr@shipout   \ifpr@fixbb\hbox{%     \dimen@\wd\pr@box     \@tempdima\ht\pr@box     \@tempdimb\dp\pr@box     \box\pr@box     \llap{\raise\@tempdima\copy\pr@markerbox\kern\dimen@}%     \lower\@tempdimb\copy\pr@markerbox}%   \else \box\pr@box \fi}%   \global\advance\pr@snippet\@ne   \pr@cleanup}%    \end{macrocode}% \end{macro}% \end{macro}% Oh, and we kill off the usual meaning of \cmd{\shipout} in case% somebody makes a special output routine.  The following is rather% ugly, but should do the trick most of the time since \cmd{\shipout}% is most often called in a local group by \cmd{\output}.% \begin{macro}{\shipout}%    \begin{macrocode}\let\pr@shipout=\shipout\def\shipout{\deadcycles\z@\setbox\z@\box\voidb@x\setbox\z@}%    \end{macrocode}% \end{macro}% \subsection{Parsing commands}% \begin{macro}{\pr@parseit}% \begin{macro}{\pr@endparse}% \begin{macro}{\pr@callafter}%   The following stuff is for parsing the arguments of commands we%   want to somehow surround with stuff.  Usage is%   \begin{quote}%     \cmd{\pr@callafter}\meta{aftertoken}\meta{parsestring}\cmd{\pr@endparse}\\%     \qquad\meta{macro}\meta{parameters}%   \end{quote}%   \meta{aftertoken} is stored away and gets executed once parsing%   completes, with its first argument being the parsed material.%   \meta{parsestring} would be, for example for the%   \cmd{\includegraphics} macro, |*[[!|, an optional |*| argument%   followed by two optional arguments enclosed in |[]|, followed by%   one mandatory argument.%%   For the sake of a somewhat more intuitive syntax, we now support%   also the syntax |{*[]{}}| in the optional argument.  Since \TeX\%   strips redundant braces, we have to write |[{{}}]| in this syntax%   for a single mandatory argument.  Hard to avoid.  We use an%   unusual character for ending the parsing.  The implementation is%   rather trivial.%    \begin{macrocode}\def\pr@parseit#1{\csname pr@parse#1\endcsname}\let\pr@endparse=\@percentchar\def\next#1{%\def\pr@callafter{%  \afterassignment\pr@parseit  \let#1= }}\expandafter\next\csname pr@parse\pr@endparse\endcsname%    \end{macrocode}% \end{macro}% \end{macro}% \end{macro}% \begin{macro}{\pr@parse*}%   Straightforward, same mechanism \LaTeX\ itself employs.  We take%   some care not to pass potential |#| tokens unprotected through%   macros.%    \begin{macrocode}\long\expandafter\def\csname pr@parse*\endcsname#1\pr@endparse#2{%  \begingroup\toks@{#1\pr@endparse{#2}}%  \edef\next##1{\endgroup##1\the\toks@}%  \@ifstar{\next{\pr@parse@*}}{\next\pr@parseit}}%    \end{macrocode}% \end{macro}% \begin{macro}{\pr@parse[}% \begin{macro}{\pr@brace}%   Copies optional parameters in brackets if present.  The additional%   level of braces is necessary to ensure that braces the user might%   have put to hide a~|]| bracket in an optional argument don't get%   lost.  There will be no harm if such braces were not there at the%   start.%    \begin{macrocode}\long\expandafter\def\csname pr@parse[\endcsname#1\pr@endparse#2{%  \begingroup\toks@{#1\pr@endparse{#2}}%  \edef\next##1{\endgroup##1\the\toks@}%  \@ifnextchar[{\next\pr@bracket}{\next\pr@parseit}}\long\def\pr@bracket#1\pr@endparse#2[#3]{%   \pr@parseit#1\pr@endparse{#2[{#3}]}}%    \end{macrocode}% \end{macro}% \end{macro}% \begin{macro}{\pr@parse]}%   This is basically a do-nothing, so that we may use the syntax%   |{*[][]!}| in the optional argument instead of the more concise%   but ugly |*[[!| which confuses the brace matchers of editors.%    \begin{macrocode}\expandafter\let\csname pr@parse]\endcsname=\pr@parseit%    \end{macrocode}% \end{macro}% \begin{macro}{\pr@parse}% \begin{macro}{\pr@parse!}%   Mandatory arguments are perhaps easiest to parse.%    \begin{macrocode}\long\def\pr@parse#1\pr@endparse#2#3{%  \pr@parseit#1\pr@endparse{#2{#3}}}\expandafter\let\csname pr@parse!\endcsname=\pr@parse%    \end{macrocode}% \end{macro}% \end{macro}% \begin{macro}{\pr@parse?}% \begin{macro}{\pr@parsecond}%   This does an explicit call of |\@ifnextchar| and forks into the%   given two alternatives as a result.%    \begin{macrocode}\long\expandafter\def\csname pr@parse?\endcsname#1#2\pr@endparse#3{%  \begingroup\toks@{#2\pr@endparse{#3}}%  \@ifnextchar#1{\pr@parsecond\@firstoftwo}%                {\pr@parsecond\@secondoftwo}}\def\pr@parsecond#1{\expandafter\endgroup  \expandafter\expandafter\expandafter\pr@parseit  \expandafter#1\the\toks@}%    \end{macrocode}% \end{macro}% \end{macro}% \begin{macro}{\pr@parse@}%   This makes it possible to insert literal material into the%   argument list.%    \begin{macrocode} \long\def\pr@parse@#1#2\pr@endparse#3{%   \pr@parseit #2\pr@endparse{#3#1}}%    \end{macrocode}% \end{macro}% \begin{macro}{\pr@parse-}%   This will just drop the next token.%    \begin{macrocode}\long\expandafter\def\csname pr@parse-\endcsname  #1\pr@endparse#2{\begingroup  \toks@{\endgroup\pr@parseit #1\pr@endparse{#2}}%  {\aftergroup\the\aftergroup\toks@ \afterassignment}%  \let\next= }%    \end{macrocode}% \end{macro}% \begin{macro}{\pr@parse:}%   The following is a transform rule.  A macro is being defined with%   the given argument list and replacement, and the transformed%   version replaces the original.  The result of the transform is%   still subject to being parsed.%    \begin{macrocode}\long\expandafter\def\csname pr@parse:\endcsname  #1#2#3\pr@endparse#4{\begingroup    \toks@{\endgroup \pr@parseit#3\pr@endparse{#4}}%    \long\def\next#1{#2}%    \the\expandafter\toks@\next}%    \end{macrocode}% \end{macro}% \edef\next{\noexpand\begin{macro}{\noexpand%    \pr@parse\string#}}% \next%   Another transform rule, but this passes the transformed material%   into the token list.%    \begin{macrocode}\long\expandafter\def\csname pr@parse#\endcsname  #1#2#3\pr@endparse#4{\begingroup    \toks@{#4}%    \long\edef\next##1{\toks@{\the\toks@##1}}%    \toks@{\endgroup \pr@parseit#3\pr@endparse}%    \long\def\reserved@a#1{{#2}}%    \the\expandafter\next\reserved@a}%</active>%    \end{macrocode}% \end{macro}%% \subsection{Selection options}% The |displaymath| option.  The |equation| environments in AMS\LaTeX\% already do too much before our hook gets to interfere, so we hook% earlier.  Some juggling is involved to ensure we get the original% |\everydisplay| tokens only once and where appropriate.%% The incredible hack with |\dt@ptrue| is necessary for working around% bug `amslatex/3425'.%    \begin{macrocode}%<*!active>\begingroup\catcode`\*=11\@firstofone{\endgroup\DeclareOption{displaymath}{%  \preview@delay{\toks@{%      \pr@startbox{\noindent$$%        \aftergroup\pr@endbox\@gobbletwo}{$$}\@firstofone}%    \everydisplay\expandafter{\the\expandafter\toks@      \expandafter{\the\everydisplay}}}%  \pr@advise@ship\equation{\begingroup\aftergroup\pr@endbox    \def\dt@ptrue{\m@ne=\m@ne}\noindent}%    {\endgroup}%  \pr@advise@ship\equation*{\begingroup\aftergroup\pr@endbox    \def\dt@ptrue{\m@ne=\m@ne}\noindent}%    {\endgroup}%

⌨️ 快捷键说明

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