Graphics, Figures & TablesTikZ: macro rotation (span leg+string)

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

TikZ: macro rotation (span leg+string)

Post by Sundial »

It could be sometimes useful to create a unique macro which the LaTeX user may rotate the span leg with, along the embedded string, as per attachments. Thanks in advance

Code: Select all

Code, edit and compile here:
% --------- 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
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Attachments
13.png
13.png (10.92 KiB) Viewed 4491 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

TikZ: macro rotation (span leg+string)

Post by Johannes_B »

Hi, unfortunately i cannot help you with the TikZ stuff, i don't have enough training.
One thing caught my attention, the italic units. According to the BIPM units are typeset upright. Package siunitx gives some more information and a great set of macros to save some time.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

TikZ: macro rotation (span leg+string)

Post by Sundial »

Hi Joannes,
what I'm running to investigate is "something of slim", and specifically the simple way (if exists, as I believe) to rotate strings (not units, they could be litteral marks, l_1, d_1, etc.). That permits the LaTeX user to avoid big macros for solving easy drawbacks. Cheers.
Sundial
Posts: 57
Joined: Thu Apr 19, 2012 7:28 pm

TikZ: macro rotation (span leg+string)

Post by Sundial »

Oh yes ... end of story!

Code: Select all

Code, edit and compile here:
% x-axis rotation [dx=1.5] - #3
\begin{scope}[xshift=5cm, yshift=1.5cm, rotate=90, scale=1]
\draw[dim] (0,0) -- ++(1.5,0) node[sloped,midway,below,rotate=90] {$1.5\,m$}; % col. dimension
\draw (1.5,-0.2) -- ++(0,0.4);
\draw (0,-0.2) -- ++(0,0.4);
\end{scope}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Attachments
15.png
15.png (11.49 KiB) Viewed 4475 times
Post Reply