bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-AUCTeX] Re: Request to add support for xetex in preview.sty


From: Ralf Angeli
Subject: [Bug-AUCTeX] Re: Request to add support for xetex in preview.sty
Date: Thu, 09 Jul 2009 22:39:51 +0200

* 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}
>     address@hidden@end
>     {\let\protect\noexpand
> -   address@hidden
> -   \hoffset=\z@
> +   \ifx\XeTeXversion\undefined
> +      address@hidden
> +      \hoffset=\z@
> +   \else
> +      \voffset=-1in
> +      \advance\voffset by \pdfvorigin
> +      \advance\voffset by address@hidden
> +      \hoffset=-1in
> +      \advance\hoffset by \pdfhorigin
> +   \fi
>     address@hidden@snippet
>     address@hidden
>     address@hidden

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 address@hidden@end is suppressed.
Shouldn't the setting added with address@hidden@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 address@hidden@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 address@hidden
@@ -588,6 +588,8 @@
 %    \begin{macrocode}
 \DeclareOption{pdftex}{%
   address@hidden@}
+\DeclareOption{xetex}{%
+  address@hidden@@}
 %</!active>
 %    \end{macrocode}
 % \end{macro}
@@ -743,8 +745,10 @@
 %    \begin{macrocode}
    address@hidden@end
    {\let\protect\noexpand
+   \ifx\XeTeXversion\undefined% FIXME: Why is this necessary?
    address@hidden
    \hoffset=\z@
+   \fi
    address@hidden@snippet
    address@hidden
    address@hidden
@@ -1276,7 +1280,12 @@
 %    \begin{macrocode}
 address@hidden: Fontsize address@hidden pt}%
   address@hidden: Magnification \number\mag}\fi
-  address@hidden \else
+  address@hidden
+    \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>    address@hidden@address@hidden
 %<tightpage>    \global\pdfpagewidth\dimen@
 %<tightpage>    address@hidden@i}}
+%<tightpage>\or
+%<tightpage>  address@hidden@address@hidden@address@hidden@box
+%<tightpage>    \ifdim\dimen@<\z@ address@hidden@\fi
+%<tightpage>    address@hidden@address@hidden
+%<tightpage>    address@hidden@
+%<tightpage>    \voffset=-1in
+%<tightpage>    \advance\voffset\dimen@
+%<tightpage>    address@hidden
+%<tightpage>    address@hidden@box
+%<tightpage>    \ifdim\dimen@<\z@ address@hidden@\fi
+%<tightpage>    address@hidden@address@hidden
+%<tightpage>    address@hidden@ii
+%<tightpage>    \global\pdfpageheight\dimen@
+%<tightpage>    \global\paperheight\dimen@
+%<tightpage>    address@hidden@box
+%<tightpage>    \ifdim\dimen@<\z@ address@hidden@\fi
+%<tightpage>    address@hidden@address@hidden
+%<tightpage>    address@hidden@address@hidden
+%<tightpage>    \global\pdfpagewidth\dimen@
+%<tightpage>    \hoffset=-1in
+%<tightpage>    address@hidden@i}
 %<tightpage>\fi
 %    \end{macrocode}
 % Ok, here comes the beef.  First we fish the 7~numbers from the file


-- 
Ralf





reply via email to

[Prev in Thread] Current Thread [Next in Thread]