如何使用 tikz decorate 改善装饰效果

如何使用 tikz decorate 改善装饰效果

你会在下面的例子中看到两个问题

1)如何让剧情线不在终端标记之下

2)为什么是粗体文本

\documentclass{article}
\usepackage[latin1]{inputenc}                 
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}
\draw[decoration={markings,
mark connection node=my node,
mark=at position 0  with {\node [draw,blue,transform shape,inner sep=0,minimum size=1em,fill=white] (my node) {->};},
mark=at position 0.5  with {\arrow{stealth}},
mark=at position 1  with {\node [draw,blue,transform shape,inner sep=0,minimum size=1em,fill=white] (my node) {->};},
},decorate,green](0,0) --(3,1)node[pos=0.5,below,black,text width =5em,align=center]{signal amplifie};
\end{tikzpicture}

\end{document}

谢谢

答案1

连接节点用于连接,因此首先绘制一条路径到锚点west,然后继续路径。再次锚定连接节点足以隐藏那些零长度路径。

\documentclass{article}
\usepackage[latin1]{inputenc}                 
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}
\draw[decoration={markings,
mark connection node=my node,
mark=at position 0  with {\node [draw,blue,transform shape,inner sep=0,minimum size=1em,fill=white,anchor=east] (my node) {->};},
mark=at position 0.5  with {\arrow{stealth}},
mark=at position 1  with {\node [draw,blue,transform shape,inner sep=0,minimum size=1em,fill=white,anchor=west] (my node) {->};},
},decorate,green](0,0) --(3,1)node[pos=0.5,below,black,text width =5em,align=center]{signal amplifie};
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容