6

enter image description here

\begin{tikzpicture}
     \draw[dashed] (1.9,3)--(4,3);
     \draw[dashed] (4,3)--(4,0);
     \draw[dashed] (2.5,4)--(4,3);
     \draw[dashed] (4,3)--(2,0);
     \draw[very thick,->] (0,0)--(1.5,0) node[below] {$\mathbf{e}_1$};
     \draw [very thick, ->] (0,0)--(0.94,1.5) node[left] {$\mathbf{e}_2$};
     \draw [very thick, red, ->] (0,0)--(4,3) node[midway,below] {$\mathbf{A}$};
     \draw[->] node[below]{$O$} (0,0) --(6,0) node [above] {$m'$};
     \draw[->] (0,0)--(3,4.8) node[above] {$m''$};
     \node at (4.2,3.1) {$M$};
     \node at (1.4,3) {$\boldsymbol{M''}$};
     \node at (2.3,-0.14) {$\boldsymbol{M'}$};
\end{tikzpicture}

enter image description here

Here's the result of my code above, but I'm having two problems I don't know how to draw the angles $\alpha$ and $\beta$ and the thick nodes $M''$ and $M'$.

For those interested in figure it's representing the covariant and contravariant components.

5
  • tex.stackexchange.com/questions/554562/…
    – js bibra
    Commented Jul 25, 2020 at 0:28
  • @jsbibra Hi! thanks for the comment, note that I've learned only the basics of Tikz a few weeks ago, please consider that! have you a Gmail so I can contact you?
    – user209604
    Commented Jul 25, 2020 at 0:31
  • 1
    [email protected]
    – js bibra
    Commented Jul 25, 2020 at 5:06
  • Hi, please give a fully compilable code.
    – AndréC
    Commented Jul 25, 2020 at 5:08
  • @Electroelf -- please have a look at the edit below
    – js bibra
    Commented Jul 25, 2020 at 6:29

2 Answers 2

9

Any angle is defined by three points which are endorsed below as coordinates

Thereafter the angles are physically drawn with the help of the pic command

Simply add all the code below to your own code to get the desired output

enter image description here

\coordinate(m) at (4,3);
\coordinate(x) at (4,0);
\coordinate(o) at (0,0);
\coordinate(y) at (2.5,4);

\pic[ draw,->,>=stealth,blue, "$\theta_1$"{fill=white},inner sep=1pt, circle,  draw,angle 
eccentricity=1.1, angle radius = 10mm] {angle = m--o--x};   

\pic[ draw,->,>=stealth,blue, "$\theta_2$"{fill=white},inner sep=1pt, circle,  draw,angle 
eccentricity=1, angle radius = 7mm] {angle = y--o--m};

EDIT -- I simply forgot the point nodes required by the OP-- apologies

enter image description here

\documentclass[]{article}
\usepackage{tikz}
\usepackage{newtxtext,newtxmath}

\usetikzlibrary{arrows, shapes, positioning, calc, decorations.text, angles, 
               quotes}
\begin{document}

\begin{tikzpicture}[
                    mycirc/.style={circle,
                                   fill=red!50!black, 
                                   minimum size=5pt,
                                   inner sep=0pt}
                    ]
\draw[dashed] (1.9,3)--(4,3);
\draw[dashed] (4,3)--(4,0);
% The nodes as points or circles are drawn as under--note tha the names of
% the nodes are given in `()` and the same can be used in place of using
% coordinate names
\node[mycirc]at(0,0) (a) {};
\node[mycirc]at(4,0) (b) {};
\node[mycirc]at(2,0) (c) {};
\node[mycirc]at(1.9,3) (d) {};
\node[mycirc]at(4,3) (e) {};
\node[mycirc]at(2.5,4) (f) {};

\draw[dashed] (2.5,4)--(4,3);
\draw[dashed] (4,3)--(2,0);
\draw[very thick,->] (0,0)--(1.5,0) node[below] {$\mathbf{e}_1$};
\draw [very thick, ->] (0,0)--(0.94,1.5) node[left] {$\mathbf{e}_2$};
\draw [very thick, red, ->] (0,0)--(4,3) node[midway,below] {$\mathbf{A}$};
\draw[->] node[below]{$O$} (0,0) --(6,0) node [above] {$m'$};
\draw[->] (0,0)--(3,4.8) node[above] {$m''$};
\node at (4.2,3.1) {$M$};
\node at (1.4,3) {$\boldsymbol{M''}$};
\node at (2.3,-0.14) {$\boldsymbol{M'}$};

%Coordinate names for the angles-- can be deleted and node names can also be 
%used
\coordinate(m) at (4,3);
\coordinate(x) at (4,0);
\coordinate(o) at (0,0);
\coordinate(y) at (2.5,4);

\pic[ draw,->,>=stealth,green!50!yellow!50!red, "$\theta_1$"{fill=white},inner sep=1pt, circle,  draw,angle 
eccentricity=1.1, angle radius = 10mm] {angle = m--o--x};   

\pic[ draw,->,>=stealth,blue, "$\theta_2$"{fill=white},inner sep=1pt, circle,  draw,angle 
eccentricity=1, angle radius = 7mm] {angle = y--o--m};
\end{tikzpicture}

\end{document}

EDIT2 -- for inner angles instead of outer angles

Change the last lines of the code containing the \pic command to--

\pic[ "$\beta$"{fill=white, inner sep=0pt},draw=green!50!yellow!50!red, <->, 
                >=stealth, angle eccentricity=1, angle radius = 1.5cm] 
                {angle = x--o--m};   

    \pic["$\alpha$"{fill=white, inner sep=0pt}, draw=orange, <->, >=stealth, 
               angle eccentricity=1, angle radius=1.5cm]
               {angle = m--o--y};

and you would get--

enter image description here

6

When you want to build a figure, it is easier to give a name to the points you want to use. To do this, I used nodes, because any path from one node to another goes from edge to edge without crossing them. To do this, I defined a style called point like this point/.style={circle,fill,inner sep=1.3pt}

I used the angle library to draw the angles. And I used the calc library to build the orthogonal projections, which avoids having to do manual calculations.

screenshot

 \documentclass[tikz,border=5mm]{standalone}

 \usepackage{amsmath}
 \usetikzlibrary{arrows,angles,calc,quotes}

\begin{document}
\begin{tikzpicture}[
point/.style={circle,fill,inner sep=1.3pt}
]
\node[point,label={[below left,yshift=-2pt]:$O$}] (O) at (0,0){}; 
\node [point,label={[above right,yshift=-2pt]:$\boldsymbol{M}$}](M) at (4,3){};
\node [point,label={[below,yshift=-2pt]:$\boldsymbol{M'}$}](M') at (2,0){};
\node [point,label={[left]:$\boldsymbol{M''}$}](M'') at (1.9,3){};
\draw[dashed] (M'')--(M)--(M');
\draw[dashed] (M)--($(O)!(M)!(M')$); % projection orthogonale de M sur (OM')
\draw[dashed] ($(O)!(M)!(M'')$)--(M);% projection orthogonale de M sur (OM'')
%     \draw[dashed] (4,3)--(2,0);
\draw[very thick,->] (O)--(1.5,0) node[below] {$\mathbf{e}_1$};
\draw [very thick, ->] (O)--(0.94,1.5) node[left] {$\mathbf{e}_2$};
\pic [draw=violet,fill=violet!30,text=violet!60!black,angle radius=8mm,"$\beta$",angle eccentricity=1.3]{angle=M'--O--M};
\pic [draw=blue,fill=blue!40,text=blue,angle radius=9mm,"$\alpha$",angle eccentricity=1.3]{angle=M--O--M''};
\draw [very thick, red, ->] (O)--(M) node[midway,below] {$\mathbf{A}$};
\node[point] at (O){};% We place again the point  O     \draw[->] (O) --(6,0) node [above] {$m'$};
\draw[->] (O)--(3,4.8) node[above] {$m''$};
%     \node at (4.2,3.1) {$M$};
%     \node at (1.4,3) {$\boldsymbol{M''}$};
%     \node at (2.3,-0.14) {$\boldsymbol{M'}$};
\end{tikzpicture}
\end{document}
6
  • Hi, can you sent the dot of O above? I see the violet arc in the dot. Same for the arrows e_1 and e_2. Thank you.
    – Sebastiano
    Commented Jul 25, 2020 at 12:21
  • 1
    @Sebastiano There, it's done.
    – AndréC
    Commented Jul 25, 2020 at 14:15
  • Oh, thank you...I have forgot...."please"...For my opinion now it is better instead of first answer.
    – Sebastiano
    Commented Jul 25, 2020 at 14:54
  • I had noticed, but if the OP doesn't ask for it, why would I change it? As you requested, I did. :-)
    – AndréC
    Commented Jul 25, 2020 at 18:28
  • 1
    No, on the contrary, it's nice to see that someone is interested in what we're doing.
    – AndréC
    Commented Jul 25, 2020 at 20:08

You must log in to answer this question.