我已经尝试了大约一个小时来对 tcolorbox 进行 tikz 移位,没有任何效果。无论我使用什么宏,它似乎都不起作用。这是我到目前为止的代码:
\documentclass[a3paper,landscape]{memoir}
\usepackage{graphicx}
\usepackage{tcolorbox}
\usepackage{float}
\usepackage{tikz}
\usepackage[a3paper,top=4mm,bottom=4mm,left=4mm,right=4mm]{geometry}
\tcbuselibrary{skins,breakable}
\pagenumbering{gobble}
\begin{document}
\begin{tcolorbox}[enhanced,freelance,colback=black,colframe=black,arc=0mm,width=280pt,left=0.5mm,boxrule=0pt,tikz={yshift=0pt,rotate=15,transform shape}]
\includegraphics[width=270pt]{image1}
\begin{tcolorbox}[colframe=white,colback=white,width=270pt,arc=0mm,boxsep=0pt,boxrule=0mm] % halign=center
\bfseries Blahblah
\end{tcolorbox}
\end{tcolorbox}
\begin{tcolorbox}[enhanced,freelance,colback=black,colframe=black,arc=0mm,width=280pt,left=0.5mm,boxrule=0pt,tikz={xshift=15cm,rotate=-15,transform shape}]
\includegraphics[width=270pt]{image2}
\begin{tcolorbox}[colframe=white,colback=white,width=270pt,arc=0mm,boxsep=0pt,boxrule=0mm] % halign=center
\bfseries Blahblah
\end{tcolorbox}
\end{tcolorbox}
\end{document}
我究竟做错了什么?
答案1
将tcolorboxe
s 放入 s 内node
并使用\vspace
和\hspace
移动它们。
\documentclass[a3paper,landscape]{memoir}
\usepackage{tcolorbox}
\usepackage[a3paper,top=4mm,bottom=4mm,left=4mm,right=4mm]{geometry}
\tcbuselibrary{skins,breakable}
\usetikzlibrary{positioning}
\pagenumbering{gobble}
\begin{document}
\vspace*{3in}
\mbox{}\hspace{4in}
\begin{tikzpicture}
\coordinate (A);
\node[anchor=north west,rotate=15,xshift=3in] (a) at (A) {
\begin{tcolorbox}[enhanced,colback=black,colframe=black,arc=0mm,width=280pt,left=0.5mm,
boxrule=0pt]
\includegraphics[width=270pt]{example-image-a}
\begin{tcolorbox}[colframe=white,colback=white,width=270pt,arc=0mm,boxsep=0pt,boxrule=0mm] % halign=center
\bfseries Blahblah
\end{tcolorbox}
\end{tcolorbox}
};
\node[right=of a,xshift=-1.5cm,rotate=-15] (b) {
\begin{tcolorbox}[enhanced,colback=black,colframe=black,arc=0mm,width=280pt,
left=0.5mm,boxrule=0pt]
\includegraphics[width=270pt]{example-image-b}
\begin{tcolorbox}[colframe=white,colback=white,width=270pt,arc=0mm,boxsep=0pt,boxrule=0mm] % halign=center
\bfseries Blahblah
\end{tcolorbox}
\end{tcolorbox}
};
\end{tikzpicture}
\end{document}
答案2
装箱tcolorbox
,然后你可以随意移动它们;我用的是adjustbox
包来垂直对齐它们:
\documentclass[a3paper,landscape]{memoir}
\usepackage{graphicx}
\usepackage{tcolorbox}
\usepackage{adjustbox}
\usepackage[a3paper,top=4mm,bottom=4mm,left=4mm,right=4mm]{geometry}
\tcbuselibrary{skins,breakable}
\pagenumbering{gobble}
\newsavebox\myboxa
\newsavebox\myboxb
\begin{lrbox}{\myboxa}
\begin{tcolorbox}[enhanced,freelance,colback=black,colframe=black,arc=0mm,width=280pt,left=0.5mm,boxrule=0pt,tikz={yshift=0pt,rotate=15,transform shape}]
\includegraphics[width=270pt]{example-image-a}
\begin{tcolorbox}[colframe=white,colback=white,width=270pt,arc=0mm,boxsep=0pt,boxrule=0mm] % halign=center
\bfseries Blahblah
\end{tcolorbox}
\end{tcolorbox}%
\end{lrbox}
\begin{lrbox}{\myboxb}
\begin{tcolorbox}[enhanced,freelance,colback=black,colframe=black,arc=0mm,width=280pt,left=0.5mm,boxrule=0pt,tikz={xshift=15cm,rotate=-15,transform shape}]
\includegraphics[width=270pt]{example-image-b}
\begin{tcolorbox}[colframe=white,colback=white,width=270pt,arc=0mm,boxsep=0pt,boxrule=0mm] % halign=center
\bfseries Blahblah
\end{tcolorbox}
\end{tcolorbox}%
\end{lrbox}
\begin{document}
\adjustbox{valign=c}{\usebox\myboxa}\adjustbox{valign=c}{\hspace*{-40pt}\usebox\myboxb}
\end{document}