使用 thmtools 在定理环境中进行填充

使用 thmtools 在定理环境中进行填充

我正在使用 thmtools 来制作阴影定理,但定理主体周围没有填充,这使其很丑陋。

梅威瑟:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage[dvipsnames]{xcolor}

\colorlet{LightGray}{White!90!Periwinkle}

\declaretheoremstyle[
    name=Theorem,
    shaded={bgcolor=LightGray},
]{thmsty}
\declaretheorem[style=thmsty]{thm}

\begin{document}
    \begin{thm}
        In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle).
    \end{thm}
\end{document}

结果: 韓

我想在定理周围添加填充。我阅读了thmtools文档,但没有找到方法。我不介意阴影框大于\textwidth

答案1

这是tcolorboxenvironment的包装器样式thm,提供更漂亮的盒子(在我看来),实际上只需一行代码!

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}

\usepackage[dvipsnames]{xcolor}

\usepackage[most]{tcolorbox}

\colorlet{LightGray}{White!90!Periwinkle}

\declaretheoremstyle[
    name=Theorem,
]{thmsty}
\declaretheorem[style=thmsty]{thm}

\tcolorboxenvironment{thm}{enhanced jigsaw,colback=LightGray,drop shadow}

\begin{document}
    \begin{thm}
        In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle).
    \end{thm}
\end{document}

在此处输入图片描述

答案2

使用mdframed定理样式中的选项可以设置指定大小的边框,这里设置为 6 或 8pt,具体取决于。

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage[dvipsnames]{xcolor}

\colorlet{LightGray}{White!90!Periwinkle}

\declaretheoremstyle[
    name=Theorem,
    mdframed={
  skipabove=8pt,
  skipbelow=6pt,
  hidealllines=true,
  backgroundcolor={LightGray},
  innerleftmargin=8pt,
  innerrightmargin=8pt}
]{thmsty}
\declaretheorem[style=thmsty]{thm}

\begin{document}

    \begin{thm}
        In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle).
    \end{thm}

    In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle).
\end{document}

在此处输入图片描述

相关内容