3

This question already has an answer here:

The following 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}

Produces the following (cropped) output An almost correct output

But my editor also says that there is a runaway argument. Likely for the same reason, there is an out of place D before the tcbtheorem.

My error log (I think?) says

 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$}'.

While I partially understand what a runaway argument is, I haven't found it here, and I don't know what to do next.

Any help would be appreciated.

marked as duplicate by user31729 Feb 7 at 15:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5

You are missing the <prefix> argument of \newtcbtheorem (see page 340 of the manual) and the <label> argument of \begin{defbox}.

With the <prefix> and <label> you can reference your theorem with \ref{<prefix>:<label>}:

enter image description here

\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}
  • :-) I thinked that the answer was that of Christian of the black forest :-) Very good. – Sebastiano Feb 6 at 21:17
  • @Sebastiano Ooh :) He's the expert, I just searched the manual :) – Phelype Oleinik Feb 6 at 21:19
  • LOL:-) In fact, I appreciate Christian very much as man and as LaTeX expert. – Sebastiano Feb 6 at 21:21
  • @Sebastiano: This is a duplicate of tex.stackexchange.com/questions/423741/… -- I just close-hammered it ;-) – user31729 Feb 7 at 15:28
  • @ChristianHupfer Who'd you hammer? You're so quiet and so funny. As you can see, I always compliment you even on the secret ahahah. – Sebastiano Feb 7 at 18:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.