![Tcolorbox 作为列表环境中的项目](https://linux22.com/image/391641/Tcolorbox%20%E4%BD%9C%E4%B8%BA%E5%88%97%E8%A1%A8%E7%8E%AF%E5%A2%83%E4%B8%AD%E7%9A%84%E9%A1%B9%E7%9B%AE.png)
我曾用它tcolorbox
作为突出显示某些内容的项目。总体来说效果不错。
梅威瑟:
\documentclass{article}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{adjustbox}
\usepackage[most]{tcolorbox}
%
\begin{document}
%
\begin{itemize}
\item[\textcolor{DarkGreen}{\textbullet}]\adjustbox{valign=t}{%
\begin{tcolorbox}[width=0.934\textwidth,colback={white},title={Title},colbacktitle={DarkGreen},coltitle=white,colframe={DarkGreen}]
\parskip=5pt
Some text
\end{tcolorbox}
}
\item Some Item
\end{itemize}
\end{document}
但是,每当我必须使用另一个列表环境或居中表格/图形时,项目点就会被推入框内。我希望该项目点保持在框外。请告诉我如何解决这个问题。
\documentclass{article}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{adjustbox}
\usepackage[most]{tcolorbox}
%
\begin{document}
%
\begin{itemize}
\item[\textcolor{DarkGreen}{\textbullet}]\adjustbox{valign=t}{%
\begin{tcolorbox}[width=0.934\textwidth,colback={white},title={Title},colbacktitle={DarkGreen},coltitle=white,colframe={DarkGreen}]
\parskip=5pt
Some text
\begin{enumerate}
\item A
\item B
\end{enumerate}
\end{tcolorbox}
}
\item Some Item
\end{itemize}
\end{document}
答案1
在插入框之前开始以下段落:
\documentclass{article}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{adjustbox}
\usepackage[most]{tcolorbox}
%
\begin{document}
%
\begin{itemize}
\item[\textcolor{DarkGreen}{\textbullet}]
\leavevmode %<--------------
\adjustbox{valign=t}{%
\begin{tcolorbox}[width=0.934\textwidth,colback={white},title={Title},colbacktitle={DarkGreen},coltitle=white,colframe={DarkGreen}]
\parskip=5pt
Some text
\begin{enumerate}
\item A
\item B
\end{enumerate}
\end{tcolorbox}
}
\item Some Item
\end{itemize}
\end{document}