1

I'd like to build a graph of dependencies as they do in the index of the Numerical Recipes book. I want something straight-forward and plain like this:

enter image description here

What has been suggested in the question in Graph of dependencies from LaTeX file is to use some chart offered in http://www.graphviz.org/. However, I don't want a visual graph since I have many dependencies. How would I best be able to compile a latex document with this type of chart?

5
  • @HenriMenke Close, but I don't want diagonal lines, nor the way the dirtree documentation is represented (since it has unnecessary square dots). I just want the Numerical Recipes style, which I'm surprised is not easily accessible since it's so straightforward.
    – Sara
    Commented Jul 13, 2017 at 22:42
  • Did you even look at all the answers? Isn't this one exactly what you want? Commented Jul 13, 2017 at 22:45
  • @HenriMenke Yes, thanks. But, I don't want the dots there. I've looked at the documentation, and if I could get rid of those, that would be great. Also, I would want to change the font as shown above depending on the order of my dependencies. Just want to make sure there is not anything else out there that follows this exact style before I create one myself.
    – Sara
    Commented Jul 13, 2017 at 23:04
  • Then show us a minimal working example (MWE) of what you have tried so far and where you got stuck. Commented Jul 13, 2017 at 23:09
  • The width of the dot is the last argument of \DTsetlength. The default of all arguments can be found in the manual. So it should not be a lot of work to set the dot size either to 0 or to the rule width. The text style of the nodes is given by \DTstyle. Commented Jul 14, 2017 at 6:06

2 Answers 2

1
\documentclass{article}
\usepackage{dirtree}
\begin{document}

%\DTsetlength{offset}{width}{sep}{rule-width}{dot-size}
\DTsetlength{.2em}{1em}{.2em}{.4pt}{0pt}

\dirtree{%
.1 debug.
.2 filename.
.2 modules.
.3 module.
.3 module.
.3 module.
.2 level.
}

\end{document}

enter image description here

0
0

Here is a solution with the psmatrix environment from pst-node:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{pgffor}
\usepackage{pst-node}
\usepackage{auto-pst-pdf}

\newcommand{\ebranch}[1]{\textnormal{[#1]}}

\begin{document}

\psset{armA=0.4cm, angleB=180, nodesep=3pt, linewidth=0.6pt, linejoin=1}
\psset{mcol=l, rowsep=0.15cm, colsep=1cm}% settings for psmatrices
\ttfamily
\begin{psmatrix}
  %% nodes
  shoot & \ebranch{load} \\
  & odeint & \ebranch{derivs} \\
  & & rkqs & rkrk & \ebranch{derivs} \\
  & \ebranch{score}
  %% node connections
  \foreach \i in {1,2,4}{\ncangles{1,1}{\i,2}}
  \foreach \i in {2,3}{\ncangles{2,2}{\i,3}}
  \foreach \i in {3,4} {\fpAdd{\i}{1}{\j}\ncline{3,\i}{3, \j}}
\end{psmatrix}
\vspace{1cm}

\begin{psmatrix}
  %% nodes
  shootf & \ebranch{load1} \\
  & odeint & \ebranch{derivs} \\
  & & rkqs & rkrk & \ebranch{derivs} \\
  & \ebranch{score} \\
  & \ebranch{load2}
  %% node connections
  \foreach \i in {1,2, 4, 5}{\ncangles{1,1}{\i,2}}
  \foreach \i in {2,3}{\ncangles{2,2}{\i,3}}
  \foreach \i in {3,4} {\fpAdd{\i}{1}{\j}\ncline{3,\i}{3, \j}}
\end{psmatrix}

\end{document} 

enter image description here

Not the answer you're looking for? Browse other questions tagged .