调整框图中一对块之间的距离

调整框图中一对块之间的距离

在此处输入图片描述

我只想将第二个块移到第三个块附近,以便清楚地看到第一个块和第二个块之间的变量。框图的其他部分应保持不变。我已将输出作为.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}

在此处输入图片描述

相关内容