맞춤형 환경을 어떻게 만들 수 있나요?

맞춤형 환경을 어떻게 만들 수 있나요?

나는 다음과 같은 몇 가지 정리를 쓰고 싶습니다.

\begin{theorem}
    \begin{preconditions}
        $A := \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$\\
        $B := \begin{pmatrix} 2 & 2 \\ 3 & 4 \end{pmatrix}$\\
        $n \in \mathbb{N}$
    \end{preconditions}

    \begin{claim}
        $\sqrt{2} \notin \mathbb{Q}$
    \end{claim}

    \begin{proof}{directly}
        [... the proof ...]
    \end{proof}

\end{theorem}

다음과 같아야 합니다.

**Theorem 123**
    **Preconditions**:
        $A := \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$\\
        $B := \begin{pmatrix} 2 & 2 \\ 3 & 4 \end{pmatrix}$\\
        $n \in \mathbb{N}$

    **Claim**: √2 ∉ Q

    **Proof**: directly

        [... the proof ...]
        [.. the end]                 ■

( Theorem 123, Preconditions, ClaimProof굵은 글씨로 표시)

환경의 논리:

  • 정리는 자동으로 1부터 시작하여 각 정리에 대해 1씩 증가하는 숫자를 얻어야 합니다.
  • Theorem 환경 내에서는 및 환경만 preconditions허용 됩니다 claim.proof
  • 정리 환경 내에서 claimproof환경은 정확히 한 번이어야 합니다.
  • 증명의 내용과 전제조건의 내용은 동일한 의도를 가지고 있어야 합니다.

지금까지 내가 찾은 것 :

나는 생각했다\new환경내가 찾고 있는 것일 수도 있습니다.

\newenvironment{name}[num]{before}{after}

하지만 내부 환경을 필요에 따라 표시하는 방법을 알 수 없었습니다.


amsthm 패키지에는 증명을 위한 환경이 있는 것 같습니다(원천), 하지만 서로 다른 환경을 중첩하여 내가 원하는 것처럼 보이게 만들 가능성은 보이지 않습니다.


이론많은 가능성을 제공하는 것 같습니다. 나는 4개의 새로운 정리 환경을 만들었습니다:

\newtheorem{theorem}{Theorem}
\newtheorem{preconditions}{Preconditions}
\newtheorem{proof}{Proof}
\newtheorem{claim}{Claim}

위에서 라텍스 코드를 사용하여 다음을 얻었습니다. 여기에 이미지 설명을 입력하세요

이것은 내부 환경에 대한 의도가 없습니다. 내부 환경은 번호를 매겨서는 안 되지만 번호가 매겨져 있습니다.묘비끝에 있습니다

답변1

나는thmtools새로운 환경을 amsthm정의하기 위한 프런트엔드로 패키지화 Proof다른 두 환경은 \newenvironment. Proof및 환경은 claim다음 에서 사용 됩니다.preconditionadjustwidthchangepage왼쪽 여백을 늘리는 패키지입니다. 물론 필요에 따라 필요한 조정을 자유롭게 수행하십시오.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{changepage}
\usepackage[nopar]{lipsum}% just to generate some text

\newlength\Thmindent
\setlength\Thmindent{20pt}

\newenvironment{precondition}
  {\par\medskip\adjustwidth{\Thmindent}{}\normalfont\textbf{Preconditions:}\par\nobreak}
  {\endadjustwidth}
\newenvironment{claim}
  {\par\medskip\adjustwidth{\Thmindent}{}\normalfont\textbf{Claim:}}
  {\endadjustwidth}

\declaretheoremstyle[
  spaceabove=0pt,spacebelow=0pt,
  preheadhook=\adjustwidth{\Thmindent}{},
  prefoothook=\endadjustwidth,
  headpunct=:,
  numbered=no,
  qed=\qedsymbol
]{proof}
\declaretheorem[style=proof]{Proof}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}
\lipsum[2]
\begin{precondition}
\begin{itemize}
\item $A := \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$
\item $B := \begin{pmatrix} 2 & 2 \\ 3 & 4 \end{pmatrix}$
\item $n \in \mathbb{N}$
\end{itemize}
\end{precondition}
\begin{claim}
$\sqrt{2}\notin\mathbb{Q}$
\end{claim}
\begin{Proof}
\lipsum[2]
\end{Proof}
\end{theorem}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보