tikz 矩阵-更长的箭头

tikz 矩阵-更长的箭头

以下代码:

\usepackage{tikz}
\usetikzlibrary{matrix}
%...
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, inner sep=0.3pt,row sep=0.3em,column sep=0.3em] 
{
1s & & & \\
2s & 2p & & \\
3s & 3p & 3d & \\
4s & 4p & 4d & 4f \\
5s & 5p & 5d & 5f \\
6s & 6p & 6d & \\
7s & 7p & & \\
}
;
\draw[->] (m-1-1.north east) -- (m-1-1.south west);
\draw[->] (m-2-1.north east) -- (m-2-1.south west);
\draw[->] (m-2-2.north east) -- (m-3-1.south west);
\draw[->] (m-3-2.north east) -- (m-4-1.south west);
\draw[->] (m-3-3.north east) -- (m-5-1.south west);
\draw[->] (m-4-3.north east) -- (m-6-1.south west);
\draw[->] (m-4-4.north east) -- (m-7-1.south west);
\draw[->] (m-5-4.north east) -- (m-7-2.south west);
\end{tikzpicture}

产生图像:

在此处输入图片描述

我如何让箭头延伸得更长一些?
它的边缘(在最左边的列上)太靠近数字了。
但又不影响矩阵的紧凑尺寸!

答案1

这将成为今年的最后一个答案:)

托盘;

    \documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}

\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}% <---------------------------------
    \setlength\PreviewBorder{1em}

    \begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, inner sep=0.3pt,row sep=0.3em,column sep=0.3em]
{
1s & & & \\
2s & 2p & & \\
3s & 3p & 3d & \\
4s & 4p & 4d & 4f \\
5s & 5p & 5d & 5f \\
6s & 6p & 6d & \\
7s & 7p & & \\
}
;
\draw[->,shorten >=-2pt] 
    (m-1-1.north east) edge (m-1-1.south west) 
    (m-2-1.north east) edge (m-2-1.south west)
    (m-2-2.north east) edge (m-3-1.south west)
    (m-3-2.north east) edge (m-4-1.south west)
    (m-3-3.north east) edge (m-5-1.south west)
    (m-4-3.north east) edge (m-6-1.south west)
    (m-4-4.north east) edge (m-7-1.south west)
    (m-5-4.north east)  --  (m-7-2.south west);
\end{tikzpicture}
    \end{document}

在此处输入图片描述

正如我在评论中所说,您可以根据自己的口味选择延长箭头的数量。

相关内容