我有这个代码:
% Title: Block diagram of Third order noise shaper in Compact Disc Players
% Author: Ramón Jaramillo
\documentclass[border=10pt]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
%Blocks
\tikzset{%
block/.style = {draw, thick, rectangle, minimum height = 3em,
minimum width = 3em},
circle/.style = {draw, circle, node distance = 2cm},
}
%Symbols
\renewcommand{\sum}{\Large$+$}
\newcommand{\cross}{\Large$\times$}
\begin{tikzpicture}[auto, node distance=2cm, >=triangle 45]
%nodes
\node [] (start) at (0,0) {};
\node [circle, right of=start] (plus) {\cross};
\node at (7,0)[] (end) {};
\node at (6.8,0)[] (send) {};
\node [block, below of=send] (T) {T};
%##### I don't know how to place the last node - it should be in the midlle between plus and send and 2x the distance from send to T.
%arrows
\draw[->] (start) -- (plus);
\draw[->] (plus) -- (end);
\draw[--] (send) -- (T);
\end{tikzpicture}
\end{document}
最后看起来应该是这样的:
但是在节点(开始)的左侧应该有字母 a,在节点(结束)的右侧应该有字母 b,并且应该有一个短水平箭头显示在十字上(我无法画出)。
问题 它没有编译通过。我不知道如何做最后的注释。我不知道如何贴上标签。我不知道如何让箭头改变方向。
提前谢谢您!问候!
答案1
类似这样的事?
您的代码的主要问题是重新定义circle
which 调用circle
。我将其替换为my circle
。对于元素,我使用了绝对定位,虽然不太优雅,但允许所有自由度。
\documentclass[border=10pt]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
%Blocks
\tikzset{%
block/.style = {draw, thick, rectangle, minimum height = 3em,
minimum width = 3em},
my circle/.style = {draw, circle, node distance = 2cm},
}
%Symbols
\renewcommand{\sum}{\Large$+$}
\newcommand{\cross}{\Large$\times$}
\begin{tikzpicture}[auto, node distance=2cm, >=triangle 45]
\node (start) at (0,0) {a};
\node[my circle] (plus) at (2,0) {\sum};
\node[my circle] (times) at (4,-2) {\cross};
\node[block] at (6.5,-1) (T) {T};
\node (end) at (8,0) {b};
\coordinate (send) at (6.5,0);
\draw[->] (start) -- (plus);
\draw[->] (plus) -- (end);
\draw (send) -- (T);
\draw[->] (T) |- (times);
\draw[->] (times) -| (plus);
\end{tikzpicture}
\end{document}