2

I have the following issue of first sentence characters skipping to numbering box :

Like the O in Defintion 1.6.2

The text start with : " On appelle " which explains the origin of displayed charachters.

enter image description here

The used environment :

    \usepackage{amsthm}
    \usepackage{tcolorbox}
    \tcbuselibrary{theorems}
    \newtcbtheorem[number within=section]{Definition}{Definition}{
        colback=orange!5,
        colframe=orange!35!black,
        fonttitle=\bfseries,
        enhanced,
        sharp corners,
        attach boxed title to top left={xshift=3mm, yshift=-2mm},
        boxed title style={size=small, colframe=orange!35!black},
        separator sign none,
        before lower={\par\noindent}, % Ensure content starts on a new line
    }{def}


\begin{document}

\begin{Definition}[Lien complet]
On appelle lien complet, ou complete linkage, la distance entre deux clusters définie par:
$$
d_{\text {complet }}\left(\mathcal{C}_{k}, \mathcal{C}_{l}\right)=\max _{(\vec{u}, \vec{v}) \in \mathcal{C}_{k} \times \mathcal{C}_{l}} d(\vec{u}, \vec{v}) .
$$
Une approche intermédiaire consiste à considérer la distance moyenne entre un élément du premier cluster et un élément du deuxième. C'est le lien moyen.
\end{Definition}

\begin{Definition}[Lien moyen]
On appelle lien moyen, ou average linkage, la distance entre deux clusters définie par:
$$
d_{\text {moyen }}\left(\mathcal{C}_{k}, \mathcal{C}_{l}\right)=\frac{1}{\left|\mathcal{C}_{k}\right|} \frac{1}{\left|\mathcal{C}_{l}\right|} \sum_{\vec{u} \in \mathcal{C}_{k}} \sum_{\vec{v} \in \mathcal{C}_{l}} d(\vec{u}, \vec{v})
$$
Cette distance est aussi parfois appelée UPGMA pour Unweighted Paired Group Method with Arithmetic mean.

\end{Definition}
\end{document}
2
  • 1
    Please read up on whart \newtcbtheorem generates. The env takes a mandatory argument in {}, as you did not give any it takes the first letter.
    – daleif
    Dec 7, 2023 at 13:10
  • Unrelated d_{\text{moyen}} does not do what you think it does. You might want to use \mathrm or \textup instead of \text. Why Try this \textit{text $\text{text}$}
    – daleif
    Dec 7, 2023 at 13:12

2 Answers 2

3

The syntax of your definition is

\begin{Definition}{Insert the title here}{label}
...
\end{Definition}

If you want a definition without title, you can leave the {} empty, but you cannot write the definition without it. Same for the label.

Full code:

\documentclass{article}

\usepackage{amsthm}
\usepackage[most]{tcolorbox}
\tcbuselibrary{theorems}

\newtcbtheorem[number within=section]{Definition}{Definition}{
    colback=orange!5,
    colframe=orange!35!black,
    fonttitle=\bfseries,
    enhanced,
    sharp corners,
    attach boxed title to top left={xshift=3mm, yshift=-2mm},
    boxed title style={size=small, colframe=orange!35!black},
    separator sign none,
    before lower={\par\noindent}, % Ensure content starts on a new line
}{def}

\begin{document}

\begin{Definition}{Title}{label}
On appelle lien complet, ou complete linkage, la distance entre deux clusters définie par:
\[
d_{\text {complet }}\left(\mathcal{C}_{k}, \mathcal{C}_{l}\right)=\max _{(\vec{u}, \vec{v}) \in \mathcal{C}_{k} \times \mathcal{C}_{l}} d(\vec{u}, \vec{v}) .
\]
Une approche intermédiaire consiste à considérer la distance moyenne entre un élément du premier cluster et un élément du deuxième. C'est le lien moyen.
\end{Definition}

\begin{Definition}{}{AnotherLabel}
On appelle lien moyen, ou average linkage, la distance entre deux clusters définie par:
\[
d_{\text {moyen }}\left(\mathcal{C}_{k}, \mathcal{C}_{l}\right)=\frac{1}{\left|\mathcal{C}_{k}\right|} \frac{1}{\left|\mathcal{C}_{l}\right|} \sum_{\vec{u} \in \mathcal{C}_{k}} \sum_{\vec{v} \in \mathcal{C}_{l}} d(\vec{u}, \vec{v})
\]
Cette distance est aussi parfois appelée UPGMA pour Unweighted Paired Group Method with Arithmetic mean.
\end{Definition}
\end{document}

enter image description here

4
  • 1
    "If you want a Definition with title" should probably be "If you want a Definition without title".
    – campa
    Dec 7, 2023 at 13:18
  • 1
    @campa Indeed! Thx! Dec 7, 2023 at 13:20
  • yes , this is exactly what i just tried. For curiosity , what is the difference between title and label in \begin{Definition}{Title}{label} ?
    – Tou Mou
    Dec 7, 2023 at 13:22
  • @TouMou The label is the key used to reference the definition, e.g. if you want to use \ref{label} somewhere in your text to link to the theorem. You should NOT use the complete title for this. Avoid special characters like spaces in labels. Dec 7, 2023 at 13:23
0

Just add title for each definition and issue will be solved :

   \usepackage{amsthm}
    \usepackage{tcolorbox}
    \tcbuselibrary{theorems}
    \tcbuselibrary{skins}
    \newtcbtheorem[number within=section]{Definition}{Definition}{
        colback=orange!5,
        colframe=orange!35!black,
        fonttitle=\bfseries,
        enhanced,
        sharp corners,
        attach boxed title to top left={xshift=3mm, yshift=-2mm},
        boxed title style={size=small, colframe=orange!35!black},
        separator sign none,
        before lower={\par\noindent}, % Ensure content starts on a new line
    }{def}


\begin{document}

\begin{Definition}{lien complet}{}
On appelle lien complet, ou complete linkage, la distance entre deux clusters définie par:
$$
d_{\text {complet }}\left(\mathcal{C}_{k}, \mathcal{C}_{l}\right)=\max _{(\vec{u}, \vec{v}) \in \mathcal{C}_{k} \times \mathcal{C}_{l}} d(\vec{u}, \vec{v}) .
$$
Une approche intermédiaire consiste à considérer la distance moyenne entre un élément du premier cluster et un élément du deuxième. C'est le lien moyen.
\end{Definition}

\begin{Definition}{lien moyen}{}
On appelle lien moyen, ou average linkage, la distance entre deux clusters définie par:
$$
d_{\text {moyen }}\left(\mathcal{C}_{k}, \mathcal{C}_{l}\right)=\frac{1}{\left|\mathcal{C}_{k}\right|} \frac{1}{\left|\mathcal{C}_{l}\right|} \sum_{\vec{u} \in \mathcal{C}_{k}} \sum_{\vec{v} \in \mathcal{C}_{l}} d(\vec{u}, \vec{v})
$$
Cette distance est aussi parfois appelée UPGMA pour Unweighted Paired Group Method with Arithmetic mean.

\end{Definition}
\end{document}

This displays something like :

enter image description here

5
  • 1
    You are missing the skins tcb library. Without it, you cannot use the enhanced option. Dec 7, 2023 at 13:24
  • I added \tcbuselibrary{skins}
    – Tou Mou
    Dec 7, 2023 at 13:32
  • Please also remove the full title from the labels. Things like spaces are really not that good of an idea in labels... Dec 7, 2023 at 13:35
  • is it Ok now , or shoud i replace \begin{Definition}{lien moyen}{} by \begin{Definition}{lien moyen}
    – Tou Mou
    Dec 7, 2023 at 13:46
  • 1
    \begin{Definition}{lien moyen} would be wrong. You must not leave out mandatory arguments. That's exactly the problem in your question. Instead of leaving it empty, choose a short key which is easy to remember and allows you to reference your theorem. Dec 7, 2023 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .