wrapstuff icon indicating copy to clipboard operation
wrapstuff copied to clipboard

displayed equation in theorem like environment cause error

Open DailyShana opened this issue 2 years ago • 2 comments

MME:

\documentclass{ctexart}
\usepackage{wrapstuff}
\usepackage{graphicx}
\usepackage{amsthm}

\newtheorem*{thm}{定理}

\begin{document}

\begin{wrapstuff}[l]
\includegraphics[width=4cm]{example-image.pdf}
\end{wrapstuff}

\begin{thm}\noindent
  勾股定理:
  \[a^2+b^2=c^2\]
  西方叫毕达哥拉斯定理 %no error if this line do not exist or this line will not be wrapped
\end{thm}
\end{document}

log:

! Extra }, or forgotten \endgroup.
\par ...m \@noitemerr {\@@par }\fi \else {\@@par }
                                                  \fi 
l.42 \end{thm}

DailyShana avatar Jun 01 '24 12:06 DailyShana

A code line like \newtheorem{thm}{Theorem} was missing from the original example.

As you mentioned in tex comment, the text after displayed equation triggers the error.

A slightly simplified example:

\documentclass{article}
\usepackage{wrapstuff}

\begin{document}

\begin{wrapstuff}[l]
  \fbox{\phantom{\rule{3cm}{2cm}}}
\end{wrapstuff}

\begin{trivlist}
  \item[]
  \[ a^2+b^2=c^2 \]
  abc
\end{trivlist}

\end{document}

muzimuzhi avatar Jun 03 '24 15:06 muzimuzhi

Yes, I forgot \newtheorem. proof environment will have error without the line after displayed equation, probably because of the implicit qed symbol.

\documentclass{ctexart}
\usepackage{wrapstuff}
\usepackage{graphicx}
\usepackage{amsthm}

\begin{document}

\begin{wrapstuff}[l]
\includegraphics[width=4cm]{example-image.pdf}
\end{wrapstuff}

\begin{proof}
  \[a^2+b^2=c^2\]
\end{proof}

\end{document}

DailyShana avatar Jun 05 '24 09:06 DailyShana