![为 \lineload 指定颜色](https://linux22.com/image/418105/%E4%B8%BA%20%5Clineload%20%E6%8C%87%E5%AE%9A%E9%A2%9C%E8%89%B2.png)
我需要说明三种不同的负载情况。我需要负载以三种不同的方式作用于一条线:均等地、峰值在最上部和峰值在最下部。为此,我使用了封装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}
结果: