1
\documentclass[12pt,a4paper]{article} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{positioning, calc} \begin{document} \begin{tikzpicture}[on grid] \node[inner sep=0pt] (imga) at (0, 0) {\includegraphics[width=.35\textwidth]{example-image-a}}; \node[right = 10 of imga, inner sep=0pt] (imgb) {\includegraphics[width=.25\textwidth]{example-image-b}}; \node[below = 5 of imga, inner sep=0pt] (imgc) {\includegraphics[width=.25\textwidth]{example-image-c}}; \node[below = 5 of imgb, inner sep=0pt] (imge) {\includegraphics[width=.25\textwidth]{example-image}}; \node[inner sep=0pt] (imgd) at ($(imgc)!0.5!(imge)$) {\includegraphics[width=.25\textwidth]{example-image}}; \end{tikzpicture} \end{document} 

The code draws a tikzpicture like:

enter image description here

Image A and image C are of different dimension. Is there a way to align image A and image C horizontally so that the left margin of A and left margin of B are at the same line?

Hopefully, [on grid] doesn't have to be changed as I rely on it for other nodes' positioning.

1
  • 1
    What about \node[below = 5 of imga.west, inner sep=0pt, anchor=west] (imgc) {\includegraphics[width=.25\textwidth]{example-image-c}};? Commented Feb 7, 2021 at 13:55

1 Answer 1

0

With set anchor to west and make node distanco also from west:

\node[below = 5 of imga.west, anchor=west] (imgc) {\includegraphics[width=.25\textwidth]{example-image-c}}; 
\documentclass[12pt,a4paper]{article} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{calc, positioning} \begin{document} \begin{tikzpicture}[every node/.style ={inner sep=0pt}, on grid] \node (imga) {\includegraphics[width=.35\textwidth]{example-image-a}}; \node[right = 10 of imga] (imgb) {\includegraphics[width=.25\textwidth]{example-image-b}}; \node[below = 5 of imga.west, anchor=west] (imgc) {\includegraphics[width=.25\textwidth]{example-image-c}}; % <--- \node[below = 5 of imgb, inner sep=0pt] (imge) {\includegraphics[width=.25\textwidth]{example-image}}; \node[inner sep=0pt] (imgd) at ($(imgc)!0.5!(imge)$) {\includegraphics[width=.25\textwidth]{example-image}}; \end{tikzpicture} \end{document} 

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.