From 9f745038d5a6cdd670d76719b21c4d0e38bc5cf5 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 21 Feb 2010 23:13:39 +0000
Subject: preview update (21feb09)

git-svn-id: svn://tug.org/texlive/trunk@17118 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/preview/preview.dtx | 82 ++++++++++++++++------
 1 file changed, 62 insertions(+), 20 deletions(-)

(limited to 'Master/texmf-dist/source/latex/preview/preview.dtx')

diff --git a/Master/texmf-dist/source/latex/preview/preview.dtx b/Master/texmf-dist/source/latex/preview/preview.dtx
index e3961ba7a49..fd834c6f342 100644
--- a/Master/texmf-dist/source/latex/preview/preview.dtx
+++ b/Master/texmf-dist/source/latex/preview/preview.dtx
@@ -2,12 +2,12 @@
 %%    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
+%     Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006,
+%                   2010 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
+%     the Free Software Foundation; either version 3 of the License, or
 %     (at your option) any later version.
 %
 %     This program is distributed in the hope that it will be useful,
@@ -20,7 +20,7 @@
 %     Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 %     Boston, MA 02110-1301  USA
 % \fi
-% \CheckSum{1664}
+% \CheckSum{1758}
 % \GetFileInfo{preview.sty}
 % \date{\filedate}
 % \author{David Kastrup\thanks{\texttt{dak@gnu.org}}}
@@ -31,7 +31,7 @@
 % environments (most notably displayed formulas) from \LaTeX\ sources
 % as graphics.  This works with DVI files postprocessed by either
 % Dvips and Ghostscript or dvipng, but it also works when you are
-% using PDF\TeX for generating PDF files (usually also postprocessed
+% using PDF\TeX\ for generating PDF files (usually also postprocessed
 % by Ghostscript).
 %
 % Current uses of the package include the \previewlatex\ package for
@@ -124,6 +124,8 @@
 %   if possible.
 % \item[|pdftex|] If this option is set, PDF\TeX\ is assumed as the
 %   output driver.  This mainly affects the |tightpage| option.
+% \item[|xetex|] If this option is set, Xe\TeX\ is assumed as the
+%   output driver.  This mainly affects the |tightpage| option.
 % \item[|displaymath|] will make all displayed math environments
 %   subject to preview processing.  This will typically be the most
 %   desired option.
@@ -437,12 +439,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_84 $ \ifx\pr@version\@empty
-\reserved@a\pr@version CVS-$Revision: 1.122 $ \endgroup \else
+\reserved@a\pr@version $Name: release_11_86 $ \ifx\pr@version\@empty
+\reserved@a\pr@version CVS-$Revision: 1.126 $ \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/08/25 10:34:36 $
+\reserved@a\next $Date: 2010/02/14 16:19:00 $
 \edef\next{\noexpand\ProvidesPackage{preview}%
   [\next\space \pr@version\space (AUCTeX/preview-latex)]}
 \next
@@ -588,6 +590,11 @@
 %    \begin{macrocode}
 \DeclareOption{pdftex}{%
   \let\pr@graphicstype\tw@}
+%    \end{macrocode}
+% And so does the |xetex| option.
+%    \begin{macrocode}
+\DeclareOption{xetex}{%
+  \let\pr@graphicstype\thr@@}
 %</!active>
 %    \end{macrocode}
 % \end{macro}
@@ -722,7 +729,7 @@
 %   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}.
+%   |\box\pr@box| may contain 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
@@ -739,12 +746,15 @@
 %   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.
+%   regard to the treating of its depth.  Shifting \cmd{\voffset} and
+%   \cmd{\hoffset} can be inhibited by setting |\pr@offset@override|.
 %    \begin{macrocode}
    \pr@ship@end
    {\let\protect\noexpand
-   \voffset=-\ht\pr@box
-   \hoffset=\z@
+   \ifx\pr@offset@override\@undefined
+     \voffset=-\ht\pr@box
+     \hoffset=\z@
+   \fi
    \c@page=\pr@snippet
    \pr@shipout
    \ifpr@fixbb\hbox{%
@@ -1276,7 +1286,13 @@ Please complain to your document class author}%
 %    \begin{macrocode}
 \def\pr@typeinfos{\typeout{Preview: Fontsize \f@size pt}%
   \ifnum\mag=\@m\else\typeout{Preview: Magnification \number\mag}\fi
-  \ifx\pdfoutput\@undefined \else
+  \ifx\pdfoutput\@undefined
+    \ifx\XeTeXversion\@undefined \else
+      % FIXME: The message should not be emitted if XeTeX does not produce
+      % PDF.  There does not seem to be a primitive for that, though.
+      \typeout{Preview: PDFoutput 1}%
+    \fi
+  \else
     \ifx\pdfoutput\relax \else
       \ifnum\pdfoutput>\z@
         \typeout{Preview: PDFoutput 1}%
@@ -1433,8 +1449,8 @@ Please complain to your document class author}%
 %<counters>\def\pr@ckpt#1{{\let\@elt\pr@eltprint\edef\next{\cl@@ckpt}%
 %<counters>  \ifx\next\@empty\else\typeout{Preview: Counters\next#1}%
 %<counters>  \let\@elt\pr@eltdef\cl@@ckpt\fi}}
-%<counters>\g@addto@macro\pr@ship@start{\pr@ckpt:}
-%<counters>\g@addto@macro\pr@ship@end{\pr@ckpt.}
+%<counters>\pr@addto@front\pr@ship@start{\pr@ckpt:}
+%<counters>\pr@addto@front\pr@ship@end{\pr@ckpt.}
 %    \end{macrocode}
 %
 % \subsection{Debugging options}
@@ -1527,11 +1543,15 @@ Please complain to your document class author}%
 % out to the console.
 %    \begin{macrocode}
 %<tightpage>\ifnum\pr@graphicstype=\z@
-%<tightpage>  \ifcase \ifx\pdfoutput\@undefined \@ne\fi
-%<tightpage>    \ifx\pdfoutput\relax \@ne\fi
-%<tightpage>    \ifnum\pdfoutput>\z@ \tw@\fi \@ne \or
-%<tightpage>    \ExecuteOptions{dvips}\relax \or
-%<tightpage>    \ExecuteOptions{pdftex}\relax\fi\fi
+%<tightpage>  \ifcase
+%<tightpage>    \ifx\XeTeXversion\@undefined
+%<tightpage>      \ifx\pdfoutput\@undefined \@ne\fi
+%<tightpage>      \ifx\pdfoutput\relax \@ne\fi
+%<tightpage>      \ifnum\pdfoutput>\z@ \tw@\fi \@ne
+%<tightpage>    \else \thr@@\fi
+%<tightpage>  \or \ExecuteOptions{dvips}\relax
+%<tightpage>  \or \ExecuteOptions{pdftex}\relax
+%<tightpage>  \or \ExecuteOptions{xetex}\relax\fi\fi
 %<tightpage>\global\let\pr@bbadjust\@empty
 %<tightpage>\pr@addto@front\pr@ship@end{\begingroup
 %<tightpage>  \let\next\@gobble
@@ -1571,6 +1591,28 @@ Please complain to your document class author}%
 %<tightpage>    \advance\dimen@\pr@bb@iii
 %<tightpage>    \global\pdfpagewidth\dimen@
 %<tightpage>    \global\pdfhorigin-\pr@bb@i}}
+%<tightpage>\or
+%<tightpage>  \g@addto@macro\pr@ship@end{\dimen@\ht\pr@box
+%<tightpage>    \ifdim\dimen@<\z@ \dimen@\z@\fi
+%<tightpage>    \advance\dimen@\pr@bb@iv
+%<tightpage>    \dimen@ii=\dimen@
+%<tightpage>    \voffset=-1in
+%<tightpage>    \advance\voffset\dimen@
+%<tightpage>    \advance\voffset-\ht\pr@box
+%<tightpage>    \dimen@\dp\pr@box
+%<tightpage>    \ifdim\dimen@<\z@ \dimen@\z@\fi
+%<tightpage>    \advance\dimen@-\pr@bb@ii
+%<tightpage>    \advance\dimen@\dimen@ii
+%<tightpage>    \global\pdfpageheight\dimen@
+%<tightpage>    \global\paperheight\dimen@
+%<tightpage>    \dimen@\wd\pr@box
+%<tightpage>    \ifdim\dimen@<\z@ \dimen@=\z@\fi
+%<tightpage>    \advance\dimen@-\pr@bb@i
+%<tightpage>    \advance\dimen@\pr@bb@iii
+%<tightpage>    \global\pdfpagewidth\dimen@
+%<tightpage>    \hoffset=-1in
+%<tightpage>    \advance\hoffset-\pr@bb@i
+%<tightpage>    \let\pr@offset@override\@empty}
 %<tightpage>\fi
 %    \end{macrocode}
 % Ok, here comes the beef.  First we fish the 7~numbers from the file
-- 
cgit v1.2.3

