理由不当和语句环境定义不当的问题

理由不当和语句环境定义不当的问题

关于这段代码,我有两个问题,如下图所示:

Goldboxed 定理,两个问题

其代码是

\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=subsection]{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}

\newenvironment{statement}[1]{\textsc{Statement}$\:\:\blacktriangleright\:\:${#1}}

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

\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}
%Next goldtheorem is bad centralized

\subsection{Other examples}
\begin{goldtheorem}{Gauss}{Gauss}
Statement
\end{goldtheorem}
\begin{proof}

\end{proof}
\begin{goldtheorem}{Cauchy}{Cauchy}
Statement
\end{goldtheorem}
\begin{proof}

\end{proof}


\end{document}

关于\begin{goldtheorem}{Cauchy}{Cauchy}Statement\end{goldtheorem}Overleaf 无法实现其在 下所实现的功能Theroem 1.1.0.1 --- Goldboxed Theorem,为什么?

我的定义哪里错了statement-environment

此外,最后一个 tcolorbox 的理由很糟糕:我希望它和其他人一样,数学\newtheorem[theorem]{Theorem}你写的时候\begin{theorem}...\end{theorem}

非常感谢。

**这个问题与此链接中的另一个问题(我的)类似:** 金盒定理

第一次编辑:我解决了环境问题,但没有解决理由问题

答案1

\chapterLaTeX 的默认设置是,在章节标题(如和)之后的第一个段落不缩进\section

因此,\subsection{Other examples}第一个框没有缩进,而第二个框缩进。

使用已定义的 GoldTheorem 环境或\noindent之前添加\begin{goldtheorem}

b

\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=subsection]{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}

\newenvironment{statement}[1]{\textsc{Statement}$\:\:\blacktriangleright\:\:${#1}}

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

\usepackage{kantlipsum} % added to show indent after headers

\begin{document}
    
    \chapter{Goldboxed Theorems}
    \kant[9] %first paragraph => no indented.
    
    \section{Some theorem for proof}
    
    \begin{goldtheorem}{Goldboxed Theorem}{Cantor}
        \textsc{Statement}\:\:$\blacktriangleright$\:\:Its Statement first paragraph => no indented.
    \end{goldtheorem}
    
    \begin{proof}
        Its Proof.
    \end{proof}
    
    \ref{th:Cantor}
    %Next goldtheorem is bad centralized
    
    \subsection{Other examples}
    \kant[9]\medskip
    
    \begin{goldtheorem}{Gauss}{Gauss}
        Statement second paragraph => indented.
    \end{goldtheorem}

    \begin{proof}
        
    \end{proof}

    \begin{GoldTheorem}{Cauchy}{Cauchy}
        Statement using GoldTheorem
    \end{GoldTheorem}

    \begin{proof}
        
    \end{proof}

\noindent   \begin{goldtheorem}{Laplace}{Laplace}
    Statement using \verb|\noindent|
\end{goldtheorem}

\begin{proof}
    
\end{proof}
    
\end{document}

相关内容