如何用开关画一条弯曲的线

如何用开关画一条弯曲的线

有点令人失望的是乳胶对此没有任何简单的补救措施!

我想在两点之间画一个箭头,箭头中间有一个开关。为此,我使用了以下代码:

\draw [line width=1pt,addarrow] (0,0) to[cspst] (3,0);

这样差不多就好了,但是中间的开关不太美观。有什么办法可以改进吗?

当我想要按如下方式弯曲这条线时:

\draw [line width=1pt,addarrow] (0,-2) to[cspst,out=120,in=-20] (3,-2);

这会导致开关消失。有什么解决办法吗?

这是第一段和第二段代码的结果图像:

d

我的代码:

\documentclass[12pt]{report}

\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{tikz-cd}
\usetikzlibrary{arrows,decorations.markings,decorations}
\usetikzlibrary{arrows,shapes,calc,positioning}
\tikzstyle{block} = [draw,rectangle, rounded corners, minimum width=1cm, minimum height=0.8cm,text centered, line width=2pt ]
\tikzstyle{arrow} = [thick,->,>=stealth,line width=2pt]
\tikzset{% define addarrow decoration
    addarrow/.style={decoration={markings, mark=at position 1 with {\arrow{stealth}}},
                     postaction={decorate}}
                     }

\begin{document}
\begin{figure}
\begin{tikzpicture}
\draw [line width=1pt,addarrow] (0,0) to[cspst] (3,0);
\draw [line width=1pt,addarrow] (0,-2) to[cspst,out=-20,in=-120] (3,-2);
\end{tikzpicture}
\end{figure}
\end{document}

答案1

来自https://tex.stackexchange.com/a/272124/54817

\documentclass[12pt]{report}
\usepackage{tikz} 
\usepackage{circuitikz} 
\usepackage{tikz-cd} 
\usetikzlibrary{arrows,decorations.markings,decorations} 
\usetikzlibrary{arrows,shapes,calc,positioning} 
\tikzstyle{block} = [draw,rectangle, rounded corners, minimum width=1cm, minimum height=0.8cm,text centered, line width=2pt ]
\tikzstyle{arrow} = [thick,->,>=stealth,line width=2pt]
\tikzset{addarrow/.style={decoration={markings, mark=at position 1 with {\arrow{stealth}}}, postaction={decorate}} } 
\begin{document} 
\begin{figure} 
\begin{tikzpicture} 
\draw [line width=1pt,addarrow] (0,0) to[cspst] (3,0);
\draw [line width=1pt,addarrow] (0,-2)  to[out=-20,in=-120] coordinate[pos=.35] (A) coordinate[pos=.55] (B) (3,-2) ; 
\fill[white] ( [yshift=-2mm] A) rectangle ( [yshift=1mm] B); 
\draw [line width=1pt] (A) to[cspst] (B);
\end{tikzpicture} 
\end{figure} 
\end{document}

在此处输入图片描述

相关内容