# Using tcolorbox along with tikz

I want to use tcolorbox along with tikz. Need some nodes with tcolorbox joined with arrows.

\documentclass[border=10pt]{standalone}

\usepackage{enumitem}
\setlist[itemize]{leftmargin=*, itemsep = 0em}
\usepackage[none]{hyphenat}

\usepackage{tikz}
\usetikzlibrary{matrix, shapes, arrows, positioning}

\usepackage[most]{tcolorbox}

\begin{document}

\newtcolorbox{GreenBox}[1]{colback = green!5!white,
colframe = green!75!black, arc = 4mm, outer arc = 1mm, fonttitle = \huge\textbf, title = #1}

\begin{GreenBox}{\textit{ASD}}

\begin{tikzpicture}

\node [text width = 6cm] at (0, 0) (node1) {
\begin{GreenBox}{\textit{AS}}
\begin{itemize}
\item A
\item B
\end{itemize}
\end{GreenBox}
};

\node [text width = 6cm, right of = node1]  (node2) {
\begin{GreenBox}{\textit{ASD}}
\begin{itemize}
\item AS
\item BC
\end{itemize}
\end{GreenBox}
}

%\node at (0,0) (node1) [shape=rectangle,fill=green] {box1}

\end{tikzpicture}

\end{GreenBox}

\end{document}

• Tikz instructions always end with ; please correct your code. For the rest, can you make a freehand drawing of what you would like to get? – AndréC Jun 27 '20 at 8:51
• That's more like a mindmap with square boxes. I never did it but tex.stackexchange.com/a/52817/38080 could give some starting point – Rmano Jun 27 '20 at 11:07
• – Rmano Jun 27 '20 at 11:11

tcolorbox with enhanced skin can be remember(ed) as to be referenced later on inside a tikzpicture. This way there's no need for a tcolorbox inside a TikZ node unless you need special positioning between boxes.

Following code shows an example with OP's code. GreenBox definition has been changed to accept an optional parameter and making box title mandatory.

\documentclass[border=10pt]{standalone}

\usepackage{enumitem}
\setlist[itemize]{leftmargin=*, itemsep = 0em}
\usepackage[none]{hyphenat}

\usepackage{tikz}
\usetikzlibrary{matrix, shapes, arrows, positioning}

\usepackage[most]{tcolorbox}

\begin{document}

\newtcolorbox{GreenBox}[2][]{%
enhanced,
colback = green!5!white,
colframe = green!75!black,
arc = 4mm, outer arc = 1mm,
fonttitle = \huge\slshape\textbf,
title = #2,
#1}

\begin{GreenBox}{ASD}
\begin{GreenBox}[width=5cm, remember as=box1, nobeforeafter]{AS}
\begin{itemize}
\item A
\item B->
\end{itemize}
\end{GreenBox}
\hfill
\begin{GreenBox}[width=5cm, remember as=box2, nobeforeafter]{ASD}
\begin{itemize}
\item AS
\item BC
\end{itemize}
\end{GreenBox}
\end{GreenBox}

\begin{tikzpicture}[overlay, remember picture, line width=1mm, draw=red]
\draw[->] (box1)--(box2);
\end{tikzpicture}

\end{document}


• Thanks @Ignasi for very helping answer. Please see my edits and guide me accordingly. Thanks – MYaseen208 Jun 27 '20 at 10:26
• After your edits, the question is completely different. Please make a new question and provide some initial code to work with. Don't leave all the work to us. – Ignasi Jun 27 '20 at 10:34
• Thanks @Ignasi for your help. As you suggested I tried and asked a new question here. – MYaseen208 Jun 27 '20 at 11:43