## Clipping support with XeLaTeX?

Showing 1-16 of 16 messages
 Clipping support with XeLaTeX? Martin Scharrer 7/11/11 5:18 AM When using the clip,trim=.. options of \includegraphics XeLaTeXprints the error:       Package xetex.def Warning: No clipping support in XeTeX yetHowever, clipping within TikZ works fine with text and the image asshown by the example code below.Can it be that the xetex.def driver file is outdated and the supportgot actually implemented in the meantime?I don't see a reason why that driver doesn't use the same technique asthe XeTeX system driver of PGF/TikZ.Do you see this wrong?I don't use XeLaTeX myself but wanted to add lower level clippingsupport for my adjustbox package to avoid the dependency on PGF/TikZ.% Compile with xelatex\documentclass{article}\usepackage{tikz}\begin{document}%\frame{%\begin{tikzpicture}%    \clip (0,0) rectangle (1em,1ex);    \node {Hello};\end{tikzpicture}%}\frame{\includegraphics[trim=5cm 5cm 5cm 5cm,clip]{tiger.pdf}}% doesnot clip\setbox0\hbox{\includegraphics{tiger.pdf}}% Clips fine\frame{%\begin{tikzpicture}%    \clip (5cm,5cm) rectangle (\wd0-5cm,\ht0-5cm);    \node [above right] {\usebox0};\end{tikzpicture}%}\end{document} Re: Clipping support with XeLaTeX? GL 7/11/11 5:23 AM Le 11/07/2011 14:18, Martin Scharrer a écrit :> When using the clip,trim=.. options of \includegraphics XeLaTeX> prints the error:>>         Package xetex.def Warning: No clipping support in XeTeX yet>> However, clipping within TikZ works fine with text and the image as> shown by the example code below.in your adjustbox package, why don't you use \pgfpathqclip ?Thanks in advance. Re: Clipping support with XeLaTeX? Martin Scharrer 7/11/11 5:28 AM On Jul 11, 1:23 pm, GL wrote:> Le 11/07/2011 14:18, Martin Scharrer a écrit :>> > When using the clip,trim=.. options of \includegraphics XeLaTeX> > prints the error:>> >         Package xetex.def Warning: No clipping support in XeTeX yet>> > However, clipping within TikZ works fine with text and the image as> > shown by the example code below.>> in your adjustbox package, why don't you use \pgfpathqclip ?>> Thanks in advance.Originally I used TikZ code and then translated it to the PGFequivalent without checking if there is such a better macro.I'm planning now to replace the use of PGF/TikZ altogether. I alreadyfound out how to do it with pdftex (\pdfxform) but stillhave to crack dvips and other output drivers.Best,Martin Re: Clipping support with XeLaTeX? GL 7/11/11 6:09 AM Le 11/07/2011 14:28, Martin Scharrer a écrit :No \pdfxform must not be used for clipping, though it clips as a sideeffect. If you use \pdfxform each time you clip, your pdf file willgrow up because \pdfxform inserts the box in the catalog each time.Clipping with pdfTeX can be done with \pdfliteral.\pdfxform (like \pdfximage) must be used when a same form (box) orimage have to be inserted many time in the document.Regards.>> Best,> Martin Re: Clipping support with XeLaTeX? Martin Scharrer 7/11/11 6:54 AM The pdftex.def driver used by graphics/x uses:  \expandafter\pdfxform\GPT@temp\@tempboxa  \pdfrefxform\pdflastxformWhere \GPT@temp is either empty or an attribute.I don't mind either way.Please give me an example how to clip a given TeX box using fourparameters (llx, lly, urx, ury).Best,Martin Re: Clipping support with XeLaTeX? GL 7/11/11 7:51 AM Le 11/07/2011 15:54, Martin Scharrer a écrit :Just \setbox 0=\hbox{\tikz { \clip ...}}And then \showbox 0  => look at the \pdfliteral code and you will knowhow to proceed. This is what i've done for TabU images (and some leaders)Each time you use \pdfxform, the form is inserted into the calatog.I think pdftex.def does not provide clipping but for \includegraphics.In this case, using \pdfxform or \pdfximage makes sense. It's justnon optimal if the same image is inserted many times in the document.In TabU for example, the images are stored in a buffer, in order notto insert the same image more than once (because images can be easilyreplicated as backgrounds of cells). The same would apply for a tiledwallpaper.However, if you clip 1 squared centimeter of a A1 image, the full A1image will be inserted in the pdf catalog with \pdfxform... This is notwhat "clipping means" and pgf uses appropriately \pdfliteral to clip.>> Best,> Martin Re: Clipping support with XeLaTeX? Martin Scharrer 7/11/11 8:32 AM \pdfxform itself doesn't even produce any output as long it is notreferencedusing \pdfrefxform.> I think pdftex.def does not provide clipping but for \includegraphics.>> In this case, using \pdfxform or \pdfximage makes sense. It's just> non optimal if the same image is inserted many times in the document.>> In TabU for example, the images are stored in a buffer, in order not> to insert the same image more than once (because images can be easily> replicated as backgrounds of cells). The same would apply for a tiled> wallpaper.I don't see it:Using:\documentclass{article}\usepackage{graphicx}\begin{document}\includegraphics[clip,trim=1cm 1cm 1cm 1cm]{tiger}\includegraphics[clip,trim=1cm 1cm 10cm 1cm]{tiger}\includegraphics[clip,trim=1cm 10cm 1cm 1cm]{tiger}\includegraphics[clip,trim=1cm 10cm 1cm 10cm]{tiger}\end{document}I get: and a PDF of 42k where the tiger.pdf (comes with PStricks) is 34k.With only one image I get 40k.The image isn't stored multiple times.> However, if you clip 1 squared centimeter of a A1 image, the full A1> image will be inserted in the pdf catalog with \pdfxform... This is not> what "clipping means" and pgf uses appropriately \pdfliteral to clip.Does \pdfliteral then strip all material of the A1 image which isn'tdisplayed?It would surprise me.Martin Re: Clipping support with XeLaTeX? GL 7/11/11 9:14 AM Le 11/07/2011 17:32, Martin Scharrer a écrit :Sorry this does not work for me with a .jpg image...Don't know why.>> and a PDF of 42k where the tiger.pdf (comes with PStricks) is 34k.> With only one image I get 40k.> The image isn't stored multiple times.>>>> However, if you clip 1 squared centimeter of a A1 image, the full A1>> image will be inserted in the pdf catalog with \pdfxform... This is not>> what "clipping means" and pgf uses appropriately \pdfliteral to clip.> Does \pdfliteral then strip all material of the A1 image which isn't> displayed?> It would surprise me.>> Martin> Re: Clipping support with XeLaTeX? Martin Scharrer 7/11/11 11:08 AM It works for me with an JPG image as well.pdfTeX 3.1415926-1.40.11-2.2 (TeX Live 2010)kpathsea version 6.0.0Copyright 2010 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).There is NO warranty.  Redistribution of this software iscovered by the terms of both the pdfTeX copyright andthe Lesser GNU General Public License.For more information about these matters, see the filenamed COPYING and the pdfTeX source.Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh(pdfTeX).Compiled with libpng 1.2.40; using libpng 1.2.40Compiled with zlib 1.2.3; using zlib 1.2.3Compiled with xpdf version 3.02pl4Martin Re: Clipping support with XeLaTeX? Ulrike Fischer 7/12/11 1:47 AM Am Mon, 11 Jul 2011 05:18:54 -0700 (PDT) schrieb Martin Scharrer:> When using the clip,trim=.. options of \includegraphics XeLaTeX> prints the error:> >        Package xetex.def Warning: No clipping support in XeTeX yet> > However, clipping within TikZ works fine with text and the image as> shown by the example code below.> Can it be that the xetex.def driver file is outdated and the support> got actually implemented in the meantime?> I don't see a reason why that driver doesn't use the same technique as> the XeTeX system driver of PGF/TikZ.> Do you see this wrong?I agree with you: it should be technically possible. The problem isto find someone who can update the code of xetex.def. Jonathan Kewwrote two or three years ago about it in the xetex mailing list.Another idea would be the (x)dvipdfmx team. In their mailing list Isaw that Jin-Hwan Cho wrote the driver files for pgf. -- Ulrike Fischer Re: Clipping support with XeLaTeX? Martin Scharrer 7/12/11 4:11 AM On Tuesday, July 12, 2011 9:47:46 AM UTC+1, Ulrike Fischer wrote:> Am Mon, 11 Jul 2011 05:18:54 -0700 (PDT) schrieb Martin Scharrer:> > > When using the clip,trim=.. options of \includegraphics XeLaTeX> > prints the error:> > > >        Package xetex.def Warning: No clipping support in XeTeX yet> > > > However, clipping within TikZ works fine with text and the image as> > shown by the example code below.> > Can it be that the xetex.def driver file is outdated and the support> > got actually implemented in the meantime?> > I don't see a reason why that driver doesn't use the same technique as> > the XeTeX system driver of PGF/TikZ.> > Do you see this wrong?> > I agree with you: it should be technically possible.Thanks for confirming this.> The problem is> to find someone who can update the code of xetex.def. Jonathan Kew> wrote two or three years ago about it in the xetex mailing list.> Another idea would be the (x)dvipdfmx team. In their mailing list I> saw that Jin-Hwan Cho wrote the driver files for pgf. I simply would base the xetex.def code on the PGF driver, so that author would be indeed a good choice to contact. Who would be in charge to accept the new version?--Best Regards,Martin Scharrer Re: Clipping support with XeLaTeX? agmad...@gmail.com 9/14/14 10:50 AM I am trying the given code to center image but its not working.     \begin{figure}[ht]     \centering     \includegraphics[trim=0cm 0cm 0cm 0cm, clip=true,width=\linewidth]{twsd.jpg}     \caption{Types of WSD}     \label{fig:my_2}     \end{figure} and showing a warning:     h' float specifier changed to ht'. output of the above code: ![here is the output image][1] At starting i was using compiler latex and it was working correctly. But now am using xelatex, and the images alignment changed automatically. Please suggest me some way to center the images.   [1]: http://i.stack.imgur.com/KTxg2.jpg Re: Clipping support with XeLaTeX? Axel Berger 9/14/14 1:21 PM agmadhavi11 wrote on Sun, 14-09-14 19:50: >Please suggest me some way to center the images. Something is wrong here. At there can't be any centering. It seems to me your inserted image has a wide invisible (white) right margin. Axel Re: Clipping support with XeLaTeX? Ulrike Fischer 9/15/14 12:15 AM Am Sun, 14 Sep 2014 10:50:23 -0700 (PDT) schrieb agmad...@gmail.com: > I am trying the given code to center image but its not working. > >     \begin{figure}[ht] >     \centering >     \includegraphics[trim=0cm 0cm 0cm 0cm, clip=true,width=\linewidth]{twsd.jpg} >     \caption{Types of WSD} >     \label{fig:my_2} >     \end{figure} You are't trimming anything so there is no clipping.  As an example your code is useless. > At starting i was using compiler latex and it was working > correctly. But now am using xelatex, and the images alignment > changed automatically. Make sure that you have an current system. Clipping depends on the graphicx driver and at least in the case of xetex there has been changes. -- Ulrike Fischer http://www.troubleshooting-tex.de/ Re: Clipping support with XeLaTeX? Axel Berger 9/15/14 3:49 AM Ulrike Fischer wrote on Mon, 14-09-15 09:15: >You are't trimming anything so there is no clipping.  As an example your >code is useless. Sorry, but that seems irrelevant here. The width= is applied after trimming and clipping, and if that's the full linewidth, nothing can get centred. If it looks moved out of centre, that must be part of the image itself. Re: Clipping support with XeLaTeX? Ulrike Fischer 9/16/14 12:22 AM Am Mon, 15 Sep 2014 12:49:00 +0200 schrieb Axel Berger: >>You are't trimming anything so there is no clipping.  As an example your >>code is useless.   > Sorry, but that seems irrelevant here. The subject of the question is about "clipping support". > The width= is applied after trimming and clipping, and if that's > the full linewidth, nothing can get centred. If it looks moved > out of centre, that must be part of the image itself. You are trying to make sense from an example which -- as you proved yourself -- can't be real as it can't have worked with latex either. I don't see a point to discuss what could have happened when parts of the example are a lie.