1

I would like to know how to easily draw a Dyck path similar to the one below using PSTricks instead of Tikz. Any ideas?

Thank you!

\documentclass[border=2mm]{standalone}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=0.8]
(8,0) rectangle +(5,5);
\draw[help lines] (8,0) grid +(5,5);
\draw[dashed] (8,0) -- +(5,5);
\coordinate (prev) at (8,0);
\draw [color=blue, line width=2] (8,0)--(9,0)--(10,0)--(10,1)--(13,1)--(13,3)--(13,5);
\draw [color=red, line width=1] (8,0)--(9,0)--(10,0)--(10,1)--(10,2)--(13,2)--(13,3)--(13,5);

\draw (10,1) node [scale=0.5, circle, draw,fill=blue]{};
\draw (13,2) node [scale=0.5, circle, draw,fill=red]{};
 \end{tikzpicture}
}
\end{document}
Combin
  • 335

1 Answers1

3
\documentclass[pstricks,border=2mm]{standalone}
\usepackage{pstricks}
\begin{document}

\psset{unit=0.8}
\begin{pspicture}(8,0)(13,5)
\psgrid[gridlabels=0pt,subgriddiv=1,gridcolor=black!30](8,0)(13,5)
\psline[linestyle=dashed](8,0)(13,5)
\psline[linecolor=blue,linewidth=2pt](8,0)(9,0)(10,0)(10,1)(13,1)(13,3)(13,5)
\psline[linecolor=red,linewidth=1pt](8,0)(9,0)(10,0)(10,1)(10,2)(13,2)(13,3)(13,5)
\psdot[linecolor=blue,dotscale=1.5](10,1)
\psdot[linecolor=red,dotscale=1.5](13,2)
\end{pspicture}

\end{document}

enter image description here