Code: Select all
% --------- spanleg.tex --------- Apr.28,2015 ---------
%
\documentclass[10pt]{article}
\usepackage{tikz}
% ---
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{center}
\setlength\PreviewBorder{10pt}%
% ---
\tikzstyle{load} = [thick,-latex]
\tikzstyle{stress} = [-latex]
\tikzstyle{dim} = [latex-latex]
\tikzstyle{axis} = [-latex,blue!55]
% ---
\tikzstyle{two}=[x={(1cm,0cm)},y={(0cm,1cm)}] % axes scale, 1cm
\begin{document}
\begin{center}
% =================== Start Picture =================
\begin{tikzpicture} [two]
% -------- a) Draw Axes, blue dashed ------
\coordinate (O) at (0,0);
\draw[axis,two,dashed] (O) -- ++(6,0) node[right] {$x$};
\draw[axis,two,dashed] (O) -- ++(0,6) node[above] {$y$};
%
% -------- b) Draw structural elements
\draw[ultra thick] (0,3) -- ++(5,0); % beam [starting point to increment]
\draw[ultra thick] (3.5,1.5) -- ++(0,3); % cross beam
% -------- b2) Draw grid
\draw [step=1,blue,dotted] (0,0) grid (5,5);
% -------------------------------------------------
%
% ------------ c2) Concentrated load
\begin{scope}[xshift=2cm, yshift=3cm, rotate=0, scale=0.5]
\draw[load,blue] (0,2) -- ++(0,-2) node[pos=0.0,right,xshift=0cm] {$P$};
\end{scope}
% x-axis dimensions [dx=3.5] - #1
\begin{scope}[xshift=0cm, yshift=1cm, rotate=0, scale=1]
\draw[dim] (0,0) -- ++(3.5,0) node[midway,above] {$3.5\,m$}; % beam dimension
\draw (3.5,-0.2) -- ++(0,0.4);
\draw (0,-0.2) -- ++(0,0.4);
\end{scope}
% x-axis dimensions [dx=1.5] - #2
\begin{scope}[xshift=3.5cm, yshift=1cm, rotate=0, scale=1]
\draw[dim] (0,0) -- ++(1.5,0) node[midway,above] {$1.5\,m$}; % beam dimension
\draw (1.5,-0.2) -- ++(0,0.4);
\draw (0,-0.2) -- ++(0,0.4);
\end{scope}
% test rotation caption [dx=1.5] - #3 (fails on rotation string '1.5 m')
\begin{scope}[xshift=5cm, yshift=1.5cm, rotate=90, scale=1]
\draw[dim] (0,0) -- ++(1.5,0) node[midway,right] {$1.5\,m$}; % col. dimension
\draw (1.5,-0.2) -- ++(0,0.4);
\draw (0,-0.2) -- ++(0,0.4);
\end{scope}
%
\end{tikzpicture} %
% ========================= End Picture =================
% ----------------------------------------------------------
\end{center}
\end{document}
% ---- EOF: spanleg.tex ----