0

I am trying to put this Tkz-Euclide code onto three separate columns in a table, Each triangle work separately outside a table environment. Is there a different type of table I should be using? or should I be using a different method to put these Diagrams next to each other?

\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}
4
  • 1
    This won't work. You need three separate pictures to put into a table or need one picture that separates the three parts all on its own. (If they are independent of each other a TikZ-\matrix would be the next best thing.) Oct 26, 2022 at 7:09
  • 1
    (1) You can't begin an environment (diagram in this case) in one table cell and end it in another one. (2) Your diagram uses \begin{center} ... and this can only be used in an outer vertical mode, not inside a table cell. Oct 26, 2022 at 7:18
  • Please add (maybe handwriting) your desired output
    – Black Mild
    Oct 26, 2022 at 9:35
  • Thanks for your input, but the answer below is good work around I would have just liked to use my design environment, so it matched the styling in the rest of my document which don't involve tables.
    – Paul A
    Oct 26, 2022 at 9:39

2 Answers 2

1

If you put the diagram environment (without tikzpicture) outside of the tabular environment, and a tikzpicture in each cell, it works.

\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}

enter image description here

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}

Triangle diagram

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .