我正在尝试创建一个图形布局,如下所示
通过llap
和raisebox
,makebox
我成功实现了
有人能帮助/指导我如何获得如第一张图所示的效果吗?也欢迎提出更好的建议。
这是 MWE(直到我所拥有的):
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics[height=1.75in]{example-image-a}\llap{\raisebox{-0.875in}{\includegraphics[height=0.875in]{example-image-c}}}\llap{\raisebox{1.75in}{\includegraphics[height=0.875in]{example-image-c}}}
\includegraphics[height=1.75in]{example-image-b}\llap{\raisebox{-0.875in}{\includegraphics[height=0.875in]{example-image-c}}}\llap{\raisebox{1.75in}{\includegraphics[height=0.875in]{example-image-c}}}\llap{\makebox[\wd1][l]{\raisebox{-.875in}{\includegraphics[height=0.875in]{example-image-c}}}}\llap{\makebox[\wd1][l]{\raisebox{-.875in}{\includegraphics[height=0.875in]{example-image-c}}}}\llap{\makebox[\wd1][l]{\includegraphics[height=0.875in]{example-image-c}}}\llap{\makebox[\wd1][l]{\raisebox{.875in}{\includegraphics[height=0.875in]{example-image-c}}}}\llap{\makebox[\wd1][l]{\raisebox{1.75in}{\includegraphics[height=0.875in]{example-image-c}}}}
\caption{My caption.}
\end{figure}
\end{document}
答案1
这是一个使用棺材的非常简单的版本。请注意,您可以使用一些循环对其进行优化,但我想展示这个概念。
您唯一需要注意的是主图片(A 和 B),因为它们需要具有相同的纵横比(最好是相同的宽度和高度)。
要缩放它,请更改当前显示的尺寸值1in
。
\documentclass{article}
\usepackage{graphicx}
\usepackage{xparse} % you could also do that with xcoffins
\ExplSyntaxOn
\dim_const:Nn \c__raaja_main_height_dim { 1in }
\coffin_new:N \l__raaja_main_coffin
\coffin_new:N \l__raaja_surroundings_coffin
\coffin_new:N \l__raaja_result_coffin
\NewDocumentCommand { \typesetfigures } { m m m }
{
\hcoffin_set:Nn \l__raaja_main_coffin
{
\includegraphics [height=\dim_use:N \c__raaja_main_height_dim] { #1 }
\includegraphics [height=\dim_use:N \c__raaja_main_height_dim] { #2 }
}
\hcoffin_set:Nn \l__raaja_surroundings_coffin
{
\includegraphics [width=\dim_eval:n { \coffin_wd:N \l__raaja_main_coffin / 4 }] { #3 }
}
\coffin_clear:N \l__raaja_result_coffin
\coffin_join:NnnNnnnn \l__raaja_result_coffin { l } { t }
\l__raaja_main_coffin { l } { t }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { hc } { t }
\l__raaja_surroundings_coffin { l } { b }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { hc } { t }
\l__raaja_surroundings_coffin { r } { b }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { l } { t }
\l__raaja_surroundings_coffin { l } { b }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { r } { t }
\l__raaja_surroundings_coffin { l } { b }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { r } { t }
\l__raaja_surroundings_coffin { r } { b }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { hc } { b }
\l__raaja_surroundings_coffin { l } { t }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { hc } { b }
\l__raaja_surroundings_coffin { r } { t }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { l } { b }
\l__raaja_surroundings_coffin { l } { t }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { l } { b }
\l__raaja_surroundings_coffin { r } { t }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { r } { b }
\l__raaja_surroundings_coffin { r } { t }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { l } { t }
\l__raaja_surroundings_coffin { r } { t }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { l } { b }
\l__raaja_surroundings_coffin { r } { b }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { r } { t }
\l__raaja_surroundings_coffin { l } { t }
{ 0pt } { 0pt }
\coffin_attach:NnnNnnnn \l__raaja_result_coffin { r } { b }
\l__raaja_surroundings_coffin { l } { b }
{ 0pt } { 0pt }
\coffin_join:NnnNnnnn \l__raaja_result_coffin { l } { t }
\l__raaja_surroundings_coffin { r } { b }
{ 0pt } { 0pt }
\coffin_join:NnnNnnnn \l__raaja_result_coffin { r } { b }
\l__raaja_surroundings_coffin { l } { t }
{ 0pt } { 0pt }
\coffin_typeset:Nnnnn \l__raaja_result_coffin { l } { t }
{ 0pt } { 0pt }
}
\ExplSyntaxOff
\begin{document}
\begin{figure}
\centering
\typesetfigures{example-image-a}{example-image-b}{example-image-c}
\caption{My caption.}
\end{figure}
\end{document}
答案2
和makebox
的另一种可能性是risebox
overlaps
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\setbox1=\hbox{\includegraphics[height=2cm]{example-image-b}}
\includegraphics[height=2cm]{example-image-b}\llap{\raisebox{-1cm}{\includegraphics[height=1cm]{example-image-c}}}\llap{\makebox[\wd1][l]{\raisebox{2cm}{\includegraphics[height=1cm]{example-image-c}}}}\llap{\raisebox{2cm}{\includegraphics[height=1cm]{example-image-c}}}\llap{\makebox[\wd1][l]{\raisebox{-1cm}{\includegraphics[height=1cm]{example-image-c}}}}\llap{\makebox[4cm][l]{\raisebox{2cm}{\includegraphics[height=1cm]{example-image-c}}}}\llap{\makebox[4cm][l]{\raisebox{1cm}{\includegraphics[height=1cm]{example-image-c}}}}\llap{\makebox[4cm][l]{{\includegraphics[height=1cm]{example-image-c}}}}\llap{\makebox[4cm][l]{\raisebox{-1cm}{\includegraphics[height=1cm]{example-image-c}}}}
\includegraphics[height=2cm]{example-image-a}\llap{\raisebox{2cm}{\includegraphics[height=1cm]{example-image-c}}}\llap{\makebox[\wd1][l]{\raisebox{2cm}{\includegraphics[height=1cm]{example-image-c}}}}\llap{\raisebox{-1cm}{\includegraphics[height=1cm]{example-image-c}}}\llap{\makebox[\wd1][l]{\raisebox{-1cm}{\includegraphics[height=1cm]{example-image-c}}}}\llap{\makebox[0cm][l]{\raisebox{-1cm}{\includegraphics[height=1cm]{example-image-c}}}}\llap{\makebox[0cm][l]{{\includegraphics[height=1cm]{example-image-c}}}}\llap{\makebox[0cm][l]{\raisebox{1cm}{\includegraphics[height=1cm]{example-image-c}}}}\llap{\makebox[0cm][l]{\raisebox{2cm}{\includegraphics[height=1cm]{example-image-c}}}}
\caption{My caption.}
\end{figure}
\end{document}
这使