使用 tikz 创建的流程图中的节点不会移动

使用 tikz 创建的流程图中的节点不会移动

尽管我正在改变 x/y,但我的节点/jct 没有水平/垂直移动——问题是什么

在此处输入图片描述

\documentclass[10pt,a4paper]{article}
\usepackage{printlen}
\usepackage{layouts}
\usepackage{titlesec}
\usepackage{multirow, makecell, tabularx, booktabs}
\usepackage{babel}
\usepackage{setspace}
\usepackage{framed}
\usepackage{tgschola}%------------font YES
\usepackage[
  height=8.5in,      % height of the text block
  width=6.5in,       % width of the text block
  top=78pt,        % distance of the text block from the top of the page
  headheight=60pt, % height for the header block
  headsep=12pt,    % distance from the header block to the text block
  heightrounded,   % ensure an integer number of lines
  %showframe,       % show the main blocks
  verbose,         % show the values of the parameters in the log file
]{geometry}
\usepackage{enumitem}
\usepackage[table]{xcolor}                      %for color of table
\usepackage{booktabs}                        %for toprule midrule bottomrule in tables
\usepackage{multirow} % Required for multirows
\usepackage{longtable}
\usepackage{rotating}
\usepackage{lscape}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage[none]{hyphenat}                             %no hyphenation
\usepackage{graphicx}
\usepackage{float}
\usepackage{lastpage}                                     %toget last page number
 \usepackage{indentfirst}
 \usepackage{smartdiagram}
\usepackage{tikz,xcolor}
\usetikzlibrary{shapes, arrows, matrix, calc}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows.meta,quotes,positioning}
\usetikzlibrary{arrows,calc,positioning}
\usetikzlibrary{positioning}
\usetikzlibrary{matrix,fit,calc}
\usepackage{verbatim}
\begin{document}
\begin{landscape}

\begin{tikzpicture}[node distance=2cm]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=2.5cm, draw=black, fill=blue!20]

\tikzstyle{arrow} = [thick,  ->, >=stealth]

\node (cont)[process]{CONTROLLER};
\node (sqach)[process, below of =cont, xshift=-6cm]{SQAO, Chennai};

\node (sqame)[process, below of =pro1, xshift=6cm]{SQAO, Medak};
\node (vigo)[process, below of =sqach]{Vigilance Offr};
\node (cyso)[process, below of =vigo]{Cyber Security Offr};
\node (rtio)[process, below of =cyso]{RTI Offr};
\node (grio)[process, below of =sqame]{Grievance Offr};
\node (sect)[process, below of =grio]{Secretariat};
\node (hino)[process, below of =sect]{Hindi Offr};
\node (jct)[process, below of =cont, x=6cm]{Jt Controller\\T Wing};
\end{tikzpicture}

\end{landscape}
\end{document}

在此处输入图片描述

使用变换命令后

在此处输入图片描述

最后

在此处输入图片描述

和代码

\begin{landscape}
% \begin{figure}[H]
% \begin{tikzpicture}[node distance=2cm]
\begin{tikzpicture}[node distance=2cm, transform canvas={scale=0.6}, xshift=600]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=2.5cm, draw=black, fill=blue!20]

\tikzstyle{arrow} = [thick,  ->, >=stealth]

\node (cont)[process]{CONTROLLER};
%------------
\node (sqach)[process, below of =cont, xshift=-21cm]{SQAO, Chennai};
\node (sqame)[process, below of =sqach]{SQAO, Medak};
%--------------------------
\node (vigo)[process, below of =cont, xshift=-17cm, yshift=0cm]{Vigilance Offr};
\node (cyso)[process, below of =vigo]{Cyber Security Offr};
\node (rtio)[process, below of =cyso]{RTI Offr};
\node (grio)[process, below of =rtio]{Grievance Offr};
\node (sect)[process, below of =grio]{Secretariat};
\node (hino)[process, below of =sect]{Hindi Offr};
%----------------------------------------
\node (jct)[process, below of =cont, xshift=1cm]{Jt Controller\\T Wing};
\node (jcm)[process, right of =jct, xshift=6cm, yshift=0cm]{Jt Controller \\M Wing};
\node (jco)[process, left of =jct, xshift=-6cm, yshift=0cm]{Jt Controller \\O Wing};
\node (jcsa)[process, left of =jct, xshift=-12cm, yshift=0cm]{Jt Controller \\SA Wing};
%--------------------------------------------

\node (dcsa)[process, below of =jcsa, xshift=1.7cm]{Dy Controller};
\node (rdcsa)[process, below of =dcsa, xshift=1.7cm]{QMS\\URC};
%--------------------------
\node (dco)[process, below of =jco, xshift=1.7cm]{Dy Controller};
\node (so)[process, below of =dco, xshift=1.7cm]{Store Offr};
\node (ao)[process, below of =so, yshift=-4cm]{Adm offr};
        \node (os1)[process, below of =ao, xshift=1.7cm]{OS Est};
        \node (os2)[process, below of =os1, xshift=0cm]{OS Fin}; 
\node (acpc)[process, below of =ao, yshift=-4cm]{AC P\&C};
        \node (pc)[process, below of =acpc, xshift=1.7cm]{P\&C};
\node (adm)[process, below of =acpc, yshift=-2cm]{Adm\\(Service pers)};
%-------------------------------------------------------------------
\node (store)[process, below of =so, xshift=1.7cm]{Stores};
\node (mt)[process, below of =store, xshift=0cm]{MT};
%--------------------------------------------------------





\draw (cont)--(-23,0)|-(sqach);
\draw (cont)--(-23,0)|-(sqame);
%-------------------
\draw (cont)--(-19,0)|-(vigo);
\draw (cont)--(-19,0)|-(rtio);
\draw (cont)--(-19,0)|-(cyso);
\draw (cont)--(-19,0)|-(grio);
\draw (cont)--(-19,0)|-(sect);
\draw (cont)--(-19,0)|-(hino);
%-------------------
\draw (cont)--(-15,0)|-(jcsa);
\draw (jcsa)|-(dcsa);
\draw (dcsa)|-(rdcsa);
%-------------------------------------
\draw (cont)--(-9,0)|-(jco);
\draw (jco)|-(dco);
        \draw (dco)|-(so);
                \draw (so)|-(store);
                \draw (so)|-(mt);
        \draw (dco)|-(ao);
                \draw (ao)|-(os1);
                \draw (ao)|-(os2);
        \draw (dco)|-(acpc);
                \draw (acpc)|-(pc);
        \draw (dco)|-(adm);

\end{landscape}

我已经完成了以下组​​织结构图

在此处输入图片描述

代码

\documentclass[10pt,a4paper]{article}
\usepackage{printlen}
\usepackage{titlesec}
\usepackage{multirow, makecell, tabularx, booktabs}
\usepackage{babel}
\usepackage{setspace}
\usepackage{framed}
\usepackage{fancybox}
\usepackage[short, nodayofweek, level, 12hr]{datetime}
\usepackage{paralist}
\usepackage{xcolor} 
\usepackage{xcoffins}
\usepackage{tocloft}
\usepackage{tgschola}%------------font YES
\usepackage{enumitem}
\usepackage{booktabs}                        %for toprule midrule bottomrule in tables
\usepackage{multirow} % Required for multirows
\usepackage{longtable}
\usepackage{rotating}
\usepackage{lscape}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage[none]{hyphenat}                             %no hyphenation
\usepackage{graphicx}
\usepackage{float}
\usepackage{lastpage}                                     %toget last page number
\usepackage{indentfirst}
\usepackage{smartdiagram}
\usepackage{wrapfig}

%header and footer
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}

\usepackage{fourier-orns}

\renewcommand\headrule{%------------fancy top line of page
\vspace{-6pt}
\hrulefill
\raisebox{-2.1pt}
{\quad\decofourleft\decotwo\decofourright\quad}%
\hrulefill}
\renewcommand\footrule{%------------fancy bottom line of page
\vspace{-6pt}
\hrulefill
\raisebox{-2.1pt}
{\quad\decofourleft\decotwo\decofourright\quad}%
\hrulefill}


%-----------------------------------------
\begin{document}
\begin{landscape}
\begin{tikzpicture}[node distance=2cm, transform canvas={scale=0.6}, xshift=420]

\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=2.5cm, draw=black, fill=blue!20]

\tikzstyle{arrow} = [thick,  ->, >=stealth]

\node (cont)[process]{CONTROLLER};
%------------
\node (sqach)[process, below of =cont, xshift=-14cm]{SQAO, Chennai};
\node (sqame)[process, below of =sqach]{SQAO, Medak};
%--------------------------
\node (vigo)[process, below of =cont, xshift=-10cm, yshift=-9cm]{Vigilance Offr};
\node (cyso)[process, below of =vigo]{Cyber Security Offr};
\node (rtio)[process, below of =cyso]{RTI Offr};
\node (grio)[process, below of =rtio]{Grievance Offr};
\node (sect)[process, below of =grio]{Secretariat};
\node (hino)[process, below of =sect]{Hindi Offr};
%----------------------------------------
\node (jct)[process, below of =cont, xshift=6cm]{Jt Controller\\T Wing};
\node (jcm)[process, below of =cont, xshift=14cm, yshift=0cm]{Jt Controller \\M Wing};
\node (jco)[process, below of =cont, xshift=-2cm, yshift=0cm]{Jt Controller \\O Wing};
\node (jcsa)[process, below of =cont, xshift=-8cm, yshift=0cm]{Jt Controller \\SA Wing};
%--------------------------------------------

\node (dcsa)[process, below of =jcsa, xshift=1.7cm]{Dy Controller};
\node (rdcsa)[process, below of =dcsa, xshift=1.7cm]{QMS\\URC};
%--------------------------
\node (dco)[process, below of =jco, xshift=1.7cm]{Dy Controller};
\node (so)[process, below of =dco, xshift=1.7cm]{Store Offr};
\node (ao)[process, below of =so, yshift=-4cm]{Adm offr};
        \node (os1)[process, below of =ao, xshift=1.7cm]{OS Est};
        \node (os2)[process, below of =os1, xshift=0cm]{OS Fin}; 
\node (acpc)[process, below of =ao, yshift=-4cm]{AC P\&C};
        \node (pc)[process, below of =acpc, xshift=1.7cm]{P\&C};
\node (adm)[process, below of =acpc, yshift=-2cm]{Adm\\(Service pers)};
%-------------------------------------------------------------------
\node (store)[process, below of =so, xshift=1.7cm]{Stores};
\node (mt)[process, below of =store, xshift=0cm]{MT};
%--------------------------------------------------------
\node (dcqa1)[process, below of =jct, xshift=1.7cm]{DCQA\\T-72};
        \node (acqa1)[process, below of =dcqa1, xshift=1.7cm]{ACQA\\T-72};
                  \node (racqa1)[process, below of =acqa1, xshift=1.7cm]{AHSP\\T-72};
                  \node (racqa2)[process, below of =racqa1, xshift=0cm]{OH\\T-72\\BLT};
%-------------------------------------------------------------------
\node (dcqa2)[process, below of =dcqa1, xshift=0cm, yshift=-6cm]{DCQA\\T-90};
        \node (acqa2)[process, below of =dcqa2, xshift=1.7cm]{ACQA\\QMS};
                \node (racqa3)[process, below of =acqa2, xshift=1.7cm]{QMS\\(Quality\\Audit)};
        \node (acqa3)[process, below of =acqa2, xshift=0cm, yshift=-2cm]{ACQA\\T-90};
                \node (racqa4)[process, below of =acqa3, xshift=1.7cm, yshift=-0cm]{AHSP\\T-90};
                \node (racqa5)[process, below of =racqa4, xshift=0cm, yshift=0cm]{GA\\TRAWL\\(T-72)\\Simulators};
%-------------------------------------------------------------------------------
\node (dcqam1)[process, below of =jcm, xshift=1.7cm]{DCQA\\AHSP\\QA/OH};
        \node (acqam1)[process, below of =dcqam1, xshift=1.7cm]{ACQA\\AHSP\\QA/OH}; 
                \node (racqam1)[process, below of =acqam1, xshift=1.7cm]{MBT\\T-55};
                \node (racqam2)[process, below of =racqam1, xshift=0cm]{MBT\\QA/ OH};
                \node (racqam3)[process, below of =racqam2, xshift=0cm]{BMP};   
\node (dcqam2)[process, below of =dcqam1, xshift=0cm, yshift=-8cm]{DCQA\\Doc\\Tracked vehicles};
        \node (acqam2)[process, below of =dcqam2, xshift=1.7cm]{ACQA\\Doc\\Tracked vehicles};   
                \node (racqam4)[process, below of =acqam2, xshift=1.7cm]{COD};      
                \node (racqam5)[process, below of =racqam4, xshift=0cm]{DRG};
                \node (racqam6)[process, below of =racqam5, xshift=0cm]{R\&R};  

%-------------------------------------------------------------------------------------
\draw (cont)--(-16,0)|-(sqach);
\draw (cont)--(-16,0)|-(sqame);
%-------------------
\draw (cont)--(-12,0)|-(vigo);
\draw (cont)--(-12,0)|-(rtio);
\draw (cont)--(-12,0)|-(cyso);
\draw (cont)--(-12,0)|-(grio);
\draw (cont)--(-12,0)|-(sect);
\draw (cont)--(-12,0)|-(hino);
%-------------------
\draw (cont)--(-11,0)|-(jcsa);
\draw (jcsa)|-(dcsa);
\draw (dcsa)|-(rdcsa);
%-------------------------------------
\draw (cont)--(-5,0)|-(jco);
\draw (jco)|-(dco);
        \draw (dco)|-(so);
                \draw (so)|-(store);
                \draw (so)|-(mt);
        \draw (dco)|-(ao);
                \draw (ao)|-(os1);
                \draw (ao)|-(os2);
        \draw (dco)|-(acpc);
                \draw (acpc)|-(pc);
        \draw (dco)|-(adm);
%---------------------------------------
\draw (cont)-|(jct);
        \draw (jct)|-(dcqa1);
            \draw (dcqa1)|-(acqa1);
                \draw (acqa1)|-(racqa1);
                \draw (acqa1)|-(racqa2);
        \draw (jct)|-(dcqa2);
                \draw (dcqa2)|-(acqa2);
                    \draw (acqa2)|-(racqa3);
                \draw (dcqa2)|-(acqa3);
                    \draw (acqa3)|-(racqa4);
                    \draw (acqa3)|-(racqa5);

%----------------------------------------
\draw (cont)--(19,0)|-(jcm);
        \draw (jcm)|-(dcqam1);
        \draw (jcm)|-(dcqam2);
            \draw (dcqam1)|-(acqam1);
            \draw (dcqam2)|-(acqam2);
                \draw (acqam1)|-(racqam1);
                \draw (acqam1)|-(racqam2);
                \draw (acqam1)|-(racqam3);
                \draw (acqam2)|-(racqam4);
                \draw (acqam2)|-(racqam5);
                \draw (acqam2)|-(racqam6);  

\end{tikzpicture}
\end{landscape}
\cleardoublepage
\end{document}

平衡是让线从控制器节点的底部出来,而不是从左侧或右侧出来

如果有其他改进建议

答案1

像这样?

在此处输入图片描述

使用`forest 包可以简单地绘制:

\documentclass[10pt,margin=3mm]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows, arrows.meta,
                calc,
                decorations.markings,
                fit,
                matrix,
                positioning,
                quotes}

\begin{document}
    \begin{forest}
for tree = {draw,
            fill=blue!20,
            text width=24mm, minimum height=1cm,
            text centered,
    parent anchor = south,
     child anchor = north,
             grow = south,
            l sep = 7mm,
            s sep = 5mm,
         fork sep = 3mm,    % distance from parent to branching point
             edge = {draw, semithick, -stealth},
             forked edge,            
            }
[CONTROLLER
    [{SQAO,\\ Chennai}
        [Vigilance\\ Offr
            [Cyber\\ Security
                [RTI\\ Offr]
            ]
        ]
    ]
    [Jt Controller\\T Wing]
    [{SQAO,\\ Medak}
        [Grievance\\ Offr
            [Secretariat
                [Hindi\\ Offr]
            ]
        ]
    ]
]
\end{forest}
\end{document}

相关内容