尝试将 Tkz-Euclide 放入表中

尝试将 Tkz-Euclide 放入表中

我正在尝试将这个 Tkz-Euclide 代码放到一个表中的三个独立列上,每个三角形在表环境之外单独工作。我应该使用不同类型的表吗?或者我应该使用不同的方法将这些图表放在一起吗?

\documentclass{book}

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

\newcommand{\AB}{0.75}   % A  and B added <<<<<<<<<<<<<<
\newcommand{\C}{1.5}    % C added <<<<<<<<<<<<<<
\newcommand{\AD}{0.75} % D added<<<<<<<<<<<<<<
\newcommand{\Asize}{0.25}   % Angle added <<<<<<<<<<<<<<


% Standard packages
\usepackage{
float, 
graphicx
}

% Set page margins
\usepackage[top=1.0in, bottom=1.0in, left=1.0in, right=1.0in]{geometry}

\setlength{\marginparwidth}{0pt}

% Set nice page headers
\usepackage{fancyhdr}
\pagestyle{fancy}

% Paragraph style
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}


% Proposition environment
\newenvironment{proposition}
{\begin{center}\em}
{\end{center}}

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

\newcounter{CountStep}


\newcounter{CountDiag}
\newenvironment{diagram}
{\stepcounter{CountStep}\stepcounter{CountDiag}\vspace*{10pt}      Step~\theCountStep\par
\begin{center}
\begin{tikzpicture}}
        {\end{tikzpicture}\vspace*{-5pt}\par Diagram~\theCountDiag
    \end{center}}
 
 
\setcounter{chapter}{-1}

\usepackage{titlesec}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{}{0pt}{\Huge}
\titlespacing*{\chapter}
{0pt}{0pt}{30pt}


\begin{document}

\begin{tabular}{ccc}
\begin{diagram}

        \tkzDefPoints{-\AB/0/A,\AB/0/B,0/\C/C,1/\AD/D}
    
        \tkzDefPointOnLine[pos=0.5](B,C)\tkzGetPoint{E}

    \tkzDrawPolygon(A,B,C)
    %\tkzDrawPolygon(A,B,D)

    \tkzLabelPoints[left](A)
    \tkzLabelPoints[right](B)
    \tkzLabelPoints[above](C)
    %\tkzLabelPoints[above](D)
      
    \tkzMarkSegment[mark=|](A,C)
    \tkzMarkSegment[mark=||](A,B)
    \tkzMarkAngle[size=\Asize](B,A,C)
    \tkzMarkAngle[size=\Asize](C,B,A)

&

    \tkzDefPoints{-\AB/0/A,\AB/0/B,0/\C/C,1/\AD/D}
    
    \tkzDefPointOnLine[pos=0.5](B,C)\tkzGetPoint{E}

    %\tkzDrawPolygon(A,B,C)
    \tkzDrawPolygon(A,B,D)

    \tkzLabelPoints[left](A)
    \tkzLabelPoints[right](B)
    %\tkzLabelPoints[above](C)
    \tkzLabelPoints[above](D)
      
    \tkzMarkSegment[mark=|](A,D)
    \tkzMarkSegment[mark=|](A,B)
    \tkzMarkAngle[size=\Asize](B,A,C)
     \tkzMarkAngle[size=\Asize](C,B,A)

&

\tkzDefPoints{-\AB/0/A,\AB/0/B,0/\C/C,1/\AD/D}
    
        \tkzDefPointOnLine[pos=0.5](B,C)\tkzGetPoint{E}

    \tkzDrawPolygon(A,B,C)
    \tkzDrawPolygon(A,B,D)

    \tkzLabelPoints[left](A)
    \tkzLabelPoints[right](B)
    \tkzLabelPoints[above](C)
    \tkzLabelPoints[above](D)
      
    %\tkzMarkSegment[mark=|](A,D)
    \tkzMarkSegment[dashed,](D,C)
    \tkzMarkAngle[size=\Asize](B,A,C)
    \tkzMarkAngle[size=\Asize](C,B,A)\\ 
    \end{diagram}
 \end{Tablular}

 \end{document}

答案1

如果将diagram环境(没有tikzpicture)放在环境之外tabular,并tikzpicture在每个单元格中放置一个,它就可以起作用。

\documentclass{book}

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

\newcommand{\AB}{0.75}   % A  and B added <<<<<<<<<<<<<<
\newcommand{\C}{1.5}    % C added <<<<<<<<<<<<<<
\newcommand{\AD}{0.75} % D added<<<<<<<<<<<<<<
\newcommand{\Asize}{0.25}   % Angle added <<<<<<<<<<<<<<


% Standard packages
\usepackage{
float, 
graphicx
}

% Set page margins
\usepackage[top=1.0in, bottom=1.0in, left=1.0in, right=1.0in]{geometry}

\setlength{\marginparwidth}{0pt}

% Set nice page headers
\usepackage{fancyhdr}
\pagestyle{fancy}

% Paragraph style
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}


% Proposition environment
\newenvironment{proposition}
{\begin{center}\em}
{\end{center}}

\newcounter{CountStep}

\newcounter{CountDiag}
\newenvironment{diagram}
  {\stepcounter{CountStep}\stepcounter{CountDiag}\vspace*{10pt}      Step~\theCountStep\par
    \begin{center}}
  {\vspace*{-5pt}\par Diagram~\theCountDiag
    \end{center}}
 
 
\setcounter{chapter}{-1}

\usepackage{titlesec}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{}{0pt}{\Huge}
\titlespacing*{\chapter}
{0pt}{0pt}{30pt}


\begin{document}

\begin{diagram}
\begin{tabular}{ccc}
\begin{tikzpicture}
        \tkzDefPoints{-\AB/0/A,\AB/0/B,0/\C/C,1/\AD/D}
    
        \tkzDefPointOnLine[pos=0.5](B,C)\tkzGetPoint{E}

    \tkzDrawPolygon(A,B,C)
    %\tkzDrawPolygon(A,B,D)

    \tkzLabelPoints[left](A)
    \tkzLabelPoints[right](B)
    \tkzLabelPoints[above](C)
    %\tkzLabelPoints[above](D)
      
    \tkzMarkSegment[mark=|](A,C)
    \tkzMarkSegment[mark=||](A,B)
    \tkzMarkAngle[size=\Asize](B,A,C)
    \tkzMarkAngle[size=\Asize](C,B,A)
\end{tikzpicture}
&
\begin{tikzpicture}
    \tkzDefPoints{-\AB/0/A,\AB/0/B,0/\C/C,1/\AD/D}
    
    \tkzDefPointOnLine[pos=0.5](B,C)\tkzGetPoint{E}

    %\tkzDrawPolygon(A,B,C)
    \tkzDrawPolygon(A,B,D)

    \tkzLabelPoints[left](A)
    \tkzLabelPoints[right](B)
    %\tkzLabelPoints[above](C)
    \tkzLabelPoints[above](D)
      
    \tkzMarkSegment[mark=|](A,D)
    \tkzMarkSegment[mark=|](A,B)
    \tkzMarkAngle[size=\Asize](B,A,C)
     \tkzMarkAngle[size=\Asize](C,B,A)
\end{tikzpicture}
&
\begin{tikzpicture}
\tkzDefPoints{-\AB/0/A,\AB/0/B,0/\C/C,1/\AD/D}
    
        \tkzDefPointOnLine[pos=0.5](B,C)\tkzGetPoint{E}

    \tkzDrawPolygon(A,B,C)
    \tkzDrawPolygon(A,B,D)

    \tkzLabelPoints[left](A)
    \tkzLabelPoints[right](B)
    \tkzLabelPoints[above](C)
    \tkzLabelPoints[above](D)
      
    %\tkzMarkSegment[mark=|](A,D)
    \tkzMarkSegment[dashed,](D,C)
    \tkzMarkAngle[size=\Asize](B,A,C)
    \tkzMarkAngle[size=\Asize](C,B,A) 
\end{tikzpicture}
 \end{tabular}
    \end{diagram}

 \end{document}

在此处输入图片描述

答案2

\documentclass[border=1cm]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tabular}{ccc}
\begin{tikzpicture}
\tkzDefPoints{-0.75/0/A,0.75/0/B,0/1.5/C,1/0.75/D}
\tkzDefPointOnLine[pos=0.5](B,C)\tkzGetPoint{E}
\tkzDrawPolygon(A,B,C)
\tkzLabelPoints[left](A)
\tkzLabelPoints[right](B)
\tkzLabelPoints[above](C)
\tkzMarkSegment[mark=|](A,C)
\tkzMarkSegment[mark=||](A,B)
\tkzMarkAngle[size=0.25](B,A,C)
\tkzMarkAngle[size=0.25](C,B,A)
\end{tikzpicture}
& BB & CC
\end{tabular}
\end{document}

三角图

相关内容