为 \lineload 指定颜色

为 \lineload 指定颜色

我需要说明三种不同的负载情况。我需要负载以三种不同的方式作用于一条线:均等地、峰值在最上部和峰值在最下部。为此,我使用了封装structuralanalysis\lineload元件。现在,我想为每种情况分配\lineload不同的颜色。有人知道是否可以通过在draw=*color*某个特定位置添加一个来实现这一点吗?或者我是否应该创建一个新命令?

    \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}```    

答案1

宏在内部使用由包定义的\lineload线条样式。您可以使用修改此样式以使用不同的颜色。线条样式也用于许多其他地方,因此您可能需要事后重置它。normalLine\tikzstyle

梅威瑟:

\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}

结果:

在此处输入图片描述

相关内容