0

I would like to align text boxes and draw arrows between them. My current attempt is the following:

\documentclass[crop,tikz]{standalone}

\usepackage[most]{tcolorbox}

\begin{document}

\begin{minipage}[t]{\textwidth} \begin{tcolorbox}[colback=white, boxrule=0pt, width=\textwidth] $\quad$\textbf{Work package overview:} \end{tcolorbox}

\begin{minipage}[t]{\textwidth} \begin{tcolorbox}[colback=white, colframe=black, arc=0pt, outer arc=0pt, width=\textwidth, remember as=ci] test \end{tcolorbox} \end{minipage}

\begin{minipage}[t]{0.495\textwidth} \begin{tcolorbox}[colback=white, colframe=black, arc=0pt, outer arc=0pt, width=\textwidth] First text box \end{tcolorbox} \end{minipage} \hfill \begin{minipage}[t]{0.495\textwidth} \begin{tcolorbox}[colback=white, colframe=black, arc=0pt, outer arc=0pt, width=\textwidth, remember as=adm] Second text box\ test \end{tcolorbox} \end{minipage}

\begin{minipage}[t]{\textwidth} \begin{tcolorbox}[colback=white, colframe=black, arc=0pt, outer arc=0pt, width=\textwidth] test \end{tcolorbox} \end{minipage}

\end{minipage} \end{document}

tex result

The result almost looks correct, but if one box is vertically longer than another, it should be aligned with the top border of the neighbouring box instead of the bottom one.

I would like to be able to do this for a variable number of boxes next to each other as well as above and below of each other.

Arrows should be somewhat like that:

https://tex.stackexchange.com/questions/291205/drawing-arrows-using-tikz

the arrows as well as working with remember as (and enhanced?) did something weird with the result. But was not recognised by the tikz arrows.

baxbear
  • 167

1 Answers1

1

It seems odd to use tcolorboxs for this instead of tikz nodes, but here you go:

  • for the top alignment, see tex.stackexchange.com/a/712457/36296
  • for adding arrows, see tex.stackexchange.com/a/391066/36296

\documentclass[crop]{standalone}

\usepackage{tikz} \usetikzlibrary{ext.paths.ortho} \usepackage[most]{tcolorbox}

\tcbset{enhanced}

\begin{document}

\noindent\begin{minipage}[t]{\textwidth} \begin{tcolorbox}[colback=white, boxrule=0pt, width=\textwidth,box align=top] $\quad$\textbf{Work package overview:} \end{tcolorbox}

\begin{minipage}[t]{\textwidth} \begin{tcolorbox}[colback=white, colframe=black, arc=0pt, outer arc=0pt, width=\textwidth, remember as=ci,box align=top,remember as=NodeName1] test \end{tcolorbox} \end{minipage}

\begin{minipage}[t]{0.495\textwidth} \begin{tcolorbox}[colback=white, colframe=black, arc=0pt, outer arc=0pt, width=\textwidth,box align=top] First text box \end{tcolorbox} \end{minipage} \hfill \begin{minipage}[t]{0.495\textwidth} \begin{tcolorbox}[colback=white, colframe=black, arc=0pt, outer arc=0pt, width=\textwidth, remember as=adm,box align=top,remember as=NodeName2] Second text box\ test \end{tcolorbox} \end{minipage}

\begin{minipage}[t]{\textwidth} \begin{tcolorbox}[colback=white, colframe=black, arc=0pt, outer arc=0pt, width=\textwidth,box align=top] test \end{tcolorbox} \end{minipage}

\end{minipage}\hspace{1cm}

\begin{tikzpicture}[remember picture,overlay] \draw[red,->,ultra thick] (NodeName1.east) -|-[distance=1cm] (NodeName2.east); \end{tikzpicture} \end{document}

enter image description here

  • It seems odd to use tcolorboxs for this instead of tikz nodes found an example on stackexchange using it - that's why I chose this attempt, no additional particular reason – baxbear Mar 12 '24 at 13:20