![调整框图中一对块之间的距离](https://linux22.com/image/320298/%E8%B0%83%E6%95%B4%E6%A1%86%E5%9B%BE%E4%B8%AD%E4%B8%80%E5%AF%B9%E5%9D%97%E4%B9%8B%E9%97%B4%E7%9A%84%E8%B7%9D%E7%A6%BB.png)
我只想将第二个块移到第三个块附近,以便清楚地看到第一个块和第二个块之间的变量。框图的其他部分应保持不变。我已将输出作为.png
图像附加,代码如下
\documentclass[english]{IEEEtran}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{float}
\usepackage{amsbsy}
\usepackage{graphicx}
\usepackage{babel}
\makeatletter
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shadows}
\usepackage{amsmath}
\usepackage{amssymb}
\makeatother
\usepackage{babel}
\begin{document}
\begin{figure}[H]
\tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=3em]
\tikzstyle{output} = [coordinate]
\begin{tikzpicture}[auto, node distance=2.2cm,>=latex']
%placing the blocks
\node[text width=5em] [block] (node1) {ZC sequence generation $u,v,N_{cs}$};
\node[text width=3em] [block, right of=node1] (node2) {point point point };
\node[text width=2em] [block, right of=node2] (node3) {taking inverse};
\node[text width=4em] [block, right of=node3] (node4) {up filter sam};
\node[text width=5em] [block, below of=node4] (node5) {Add PP};
\node[text width=4em] [block, left of=node5] (node6) {Shifty Res Blo};
\node [output, left of=node6] (output) {};
%\node[dspnodeopen,dsp/label=above,left of=node6] (node7) {Tx};
%connecting the blocks
\draw (0.98,0)--(1,0)[draw,->] (node1) -- node {$z_{u,v}(n)$} (node2);
\draw[-> ] (node2) -- (node3);
\draw[-> ] (node3) -- (node4);
\draw[-> ] (node4) -- (node5);
\draw[-> ] (node5) -- (node6);
\draw[-> ] (node6) -- node [name=Tx] {Tx}(output);
%\draw[-> ] (node6) -- (node7);
\end{tikzpicture}\caption{\label{transmitter_block_diagram}transmission}
\end{figure}
\end{document
答案1
借助positioning
库可以更好地将节点相对于彼此放置。添加\usetikzlibrary{positioning}
并将所有更改of =
为= of
。然后调整节点距离(我将其保留为 1.3 厘米)。
\documentclass[english]{IEEEtran}
\usepackage{babel}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shadows,positioning}
\usepackage{babel}
\begin{document}
\begin{figure}[htb]%[H]
\tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=3em]
\tikzstyle{output} = [coordinate]
\begin{tikzpicture}[auto, node distance=1.3cm,>=latex']
%placing the blocks
\node[text width=5em,block] (node1) {ZC sequence generation $u,v,N_{cs}$};
\node[text width=3em,block, right = of node1] (node2) {point point point };
\node[text width=2em,block, right = of node2] (node3) {taking inverse};
\node[text width=4em,block, right = of node3] (node4) {up filter sam};
\node[text width=5em,block, below = of node4] (node5) {Add PP};
\node[text width=4em,block, left = of node5] (node6) {Shifty Res Blo};
\node [output, left = of node6] (output) {};
%\node[dspnodeopen,dsp/label=above,left of=node6] (node7) {Tx};
%connecting the blocks
\draw (0.98,0)--(1,0)[draw,->] (node1) -- node {$z_{u,v}(n)$} (node2);
\draw[-> ] (node2) -- (node3);
\draw[-> ] (node3) -- (node4);
\draw[-> ] (node4) -- (node5);
\draw[-> ] (node5) -- (node6);
\draw[-> ] (node6) -- node [name=Tx] {Tx}(output);
%\draw[-> ] (node6) -- (node7);
\end{tikzpicture}%
\caption{\label{transmitter_block_diagram}transmission}
\end{figure}
\end{document}
请记住,positioning
库在相对定位方面更准确。
答案2
另一种解决方案。使用 tikz 库chains
,不使用库positioning
和节点选项,join
代码如下:
\documentclass[english]{IEEEtran}
\usepackage{babel}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,chains}
\begin{document}
\begin{figure}[h]
\begin{tikzpicture}[
> = {Latex[]},
auto,
start chain = going right,
node distance=13mm,
block/.style={shape=rectangle, draw,
inner sep=1mm, align=center,
minimum height=4em, text width=#1,
join=by ->, on chain}]
%placing the blocks
\node[block=5em] (n1) {ZC sequence generation $u,v,N_{cs}$};
\node[block=3em] (n2) {point point point };
\node[block=3em] (n3) {taking inverse};
\node[block=4em] (n4) {up filter sam};
\node[block=5em,below=of n4] (n5) {Add PP};
\node[block=4em,left =of n5] (n6) {Shifty Res Blo};
%
\path (n1) -- node {$z_{u,v}(n)$} (n2);
\draw[->] (n6) -- node {Tx} (n6 -| n2.west);
\end{tikzpicture}%
\caption{\label{transmitter_block_diagram}transmission}
\end{figure}
\end{document}