我想知道,是否可以更改在 中定义的图片的位置,tcolorbox
例如fill overzoom image
或watermark
?默认情况下,图像居中,但我希望能够选择将其放在右侧、左侧还是居中。
谢谢 !
例子 :
平均能量损失
\documentclass{article}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\begin{document}
\includegraphics[width=10cm]{simpson}
By default the focus is on the middle part...
\begin{tcolorbox}[enhanced,width=7cm,height=7cm,interior style={fill overzoom image=simpson}]
\end{tcolorbox}
% And now I'd like to say please, focus on the right part,
% on the left part, or go 80% on the right...
\end{document}
答案1
您可以使用带星号版本的键将选项传递给 includegraphics,然后使用 trim 或 viewport:
\documentclass{article}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\begin{document}
\includegraphics[width=5cm]{example-image-A}
\begin{tcolorbox}[enhanced,width=5cm,height=5cm,
interior style={fill overzoom image*={trim=4cm 4cm 0cm 0cm}{example-image-A}}]
\end{tcolorbox}
\begin{tcolorbox}[enhanced,width=5cm,height=5cm,
interior style={fill overzoom image*={viewport= 5cm 1cm 10cm 10cm}{example-image-A}}]
\end{tcolorbox}
\end{document}