This is not a duplicate question of the one titled Creating a Free Body Diagram in TikZ. I am confused as to how one might draw this specific diagram:
Say we want to describe two masses on a pulley and we want to draw 2 diagrams, 1 for each box. They would look like this:
(down arrow) m1g
string
mass 1 (circle)
(up arrow) T
and:
(down arrow) m2g
string
mass 2 (circle)
(up arrow) T
Here is what I've got so far:
\documentclass[11pt]{article}
\usepackage{tikz}
\usepackage[pdftex]{graphicx}
\usetikzlibrary{quotes}
\begin{document}
\begin{tikzpicture}
\path [draw] (0,2) -- (0,1);
\path (0,2)
edge [near start, xshift=5pt, "$T$", <-, shorten >=10pt, shorten <=2.5pt] (0,1);
\path (0,1)
edge [very near end, xshift=5pt, "$m_1g$", ->, shorten <=10pt, shorten >=2.5pt] (0,0);
\node [circle, fill, radius=2.5pt, label=right:$mass_1$] at (0,1) {};
\end{tikzpicture}
\end{tikzpicture}
\end{document}
Best Answer
Explanations:
scope
forms a group around its contents so that we can perform operations (like shift) on the entire group. Everynode
's contents are separated from the border byinner sep
(In other words, the distance between the contents and the border). By adjustinginner sep
we can make the node bigger or smaller (so as to just enclose the contents). We canlabel
a node by(m)
so that we can use that node's anchors (for ex,m.north
) later whereas{m}
is the content of the node. And finally(m.north) -- +(0,2)
means draw a line fronm.north
to a point that is0cm
away horizontally and2cm
away vertically.