# How to Draw This Free Body Diagram on TikZ or PGFPlots 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}

• Can you draw it by hand say, scan it and post? I don't quite get your explanation. Also please add a MWE. – user11232 Sep 15 '14 at 0:01
• Here is the MWE: – user11629 Sep 15 '14 at 0:10
• \documentclass[11pt]{article} \usepackage{pgfplots} \usepackage{tikz \begin{document} \end{document} – user11629 Sep 15 '14 at 0:11
• minimal working example (MWE) and add it to the question please. – user11232 Sep 15 '14 at 0:12
• As @HarishKumar said, an MWE is needed. You can edit it into your question by clicking the 'edit' link at the bottom left of your question. Then paste or type your code, highlight it and click the {} button to format it as code. – cfr Sep 15 '14 at 0:13

\documentclass[11pt]{article}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\begin{scope}
\draw[<-] (0,0) -- node[right]{$W_{m}$}(0,2)
node[circle,fill,inner sep=3mm,text=white,anchor=south] (m) {$m$};
\draw (m.north) -- node[right]{$T \uparrow$} +(0,2);
\end{scope}
\begin{scope}[shift={(2cm,-8mm)}]
\draw[<-] (0,0) -- node[right]{$W_{2m}$}(0,2)
node[circle,fill,inner sep=6mm,text=white,anchor=south] (m) {$m$};
\draw (m.north) -- node[right]{$T \uparrow$} +(0,2);
\end{scope}
\end{tikzpicture}
\end{document} Explanations:

scope forms a group around its contents so that we can perform operations (like shift) on the entire group. Every node's contents are separated from the border by inner sep (In other words, the distance between the contents and the border). By adjusting inner sep we can make the node bigger or smaller (so as to just enclose the contents). We can label 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 fron m.north to a point that is 0cm away horizontally and 2cm away vertically.

• Great! Thanks! Also, I want to learn what this code does instead of just blindly copying it. A few questions: sep=3mm - what does this do? \begin{scope} - and this? (m) - why does this have a place here when you already have {m} right next to it? (m.north) - Does this have to do with (m)? And later, the +(0,2) plots the next line in relation to the end of the first? – user11629 Sep 15 '14 at 1:18
• @user11629 I have added some explanations. Ask for any further clarifications. You can always refer to pgfmanual which has lot of examples and well written. To access it, run texdoc pgfmanual from command prompt/terminal. – user11232 Sep 15 '14 at 11:04 Here is the code for one of the two masses shown above. The second is just like the first but with slightly different coordinates and modified labels.

\documentclass[tikz, border=10pt]{standalone}
\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{document}

• I didn't want to change my documentclass from article to tikz, so I just copy pasted \begin{tikzpicture} ..... \end{tikzpicture}. What is wrong with this? The error given is apparently on line 142: edge [near start, xshift=5pt, "$T$", <-, shorten >=10pt, shorten <=2.5pt] (0,1); but I don't think that if it worked for you this is the issue. – user11629 Sep 15 '14 at 0:55
• Did you copy the \usetikzlibrary line into your preamble? The document class isn't TiKZ. Just standalone is particularly good for typesetting images etc. for posting here or including in another document. It is used for lots of examples on TeX SE. You aren't expected to use it for your actual document. – cfr Sep 15 '14 at 0:58
• @user11629 Sorry. Forgot to ping you. You need the quotes library. You'll get an error without it. – cfr Sep 15 '14 at 0:59
• I did copy it, and then it wouldn't let me compile because of that line. Now, when I put in \documentclass[11pt] {article} {standalone}, it didn't compile because of standalone. – user11629 Sep 15 '14 at 1:00
• @user11629 It is because tikz already loads graphicx with conflicting options. So when I try to compile your code with it in, LaTeX complains about an 'option clash'. If you really needed to pass the package options, you could do it but, in this case, you don't and would be better not, so the easiest thing is to just remove the line and let tikz load graphicx automatically. – cfr Sep 15 '14 at 1:27

A recommended diagram with PSTricks.

\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-node,pst-plot,esvect}

\begin{document}
\begin{pspicture}[arrows=->](8,6)
\rput(3,3){\Circlenode[radius=.5]{m}{$m$}}
\rput(6,3){\Circlenode[radius=1]{M}{$2m$}}
\pnode[0,-1](m){w}  \pnode[0,2](m){t}   \pnode[0,-2](M){W}  \pnode[0,2](M){T}
\ncline{m}{w}   \ncline{m}{t}   \ncline{M}{W}   \ncline{M}{T}
\uput[-90](w){$\vv*{W}{m}$} \uput[-90](W){$\vv*{W}{2m}$}    \uput(t){$\vv{T}$}  \uput(T){$\vv{T}$}
\psaxes[ticks=none](.5,2)(1.5,3)[$x$,0][$y$,90]
\end{pspicture}
\end{document} An another possibility which more strict follow left part of the given sketch. Right can be easy to add on the same way ...

\documentclass[12pt,tikz,border=3mm]{standalone}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[
node distance = 0mm,
every node/.style = {inner sep=2pt}]
\coordinate                     (a)  at (0,0);
\coordinate[below=11mm of a]    (b);
\node[circle,draw,minimum size=3mm,
at=(b)]            (c)    {$m$};
\draw (a) -- (c);
\node[below right=of a]         {$T\uparrow$};
\node[above left =of a]  (d)    {$\downarrow W_m$};
\node[above=of d.north west]    {$\uparrow^+$};
\end{tikzpicture}
\end{document}