* Ralf Angeli (2009-01-17) writes:
> * R. Chandrasekhar (2009-01-16) writes:
>
>> Jonathan Kew posted a hack that allows the preview package to be used
>> with the exact syntax as with pdflatex. It is available here:
>>
>> http://tug.org/pipermail/xetex/attachments/20080228/425c00a5/attachment-000
>> 1.obj
>
> Here it is as a patch to preview.dtx, so that it is not so
> time-consuming for the maintainers to get the respective information:
>
> --- preview.dtx.~1.124.~ 2008-02-03 15:53:31.000000000 +0100
> +++ preview.dtx 2009-01-17 17:46:36.000000000 +0100
> @@ -743,8 +743,16 @@
> % \begin{macrocode}
> \...@ship@end
> {\let\protect\noexpand
> - \voffset=-\ht...@box
> - \hoffset=\z@
> + \ifx\XeTeXversion\undefined
> + \voffset=-\ht...@box
> + \hoffset=\z@
> + \else
> + \voffset=-1in
> + \advance\voffset by \pdfvorigin
> + \advance\voffset by -\ht...@box
> + \hoffset=-1in
> + \advance\hoffset by \pdfhorigin
> + \fi
> \...@page=\pr@snippet
> \...@shipout
> \i...@fixbb\hbox{%
I now have a first working version of this with an `xetex' option for
preview.sty. See the patch below.
Adding this was a little like poking a beast with a long stick, checking
if it moves and hoping it does not suddenly turn around and bite off my
arm. That's also why there are some things I am not sure about. For
example what to do if XeTeX is in XDV mode. And why previews are
displaced within the area set up by the `tightpage' option unless the
setting of \voffset and \hoffset in \...@ship@end is suppressed.
Shouldn't the setting added with \...@addto@macro overwrite the original
values? The third thing I don't understand is why the new code for the
`tightpage' option only works if the second argument of \...@addto@macro
is put into a single pair of braces whereas the code for the `pdftex'
option works if it is enclosed in two pairs of braces.
Hopefully somebody can provide a few hints or constructive criticism so
that we can get this to a stage where I can check it in.
--- preview.dtx 3 Feb 2008 14:53:31 -0000 1.124
+++ preview.dtx 9 Jul 2009 20:20:42 -0000
@@ -20,7 +20,7 @@
% Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
% Boston, MA 02110-1301 USA
% \fi
-% \CheckSum{1664}
+% \CheckSum{1746}
% \GetFileInfo{preview.sty}
% \date{\filedate}
% \author{David kastrup\thanks{\texttt{[email protected]}}}
@@ -588,6 +588,8 @@
% \begin{macrocode}
\DeclareOption{pdftex}{%
\let...@graphicstype\tw@}
+\DeclareOption{xetex}{%
+ \let...@graphicstype\thr@@}
%</!active>
% \end{macrocode}
% \end{macro}
@@ -743,8 +745,10 @@
% \begin{macrocode}
\...@ship@end
{\let\protect\noexpand
+ \ifx\XeTeXversion\undefined% FIXME: Why is this necessary?
\voffset=-\ht...@box
\hoffset=\z@
+ \fi
\...@page=\pr@snippet
\...@shipout
\i...@fixbb\hbox{%
@@ -1276,7 +1280,12 @@
% \begin{macrocode}
\def...@typeinfos{\typeout{preview: Fontsize \...@size pt}%
\ifnum\ma...@m\else\typeout{preview: Magnification \number\mag}\fi
- \ifx\pdfoutp...@undefined \else
+ \ifx\pdfoutp...@undefined
+ \ifx\XeTeXversion\undefined \else
+ % FIXME: Do not set if XeTeX does not produce PDF?
+ \typeout{Preview: PDFoutput 1}%
+ \fi
+ \else
\ifx\pdfoutput\relax \else
\ifnum\pdfoutput>\z@
\typeout{Preview: PDFoutput 1}%
@@ -1571,6 +1580,27 @@
%<tightpage> \advance\di...@\pr@b...@iii
%<tightpage> \global\pdfpagewidth\dimen@
%<tightpage> \global\pdfhorigin-...@bb@i}}
+%<tightpage>\or
+%<tightpage> \...@addto@macro...@ship@end{\di...@\ht\pr@box
+%<tightpage> \ifdim\dimen@<\z@ \di...@\z@\fi
+%<tightpage> \advance\di...@\pr@b...@iv
+%<tightpage> \di...@ii=\dimen@
+%<tightpage> \voffset=-1in
+%<tightpage> \advance\voffset\dimen@
+%<tightpage> \advance\voffset-\ht...@box
+%<tightpage> \di...@\dp\pr@box
+%<tightpage> \ifdim\dimen@<\z@ \di...@\z@\fi
+%<tightpage> \advance\di...@-\pr@b...@ii
+%<tightpage> \advance\di...@\dimen@ii
+%<tightpage> \global\pdfpageheight\dimen@
+%<tightpage> \global\paperheight\dimen@
+%<tightpage> \di...@\wd\pr@box
+%<tightpage> \ifdim\dimen@<\z@ \di...@=\z@\fi
+%<tightpage> \advance\di...@-\pr@b...@i
+%<tightpage> \advance\di...@\pr@b...@iii
+%<tightpage> \global\pdfpagewidth\dimen@
+%<tightpage> \hoffset=-1in
+%<tightpage> \advance\hoffset-...@bb@i}
%<tightpage>\fi
% \end{macrocode}
% Ok, here comes the beef. First we fish the 7~numbers from the file
--
Ralf
_______________________________________________
bug-auctex mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-auctex