I want to combine the column 3&4 of the first row in a tcolorbox tcbitemize envierement. Please see my code for details:
But the typeset is not what I want.
I think something is wrong in using the option "code=", but I really don't know the cause.
Anyone can help me with this issue? Thanks in advance
]1
\documentclass[12pt,a4paper]{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable,raster}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\tcbset{%
force width/.code={\tcbset@late@options{width={#1}}},
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\columnnumbers}{} %column numbers to be merged
\newlength{\mergewidth}{} %the cell width after merged
\newcommand{\mydata}{
\renewcommand{\columnnumbers}{2} %column 3 and 4 will be merged
\setlength{\mergewidth}{0.7\textwidth} %the cell width will be 0.7\textwidth
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\hmerge}[3][]{%
\tcbitem[%
code={\mydata},
raster multicolumn=\columnnumbers,
force width=\mergewidth,
#1]#3
}%\hmerge
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tcolorbox}
[enhanced,boxrule=3pt,left=0pt,boxsep=0pt,right=0pt,sharp corners,
width=\textwidth]
\begin{tcbitemize}
[raster force size=false,raster columns=4,sharp corners,
boxrule=3pt,
raster width=\textwidth,
raster column skip=0pt,
raster row skip=0pt,
raster column 1/.style={width=0.1\textwidth},
raster column 2/.style={width=0.2\textwidth},
raster column 3/.style={width=0.3\textwidth},
raster column 4/.style={width=0.4\textwidth},
]
\tcbitem some text
\tcbitem some text
\hmerge {}{This should be "merged cell" of column number 3\&4 in row number 1. But now it is in the second row. And there is an unwanted skip between row 1 and row 2}
\tcbitem some text
\end{tcbitemize}
\end{tcolorbox}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}