summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/preview/preview.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/preview/preview.dtx')
-rw-r--r--Master/texmf-dist/source/latex/preview/preview.dtx113
1 files changed, 69 insertions, 44 deletions
diff --git a/Master/texmf-dist/source/latex/preview/preview.dtx b/Master/texmf-dist/source/latex/preview/preview.dtx
index 9f43906546f..e3961ba7a49 100644
--- a/Master/texmf-dist/source/latex/preview/preview.dtx
+++ b/Master/texmf-dist/source/latex/preview/preview.dtx
@@ -1,24 +1,26 @@
-%%\iffalse
-%% preview.dtx for extracting previews from LaTeX documents. Part of
-%% the preview-latex package.
-%% Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation
-%%
-%% This program is free software; you can redistribute it and/or modify
-%% it under the terms of the GNU General Public License as published by
-%% the Free Software Foundation; either version 2 of the License, or
-%% (at your option) any later version.
-%%
-%% This program is distributed in the hope that it will be useful,
-%% but WITHOUT ANY WARRANTY; without even the implied warranty of
-%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-%% GNU General Public License for more details.
-%%
-%% You should have received a copy of the GNU General Public License
-%% along with this program; if not, write to the
-%% Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-%% Boston, MA 02110-1301 USA
-%%\fi
-% \CheckSum{1640}
+% \iffalse
+%% The preview style for extracting previews from LaTeX documents.
+%% Developed as part of AUCTeX <URL:http://www.gnu.org/software/auctex>.
+%
+% Copyright (C) 2001, 2002, 2003, 2004, 2005,
+% 2006 Free Software Foundation
+%
+% This program is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program; if not, write to the
+% Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+% Boston, MA 02110-1301 USA
+% \fi
+% \CheckSum{1664}
% \GetFileInfo{preview.sty}
% \date{\filedate}
% \author{David Kastrup\thanks{\texttt{dak@gnu.org}}}
@@ -322,7 +324,8 @@
% \begin{description}
% \item[|*|] indicates an optional |*| modifier, as in
% |\includegraphics*|.
-% \item[|[|] indicates an optional argument in brackets. This syntax
+% \item[|[|]^^A]
+% indicates an optional argument in brackets. This syntax
% is somewhat baroque, but brief.
% \item[{|[]|}] also indicates an optional argument in brackets. Be
% sure to have encluded the entire optional argument specification
@@ -434,12 +437,12 @@
\NeedsTeXFormat{LaTeX2e} \def\reserved@a #1#2$#3:
#4${\xdef#1{\reserved@c #2#4 $}} \def\reserved@c #1 #2${#1}
\begingroup \catcode`\_=12
-\reserved@a\pr@version $Name: release_11_83 $ \ifx\pr@version\@empty
-\reserved@a\pr@version CVS-$Revision: 1.115 $ \endgroup \else
+\reserved@a\pr@version $Name: release_11_84 $ \ifx\pr@version\@empty
+\reserved@a\pr@version CVS-$Revision: 1.122 $ \endgroup \else
\def\next release_{} \lccode`\_=`.
\edef\next{\lowercase{\endgroup
\def\noexpand\pr@version{\expandafter\next\pr@version}}} \next \fi
-\reserved@a\next $Date: 2006/05/25 19:28:52 $
+\reserved@a\next $Date: 2006/08/25 10:34:36 $
\edef\next{\noexpand\ProvidesPackage{preview}%
[\next\space \pr@version\space (AUCTeX/preview-latex)]}
\next
@@ -524,11 +527,14 @@
% Now \cmd{\pr@advise} needs its helper macro. In order to avoid
% recursive definitions, we advise only macros that are not yet
% advised. Or, more exactly, we throw away the old advice and only
-% take the new one.
+% take the new one. We use e\TeX's \cmd{\protected} where available
+% for some extra robustness.
% \begin{macrocode}
\long\def\pr@adviseii#1#2#3{\preview@delay{%
\ifx#1\relax \let#1#2\fi
- \toks@{#3#1}\long\edef#2{\the\toks@}}}
+ \toks@{#3#1}%
+ \ifx\@undefined\protected \else \protected\fi
+ \long\edef#2{\the\toks@}}}
% \end{macrocode}
%\end{macro}
%
@@ -756,13 +762,16 @@
% \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}.
+% somebody makes a special output routine. The following test is
+% pretty much the same as in |everyshi.sty|. One of its implications
+% is that if someone does a \cmd{\shipout} of a \emph{void} box,
+% things will go horribly wrong.
% \begin{macro}{\shipout}
% \begin{macrocode}
\let\pr@shipout=\shipout
-\def\shipout{\deadcycles\z@\setbox\z@\box\voidb@x\setbox\z@}
+\def\shipout{\deadcycles\z@\bgroup\setbox\z@\box\voidb@x
+ \afterassignment\pr@shipoutegroup\setbox\z@}
+\def\pr@shipoutegroup{\ifvoid\z@ \expandafter\aftergroup\fi \egroup}
% \end{macrocode}
% \end{macro}
% \subsection{Parsing commands}
@@ -964,7 +973,8 @@
\preview@delay{\ifx#1\@undefined \let#1=$%$
\fi\catcode`\$=\active
\ifx\xyreuncatcodes\@undefined\else
- \makeatother\xyreuncatcodes\makeatletter\fi}%
+ \edef\next{\catcode`@=\the\catcode`@\relax}%
+ \makeatother\expandafter\xyreuncatcodes\next\fi}%
\pr@advise@ship\(\pr@endaftergroup{}% \)
\pr@advise@ship#1{\@firstoftwo{\let#1=#2%
\futurelet\reserved@a\pr@textmathcheck}}{}}%
@@ -1025,10 +1035,12 @@ Please complain to your document class author}%
\expandafter\next\csname endfigure*\expandafter\endcsname
\csname endtable*\endcsname
% \end{macrocode}
-% The |sections| option.
+% The |sections| option. Two optional parameters might occur in
+% |memoir.cls|.
% \begin{macrocode}
\DeclareOption{sections}{%
- \PreviewMacro[!!!!!!*[!]{\@startsection}%]
+ \PreviewMacro[!!!!!!*[[!]{\@startsection}%]]
+ \PreviewMacro[*[[!]{\chapter}%]]
}
% \end{macrocode}
% We now interpret any further options as driver files we load. Note
@@ -1241,18 +1253,23 @@ Please complain to your document class author}%
\renewenvironment{nopreview}{\pr@outerfalse\ignorespaces}%
{\ifhmode\unskip\fi}
% \end{macrocode}
-% Let the output routine throw everything gathered regularly away.
-% Start with all float boxes, continue with output box, pack
-% everything afloat from \cmd{\@currlist} back into \cmd{\@freelist}.
+% We use the normal output routine, but hijack it a bit for our
+% purposes to preserve \cmd{\AtBeginDvi} hooks and not get previews
+% while in output: that could become rather ugly.
+%
+% The main work of disabling normal output relies on a \cmd{\shipout}
+% redefinition.
+% \begin{macro}{\pr@output}
% \begin{macrocode}
-\output{\def\@elt#1{\global\setbox#1=\box\voidb@x}%
- \@currlist
- \@elt{255}%
- \let\@elt\relax
- \xdef\@freelist{\@currlist\@freelist}%
- \global\let\@currlist\@empty
- \deadcycles\z@}
+\newtoks\pr@output
+\pr@output\output
+\output{%
+ \pr@outerfalse
+ \let\@begindvi\@empty
+ \the\pr@output}
+\let\output\pr@output
% \end{macrocode}
+% \end{macro}
% \begin{macro}{\pr@typeinfos}
% Then we have some document info that style files might want to
% output.
@@ -1383,6 +1400,8 @@ Please complain to your document class author}%
%<auccfg>\PreviewMacro*[][#1{}]\caption
%<auccfg>\preview@delay{\@ifundefined{pr@\string\@startsection}{%
%<auccfg> \PreviewMacro*[!!!!!!*][#1{}]\@startsection}{}}
+%<auccfg>\preview@delay{\@ifundefined{pr@\string\chapter}{%
+%<auccfg> \PreviewMacro*[*][#1{}]\chapter}{}}
%<auccfg>\PreviewMacro*\index
% \end{macrocode}
%
@@ -1803,3 +1822,9 @@ Please complain to your document class author}%
%<driver> \end{document}
% \end{macrocode}
% \Finale{}
+% \iffalse
+% Local Variables:
+% mode: doctex
+% TeX-master: "preview.drv"
+% End:
+% \fi