5

Everything works fine, till I am trying to draw the angles alpha, beta and gamma. By adding \tkzMarkAngle my sketch jumps to the second side and is swallowed to its half, as you can see in the screenshot below. I don't see the problem, what am I missing?

\documentclass[11pt,a4paper]{article} % Defines the document as an article
\usepackage{tikz}                     % Graphic drawing library
\usepackage{tkz-euclide}              % Needed for "\usetkzobj{all}"
\usetkzobj{all}                       % Needed for "tkzMarkAngle" (tikz)
\begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{tikzpicture}[xscale=0.5, yscale=0.5]
% DEFINE_MAIN_FRAME_COORDINATES ------------------------------------------------
  \coordinate[label=below:$A1$] (A1) at (0,0);
  \coordinate[label=above:$B1$] (B1) at (0,30);
  \coordinate[label=right:$C1$](C1) at (8,20.4);
% DRAW_MAIN_FRAME --------------------------------------------------------------
  \draw[line width=2pt][-] (C1) -- (B1) node [pos=0.5, right] {$a_1$};
  \draw[line width=2pt][-] (B1) -- (A1) node [pos=0.5, left]  {$c_1$};
  \draw[line width=2pt][-] (A1) -- (C1) node [pos=0.5, right] {$b_1$};
  \draw[dashed][-] (0,20.4) -- (C1) node [pos=0.5, above] {$h$};
% DRAW_ANGLES ------------------------------------------------------------------
  % alpha
  \tkzMarkAngle[fill=orange, size=4, opacity=0.4](C1,A1,B1)
  \tkzLabelAngle[pos=3](C1,A1,B1){$\alpha$}
  % beta
  \tkzMarkAngle[fill=orange, size=3, opacity=0.4](A1,B1,C1)
  \tkzLabelAngle[pos=2](A1,B1,C1){$\beta$}
  % gamma
  \tkzMarkAngle[fill=orange, size=2, opacity=0.4](B1,C1,A1)
  \tkzLabelAngle[pos=-1](B1,C1,A1){$\gamma$}
\end{tikzpicture}

\end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Resulting output:

enter image description here

I am grateful for any help, links, references and hints!

  • 2
    A4 paper is small for your coordinates. TikZ default is to use centimeters and you have a point at 15 cm after scaling. Page margins don't allow it to fit properly so it is pushed to the next and then gives up – percusse Nov 15 '17 at 12:09
  • 1
    Common problem with tkz-euclide, unfortunately. In some of the constructions it creates (invisible) paths that are far larger than the drawn diagram. Add the overlay option to each of the \tkzMarkAngles, e.g. \tkzMarkAngle[overlay,fill=orange, size=2, opacity=0.4](B1,C1,A1). See also the questions listed in tex.stackexchange.com/… – Torbjørn T. Nov 15 '17 at 14:44
5

Scale the figure by 0.5 as the dimensions are too large for an A4 paper. Also, using angles,quotes libraries makes drawing angles much easier.

\documentclass[11pt,a4paper]{article} % Defines the document as an article
\usepackage{tikz}                     % Graphic drawing library
%\usepackage{tkz-euclide}              % Needed for "\usetkzobj{all}"
%\usetkzobj{all}                       % Needed for "tkzMarkAngle" (tikz)
\usetikzlibrary{angles,quotes}
\begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{figure}\centering
\begin{tikzpicture}[scale=.5]
% DEFINE_MAIN_FRAME_COORDINATES ------------------------------------------------
  \coordinate[label=below:$A1$] (A1) at (0,0);
  \coordinate[label=above:$B1$] (B1) at (0,30);
  \coordinate[label=right:$C1$] (C1) at (8,20.4);
% DRAW_MAIN_FRAME --------------------------------------------------------------
  \draw[line width=2pt] (C1) -- (B1) node [pos=0.5, right] {$a_1$}
                             -- (A1) node [pos=0.5, left]  {$c_1$}
                             -- (C1) node [pos=0.5, right] {$b_1$}
                             -- cycle;
  \draw[dashed] (0,20.4) -- (C1) node [pos=0.5, above] {$h$};
% DRAW_ANGLES ------------------------------------------------------------------
  % alpha
  \draw pic[draw,fill=orange!50,angle radius=2cm,"$\alpha$"] {angle=C1--A1--B1};
  % beta
  \draw pic[draw,fill=orange!50,angle radius=2cm,"$\beta$"] {angle=A1--B1--C1};
  % gamma
  \draw pic[draw,fill=orange!50,angle radius=1cm,"$\gamma$"] {angle=B1--C1--A1};
\end{tikzpicture}
\end{figure}

\end{document} %%%%%

enter image description here

  • 2
    [scale=.5] is equal to [xscale=.5, yscale=.5]. So it's gotta be something related to tkzmarkangle – percusse Nov 15 '17 at 12:54
  • @AboAmmar thanks! At first your solution didn't work because the command \draw pic[draw,angle radius=2cm,"$\alpha$"] {angle=C1--A1--B1}; was interfering with the language package \usepackage[ngerman.ldf]{babel} and always threw the error message ! Argument of \language@active@arg" has an extra }. But I was able to fix it by adding \usetikzlibrary{babel} to the preamble. – PatrickSteiner Nov 16 '17 at 12:28
1

as supplement to AboAmmar answer with fully exploited quotes library and some small changes:

\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}

\begin{document}
    \begin{figure}[ht]
    \centering
\begin{tikzpicture}[
    scale = 0.5,
     auto = right,
MA/.style = {% My Angle
            draw, fill=orange!50,
            angle radius=#1},
MA/.default = 16mm
                    ]
% coordinates
\coordinate[label=below:$A1$] (A1) at (0,0);
\coordinate[label=above:$B1$] (B1) at (0,30);
\coordinate[label=right:$C1$] (C1) at (8,20.4);
% angles' labels
\pic[MA,"$\alpha$"]     {angle=C1--A1--B1};
\pic[MA,"$\beta$"]      {angle=A1--B1--C1};
\pic[MA=8mm,"$\gamma$"] {angle=B1--C1--A1};
% triangle
\draw[line width=2pt] (C1) to ["$a_1$"] (B1)
                           to ["$c_1$"] (A1)
                           to ["$b_1$"] (C1)
                           -- cycle;
\draw[dashed]   (C1) to["$h$"] (C1 -| B1);
\end{tikzpicture}
    \end{figure}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.