用彩色箭头标记平行线

用彩色箭头标记平行线

我根据 J. Leon V 对这个问题的回答,使用 tkz-euclide 绘制了下面的平行四边形在平行线上放置平行线标记

带有红色箭头的平行四边形

我改编了用户121799的答案中的箭头样式这个问题

由于使用 J. Leon V 的方法在线段上放置红色箭头会产生红色线段,因此我在平行四边形的边上绘制了黑色线段,使边穿过箭头。是否可以在黑色线段上绘制彩色箭头,以便黑色线段不会透过箭头显示出来?

我的代码:

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{arrows}
\usetkzobj{all}

\tikzset{%
>=latex, % option for nice arrows
inner sep=0pt,%
outer sep=2pt,%
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
fill=black,circle}%
}

\begin{document}

\begin{tikzpicture}
\tkzDefPoint(0, 0){A}
\tkzDefPoint(2, 3){B}
\tkzDefPoint(8, 3){C}
\tkzDefPoint(6, 0){D}
%mark parallel segments AB and CD with single arrows
\begin{scope}[decoration={markings,mark=at position .55 with          {\arrow[scale=2]{>}};}]
\tkzDrawSegments[postaction={decorate},color=red](A,B D,C)
\end{scope}
%mark parallel segments BC and AD with double arrows
\begin{scope}[decoration={markings,mark=at position .55 with   {\arrow[scale=2]{>>}};}]
\tkzDrawSegments[postaction={decorate},color=red](B,C A,D)
\end{scope}
%draw segments again in black to cover red segments
\tkzDrawSegments(A,B B,C C,D D,A)
\end{tikzpicture}

\end{document}

答案1

这里有一种方法:

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{arrows}
\usetkzobj{all}

\tikzset{%
>=latex, % option for nice arrows
inner sep=0pt,%
outer sep=2pt,%
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
fill=black,circle}%
}

\begin{document}

\begin{tikzpicture}
\tkzDefPoint(0, 0){A}
\tkzDefPoint(2, 3){B}
\tkzDefPoint(8, 3){C}
\tkzDefPoint(6, 0){D}
%mark parallel segments AB and CD with single arrows
\begin{scope}[decoration={markings,mark=at position .55 with          {\arrow[scale=2,color=red]{>}};}]
\tkzDrawSegments[postaction={decorate},color=black](A,B D,C)
\end{scope}
%mark parallel segments BC and AD with double arrows
\begin{scope}[decoration={markings,mark=at position .55 with   {\arrow[scale=2,color=red]{>>}};}]
\tkzDrawSegments[postaction={decorate},color=black](B,C A,D)
\end{scope}
%%draw segments again in black to cover red segments
%\tkzDrawSegments(A,B B,C C,D D,A)
\end{tikzpicture}

\end{document}

刚刚删除(注释掉)了您的最后一条命令,并color=red在您的装饰中添加了它,但black在您的draw命令中。

答案2

您可以使用 设计自己的标记(箭头) 。然后只需在绘制spic后放置标记即可。另请注意,这是一个路径选项,而不是图片选项。 pathsloped

在此处输入图片描述

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}[meme/.pic={
\fill[red] (150:6pt) to[bend right=10] (0:3pt) to[bend right=10] (-150:6pt)--cycle;}]
\path
(0,0) coordinate (A)
(2,3) coordinate (B)
(8,3) coordinate (C)
(6,0) coordinate (D);

\draw[sloped] (A)
--(B) pic[pos=.5]{meme}
--(C) pic[pos=.46]{meme} pic[pos=.54]{meme}
--(D) pic[pos=.5]{meme}
--cycle pic[pos=.46]{meme} pic[pos=.54]{meme};
\end{tikzpicture}    
\end{document}

相关内容