以下代码失败并出现错误
! LaTeX Error: Command \mybox already defined.
Or name \end... illegal, see p.192 of the manual.
\usepackage[most]{tcolorbox}
\newtcolorbox{mybox}[2][]{%
colback=bg,
colframe=blue!75!black,
fonttitle=\bfseries,
coltitle=blue!75!black,
colbacktitle=bg,
enhanced,
attach boxed title to top left={yshift=-1.2mm, xshift=2mm},
title=#2,
#1}
%--------------------
\usepackage{fancybox} %pour faire l'encadrement
\newcommand{\mybox}[1]{
\setlength{\fboxsep}{7pt}
\begin{center}
\shadowbox{#1}
\end{center}}
%--------------------
请你帮助我好吗
答案1
您只需将 \mybox 替换为例如 \cadre 即可:
\usepackage[most]{tcolorbox}
\newtcolorbox{mybox}[2][]{%
colback=bg,
colframe=blue!75!black,
fonttitle=\bfseries,
coltitle=blue!75!black,
colbacktitle=bg,
enhanced,
attach boxed title to top left={yshift=-1.2mm, xshift=2mm},
title=#2,
#1}
%--------------------
\usepackage{fancybox} %pour faire l'encadrement
\newcommand{\cadre}[1]{
\setlength{\fboxsep}{7pt}
\begin{center}
\shadowbox{#1}
\end{center}}
%--------------------