\hspace{50pt} 对 tcolorbox 标题无效

\hspace{50pt} 对 tcolorbox 标题无效

请考虑我的最小示例,并告诉我为什么 \hspace{50pt} 命令在框标题中无效。还有其他方法可以在标题中放置一个空的输入字段吗?

\documentclass[12pt,addpoints]{exam}
\usepackage[most]{tcolorbox}% Design für Boxen
\newtcbox{\blank}[1][red]{
on line,
height=2em,
arc=7pt,colback=#1!10!white,colframe=#1!50!black,
before upper={\rule[-3pt]{0pt}{10pt}},boxrule=1pt,
boxsep=0pt,left=6pt,right=6pt,top=2pt,bottom=2pt
}
\begin{document}

\begin{tcbitemize}[raster equal height=rows,raster columns=3,,colframe=red!50!black,colback=red!10!white]
    \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=1, height=4cm,title=\blank{\hspace{50pt}}]
    \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=2, height=4cm, title=\blank{Erläuterung}]
    Text 1
    \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=1, height=4cm,title=\blank{\hspace{50pt}}]
    \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=2, height=4cm, title=\blank{Erläuterung}]
    Text 2
\end{tcbitemize}
\end{document}

在此处输入图片描述

答案1

你应该\hspace{50pt}使用\hspace*{50pt}

\documentclass[12pt,addpoints]{exam}
\usepackage[most]{tcolorbox}% Design für Boxen
\newtcbox{\blank}[1][red]{
on line,
height=2em,
arc=7pt,colback=#1!10!white,colframe=#1!50!black,
before upper={\rule[-3pt]{0pt}{10pt}},boxrule=1pt,
boxsep=0pt,left=6pt,right=6pt,top=2pt,bottom=2pt
}
\begin{document}

\begin{tcbitemize}[raster equal height=rows,raster columns=3,colframe=red!50!black,colback=red!10!white]
    \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=1, height=4cm,
             title=\blank{\hspace*{50pt}}] % <---
    \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=2, height=4cm,
             title=\blank{Erläuterung}]
    Text 1
    \tcbitem[colframe=blue!50!black, colback=blue!10!white, raster multicolumn=1, height=4cm,
             title=\blank{\hspace*{50pt}}] % <---
    \tcbitem[colframe=blue!50!black,colback=blue!10!white,raster multicolumn=2, height=4cm, title=\blank{Erläuterung}]
    Text 2
\end{tcbitemize}
\end{document}

在此处输入图片描述

相关内容