3

I have a trivial theorem that is like:

\begin{Prop}
\[1+1=2\]
\begin{proof}
Trivial.
\end{proof}
\end{Prop}

and my overleaf marks the "Trivial" red and says:

Something's wrong--perhaps a missing \item.

Everything works as intended, but the red mark just won't go.

Then, I tried adding some comment to the proposition

\begin{Prop}
This statement is true:
\[1+1=2\]
\begin{proof}
Trivial.
\end{proof}
\end{Prop}

and the red mark is gone.

Why is this?

This is the code to duplicate the problem:

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mdframed}

\newtheorem{proposition}{Proposition}
\newmdtheoremenv{Prop}{Proposition}

\surroundwithmdframed{proof}

\begin{document}

\begin{Prop}
    \[1+1=2\]
    \begin{proof}
        Trivial.
    \end{proof}
\end{Prop}

\end{document}

The result:

enter image description here

The error:

enter image description here

Also, if I remove the \usepackage{amsmath}, the line would be fine. This is also strange.

3
  • 5
    well I wished chatgpt would also mention that one always need a complete example to text code, not only some snippet from the header. Generally: use tcolorbox instead of mdframed. Much more modern and stable. Commented Jun 26 at 18:21
  • 1
    remove all the code unrelated to the question, but make a small complete example that generates the error message that you are asking about. Commented Jun 26 at 18:28
  • thanks for deleting the unnecessary code, but we still don't have code we can use to reproduce the problem. We should be able to copy-paste-compile your code to reproduce the problem you want help with.
    – cfr
    Commented Jun 27 at 5:15

1 Answer 1

2

As Ulrike told in a comment, I would recommend to use tcolorbox instead of mdframed:

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{tcolorbox}
\newtheorem{Prop}{Proposition}
\tcolorboxenvironment{Prop}{colback=white}
\tcolorboxenvironment{proof}{colback=white}
\begin{document}

\begin{Prop}
    \[1+1=2\]
    \begin{proof}
        Trivial.
    \end{proof}
\end{Prop}

\end{document}

enter image description here

Instead of first defining the new theorem environment using \newtheorem and afterwards converting it into a tcolorbox environment using \tcolorboxenvironment, you can alternatively directly define a boxed theorem environment using \NewTcbTheorem. Please, see the tcolorbox manual for more information.

You must log in to answer this question.

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