CTeX-org / ctex-kit

Macro Packages and Scripts for Chinese TeX users
967 stars 124 forks source link

裁剪图片错位 #218

Closed yihui closed 8 years ago

yihui commented 8 years ago

用ctex的文档类时,通过\includegraphics{}的clip参数裁剪图片会使图片错位,用普通的文档类如article就没有问题。可重复的例子参见这里:https://www.dropbox.com/sh/ynlu3xowk03xk85/AABtOZYX9ckNXZehq5D2Gwysa?dl=0 (要是Dropbox不能用请告诉我)

\documentclass{ctexart}
\usepackage[T1]{fontenc}
\usepackage{calc}
\usepackage{graphicx}
\begin{document}
\fbox{\begin{minipage}[t]{1\columnwidth}%
\includegraphics[bb=100bp 200bp 500bp 600bp,clip,width=1\textwidth]{crop}%
\end{minipage}}
\end{document}

出来的图片向右上角移动了:

image

把ctexart换成article就没有问题。ctexbook有同样的问题。

我的系统是Ubuntu 15.04,ctex为最新版,用xelatex编译得到PDF。

$ xelatex --version
XeTeX 3.14159265-2.6-0.99992 (TeX Live 2015)
kpathsea version 6.2.1
Copyright 2015 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 55.1; using 55.1
Compiled with zlib version 1.2.8; using 1.2.8
Compiled with FreeType2 version 2.5.5; using 2.5.5
Compiled with Graphite2 version 1.2.4; using 1.2.4
Compiled with HarfBuzz version 0.9.40; using 0.9.40
Compiled with libpng version 1.6.17; using 1.6.17
Compiled with poppler version 0.32.0
Compiled with fontconfig version 2.11.93; using 2.11.1
qinglee commented 8 years ago

这不是 ctex 的问题,看起来 bb 这个选项在 XeTeX 下没有意义(xetex.def):

      \@ifundefined{Gin@vllx}{%
        \GXT@viewportfalse
        % without viewport/trim clipping does not make sense
        % for XeTeX
        \Gin@clipfalse
      }{}%

不过这里的判断也没有意义,\Gin@vllx 总是有定义的,所以导致了错误的裁剪结果。

解决办法是将 bb 改成 viewportpdftex.def 就将 bb 内部换成了 viewport)。

yihui commented 8 years ago

谢谢,果然是xetex的问题,改成viewport果然可用,厉害啊。打扰了!