如何将定理插入到 tcolorbox?

如何将定理插入到 tcolorbox?

我尝试插入一个tcolorbox没有标题的定理。

以下是 MWE (与 LyX 合作):

% Preview source code

%% LyX 2.3.2-2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[a4paper,english,hebrew,numbers=noenddot]{scrartcl}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{fontspec}
\setlength{\parindent}{0bp}
\usepackage{color}
\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=true]
 {hyperref}
\hypersetup{
 linkcolor=blue}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\theoremstyle{plain}
\newtheorem{thm}{\protect\theoremname}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Bellefair}

\renewcommand{\labelenumii}{\labelenumi\arabic{enumii}.}
\addtokomafont{disposition}{\rmfamily}

\usepackage{tcolorbox}

\makeatother

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\addto\captionsenglish{\renewcommand{\theoremname}{Theorem}}
\addto\captionshebrew{\renewcommand{\theoremname}{משפט}}
\providecommand{\theoremname}{משפט}

\begin{document}
%\tcbox{ <=============================
\begin{thm}
as
\end{thm}

%} <=============================
\end{document}

现在,如果您删除包含该内容的行,则<=============================无法编译,您知道原因是什么吗?我该如何修复它?

(我尝试删除一些代码行但总是出现错误)

谢谢你!

::编辑:: 这里是其他 MWE:

\documentclass{scrartcl}

\usepackage{tcolorbox}
\newtheorem{theorem}{Theorem}

\begin{document}

%\tcbox{ <=============================
\begin{theorem}
Let $f$ be 
\end{theorem}
%} <=============================
\end{document}

答案1

当我使用\begin{tcolorbox}...\end{tcolorbox}它时,它对我有用。

\documentclass{scrartcl}
\usepackage{tcolorbox}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{tcolorbox} %<=============================
\begin{theorem}
Let $f$ be 
\end{theorem}
\end{tcolorbox} %<=============================
\end{document}

在此处输入图片描述

根据手动的与以下方法相比,这种方法似乎不太可能限制您\tcbox在此处输入图片描述

如果有什么原因不适合你,请告诉我

相关内容