TikZ 辫子包:绘制辫子图的闭合

TikZ 辫子包:绘制辫子图的闭合

我一直在使用辫子包(https://www.ctan.org/pkg/braids),但我不知道如何绘制图表的闭包,如下图左所示为一个示例。
在此处输入图片描述

目前我有右侧的图表,对应的是:

\documentclass{amsart}
\usepackage{tikz}
\usepackage{braids}
\begin{document}

\begin{center}
\begin{tikzpicture}[scale=1]
\braid[line width=2pt, nudge factor=-0.25, control factor=0.75, style strands={1}{red},
style strands={2}{blue},
style strands={3}{black}, style strands={4}{green}, style strands={5}{yellow}] (braid) at (0,0) s_1^{-1} s_3^{-1} s_1^{-1} s_4 s_2 s_4 s_2 s_4 s_1^{-1} s_3^{-1};
\draw[thick] (-0.3,0) -- (4.3,0);
\draw[thick] (-0.3,-10.5) -- (4.3,-10.5);
\end{tikzpicture}
\end{center}

\end{document}

我怎样才能画出这个图的闭合图?

答案1

手册中描述了坐标:

手册中的坐标描述

现在你可以连接两端,例如像这样:

\documentclass[tikz, border=1cm]{standalone}
\usepackage{braids}
\begin{document}
\begin{tikzpicture}
\braid[line width=2pt, nudge factor=-0.25, control factor=0.75, style strands={1}{red},
style strands={2}{blue},
style strands={3}{black}, style strands={4}{green}, style strands={5}{yellow}] (braid) at (0,0) s_1^{-1} s_3^{-1} s_1^{-1} s_4 s_2 s_4 s_2 s_4 s_1^{-1} s_3^{-1};
\draw[thick] (-0.3,0) -- (4.3,0);
\draw[thick] (-0.3,-10.5) -- (4.3,-10.5);
\draw[dotted] (braid-rev-3-s) -- ++(0,1) -- ++(1,0) |- ([shift=(south:1)]braid-rev-3-e) -- (braid-rev-3-e);
\end{tikzpicture}
\end{document}

用虚线连接绳子的首尾

相关内容