4

Is there a package that can typeset trees used for energy budgets?

enter image description here

The image is an extract from Dynamic Energy and Mass Budgets in Biological Systems by B.Kooijman which is easily identifiable as having been typeset using LaTeX. Unfortunately I have only a PDF of the book.

yannisl
  • 117,160

1 Answers1

4

You can use the package pst-tree. The following example is taken from the homepage of pstricks and shows a directory tree. You can simple adapt this. I reduced th example a litte bit to provide the code in this answer.

\documentclass[12pt,a4paper]{article}% Walter Schmidt
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{mathpazo}
\usepackage{courier}
\usepackage{geometry,url}
\usepackage{pst-tree,pst-node}
\newcounter{leaves}
\newcounter{directories}

\newenvironment{directory}[2][\linewidth]%
{%
\setcounter{leaves}{0}%
\addtocounter{directories}{1}
\edef\directoryname{D\thedirectories}
\begin{minipage}[t]{#1}% <-------- !!!
  \setlength{\parindent}{\linewidth}
  \addtolength{\parindent}{-\dirshrink\parindent}
  \parskip0pt%
  \noindent
  \Rnode[href=-\dirshrink]{\directoryname}{\parbox[t]{#1}{#2}}%
  \par
}  
{\end{minipage}}

\newcommand{\file}[1]{%
  \addtocounter{leaves}{1}%
  \edef\leaflabel{L\theleaves\directoryname}%
  \par
  \Rnode{\leaflabel}{\parbox[t]{\dirshrink\linewidth}{#1}}%
  \ncangle[angleA=270,angleB=180,armB=0,nodesep=1pt,arrows=->]
    {\directoryname}{\leaflabel}%
\par}

\newcommand{\dirshrink}{.95} 
\begin{document}
\def\url#1{#1}
\begin{directory}{\url{fontinst}}
\file{\begin{directory}{\url{doc/}}
  \file{\begin{directory}{\url{manual/}}
    \file{\url{fontinst.aux}}
    \file{\url{fontinst.log}}
    \file{\url{fontinst.pdf}}
    \file{\url{fontinst.tex}}
    \file{\url{fontinst.toc}}
    \file{\url{intro98.tex }}
    \file{\url{ltxguide.cfg}}
    \file{\url{roadmap.eps }}
  \end{directory}}
\file{\url{encspecs.zip }}
\end{directory}}
\file{\url{examples.zip }}
\file{\url{inputs.zip   }}
\file{\url{latex.zip    }}
\file{\url{README       }}
\file{\url{source.zip   }}
\file{\url{test.zip     }}
\end{directory}
\end{document}

Of course the same is possible with the package tikz/pgf or tikz-qtree.

Marco Daniel
  • 95,681