tikzpicture를 삽입할 수 있는 새로운 환경 만들기

tikzpicture를 삽입할 수 있는 새로운 환경 만들기

각 다이어그램 센터 위와 아래에 공간을 두는 서문에 새로운 환경을 만들려고 합니다.

\documentclass{book}

\usepackage{blindtext}
\usepackage{tikz}
\usepackage{tkz-euclide}

\newenvironment{proposition}
{\begin{center}\em}
{\end{center}}

%\newenvironment{diagram}
%\vspace*{\fill}
    %{\begin{center}\em}
    %{\end{center}}
%\vspace*{\fill}

\begin{document}

\begin{proposition}
        On a given finite right line (AB) to construct an equilateral triangle.
 \end{proposition}


%\begin{diagram}
\begin{tikzpicture}
\tkzDefPoint(0,0){A} 
\tkzDefPoint(1.25,0){B} 
\tkzDrawSegment(A,B) 
\tkzLabelPoint[left](A){$A$} 
\tkzLabelPoint[right](B){$B$}
\end{tikzpicture}
%\end{diagram]

\end{document}

환경이 없으면 괜찮게 렌더링되기 때문에 모든 일을 잘못된 방향으로 진행하고 있다고 생각합니다. 힌트가 있습니까? 나는 거기에서 어떤 예도 찾을 수 없습니다. 코드를 엉망으로 만드는 부분을 숨겼습니다.

답변1

tikzpicture이 코드를 사용하여 앞뒤에 공간을 중앙에 추가하고 추가해 보세요.

\documentclass{book}

\usepackage{blindtext}
\usepackage{tikz}
\usepackage{tkz-euclide}

\newenvironment{proposition}
{\begin{center}\em}
    {\end{center}}


\newenvironment{diagram}
{\begin{center}\vspace*{10pt}\begin{tikzpicture}}
    {\end{tikzpicture}\vspace*{-5pt}\end{center}}

\begin{document}
    
\begin{proposition}
    On a given finite right line (AB) to construct an equilateral triangle.
\end{proposition}
            
\begin{diagram}
        \tkzDefPoint(0,0){A} 
        \tkzDefPoint(1.25,0){B} 
        \tkzDrawSegment(A,B) 
        \tkzLabelPoint[left](A){$A$} 
        \tkzLabelPoint[right](B){$B$}
\end{diagram}
    
Some text.
    
\end{document}

ㅏ

관련 정보