TransWikia.com

Assign a colour to a lineload

TeX - LaTeX Asked on December 25, 2021

I need to illustrate three different load situations. I need a load to act on a line in three different ways: equally, with peak on the uppermost part and with peak on the lowermost part. For this reason I am using the structuralanalysis package and the lineload element. Now, I would like to assign to each lineload a different colour. Does somebody know if that is possible by just adding a draw=*color* somewhere specific? Or if I should create a new command?

    centering
begin{tikzpicture}

  point {A}{0.5}{4.0};
  point {B}{12.5}{4.5};

  draw[step=1cm,gray,very thin] (-0.5,-0.5) grid (13.5,6.5);
  
% PLAIN   
  draw (0.5,0.5) -- (0.5,5) -- (12.5,5.5) -- (12.5,0.5) -- (0.5,0.5); %Trapezoid
  
% BASAL FAILURE SURFACE  
  draw (0.5,4.5) -- (12.5,5) -- (12.5,4.8) -- (0.5,4.3) -- (0.5,4.5); %bfs
  
% PLAIN  
  filldraw[fill=brown, draw=black] (0.5,0.5) -- (0.5,5) -- (12.5,5.5) -- (12.5,0.5) -- (0.5,0.5); %trapezoid

% BASAL FAILURE SURFACE 
  filldraw[fill=yellow, draw=black] (0.5,4.5) -- (12.5,5) -- (12.5,4.8) -- (0.5,4.3) -- (0.5,4.5); %bfs
  
% GAS RESERVOIR  
  
  lineload{2}{A}{B}[-1][-1][.2]; %equal
  %lineload{2}{A}{B}[-1][0][.2]; %toe
  %lineload{2}{A}{B}[0][-1][.2]; %headwall
  
end{tikzpicture}
    caption{Caption}
    label{fig:fig}
end{figure}```    

One Answer

Internally the lineload macro uses the line style normalLine which is defined by the package. You can modify this style using tikzstyle to use a different color. The line style is used in many other places as well, so you may want to reset it afterwards.

MWE:

documentclass{article}
usepackage{stanli}
begin{document}
begin{tikzpicture}

  point {A}{0.5}{4.0};
  point {B}{12.5}{4.5};

  draw[step=1cm,gray,very thin] (-0.5,-0.5) grid (13.5,6.5);
  
% PLAIN   
  draw (0.5,0.5) -- (0.5,5) -- (12.5,5.5) -- (12.5,0.5) -- (0.5,0.5); %Trapezoid
  
% BASAL FAILURE SURFACE  
  draw (0.5,4.5) -- (12.5,5) -- (12.5,4.8) -- (0.5,4.3) -- (0.5,4.5); %bfs
  
% PLAIN  
  filldraw[fill=brown, draw=black] (0.5,0.5) -- (0.5,5) -- (12.5,5.5) -- (12.5,0.5) -- (0.5,0.5); %trapezoid

% BASAL FAILURE SURFACE 
  filldraw[fill=yellow, draw=black] (0.5,4.5) -- (12.5,5) -- (12.5,4.8) -- (0.5,4.3) -- (0.5,4.5); %bfs
  
% GAS RESERVOIR  
  
  tikzstyle{normalLine}=[line width=normalLineWidth,color=blue]
  lineload{2}{A}{B}[-1][-1][.2]; %equal
  tikzstyle{normalLine}=[line width=normalLineWidth,color=red]
  lineload{2}{A}{B}[-1][0][.2]; %toe
  tikzstyle{normalLine}=[line width=normalLineWidth,color=green]
  lineload{2}{A}{B}[0][-1][.2]; %headwall
  % reset to black
  tikzstyle{normalLine}=[line width=normalLineWidth,color=black]
  
end{tikzpicture}
end{document}

Result:

enter image description here

Answered by Marijn on December 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP