%% 
%%  A DANTE-Edition example
%% 
%%  Example 17-06-3 on page 286.
%% 
%%  Copyright (C) 2011 Herbert Voss
%% 
%%  It may be distributed and/or modified under the conditions
%%  of the LaTeX Project Public License, either version 1.3
%%  of this license or (at your option) any later version.
%% 
%%  See http://www.latex-project.org/lppl.txt for details.
%% 
%% 
%% ==== 
% Show page(s) 1
%% 
\documentclass[]{article}
\pagestyle{empty}
\setlength\textwidth{201.70511pt}
\setlength\parindent{0pt}

\usepackage{pst-tree}
\newcounter{leaves}
\newcounter{directories}
\newenvironment{directory}[2][\linewidth]%
% Starts a new directory and produces a minipage of specified width.
% syntax: \begin{directory}[width]{text}
% text has to fit inside a \parbox of the specified width; if no width is given,
% \linewidth is assumed.
{%
\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}{\emph{#2}}}%
  \par
}
{\end{minipage}}

% !!! --> Problem:
% because of [t] the line distance _after_ the minipage is not correct.
% The reference point of a node has to be in the _first_ line though; multi-line
% nodes -- subdirectories -- have to be fixed in the file tree with their first
% line.

\newcommand{\file}[2][]{%
% For a single entry within the directory environment. The argument may be a
% directory environment itself.
  \addtocounter{leaves}{1}%
  \edef\leaflabel{L\theleaves\directoryname}%
  \par
  \Rnode{\leaflabel}{\parbox[t]{\dirshrink\linewidth}{#2\hfill#1}}%
  \ncangle[angleA=270,angleB=180,armB=0,nodesep=1pt]
    {\directoryname}{\leaflabel}%
  % \typeout{\directoryname,\leaflabel}% Debugging
\par}


\newcommand{\dirshrink}{.95}
% relative decrease of the width of the directory entries per step


\begin{document}

\def\url#1{#1}
\begin{directory}{\url{fontinst}}
\file{\begin{directory}{\url{doc/}}
  \file{\begin{directory}{\url{manual/}}
    \file[ auxiliary file]{\url{fontinst.aux}}
    \file[ log file ]{\url{fontinst.log}}
    \file[ documentation ]{\url{fontinst.pdf}}
    \file{\url{fontinst.tex}}
    \file[ table of contents ]{\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}
