# TikZ positioning problem

I am trying to draw a more complex one but with no success. I want the one with one stiffness and damper (KR and CR) to be joined with the open end of the one with spring alone (K4). Also I am using an originally answered question which I am modifying. Is their anyway I can turn the completed diagram for me through 90degrees. Standing vertically instead of horizontally (as it is now). Thanks

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}

\begin{document}

\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
\tikzset{
spring/.style = {thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment
length=6}},
damper/.style ={thick,decoration={markings,
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)+(1pt,0)$) -- (dmp.south east) -- (dmp.south
west) -- ($(dmp.north west)+(1pt,0)$);
\draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
}
}, decorate},
ground/.style ={fill,pattern=north east lines,draw=none,minimum width=0.75cm,minimum height=0.3cm}
}

\begin{scope}[rotate=-90,transform shape]       %%% rotate here, both options needed.

\node (wall) [ground, minimum width=3cm,anchor=center] at (0,0) {};
\node (walle) [ground, minimum width=3cm,anchor=center] at (0,6) {};

\draw (wall.north east) -- (wall.north west);
\draw (walle.south west) -- (walle.south east);

%% now a parallel spring
\draw [line width=0.8pt] ($(wall.north west)!0.2!(wall.north east)$) -- ++(0,2cm)coordinate (z);
\draw [spring] (z) -- ++(0,2cm)coordinate (t);
\draw [line width=0.8pt] (t) -- ($(walle.south west)!0.2!(walle.south east)$);

\end{scope}

\begin{scope}[rotate=-90,transform shape]       %%% rotate here, both options needed.

\draw [line width=0.8pt] ($(wall.north west)!0.8!(wall.north east)$) -- ++(0,1cm)coordinate (z);
\draw [spring] (z) -- ++(0,2cm)coordinate (t);
%\draw [damper] (t) -- ++(0,2cm)coordinate (u);
\draw (-0.5,0) -- (0.5,0);
\draw [spring] (-0.5,-2) -- (-0.5,0) node[draw=none,midway,left=0.3cm] {${k}{_R}$};
\draw [damper,label=D1,] (0.5,-2) -- (0.5,0)node[draw=none,midway,right=0.4cm] {${C}{_R}$};
\draw (-0.5,-2) -- (0.5,-2);
%\draw [line width=0.8pt] (u) -- ($(walle.south west)!0.8!(walle.south east)$);

\end{scope}

\end{tikzpicture}

\end{document}

• Hello. I changed the title from "POSITIONING IN LATEX MORE", which sounds really rude (moreover, all-caps is considered shouting), to something more civil, but I didn't get what do you want to achieve. Would you please edit the question and be a bit more specific with your needs? It would make it more possible to answer your question. – yo' Jan 16 '15 at 23:14
• I've updated my answer with (what I hope) the desired orientation of the elements. – Gonzalo Medina Jan 17 '15 at 2:49

One option would be to use auxiliary coordinates defined from the (t) coordinate (the lower end of the left line with the spring)

\coordinate (upperright) at ( $(t)+(0.5,0)$ );
\coordinate (lowerleft) at ( $(t)+(-0.5,-2)$ );


and then use those coordinates to draw the "rectangular" component

\draw (lowerleft) -- (lowerleft-|upperright);
\draw (upperright) -- (lowerleft|-upperright);
\draw [damper,label=D1,]
(lowerleft|-upperright) -- (lowerleft)
node[draw=none,midway,left=0.3cm] {${C}{_R}$};
\draw [spring]
(upperright) -- (lowerleft-|upperright)
node[draw=none,midway,right=0.1cm] {${k}{_R}$};


The vertical segment connecting the rectangular component to the lower ground node can be now obtained with

\draw [line width=0.8pt]
($(wall.north west)!0.8!(wall.north east)$) -- (t|-lowerleft);


Suppressing the rotations in the scopes and changing some signs in the y-coordinates give you the desired orientation (if I understood you correctly).

The complete code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}

\begin{document}

\begin{tikzpicture}[every node/.style={draw,outer sep=0pt,thick}]
\tikzset{
spring/.style = {thick,decorate,decoration={zigzag,pre length=0.3cm,post length=0.3cm,segment
length=6}},
damper/.style ={thick,decoration={markings,
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)+(1pt,0)$) -- (dmp.south east) -- (dmp.south
west) -- ($(dmp.north west)+(1pt,0)$);
\draw [thick] ($(dmp.north)+(0,-5pt)$) -- ($(dmp.north)+(0,5pt)$);
}
}, decorate},
ground/.style ={fill,pattern=north east lines,draw=none,minimum width=0.75cm,minimum height=0.3cm}
}

\node (wall) [ground, minimum width=3cm,anchor=center] at (0,0) {};
\node (walle) [ground, minimum width=3cm,anchor=center] at (0,6) {};

\draw (wall.north east) -- (wall.north west);
\draw (walle.south west) -- (walle.south east);

%% now a parallel spring
\draw [line width=0.8pt]
($(wall.north west)!0.2!(wall.north east)$) -- ++(0,2cm)coordinate (z);
\draw [spring]
(z) -- ++(0,2cm)coordinate (u);
\draw [line width=0.8pt]
(u) -- ($(walle.south west)!0.2!(walle.south east)$);

\draw [line width=0.8pt]
($(walle.south west)!0.8!(walle.south east)$) -- ++(0,-1cm)coordinate (w);
\draw [spring] (w) -- ++(0,-2cm)coordinate (t);

\coordinate (upperright) at ( $(t)+(0.5,0)$ );
\coordinate (lowerleft) at ( $(t)+(-0.5,-2)$ );

\draw (lowerleft) -- (lowerleft-|upperright);
\draw (upperright) -- (lowerleft|-upperright);
\draw [damper,label=D1,]
(lowerleft|-upperright) -- (lowerleft)
node[draw=none,midway,left=0.3cm] {${C}{_R}$};
\draw [spring]
(upperright) -- (lowerleft-|upperright)
node[draw=none,midway,right=0.1cm] {${k}{_R}$};

\draw [line width=0.8pt]
($(wall.north west)!0.8!(wall.north east)$) -- (t|-lowerleft);

\end{tikzpicture}

\end{document}

• Thanks Gonzalo. I always want to do something they seek for help, then add to it. I have however found it hard to close this up. I mean the place where we have CR and KR are actually supposed to be joined to the south fill line (bottommost part) with a simple line (vertical line). For the last 4hrs I have found it hard to create that line. Please help. – Ismail Ladele Ladipo Jan 17 '15 at 3:30
• @IsmailLadeleLadipo You're welcome! I updated my answer adding this new line. Don't forget that, if you consider an answer solved your problem, you can accept it by clicking the checkmark to its left. In case of doubt, please see How do you accept an answer?. – Gonzalo Medina Jan 17 '15 at 3:40
• Thanks. I just clicked the check mark, Have a blissful weekend. – Ismail Ladele Ladipo Jan 17 '15 at 3:51