以下 MWE
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[many]{tcolorbox}
\newtcbtheorem{defbox}{Definition}%
{ enhanced,
arc=0mm,
interior style={white},
attach boxed title to top center= {yshift=-\tcboxedtitleheight/2},
fonttitle=\bfseries,
fontupper=\itshape,
colbacktitle=white,coltitle=black,
boxed title style={size=normal,colframe=white,boxrule=0pt}
}
\begin{document}
\begin{defbox}{Theorem Name}
Description
\end{defbox}
\end{document}
但我的编辑也说,这里有一个失控的论证。可能出于同样的原因,在 tcbtheorem 之前有一个不合适的 D。
我的错误日志(我想?)说
main.tex, line 19
Runaway argument?
{
! Paragraph ended before \tcb@theo@label was complete.
<to be read again>
\par
l.19 D
escription
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Extra }, or forgotten \endgroup.
<argument> \tcb@theo@label {\par }
{D}
l.19 D
escription
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
尽管我部分理解什么是失控论点,但我在这里没有找到它,而且我不知道下一步该怎么做。
任何帮助,将不胜感激。
答案1
你错过<prefix>
了\newtcbtheorem
(参见第 340 页)手动的) 和<label>
的论点\begin{defbox}
。
利用<prefix>
和,<label>
您可以引用您的定理\ref{<prefix>:<label>}
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[many]{tcolorbox}
\newtcbtheorem{defbox}{Definition}%
{ enhanced,
arc=0mm,
interior style={white},
attach boxed title to top center= {yshift=-\tcboxedtitleheight/2},
fonttitle=\bfseries,
fontupper=\itshape,
colbacktitle=white,coltitle=black,
boxed title style={size=normal,colframe=white,boxrule=0pt}
}{th}
\begin{document}
\begin{defbox}{Theorem Name}{mytheorem}
Description of theorem~\ref{th:mytheorem}.
\end{defbox}
\end{document}