Using xelatex... when I apply a \clipbox upon a \scalebox of a box that uses the optional argument, the clip is not performed properly.
The problem goes away if:
using pdflatex,
the optional argument to the
\scaleboxis omitted, orthe
\clipboxis omitted.
Here is an unanswered 2014 question that perhaps describes the same problem: clipbox with bidi.
\documentclass{article}
\usepackage{trimclip,graphicx}
\begin{document}
Works OK without scalebox opt.{} argument
\setbox0=\hbox{XXX}
\scalebox{1}{\copy0}%
. Now clip it:
\clipbox{0pt 0pt 10pt 0pt}{%
\scalebox{1}{\copy0}%
}.
Breaks with scalebox opt.{} argument
\setbox0=\hbox{XXX}
\scalebox{1}[.5]{\copy0}%
. Now clip it:
\clipbox{0pt 0pt 10pt 0pt}{%
\scalebox{1}[.5]{\copy0}%
}.
\end{document}
While I use the temporary \box0 for simplicity, the problem arises also if I use a permanent \savebox. Package loading order has no effect.
Below, the top image is pdflatex, the bottom with xelatex. Note the bottom-right of the bottom image, which shows an empty result for the clip.
NOTE: This question arose when Hiemanshu Sharma asked why my method at Draw Text in different shapes did not work with xelatex. I boiled it down to the above MWE.
