现在,我不知道该怎么做,但我可以画出这两条线(具体颜色并不重要): 我创建的两条线与我想要的略有不同。线 1 的右侧有一些我不太喜欢的边缘。线 2 的左侧有一个尖锐的边缘,我想把它弄圆。
所以我想要的是第 1 行和第 2 行的组合,但我不知道该怎么做。我希望有人知道并愿意帮助我。
这是我的两行代码:
\documentclass{report}
\usepackage{tikz}
\definecolor{color1}{RGB}{120, 0, 0}
\begin{document}
1
% This is what I have, but on the right side
% of the line, there's some kind of edge that
% bothers me.
\begin{tikzpicture}
\fill[
draw=none,
line width=0pt,
rounded corners=1.5pt,
left color=color1,
right color=white
]
rectangle ++(\textwidth,-3pt);
\end{tikzpicture}
2
% This is another thing I have, but now the
% left side is a sharp edge. I would like the
% sharp edge to turn into a rounded corner
% without the right side changing.
\begin{tikzpicture}
\fill[
draw=none,
line width=0pt,
left color=color1,
right color=white
]
rectangle ++(\textwidth,-3pt);
\end{tikzpicture}
\end{document}
答案1
您想要的只是一条阴影路径。使用\path
而不是\fill
。
\begin{tikzpicture}
\path[
line width=0pt,
rounded corners=1.5pt,
left color=color1,
right color=white
]
rectangle ++(\textwidth,-3pt);
\end{tikzpicture}