Math & ScienceMissing \endscname in tcolorbox theorem

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Francesco_Luligo
Posts: 1
Joined: Sat Jun 14, 2025 5:03 pm

Missing \endscname in tcolorbox theorem

Post by Francesco_Luligo »

Hello, I don´t know how to fix this error. I read it can be due to using '\' inside labels, which I didn´t.

Is it because I can´t use equations inside the theorem? That would make them quite useless for me. They print okay alright. But my code is full of this kind of errors, both in overleaf and TexStudio ( I´ve updated the packages to their newest version in MikTex).

Also, if I don´t include the command '\leavevmode' the theorem leaves out from the output the first letter of my text, How can I fix that directly from the definition of the theorem?

MWE:

Code: Select all

\documentclass[oneside]{book}

\usepackage[spanish]{babel}
\usepackage{amsmath, amssymb, amsfonts}
\usepackage[most]{tcolorbox} % Cajas
\tcbuselibrary{breakable, skins, listings, theorems}

\newcommand{\runo}{\mathbf{r_1}}
\newcommand{\rdos}{\mathbf{r_2}}
\newcommand{\rv}{\mathbf{r}}

\newcounter{importante}
\newtcbtheorem[use counter=importante]{importante}{¡Importante!}{
colback=magenta!3!white, colframe=magenta!80!black, fonttitle=\bfseries,
colbacktitle=magenta!15!white, coltitle=black,
enhanced, breakable, attach boxed title to top center = {yshift=-2mm},
title after break = {}, boxed title style={colframe=magenta!80!black, arc=3mm},
fontupper=\normalfont, before upper={\parindent10pt}
}{importante}

\begin{document}
\begin{importante}{Desacople}
\leavevmode Al resolver este Lagrangiano las ecuaciones de movimiento y las órbitas que hallamos son para la distancia entre los dos cuerpos, es decir, el cambio de $\rv = \rdos-\runo$. Entonces, ¿cómo hallamos la ecuación de movimiento para cada uno de los cuerpos?

Una vez hallado $\rv$ es sencillo sustituir en los pasos $2$ y $3$ de la reducción para hallar $\runo$ y $\rdos$.
\end{importante}
\end{document}
Output:
Missing \endcsname inserted
<to be read again>
\unhbox
l.12 ...idb@x }{{1}{1}{Desacople}{importante.1}{}}

The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

Extra \endcsname.
\@newl@bel ... \bbl@tempa \csname #1@#2\endcsname
\def \bbl@tempb {#3}\@safe...
l.12 ...idb@x }{{1}{1}{Desacople}{importante.1}{}}

I'm ignoring this, since I wasn't doing a \csname.
Please help me, I don´t understand this package :(

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Re: Missing \endscname in tcolorbox theorem

Post by Stefan Kottwitz »

Hi Francesco,

the tcolorbox theorem just requires 2 mandatory arguments (title and reference label), like

Code: Select all

\begin{importante}{Desacople}{desacople}
Stefan
LaTeX.org admin
Post Reply