To replicate the following picture (namely the evenly laid nodes a, b, c, d -- and I could want in the future to even have multiple rows, instead of just one) one can do one of multiple things: enter image description here

  1. Manually hardcode the coordinates of each one of the nodes (this is what I did, for I don't know tikz / latex that well);
  2. To create an invisible arrow from left to right and then make use of pos=0, pos=0.33, pos=0.66 and pos=1 to evenly display the nodes across the row;
  3. Use a matrix? I think this would work as long as I could set the matrix width / height and as long as nodes would actually get evenly laid out. I don't know if this is doable?
  4. Is there any other technique? Maybe by using trees?

This is a fairly known situation, so I'm looking for the best way of approaching this.



Yes, a matrix allows you to do that. I added a style for the roof such that you can entirely focus on the contents of the matrix.

\begin{tikzpicture}[roof/.style={path picture={
\draw[#1] ([xshift=\pgflinewidth/2]path picture bounding box.south west)
|- ([xshift=-\pgflinewidth/2,yshift=-\pgflinewidth/2]path picture bounding box.north east)
-- ([xshift=-\pgflinewidth/2]path picture bounding box.south east);
 \matrix[matrix of nodes,nodes in empty cells,{nodes={text width=1cm,align=center}},
 roof=dashed,label={[anchor=south west]north west:Artifactory/Nexus}]
 { a & b & c & d \\
  & & & \\ };

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.