TeX - LaTeX Asked on January 6, 2022
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}
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.
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.
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}
Answered by AndréC on January 6, 2022
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
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
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--
Answered by js bibra on January 6, 2022
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP