我想像这样对齐三幅图像,仅指定总高度,如下所示:
______ _________
| | | |
| | | |
| | |_________|
| | _________
| | | |
|______| |_________|
这是我迄今为止尝试过的:
\documentclass{standalone}
\usepackage{graphicx}
\usepackage{adjustbox}
\begin{document}
\includegraphics[height=10cm]{img/detectors-field.pdf}%
\adjustbox{height=10cm}{%
\begin{minipage}{10cm}%
\includegraphics[width=10cm]{img/coax_pic.jpg} \\
\includegraphics[width=10cm]{img/bege_pic.jpg}%
\end{minipage}%
}%
\end{document}
但我得到了这个结果:
为什么在这种情况下不起作用\adjustbox
?实现我想要的定位的正确方法是什么?
答案1
在原帖作者作出一些澄清之后,我修改了我的答案以适应情况。
语法是
\makecomposite{<left-img>}{<top-right-img>}{<bottom-right-img>}{<composite-height>}
妇女权利委员会:
\documentclass{article}
\usepackage{graphicx}
\usepackage{stackengine,scalerel}
\newcommand\makecomposite[4]{%
\savestack\imgstack{\stackengine{0pt}{\includegraphics[width=1in]{#3}}
{\belowbaseline[0pt]{\includegraphics[width=1in]{#2}}}
{O}{l}{F}{F}{S}}%
\savestack\imgcomposite{\scalerel{\includegraphics{#1}}{\imgstack}}%
\scaleto{\imgcomposite}{#4}
}
\parskip 1em
\begin{document}
\makecomposite{example-image-a}{example-image-b}{example-image-10x16}{5cm}
\makecomposite{example-image-a}{example-image-b}{example-image-golden}{3cm}
\makecomposite{example-image-a}{example-image-b}{example-image-c}{3cm}
\end{document}
答案2
这仅当右侧的两幅图像具有相同的宽度时才有效(您可以width
先使用它们来均衡它们。
在示例中,我同时使用width
和height
来获得不同的纵横比。
其想法是将左边的图像和右边两幅图像的组合缩放到相同的高度,然后将整体调整到所需的目标高度。
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htp]
\centering
\resizebox{!}{6cm}{% 6cm is the target height
\resizebox{!}{1cm}{% 1cm is arbitrary
\includegraphics[height=10cm,width=4cm]{example-image}%
}%
\resizebox{!}{1cm}{%
\renewcommand{\arraystretch}{0}%
\begin{tabular}[b]{@{}c@{}}
\includegraphics[height=6cm,width=8cm]{example-image}\\
\includegraphics[height=3cm,width=8cm]{example-image}
\end{tabular}%
}%
}
\caption{Three images}
\end{figure}
\end{document}
如果要填充目标宽度:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htp]
\centering
\resizebox{0.8\textwidth}{!}{% 0.8\textwidth is the target width
\resizebox{!}{1cm}{% 1cm is arbitrary
\includegraphics[height=10cm,width=4cm]{example-image}%
}%
\resizebox{!}{1cm}{%
\renewcommand{\arraystretch}{0}%
\begin{tabular}[b]{@{}c@{}}
\includegraphics[height=6cm,width=8cm]{example-image}\\
\includegraphics[height=3cm,width=8cm]{example-image}
\end{tabular}%
}%
}
\caption{Three images}
\end{figure}
\end{document}