summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pstricks-examples-en/17-06-3.ltx
blob: 65137a5dfde006c3b9dcacaa3e6d69e3071e54d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
%% 
%%  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}