# TikZ: How to spread out nodes/shapes FBD?

Basically I'm trying to make a free body diagram with one main diagram and 2 separate force diagrams for ease of viewing and analysis.

However, the two separate ones keep on overlapping on top of the rectangle and each other… how would I fix this?

I know from looking around there's things like shifts and node distance parameters. Or how would I go about using the positioning library?

\documentclass[man, floatsintext]{apa6}
\usepackage{soul}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{scopes}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}
\DeclarePairedDelimiter\norm{\lVert}{\rVert}
%"extra" packages are for a lab report format

\begin{tikzpicture}[
force/.style={>=latex,draw=blue,fill=blue},
axis/.style={densely dashed,gray,font=\small},
M/.style={rectangle,draw,fill=lightgray,minimum size=0.5cm,thin},
m/.style={rectangle,draw=black,fill=gray,minimum size=0.3cm,thin},
plane/.style={draw=black,fill=blue!10},
string/.style={draw=red, thick},
pulley/.style={thick},
]
%mainshape

\filldraw[blue!30!white, draw=black] (0,0) rectangle (3,1);
\draw[pulley](3.1,1.2) circle(0.25cm);
\filldraw[gray!40!white, draw=black] (1.5,1.05) rectangle (2,1.55);
\draw[red,thick] (2,1.2)--(2.91,1.2);
\draw[red,thick] (3.2,0.6)--(3.2,1);
\filldraw[gray, draw=black] (3.10, 0.1) rectangle (3.6, 0.6);

%FBD1

\begin{scope};
\node[M](M){};
{[axis,->]
\draw (0,-1) -- (0,2) node[right] {$+y$};
\draw (M) -- ++(2,0) node[right] {$+x$};}
{[force,->]
% Assuming that Mg = 1. The normal force will therefore be cos(alpha)
\draw (M.center) -- ++(0,1) node[above right] {$F_N$};
\draw (M.west) -- ++(-1,0) node[left] {$F_f$};
\draw (M.east) -- ++(1,0) node[above] {$T$};}
\draw[force,->] (M.center)-- ++(0,-1) node[below] {$Mg$};
\end{scope};

%FBD2
\node[m] (m) {};
\draw[axis,->] (m) -- ++(0,-2) node[left] {$+$};
{[force,->]
\draw (m.north) -- ++(0,1) node[above] {$T'$};
\draw (m.south) -- ++(0,-1) node[right] {$mg$};
};

\end{tikzpicture}

• Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
– cfr
Oct 12 '14 at 18:16

The positioning library is good for this. You can adjust the distances to suit. I've also adjusted the pulley a little to tidy up the line joinings and prevent the pulley overlapping the block.

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[
force/.style={>=latex,draw=blue,fill=blue},
axis/.style={densely dashed,gray,font=\small},
M/.style={rectangle,draw,fill=lightgray,minimum size=0.5cm,thin},
m/.style={rectangle,draw=black,fill=gray,minimum size=0.3cm,thin},
plane/.style={draw=black,fill=blue!10},
string/.style={draw=red, thick},
pulley/.style={draw, thick, circle},
]
%mainshape

\filldraw[blue!30!white, draw=black] (0,0) coordinate (b) rectangle (3,1) coordinate (c);
%   \draw[pulley] (3.1,1.2) circle (0.25cm);
\node (pulley) [pulley, minimum width=.5cm, anchor=south west] at (c) {};
\filldraw[gray!40!white, draw=black] (1.5,1.05) rectangle (2,1.55);
\draw[red,thick] (2,1.2)--(pulley.west);
\filldraw[gray, draw=black] (3.10, 0.1) rectangle (3.6, 0.6) coordinate (a);
\draw[red,thick] (a -| pulley.south)--(pulley.south);

%FBD1

\begin{scope};
\node[M, right=50pt of a](M){};
{[axis,->]
\draw (0,-1) -- (0,2) node[right] {$+y$};
\draw (M) -- ++(2,0) node[right] {$+x$};}
{[force,->]
% Assuming that Mg = 1. The normal force will therefore be cos(alpha)
\draw (M.center) -- ++(0,1) node[above right] {$F_N$};
\draw (M.west) -- ++(-1,0) node[left] {$F_f$};
\draw (M.east) -- ++(1,0) node[above] {$T$};}
\draw[force,->] (M.center)-- ++(0,-1) node[below] {$Mg$};
\end{scope};

%FBD2
\node[m, left=25pt of b] (m) {};
\draw[axis,->] (m) -- ++(0,-2) node[left] {$+$};
{[force,->]
\draw (m.north) -- ++(0,1) node[above] {$T'$};
\draw (m.south) -- ++(0,-1) node[right] {$mg$};
};

\end{tikzpicture}
\end{document}


Note that I don't know what these things are supposed to look like!

• Awesome, thanks! I just had to change the \draw line coordinates :) Oct 12 '14 at 18:32
• @Melanie Glad it helped. I didn't think it was quite right but not knowing what it needed to look like, I thought it best to just demonstrate the method and let you implement it properly!
– cfr
Oct 12 '14 at 18:46
• It does not make sense that the rope passes through the center of the pulley. :-) Oct 14 '14 at 5:24

Correcting the middle figure in the accepted answer; The boxes, rope and pulley are not correctly drawn.

\documentclass[pstricks,border=12pt,12pt,dvipsnames]{standalone}
\psset{dimen=monkey,fillstyle=solid}

\def\Complete{%
\begin{pspicture}(8,6)
\psline{->}(0,6)
\psline{->}(8,0)
\uput[0](0,6){$y+$}
\uput[90](8,0){$x+$}
\psframe[fillcolor=NavyBlue!50](5,3)
\pscircle(5,3){.6}
\psframe[fillcolor=gray](2,3)(3,4)
\rput(2.5,3.5){$m_1$}
\psframe[fillcolor=gray](5.1,.5)(6.1,1.5)
\rput(5.6,1){$m_2$}
\psline(3,3.6)(5,3.6)
\psline(5.6,3)(5.6,1.5)
\end{pspicture}}

\def\OnTable{%
\begin{pspicture}(5,6)
\psframe[fillcolor=gray](2,3)(3,4)
\psline{->}(2.5,4)(2.5,5)
\psline{->}(2.5,3)(2.5,1)
\psline{<-}(1,3.5)(2,3.5)
\psline{->}(3,3.5)(4,3.5)
\uput[90](2.5,5){$F_n$}
\uput[-90](2.5,1){$F_{g,1}$}
\uput[180](1,3.5){$F_f$}
\uput[0](4,3.5){$T$}
\end{pspicture}}

\def\Hanging{%
\begin{pspicture}(3,6)
\psframe[fillcolor=gray](1,3)(2,4)
\psline{->}(1.5,4)(1.5,5)
\psline{->}(1.5,3)(1.5,1)
\uput[90](1.5,5){$T$}
\uput[-90](1.5,1){$F_{g,2}$}
\end{pspicture}}

\begin{document}

\begin{pspicture}(16,6)
\rput[bl](0,0){\OnTable}
\rput[bl](5,0){\Complete}
\rput[bl](13,0){\Hanging}
\end{pspicture}

\end{document}