TikZ 矩阵定位巫术与列分隔符

TikZ 矩阵定位巫术与列分隔符

我尝试了很多不同的方法,但就是想不通如何解决 TikZ\matrix命令的 column sep 选项会改变矩阵在页面上的位置这一问题。下面是我的(相当大的)图片的代码,并添加了一些注释。

我希望有一个比这里更大的列间距(例如下面注释掉的 4em),同时将图片定位为中间向下的箭头位于页面中央。我看不出如果没有一些丑陋的 \hspace反复试验。

\documentclass[a4paper,11pt]{article}

\usepackage{tikz,relsize,mathtools}
\usetikzlibrary{matrix,arrows,shapes}
\usepackage{units}
\newcommand\onehalf{\nicefrac{1}{2}}

\begin{document}
\thispagestyle{empty}
\begin{center}{\huge\textbf{Separation Properties}}\end{center}
%
\vspace{1ex}
\begin{tikzpicture}
\tikzstyle{every node}=[font=\small]
\matrix (m) [nodes={draw,rectangle,thin,fill=blue!10},%
             row sep=1.7em,%column sep=4em,% Uncomment this to see m move around
             text depth=0.25ex,%
             draw=red] % Comment this out to not see the outline of the matrix
{%
\node (Met) {Metrizable};              & \node (T6) {P.\@ Normal Hausdorff (T$_{\smash[b]{6}}$)}; & \node (PN) {P.\@ Normal}; \\
\node (Ord) {Total order};             & \node (T5) {C./H.\@ T$_4$ (T$_{\smash[b]{5}}$)};         & \node (HN) {C./H.\@ Normal}; \\
\node (CH) {Cpt.\@ Hausdorff};         & \node (T4) {Normal Hausdorff (T$_{\smash[b]{4}}$)};      & \node (Norm) {Normal}; \\
\node (LCH) {Loc.\@ Cpt.\@ Hausdorff}; & \node (T3h) {Tychonoff (T$_{\smash[b]{3\onehalf}}$)};    & \node (CReg) {C.\@ Regular}; \\
\node (FH) {F./C.\@ Hausdorff};        & \node (T3) {Regular Hausdorff (T$_{\smash[b]{3}}$)};     & \node (Reg) {Regular}; \\
                                       & \node (T2h) {Urysohn (T$_{\smash[b]{2\onehalf}}$)}; \\
                                       & \node (T2) {Hausdorff (T$_{\smash[b]{2}}$)};             & \node (PReg) {Preregular (R$_1$)};\\
                                       & \node (T1) {T$_{\smash[b]{1}}$}; \\
                                       & \node (T0) {T$_{\smash[b]{0}}$}; \\
};
\path[->,thin]
(T3h)  edge [bend left=90]  node[fill=white,inner sep=2pt,pos=0.25]{$\scriptstyle\beta$} (T5)
(T0)   edge [bend right=60] node[fill=white,inner sep=2pt]{\scriptsize+R$\scriptstyle_1$} (T2)
(PReg) edge [bend right=60] node[fill=white,inner sep=2pt]{\scriptsize+Loc.~Cpt.} (CReg)
(Reg)  edge [bend right=80] node[fill=white,inner sep=2pt,pos=0.70]{\scriptsize+Lindel\"{o}f} (Norm)
(Reg)  edge [bend right=80] node[fill=white,inner sep=2pt,pos=0.75]{\scriptsize+2nd count.} (HN);
\path[->,thick] 
(T6)   edge node[]{} (T5)  (T6)  edge node[]{} (PN)
(T5)   edge node[]{} (T4)  (T5)  edge node[]{} (HN)
(T4)   edge node[auto]{\smaller UL} (T3h) 
    (T4)  edge node[]{} (Norm)
(T3h)  edge node[]{} (T3)  (T3h) edge node[]{} (FH)   (T3h) edge node[above,midway]{\smaller KEQ} (CReg)
(FH)   edge node[]{} (T2h)
(T3)   edge node[]{} (T2h) (T3)  edge node[above,midway]{\smaller KEQ} (Reg)
(T2h)  edge node[]{} (T2)
(T2)   edge node[]{} (T1)  (T2)  edge node[above,midway]{\smaller KEQ} (PReg)
(T1)   edge node[]{} (T0)
(PN)   edge node[]{} (HN)
(HN)   edge node[]{} (Norm)
(CReg) edge node[]{} (Reg)
(Reg)  edge node[]{} (PReg);
\path[->,thick]
(Met) edge node[]{} (T6)
(Ord) edge node[]{} (T5)
(CH)  edge [preaction={draw=white,-,line width=6pt}] node[]{} (T4)  (CH)  edge node[]{} (LCH)
(LCH) edge node[]{} (T3h);
\end{tikzpicture}
\end{document}

答案1

编辑:我使用 \pgfresetboundingbox 将原来的解决方案更改为这个更优雅的解决方案

您可以使用矩阵选项将矩阵定位在某个节点周围matrix anchor=T6.north,并使用选项将tikzpicture裁剪边界框设置为仅包含矩阵的中间线。然后trim left=0pt,trim right=0pt在将图像置于垂直中间箭头周围之前发出:tikzpicture\centeringtikzpicture

\documentclass[a4paper,11pt]{article}

\usepackage{tikz,relsize,mathtools}
\usetikzlibrary{matrix,arrows,shapes}
\usepackage{units}
\newcommand\onehalf{\nicefrac{1}{2}}

\begin{document}
\thispagestyle{empty}
\begin{center}{\huge\textbf{Separation Properties}}\end{center}
%
\vspace{1ex}
\centering
\begin{tikzpicture}[trim left=0pt,trim right=0pt]
\tikzstyle{every node}=[font=\small]
\matrix (m) [matrix anchor=T6.north,nodes={draw,rectangle,thin,fill=blue!10},%
             row sep=1.7em,column sep=4em,% Uncomment this to see m move around
             text depth=0.25ex,%
             ]
{%
\node (Met) {Metrizable};              & \node (T6) {P.\@ Normal Hausdorff (T$_{\smash[b]{6}}$)}; & \node (PN) {P.\@ Normal}; \\
\node (Ord) {Total order};             & \node (T5) {C./H.\@ T$_4$ (T$_{\smash[b]{5}}$)};         & \node (HN) {C./H.\@ Normal}; \\
\node (CH) {Cpt.\@ Hausdorff};         & \node (T4) {Normal Hausdorff (T$_{\smash[b]{4}}$)};      & \node (Norm) {Normal}; \\
\node (LCH) {Loc.\@ Cpt.\@ Hausdorff}; & \node (T3h) {Tychonoff (T$_{\smash[b]{3\onehalf}}$)};    & \node (CReg) {C.\@ Regular}; \\
\node (FH) {F./C.\@ Hausdorff};        & \node (T3) {Regular Hausdorff (T$_{\smash[b]{3}}$)};     & \node (Reg) {Regular}; \\
                                       & \node (T2h) {Urysohn (T$_{\smash[b]{2\onehalf}}$)}; \\
                                       & \node (T2) {Hausdorff (T$_{\smash[b]{2}}$)};             & \node (PReg) {Preregular (R$_1$)};\\
                                       & \node (T1) {T$_{\smash[b]{1}}$}; \\
                                       & \node (T0) {T$_{\smash[b]{0}}$}; \\
};
\path[->,thin]
(T3h)  edge [bend left=90]  node[fill=white,inner sep=2pt,pos=0.25]{$\scriptstyle\beta$} (T5)
(T0)   edge [bend right=60] node[fill=white,inner sep=2pt]{\scriptsize+R$\scriptstyle_1$} (T2)
(PReg) edge [bend right=60] node[fill=white,inner sep=2pt]{\scriptsize+Loc.~Cpt.} (CReg)
(Reg)  edge [bend right=80] node[fill=white,inner sep=2pt,pos=0.70]{\scriptsize+Lindel\"{o}f} (Norm)
(Reg)  edge [bend right=80] node[fill=white,inner sep=2pt,pos=0.75]{\scriptsize+2nd count.} (HN);
\path[->,thick] 
(T6)   edge node[]{} (T5)  (T6)  edge node[]{} (PN)
(T5)   edge node[]{} (T4)  (T5)  edge node[]{} (HN)
(T4)   edge node[auto]{\smaller UL} (T3h) 
    (T4)  edge node[]{} (Norm)
(T3h)  edge node[]{} (T3)  (T3h) edge node[]{} (FH)   (T3h) edge node[above,midway]{\smaller KEQ} (CReg)
(FH)   edge node[]{} (T2h)
(T3)   edge node[]{} (T2h) (T3)  edge node[above,midway]{\smaller KEQ} (Reg)
(T2h)  edge node[]{} (T2)
(T2)   edge node[]{} (T1)  (T2)  edge node[above,midway]{\smaller KEQ} (PReg)
(T1)   edge node[]{} (T0)
(PN)   edge node[]{} (HN)
(HN)   edge node[]{} (Norm)
(CReg) edge node[]{} (Reg)
(Reg)  edge node[]{} (PReg);
\path[->,thick]
(Met) edge node[]{} (T6)
(Ord) edge node[]{} (T5)
(CH)  edge [preaction={draw=white,-,line width=6pt}] node[]{} (T4)  (CH)  edge node[]{} (LCH)
(LCH) edge node[]{} (T3h);
\end{tikzpicture}
\end{document}

居中大 tikzpicture

相关内容