2

I have two images side by side in a tcolorbox, one horizontal and one vertical with an empty dotted line below each one. I would like to "push down" the line in the second (right) image so it is aligned with the first one in the left side, preferably without moving the right image upwards. It seems that \vfill, \vspace{\fill} don't work. Is there a simple "automatic" way to do it?

\documentclass[12pt]{article}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{graphicx}

\begin{document}
    \begin{tcolorbox}[sidebyside,righthand width=0.5\linewidth]
        
        \centering\includegraphics[width=0.9\linewidth,angle=90]{example-image-a}
        
        \dotfill
        
        \tcblower
        
        \centering\includegraphics[width=0.7\linewidth]{example-image-b}
        
        \vfill
        
        \dotfill
        
    \end{tcolorbox}
\end{document}

output

1 Answer 1

2

With sidebyside align=bottom

EDIT : With totalheight instead of width, we can calculate the vertical space to insert before the last line

\documentclass[12pt]{article}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{graphicx}


\newlength\Aheight 
\newlength\Bheight
\newcommand{\myA}{%
\includegraphics[totalheight=5cm,angle=90]{example-image-a}
}%
\newcommand{\myB}{%
\includegraphics[totalheight=4cm]{example-image-b}
}%
\settoheight{\Aheight}{\myA}
\settoheight{\Bheight}{\myB}

\begin{document}

\begin{tcolorbox}[sidebyside,sidebyside align=bottom,righthand width=0.5\linewidth]

    \centering\myA
    %\rule{1pt}{\the\Aheight}
    % \the\Aheight

    \dotfill
    \tcblower
    \centering\myB
    %\rule{1pt}{\the\Bheight}
    % \the\Bheight

    \vspace{\dimexpr (\Aheight-\Bheight)/2}

    \dotfill
\end{tcolorbox}
\end{document}   

enter image description here

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .