4

In my post here My document cannot draw angles, I replaced the drawing of angles by

\tdplotdrawarc[color=blue]{(-0.25,-0.2,0)}{-0.3}{0}%
                     {55}{anchor=south east,color=black}{$\theta$}

This gives me a figure as attached

![![/home/zmumba/Latex_Docs/Latex_Manuals/angles.jpg][1]][1]

Going through the tikz-3dplot manual it is difficult to figure out what the numbers mean, especially when one is trying to have something done quickly. I would appreciate if someone can quide me on how to modify the code above to have angles theta from the x-axis to P, phi from y-axis to P and psi from z-axis to P.

Here is the full code:

    \documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta, angles, quotes, decorations.pathreplacing,
datavisualization}
\begin{document}
\tdplotsetmaincoords{60}{110}
\begin{center}
        \begin{tikzpicture}[>=latex,tdplot_main_coords,font=
\footnotesize,scale=1.5]
\begin{scope}[remember picture,rotate=45]
\coordinate (O) at (0,0);
\coordinate (R) at (2.5,2.5,0);
\coordinate (V) at (2.5,2.5,3);
 \datavisualization [
school book axes,
all axes={ticks=few}];
       \path (V) -- (R) coordinate[pos=.05](tl2);
\end{scope}

         \draw[thick,->] (0,0,0)coordinate (O) -- (3,0,0) coordinate (X)
            node[anchor=north east]{$x$};
    \draw[thick,->] (0,0,0) -- (0,3,0) coordinate (Y) node[anchor=north
            west]{$y$};
    \draw[thick,->] (0,0,0) -- (0,0,3) coordinate (Z) node[anchor=south]{$z$};
    \draw[thick,->,color=red,opacity=0.5] (0,0,0) -- (2.5,2.5,3) coordinate (V)
            node[ right] {$P(\alpha,\beta,\gamma)$};

    \draw[dashed,magenta!50] (2.5,2.5,3) -- (2.5,2.5,0) -- (0,0,0);
    \draw[thick,blue!50] (2,0,0) -- (2.5,2.5,0);
    \draw[thick,blue!50] (2.5,2.5,0) -- (0,2,0);
    \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
            (2,0,0)node [left=1ex] {$Q(\alpha,0,0)$} node[midway,left]{$\color{black}\alpha$};
    \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
            (0,2,0)node [above] {$Q^{'}(0,\beta,0)$} node[midway,above]{$\color{black}\beta$};
    \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
            (0,0,2)node [left] {$Q(0,0,\gamma)$};
    \draw[dashed,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
            (2.5,2.5,0)node  (b1)[right] {$R(\alpha,\beta,0)$};
    \draw[dashed,red!80!black,-{Triangle[fill=white]}] (2.5,2.5,3) --
            (2.5,2.5,0)node [left,yshift=2.75cm]{$\color{black}\gamma$};
             \tdplotdrawarc[color=blue]{(-0.25,-0.2,0)}{-0.3}{0}%
                     {55}{anchor=south east,color=black}{$\theta$}
             \tdplotdrawarc[color=blue]{(0,0.2,0)}{0.2}{0}%
                     {55}{anchor=south west,color=black}{$\phi$}
         \tdplotdrawarc[color=blue]{(0,0,0.5)}{0.2}{0}%
                     {55}{anchor=south west,color=black}{$\psi$}
        \end{tikzpicture}
    \end{center}
\end{document}

Here's another try drawing arc angles

This is what I have achieved with the following modifications

\tdplotdrawarc[thick,color=blue]{(.25,.15,.15)}{-0.60}{2}%
                     {175}{anchor=east,color=black}{$\color{blue}\theta$}
\tdplotdrawarc[thick,color=red]{(0.0,0.05,.1)}{-0.35}{1.5}%
                     {-95}{anchor=south west,color=black}{$\color{red}\phi$}
\tdplotdrawarc[thick,color=magenta]{(-0.1,-0.15,0.25)}{-0.45}{2.0}%
                     {-30}{anchor=south,color=magenta}{$\psi$}

enter image description here

This is the full code which gives error

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta, angles, quotes, decorations.pathreplacing,
 datavisualization}

\begin{document}
    \tdplotsetmaincoords{60}{110}
        \begin{tikzpicture}[>=latex,tdplot_main_coords,font=
\footnotesize,scale=1.5]
             \draw[thick,->] (0,0,0)coordinate (O) -- (3,0,0) coordinate (X)
            node[anchor=north east]{$x$};
    \draw[thick,->] (0,0,0) -- (0,3,0) coordinate (Y) node[anchor=north
            west]{$y$};
    \draw[thick,->] (0,0,0) -- (0,0,3) coordinate (Z) node[anchor=south]{$z$};
    \draw[thick,->,color=red,opacity=0.5] (0,0,0) -- (2.5,2.5,3) coordinate (V)
            node[ right] {$P(\alpha,\beta,\gamma)$};
        \draw[dashed,magenta!50] (2.5,2.5,3) -- (2.5,2.5,0) -- (0,0,0);
    \draw[thick,blue!50] (2,0,0) -- (2.5,2.5,0);
    \draw[thick,blue!50] (2.5,2.5,0) -- (0,2,0);
    \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
            (2,0,0)node [left=1ex] {$Q(\alpha,0,0)$} node[midway,left]{$\color{black}\alpha$};
    \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
            (0,2,0)node [above] {$Q^{'}(0,\beta,0)$} node[midway,above]{$\color{black}\beta$};
    \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
            (0,0,2)node [left] {$Q(0,0,\gamma)$};
    \draw[dashed,red!80!black,-{Triangle[fill=white]}] (0,0,0) --
            (2.5,2.5,0)node  (b1)[right] {$R(\alpha,\beta,0)$};
    \draw[dashed,red!80!black,-{Triangle[fill=white]}] (2.5,2.5,3) --
            (2.5,2.5,0)node [left,yshift=2.75cm]{$\color{black}\gamma$};
    \path pic[draw, angle radius=5mm,"$\theta$",angle
            eccentricity=1,anchor=north east,inner sep=5pt] {angle
             = V--O--X};
    \path pic[draw, angle radius=7mm,"$\phi$",angle
            eccentricity=1.3,] {angle
             = Y--O--V};
    \path pic[draw, angle radius=8mm,"$\psi$",angle
            eccentricity=1.5] {angle
             = V--O--Z};
        \end{tikzpicture}
\end{document}

This works but in my documnt it gives an error. Part of my preambles is

\usepackage[dutch,english]{babel}

If I put english,dutch my document is in dutch.

\usepackage{tikz-3dplot}
\usetikzlibrary{shapes.geometric, decorations.pathreplacing, matrix, angles, quotes, arrows, arrows.meta, datavisualization}

I hope this provides a basis to identify the problem to help me.

  • Attaching the image to your post unfortunately does not seem to have worked as intended. Could you please edit your question to include the image and the full code you use to produce the figure, please? – diabonas Mar 26 '16 at 10:39
  • You've still not actually uploaded the image you mention in your post. We don't have access to your home directory! – cfr Mar 26 '16 at 16:59
  • The command you're using is supposed to draw an arc in the xy plane. But the vector from P is not in this plane. – cfr Mar 28 '16 at 1:31
5

Is this what you want?

angles

If so, what's the problem using the angles library? It seems to work for me:

\documentclass[tikz,multi,border=10pt]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta,angles,quotes,calc}
\begin{document}
\tdplotsetmaincoords{60}{110}
\begin{tikzpicture}[>=latex,tdplot_main_coords,font=\footnotesize]%,scale=1.5]
  \coordinate (0) at (0,0,0);
  \coordinate (R) at (2.5,2.5,0);
  \coordinate (V) at (2.5,2.5,3);
  \path (V) -- (R) coordinate [pos=.05] (tl2);
  \draw[thick,->] (0,0,0) coordinate (O) -- (3,0,0) coordinate (X) node[anchor=north east]{$x$};
  \draw[thick,->] (0,0,0) -- (0,3,0) coordinate (Y) node[anchor=north west]{$y$};
  \draw[thick,->] (0,0,0) -- (0,0,3) coordinate (Z) node[anchor=south]{$z$};
  \draw[thick,->,color=red,opacity=0.5] (0,0,0) -- (2.5,2.5,3) coordinate (V) node[ right] {$P(\alpha,\beta,\gamma)$};
  \draw[dashed,magenta!50] (2.5,2.5,3) -- (2.5,2.5,0) -- (0,0,0);
  \draw[thick,blue!50] (2,0,0) -- (2.5,2.5,0);
  \draw[thick,blue!50] (2.5,2.5,0) -- (0,2,0);
  \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) -- (2,0,0)node [left=1ex] {$Q(\alpha,0,0)$} node[midway,left]{$\color{black}\alpha$};
  \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) -- (0,2,0)node [above] {$Q^{'}(0,\beta,0)$} node[midway,above]{$\color{black}\beta$};
  \draw[very thick,red!80!black,-{Triangle[fill=white]}] (0,0,0) -- (0,0,2)node [left] {$Q(0,0,\gamma)$};
  \draw[dashed,red!80!black,-{Triangle[fill=white]}] (0,0,0) -- (2.5,2.5,0)node  (b1)[right] {$R(\alpha,\beta,0)$};
  \draw[dashed,red!80!black,-{Triangle[fill=white]}] (2.5,2.5,3) -- (2.5,2.5,0)node [left,yshift=2.75cm]{$\color{black}\gamma$};
  \pic [blue, draw, thick, "$\theta$", angle radius=4mm] {angle = V--O--X };
  \pic [red, draw, thick, "$\phi$", angle eccentricity=1.3] {angle = Y--O--V };
  \pic [magenta, draw, thick, "$\psi$", angle radius=6mm, angle eccentricity=1.3] {angle = V--O--Z };
\end{tikzpicture}
\end{document}
  • Thank you very much @cfr. This is exactly what I was looking for. The only problem is my slow learning. However, this brings me back to the original problem which led me to use "\tdplotdrawarc". The code you have given works fine on my platform when I run it as a standalone document. When I put it in my larger document, it gives the error: "! Missing \endcsname inserted." Thank you all the same for your time and effort. – Zilore Mumba Mar 28 '16 at 13:02
  • You need to post a minimal example which produces the errors. Otherwise, we can't know where they are coming from. Make sure you use the TikZ library babel if you are using a language with active shorthands. – cfr Mar 28 '16 at 14:16
  • Are the anglemarks appearing in the right planes ? It seams they don't to me. – Tarass Mar 28 '16 at 18:20
  • They seem to me, I am putting the output in an edit to the post – Zilore Mumba Mar 28 '16 at 18:34
  • @ZiloreMumba Please don't edit to put output from different code in an answer. Output posted should reflect the code in the answer (or question) else it is extremely confusing. This is especially true if the output my code gives is not correct and your output is correct. But it is equally true if the output is just different. Imagine another user coming along and trying to figure out why the angles are printed in black, say. How is that output, they might well think, when then code says to colour them? Please edit your question or answer instead. – cfr Mar 28 '16 at 23:33

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.