Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In pdflatex I'm used to clip graphics using something like this:

\includegraphics[trim=14mm 0mm 14mm 0mm,clip,width=1.2cm]{image.jpg}

When I attempt this in XeLaTeX, no clipping occurs and I get a warning:

Package xetex.def Warning: No clipping support in XeTeX yet

It is obvious, that I could clip the image with a separate tool outside TeX, but for several reasons I would like to do this automatically from inside TeX (e.g. when migrating large old documents to XeTeX without messing around with the files)

Two questions:

  1. Is there any workaround I should be aware of to do the clipping automatically during the TeX run? E.g. by replacing \includegraphics by something else (TikZ?)
  2. Does anyone know if someone is working on clipping from inside XeTeX? Maybe there is a beta I could try?
share|improve this question
add comment

1 Answer

up vote 21 down vote accepted

The graphics/x output driver for XeLaTeX doesn't include clipping support yet. However, it is possible to clip using PGF/TikZ which brings his own driver (i.e. low level code) to do clipping. I have brought this issue up on comp.text.tex: Clipping support with XeLaTeX?. Also in the meantime Joseph Wright and I produced a clipping driver for XeTeX: Patch to add clipping support to XeTeX.

In the meantime the simplest way to get clipping is to use my adjustbox package which uses its own driver internally, including for XeLaTeX.

\usepackage{adjustbox}
% ...

\adjustbox{trim=14mm 0mm 14mm 0mm,clip,width=1.2cm}{\includegraphics{image.jpg}}

% or with newer versions of adjustbox:
\adjincludegraphics[trim=14mm 0mm 14mm 0mm,clip,width=1.2cm]{image.jpg}
% or
\adjustimage{trim=14mm 0mm 14mm 0mm,clip,width=1.2cm}{image.jpg}
share|improve this answer
1  
xetex.def has some restrictions. The maintainers (Ross Moore and Jonathan Kew) seems not very familar with \specials of xdvipdfmx. I'm quite sure that xdvipdfmx can support clipping, since dvipdfmx (by Jin-Hwan Cho) supports clipping. –  Leo Liu Aug 5 '11 at 10:35
1  
magic, exactly what I needed :-) –  kongo09 Aug 5 '11 at 10:35
    
@Leo: yeah, as I said here and on c.t.t: the driver should be really be updated with code like the one used for PGF. –  Martin Scharrer Aug 5 '11 at 10:53
    
@Martin: Well, the pgf's system layer for XeTeX also has some restrictions. Pity. –  Leo Liu Aug 5 '11 at 11:12
    
@Leo: Yes, indeed. I was also thinking about mentioning it here. There is also an issue with XeLaTeX + preview + some TikZ stuff. –  Martin Scharrer Aug 5 '11 at 11:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.