4

I'm using the package tcolorboxwith the theorems library and it's giving me the following problem:

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{fourier}

\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[number within=section]{teorema}{Teorema}%
{colback=black!5,colframe=black!35!black,fonttitle=\bfseries}{th}

\begin{document}
\section{MyTheorem}
\begin{teorema}{MyTheorem}
This text loses one characther.
\end{teorema}
\end{document}

And when I type between the \begin{teorema} and \end{teorema}, it loses the first character. And if try to use the \input command in that environment I get a error related to:

missing \endcsname inserted.

One solution is typing two times the first letter of my text... but I don't like that.

4
  • Related: (See the answer and comments): tex.stackexchange.com/questions/415369/…
    – user31729
    Mar 28, 2018 at 23:06
  • There is also a missing \end{teorema} in your code
    – user31729
    Mar 28, 2018 at 23:09
  • Thank you, i will give another read to the documentation.
    – kraDracsO
    Mar 28, 2018 at 23:29
  • It's an overwhelming documentation, however ;-)
    – user31729
    Mar 28, 2018 at 23:44

1 Answer 1

5

The theorems from tcolorbox have an 2nd mandatory argument which is meant for the label. If this argument is not specified, TeX/LaTeX eats up the first token it finds, i.e. the first character of the following text -- in my point of view this 2nd mandatory label argument feature is little bit annoying, however.

Solution: Even if no label is wanted, use {} as 2nd argument.

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{fourier}

\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[number within=section]{teorema}{Teorema}%
{colback=black!5,colframe=black!35!black,fonttitle=\bfseries}{th}

\begin{document}
\section{MyTheorem}
\begin{teorema}{MyTheorem}{}
This text loses one characther.
\end{teorema}
\end{document}

You must log in to answer this question.

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