qinglee / wrapstuff

Wrapping text around stuff
https://ctan.org/pkg/wrapstuff
LaTeX Project Public License v1.3c
11 stars 4 forks source link

displayed equation in theorem like environment cause error #20

Open DailyShana opened 1 month ago

DailyShana commented 1 month ago

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}
muzimuzhi commented 1 month ago

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}
DailyShana commented 1 month ago

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}