TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I really like CircuiTikZ for drawing diagrams in my LaTeX documents. However I mostly draw mechanical and not electronic systems, which is why I'm looking for some similar way to draw mechanical systems. What I want is something to draw masses, springs, dampers and ground (boundary condition). The diagrams here (page 16) are typical examples:

enter image description here

Anybody got some suggestions or am I out of luck?

share|improve this question
You can probably draw those systems using just TikZ without any specialised packages. There are some examples of things similar to what you want in this answer: tex.stackexchange.com/questions/13401/…. Springs could easily be added using the decorations.pathreplacing library (see example here: tex.stackexchange.com/questions/12678/squiggly-arrows-in-tikz/…) – Jake Mar 20 '11 at 14:22
Google books says that there is no preview available for the book you linked. Do you have an image? – Caramdir Mar 20 '11 at 16:44
up vote 61 down vote accepted

Inspired by Andrew Stacey's pretty drawing, here's a take on two of the pictures you linked to. Once you start with drawing stuff like this, you'll pretty quickly accumulate your own library of elements, and every successive drawing will be easier.



\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
\tikzstyle{spring}=[thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment length=6}]
  mark connection node=dmp,
  mark=at position 0.5 with 
    \node (dmp) [thick,inner sep=0pt,transform shape,rotate=-90,minimum width=15pt,minimum height=3pt,draw=none] {};
    \draw [thick] ($(dmp.north east)+(2pt,0)$) -- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$);
    \draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
}, decorate]
\tikzstyle{ground}=[fill,pattern=north east lines,draw=none,minimum width=0.75cm,minimum height=0.3cm]

\node (M) [minimum width=3.5cm,minimum height=2cm] {mass, $m$};

\node (ground1) at (M.south) [ground,yshift=-1.5cm,xshift=-1.25cm,anchor=north] {};
\draw (ground1.north west) -- (ground1.north east);
\draw [spring] (ground1.north) -- ($(M.south east)!(ground1.north)!(M.south west)$);

\node (ground2) at (M.south) [ground,yshift=-1.5cm,anchor=north] {};
\draw (ground2.north west) -- (ground2.north east);
\draw [damper] (ground2.north) -- ($(M.south east)!(ground2.north)!(M.south west)$);

\node (ground3) at (M.south) [ground,yshift=-1.5cm,xshift=1.25cm,anchor=north] {};
\draw (ground3.north west) -- (ground3.north east);
\draw [spring] (ground3.north) -- ($(M.south east)!(ground3.north)!(M.south west)$);

\draw [-latex,ultra thick] (M.north) ++(0,0.2cm) -- +(0,1cm);

\node (M) [minimum width=1cm, minimum height=2.5cm] {$m$};

\node (ground) [ground,anchor=north,yshift=-0.25cm,minimum width=1.5cm] at (M.south) {};
\draw (ground.north east) -- (ground.north west);
\draw [thick] (M.south west) ++ (0.2cm,-0.125cm) circle (0.125cm)  (M.south east) ++ (-0.2cm,-0.125cm) circle (0.125cm);

\node (wall) [ground, rotate=-90, minimum width=3cm,yshift=-3cm] {};
\draw (wall.north east) -- (wall.north west);

\draw [spring] (wall.170) -- ($(M.north west)!(wall.170)!(M.south west)$);
\draw [damper] (wall.10) -- ($(M.north west)!(wall.10)!(M.south west)$);

\draw [-latex,ultra thick] (M.east) ++ (0.2cm,0) -- +(1cm,0);


springs and stuff

share|improve this answer
Very nice! Looks professional. – Loop Space Mar 21 '11 at 7:53
Cool! What about to write a package for that? – Spike May 6 '11 at 8:49
Thank you very much! It's a good starting point for me to create mechanical (or any other) pictures! – uzsolt Apr 22 '12 at 15:56
The only change I made was to do the springs and dampers in a slightly different fashion: \draw [spring] ($(wall.east)+(0,0.3cm)$)-- ($(M.west)+(0,0.3cm)$); This way you just specify a x,y distance instead of angles and doing that crazy math... – andy mcevoy Jul 22 '15 at 20:40

As Jake said, it's fairly easy to draw these using the existing TikZ tools. Here's a diagram of a coupled pendulum that I use in my lectures.

coupled pendula




\draw[ultra thick,blue] (0,0) -- (1,-3);
\fill[green!50!black] (1,-3) circle (.4);
\draw[->,thick,red!50!green] (1,-3) -- (-.5,-3.5);
\draw[ultra thick,blue] (0,0) -- (-2,-4);
\fill[green!50!black] (-2,-4) circle (.3);
\draw[->,thick,red!50!green] (-2,-4) -- (-1,-4.5);
\draw[thick,orange] (-1,-2) -- (-.8,-2) (.5,-2) -- (.667,-2);
\draw[thick,orange,decorate,decoration={coil,aspect=0.7,amplitude=5}] (-.8,-2) -- (.5,-2);
\draw[<->,thick,red!50!green] (-1,-2.5) -- (.667,-2.5);
\fill (0,0) circle (.2);

The bit to notice is the spring. As Jake said in his comment, this is done by replacing the path by a coil.

share|improve this answer
Mmmmh! This makes me glad that my undergrad times with compulsory Engineering Mechanics classes are over... – Jake Mar 20 '11 at 23:26

you can use this package


share|improve this answer
That looks like an interesting package! Would you be able to post an example implementation of one of the figures I have in my answer? – Jake May 6 '11 at 20:02
The link is broken – Yola Feb 6 '15 at 10:47
ça fonctionne le pdf : sciences-indus-cpge.papanicola.info/IMG/pdf/rpcinematik.pdf – rpapa Feb 6 '15 at 17:18

This might help. One can use an american resistor or cute inductor for springs, and a european resistor for mass.


% ************************* mechanical dashpot **************************



% create dashpot to-path style

\compattikzset{dashpot/.style = {\circuitikzbasekey, /tikz/to path=\dashpotpath}}

\draw (0,0) to[dashpot,o-*] (2,0);
\draw (3,1) to[dashpot,o-*] (3,-1);


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.