如何在框图中的线条上添加文本标签

如何在框图中的线条上添加文本标签

我对 LATEX 还很陌生,我正在尝试设置一个框图,同时按照我想要的方式格式化它,请参阅下面的框图:

https://www.writelatex.com/1492096yphfwt#/3712155/

\documentclass[margin=10pt]{standalone}
\title{Analogue Synthesizer block diagram}
\usepackage{tikz}
\begin{document}

%Define standard Block diagram node styles
\tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=6em]
\tikzstyle{line} = [draw, -stealth, thick]

\begin{tikzpicture}[scale=2]

% Blocks
\draw (2,1) node[block] (LFO) {LFO};
\draw (2,0) node[block] (VCO1) {VCO1};
\draw (4,0) node[block] (VCF) {VCF};
\draw (4,-1) node[block] (ADSR1) {ADSR};
\draw (6,0) node[block] (VCA) {VCA};
\draw (6,-1) node[block] (ADSR2) {ADSR};
\draw (0,-2) node[block] (Midi to CV) {MIDI to CV};
\draw (0,-3) node[block] (Keyboard) {MIDI Keyboard};

% Lines
\path[line] (LFO) -- (VCO1);
\path[line] (VCO1) -- (VCF);
\path[line] (VCF) -- (VCA);
\path[line] (ADSR1) -- (VCF);
\path[line] (ADSR2) -- (VCA);
\path[line] (Keyboard) -- (Midi to CV);
\path[line] (Midi to CV.north) |- node[yshift=-4em, xshift=0.5em,fill=white]{1V/Octave} (VCO1);
\path[line] (Midi to CV.east) -| node[yshift=0em, xshift=-4em,fill=white]{Gate} (ADSR1.south);
\path[line] (Midi to CV.east) -| node[yshift=0em, xshift=0em]{} (ADSR2.south);

\end{tikzpicture}
\end{document}

我的框图输出

我的具体问题与文本标签有关,正如你所看到的,我有连接线MIDI 至 CV自适应光调制器块,因此我有一条线贯穿,我希望它的格式为1V/倍频标签。

也许我需要采用\path[line]不同的格式;有人可以帮忙吗?

提前致谢,
亚历克斯

答案1

问题是你先写了 Gate 标签,然后在其上方画了另一条线。如果你只是交换tikzpicture环境中的最后两行,那么你就会得到你想要的:

在此处输入图片描述

这是您的黑客代码:

\documentclass[margin=10pt]{standalone}

\title{Analogue Synthesizer block diagram}

\usepackage{tikz}
\begin{document}

%Define standard Block diagram node styles
\tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=6em]
\tikzstyle{line} = [draw, -stealth, thick]

\begin{tikzpicture}[scale=2]

  % Blocks
  \draw (2,1) node[block] (LFO) {LFO};
  \draw (2,0) node[block] (VCO1) {VCO1};
  \draw (4,0) node[block] (VCF) {VCF};
  \draw (4,-1) node[block] (ADSR1) {ADSR};
  \draw (6,0) node[block] (VCA) {VCA};
  \draw (6,-1) node[block] (ADSR2) {ADSR};
  \draw (0,-2) node[block] (Midi to CV) {MIDI to CV};
  \draw (0,-3) node[block] (Keyboard) {MIDI Keyboard};

  % Lines
  \path[line] (LFO) -- (VCO1);
  \path[line] (VCO1) -- (VCF);
  \path[line] (VCF) -- (VCA);
  \path[line] (ADSR1) -- (VCF);
  \path[line] (ADSR2) -- (VCA);
  \path[line] (Keyboard) -- (Midi to CV);
  \path[line] (Midi to CV.north) |- node[yshift=-4em, xshift=0.5em,fill=white]{1V/Octave} (VCO1);
  \path[line] (Midi to CV.east) -| node[yshift=0em, xshift=0em]{} (ADSR2.south);
  \path[line] (Midi to CV.east) -| node[yshift=0em, xshift=-4em,fill=white]{Gate} (ADSR1.south);

\end{tikzpicture}
\end{document}

相关内容