金盒定理

金盒定理

我想要一个可以创建以下内容的 tex 函数:

金盒定理

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,top=3cm,bottom=3cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{stix}
\usepackage[most]{tcolorbox}
\usepackage{empheq}
\tcbuselibrary{theorems}

% (Re)newcommands

\renewcommand\qedsymbol{$\blacksquare$}

\newtcbox{\Goldonebox}[1][]{nobeforeafter,math upper,tcbox raise base,
enhanced,frame hidden,boxrule=0pt,interior style={top color=Gold1!10!white,
bottom color=Gold1!10!white,middle color=Gold1!50!yellow},
fuzzy halo=1pt with Gold1,#1}

\newtcbox{\greenbox}[1][]{nobeforeafter,math upper,tcbox raise base,
enhanced,frame hidden,boxrule=0pt,interior style={top color=green!10!white,
bottom color=green!10!white,middle color=green!50!yellow},
fuzzy halo=1pt with green,#1}


\newtcolorbox[]{mytcbox}[1][]{colback=Gold1,colframe=red,fonttitle=\bfseries, title=#1}

% New counter

\newtheorem{theorem}{Theorem}[subsection]

% New Theorems

\newcommand{\namedtheoremname}{}
\newtheorem{namedtheoreminner}[theorem]{\protect\namedtheoremname}
\newenvironment{namedtheorem}[1]
{%
\renewcommand{\namedtheoremname}{#1 --- }%
\begin{namedtheoreminner}%
}
{\end{namedtheoreminner}}

\newtcbtheorem[number within=subsection]{goldtheorem}{Theorem}%
{nobeforeafter,math upper,tcbox raise base,
enhanced,boxrule=0pt,interior style={top color=Gold1!10!white,
bottom color=Gold1!10!white,middle color=Gold1!50!yellow},colframe=red,
fuzzy halo=1pt with Gold1,#1,description color = black,coltitle=black,fonttitle=\bfseries, separator sign={\:\:---\:\:}}{th}

\newenvironment{goldthorem}{\flushleft
\begin{goldthorem}}{\end{goldtheorem}}

\newenvironment{statement}{%
\begin{statement}
\textsc{Statement:}}{
\end{statement}}

\title{Goldoneboxed Theorems}
\author{MATTIA ONOFRI}
\date{August 2021}

\begin{document}

\maketitle
\Large
\chapter{Goldoneboxed Theorems}

\section{Some theorem for proof}

%\Goldonebox{Something}, the word "Something" is given in equation--format--font. Then you can use \Goldonebox{\text{Something}}.\\\Goldonebox{\text{In these \textbackslash\texttt{Goldonebox}es you try to insert a \textbackslash\texttt{namedtheorem}.}}

\subsection{An Example}
%\flushleft
\begin{goldtheorem}{Goldoneboxed Theorem}{Cantor}
\textsc{Statement}\:\:$\blacktriangleright$\:\:\text{Its Statement}
\end{goldtheorem}
\begin{proof}
Its Proof.
\end{proof}

\end{document}

我的 tex 代码有些错误。怎么办?谢谢

答案1

为什么math upper

\documentclass{book}
\usepackage[a4paper,top=3cm,bottom=3cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{stix}
\usepackage[most]{tcolorbox}
\tcbuselibrary{theorems}

% (Re)newcommands

\renewcommand\qedsymbol{\ensuremath{\blacksquare}}

\newtcbtheorem[number within=section]{goldtheorem}{Theorem}{
  nobeforeafter,
  %math upper, % <--- why?
  tcbox raise base,
  enhanced,
  boxrule=0pt,
  interior style={
    top color=Gold1!10!white,
    bottom color=Gold1!10!white,
    middle color=Gold1!50!yellow,
  },
  colframe=red,
  fuzzy halo=1pt with Gold1,
  description color = black,
  coltitle=black,
  fonttitle=\bfseries,
  separator sign={\ ---},
  #1,
}{th}

\begin{document}

\chapter{Goldboxed Theorems}

\section{Some theorem for proof}

\begin{goldtheorem}{Goldboxed Theorem}{Cantor}
\textsc{Statement}\:\:$\blacktriangleright$\:\:Its Statement
\end{goldtheorem}

\begin{proof}
Its Proof.
\end{proof}

\ref{th:Cantor}

\end{document}

在此处输入图片描述

答案2

在此处输入图片描述

amssymb使用给定的包这里。还用$符号表示方程模式。我不明白为什么stix要用这个包。我评论了它。

以下是完整的代码

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,top=3cm,bottom=3cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage[x11names]{xcolor}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsthm}
%\usepackage{stix}
\usepackage[most]{tcolorbox}
\usepackage{empheq}
\tcbuselibrary{theorems}
\usepackage{amssymb}
%\usepackage{amsfonts}

% (Re)newcommands

\renewcommand\qedsymbol{$\blacksquare$}

\newtcbox{\Goldonebox}[1][]{nobeforeafter,math upper,tcbox raise base,
enhanced,frame hidden,boxrule=0pt,interior style={top color=Gold1!10!white,
bottom color=Gold1!10!white,middle color=Gold1!50!yellow},
fuzzy halo=1pt with Gold1,#1}

\newtcbox{\greenbox}[1][]{nobeforeafter,math upper,tcbox raise base,
enhanced,frame hidden,boxrule=0pt,interior style={top color=green!10!white,
bottom color=green!10!white,middle color=green!50!yellow},
fuzzy halo=1pt with green,#1}


\newtcolorbox[]{mytcbox}[1][]{colback=Gold1,colframe=red,fonttitle=\bfseries, title=#1}

% New counter

\newtheorem{theorem}{Theorem}[subsection]

% New Theorems

\newcommand{\namedtheoremname}{}
\newtheorem{namedtheoreminner}[theorem]{\protect\namedtheoremname}
\newenvironment{namedtheorem}[1]
{%
\renewcommand{\namedtheoremname}{#1 --- }%
\begin{namedtheoreminner}%
}
{\end{namedtheoreminner}}

\newtcbtheorem[number within=subsection]{goldtheorem}{Theorem}%
{nobeforeafter,math upper,tcbox raise base,
enhanced,boxrule=0pt,interior style={top color=Gold1!10!white,
bottom color=Gold1!10!white,middle color=Gold1!50!yellow},colframe=red,
fuzzy halo=1pt with Gold1,#1,description color = black,coltitle=black,fonttitle=\bfseries, separator sign={\:\:---\:\:}}{th}

\newenvironment{goldthorem}{\flushleft
\begin{goldthorem}}{\end{goldtheorem}}

\newenvironment{statement}{%
\begin{statement}
\textsc{Statement:}}{
\end{statement}}

\title{Goldoneboxed Theorems}
\author{MATTIA ONOFRI}
\date{August 2021}

\begin{document}

\maketitle
\Large
\chapter{Goldoneboxed Theorems}

\section{Some theorem for proof}

%\Goldonebox{Something}, the word "Something" is given in equation--format--font. Then you can use \Goldonebox{\text{Something}}.\\\Goldonebox{\text{In these \textbackslash\texttt{Goldonebox}es you try to insert a \textbackslash\texttt{namedtheorem}.}}

\subsection{An Example}
%\flushleft
\begin{goldtheorem}{Goldoneboxed Theorem}{Cantor}
$\textsc{Statement}\:\:$\blacktriangleright$\:\:\text{Its Statement}$
\end{goldtheorem}
\begin{proof}
Its Proof.
\end{proof}

\end{document}

相关内容