variable colsep in psmatrix | possible?

I frequently use psmatrix to create simple 'time-line' diagrams (see first figure in the MWE, below). For cases where the 'elements' of the time-line are equally spaced, this works well, and is pretty easy to implement.

However, I peridically would like to construct a time-line where the intervals are unequal. The asic idea is shown in the secon figure in the MWE. In this example, I 'brute-force a solution' by simply 'leaving out' one of the nodes. This is fine, if all the intervals are multiples of some common colsept distance.

What I'm really after is a way to generate variable distances between nodes that I define explicitly. Something like:

 time 1 --> time 2 -----> time 3 ---> time 4 ---------> time 5


where the intervals are 2, 5, 3, and 9 'units' respectively. Again, while I can imagine a brute force solution to this (similar to what I've already tried), I'm wondering if there is either (i) a more elegant solution using psmatrix (if its even possible), or, failing that, (ii) some other approach (tikz?).

Here is the simple MWE:

\documentclass[11pt,letterpaper,oneside]{article}

\usepackage{pst-node}
% set up float for putting figures where you want them
\usepackage{float}

\begin{document}

Here is a basic time-line with equal intervals:

\begin{figure}[H]
\centering
\rule[-0.5cm]{0.0pt}{1.8cm}
$\psmatrix[colsep=0.75cm,rowsep=0.2cm, arrowscale=1.5] [name=n1] 1 & [name=n2] 2 & [name=n3] 3 & [name=n4] 4 & [name=n5] 5 & \\ \small{\mbox{time~1}} & \small{\mbox{time~2}} & \small{\mbox{time~3}} & \small{\mbox{time~4}} & \small{\mbox{time~5}} \endpsmatrix \ncline[nodesep=2pt]{->}{n1}{n2} \ncline[nodesep=2pt]{->}{n2}{n3} \ncline[nodesep=2pt]{->}{n3}{n4} \ncline[nodesep=2pt]{->}{n4}{n5} \ncline[nodesep=2pt]{->}{n5}{n6}$
\end{figure}

Here is a lousy, brute-force attempt at reconfiguring for unequal intervals:

\begin{figure}[H]
\centering
\rule[-0.5cm]{0.0pt}{1.8cm}
$\psmatrix[rowsep=0.2cm, arrowscale=1.5] [name=n1] 1 & [name=n2] ~ & [name=n3] 2 & [name=n4] 3 & [name=n5] 4 & \\ \small{\mbox{time~1}} & ~ & \small{\mbox{time~2}} & \small{\mbox{time~3}} & \small{\mbox{time~4}} \endpsmatrix \ncline[nodesep=2pt]{->}{n1}{n3} \ncline[nodesep=2pt]{->}{n3}{n4} \ncline[nodesep=2pt]{->}{n4}{n5} \ncline[nodesep=2pt]{->}{n5}{n6}$
\end{figure}

\end{document}


\documentclass{article}
\usepackage{pst-node}
\begin{document}

\psmatrix[rowsep=0.2cm,arrowscale=1.5,colsep=2cm]
[name=n1] 1 \psspan{3} &  [name=n3] 2 & [name=n4] 3 & [name=n5] 4 & \\
& & & & & % dummy
\endpsmatrix
\ncline[nodesep=2pt]{->}{n1}{n3}\ncline[nodesep=2pt]{->}{n3}{n4}
\ncline[nodesep=2pt]{->}{n4}{n5}\ncline[nodesep=2pt]{->}{n5}{n6}
\small
\uput{5mm}[-90](n1){time~1}\uput{5mm}[-90](n3){time~2}
\uput{5mm}[-90](n4){time~3}\uput{5mm}[-90](n5){time~4}

\end{document}


If you're not tied to PSTricks,

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[column sep=1em]
1 \arrow[r] & 2 \arrow[r] &[3em] 3 \arrow[r] &[2em] 4 \arrow[r] &[6em] 5
\end{tikzcd}

\end{document}


This is quite an old post, but if someone is interested, one way to do this in pstricks is using hooks, as explained in the documentation.

    \documentclass{article}
\usepackage{pst-node}
\begin{document}

\newcommand*\pscolhooki{ % i is Roman number for 1, the first column
\psset{colsep=.5}
}
\newcommand*\pscolhookii{ % ii is Roman number for 2,
\psset{colsep=1}
}
\newcommand*\pscolhookiii{ % iii is Roman number for 3,
\psset{colsep=.1}
}
\newcommand*\pscolhookiv{ % iv is Roman number for 4,
\psset{colsep=.8}
}
\psmatrix[rowsep=0.2cm, arrowscale=1.5, colsep=2cm]
[name=n1] 1 \psspan{3} &  [name=n3] 2 & [name=n4] 3 & [name=n5] 4 & \\
& & & & & % dummy
\endpsmatrix
\ncline[nodesep=2pt]{->}{n1}{n3}\ncline[nodesep=2pt]{->}{n3}{n4}
\ncline[nodesep=2pt]{->}{n4}{n5}\ncline[nodesep=2pt]{->}{n5}{n6}
\small
\uput{5mm}[-90](n1){time~1}\uput{5mm}[-90](n3){time~2}
\uput{5mm}[-90](n4){time~3}\uput{5mm}[-90](n5){time~4}
\end{document}


• Very slick. I knew about hooks, but didn't connect the dots for this particular problem. Thanks very much for taking the time to post a solution using that approach. Commented Feb 19, 2023 at 15:02