考虑这个例子:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{scope}[local bounding box=scope1]
\node(a) at (0.0, 0.0){\includegraphics[width=1.0\paperwidth]{example-image-a}};
\node(a) at (a.east)[anchor=west]{\includegraphics[width=0.5\paperwidth]{example-image-b}};
\end{scope}
\begin{scope}[at (scope1.south), anchor=north, local bounding box=scope2]
\node(c) at (scope2.south west)[anchor=north west]{\includegraphics[width=0.8\paperwidth]{example-image-c}};
\node(d) at (c.east)[anchor=west]{\includegraphics[width=0.5\paperwidth]{example-image}};
\end{scope}
\end{tikzpicture}
\end{document}
输出为:
我想让范围 2 中的图像对称地居中吗?
我应该修复什么?
答案1
如果我没理解错的话,居中取决于您要包含的图片的宽度差异。在您的示例中,这个差异是0.2\paperwidth
,所以我使用这个值的一小部分作为第二行图片的移位参数。
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\node(a) at (0,0) {\includegraphics [width=1.0\paperwidth] {example-image-a}};
\node(b) at (a.east) [anchor=west] {\includegraphics [width=0.5\paperwidth] {example-image-b}};
\node(c) at ($ (a.south west) + (0.05\paperwidth,0) $) [anchor=north west] {\includegraphics [width=0.8\paperwidth] {example-image-c}};
\node(d) at ($ (c.east -| b.south) - (0.05\paperwidth,0) $) {\includegraphics [width=0.5\paperwidth] {example-image}};
\end{tikzpicture}
\end{document}
我也跳过了你的scope
环境,所以也许有人对你的问题有更好的解决方案。