定理风格(如图所示)

定理风格(如图所示)

如何使定理的风格变成这样?老实说,我从互联网上拿了这张图片,因为我无法在乳胶中做到这一点,然后我对其进行了修改以显示我想在定理环境中做的事情。

在此处输入图片描述

答案1

像这样?我改编了amsmth的默认plain定理样式来添加悬挂缩进,并定义了一个thmbox环境来tcolorbox绘制蓝色框。

\documentclass{article}
\usepackage{amsmath, amsthm}
\usepackage{tcolorbox}
\newlength{\thmindent}
\newtheoremstyle{plain}
    {\topsep}   % ABOVESPACE
    {\topsep}   % BELOWSPACE
    {\itshape%
        \settowidth{\thmindent}{\textbf{Theorem~\thetheorem~}}
        \setlength{\hangindent}{\thmindent}
        \setlength{\parindent}{\thmindent}}  % BODYFONT
    {0pt}       % INDENT (empty value is the same as 0pt)
    {\bfseries} % HEADFONT
    {.}         % HEADPUNCT
    {5pt plus 1pt minus 1pt} % HEADSPACE
    {}          % CUSTOM-HEAD-SPEC
\newtheorem{theorem}{Theorem}
\newtcolorbox{thmbox}{%
    colback=blue!25,
    colframe=blue!25,
    fontupper=\normalfont,
    left=2mm, right=2mm, top=2mm, bottom=2mm,
    boxsep=0mm,
    before skip balanced=.25\baselineskip plus 2pt,
    left skip=\thmindent,
}
\begin{document}
\begin{theorem}[Sine law]
Given \(a, b, c\) sides of a triangle and \(\alpha, \beta, \gamma\) the opposite angles respectively, we have \(\frac{a}{\sin\alpha} = \frac{b}{\sin\beta} = \frac{c}{\sin\gamma}\).
\end{theorem}

\begin{theorem}[Cosine law]
Given \(a, b, c\) sides of a triangle and \(\gamma\) the opposite angle to the side \(c\), we have \(c^2 = a^2 + b^2 - 2ab\cos\gamma\).
\begin{thmbox}
In fact: 
\end{thmbox}
\end{theorem}
\end{document}

相关内容