0

I am using dirtree to make a tree but I have noticed that adding numbers between parentheses at the end of some elements causes the tree's lines to disconnect. Is there any way to keep them connected? Is there a way to create a vertical space (maybe 1mm) between the text and the vertical line under it? And lastly, is there a way to scale it down (tried changing the font size but the tree size remains the same)?

Tree

This is the code:

\renewcommand{\DTstyle}{\textrm\expandafter\raisebox{-0.7ex}}
\DTsetlength{1em}{1em}{0.2em}{0.4pt}{0.4pt}

\dirtree{% .1 Romance. .2 Eastern (4). .2 Italo-Western. .3 Italo-Dalmatian (5). .3 Western. .4 Gallo-Iberian. .5 Gallo-Romance. .6 Gallo-Italian (6). .6 Gallo-Rhaetian. .7 Oïl. .8 French (5). .8 Southeastern (1). .7 Rhaetian (3). .5 Ibero-Romance. .6 East Iberian (1). .6 Oc (2). .6 West Iberian. .7 Asturo-Leonese (2). .7 Castilian (4). .7 Portuguese-Galician (4). .4 Pyrenean-Mozarabic. .5 Pyrenean (1). .2 Southern. .3 Corsican (1). .3 Sardinian (4). }

1 Answers1

0

I added a patch to the dirtree package to move the short horizontal lines up, to connect the lines, and add a small blank space between the text and the vertical line below.

(1) The displacement of the text lines of the tree with respect the short horizontal lines is controlled by setting \upBranch.

(2) Use \tolineSpace to add blank space bellow the text lines (up to a limit, depending of the font size of the tree)

(3) Expanding the tree size is done by changing \DTbaselineskip. With this patch the minimum size of the tree, while keeping all lines connected, depends of the font size.

For \footnotesize is 12pt, for \large is 18pt, etc.

z2

Scaling the tree, testing different tree fontsizes and changing the baselineskip

z

% !TeX TS-program = pdflatex

\documentclass[12pt,a4paper]{article}

\usepackage{dirtree}

%% ***************************************************************** \newlength{\upBranch} % shift up the text lines <<<< \setlength{\upBranch}{0.7ex} %

\newlength{\tolineSpace} % blank space bellow text lines <<< \setlength{\tolineSpace}{1mm}%

\usepackage{xpatch} % needed <<<<<<<< \makeatletter

\xpatchcmd{\dirtree} % root {\vbox{@nameuse{DT@body@1}}} {\raisebox{-\tolineSpace}{\vbox{@nameuse{DT@body@1}}}} {}{}

\xpatchcmd{\dirtree} % below space {\advance\dimen\z@ by-@nameuse{DT@lastlevel@\the\DT@countiv}\relax} {\advance\dimen\z@ by-\tolineSpace \advance\dimen\z@ by-@nameuse{DT@lastlevel@\the\DT@countiv}\relax} {}{}

\xpatchcmd{\dirtree}% shift up the text lines {\kern\DT@sep\box\z@\endgraf} {\kern\DT@sep\raisebox{-\upBranch}{\box\z@}\endgraf} {}{}

\makeatother %% *****************************************************************

\begin{document}

\DTsetlength{1em}{1em}{0em}{0.4pt}{0.4pt}

%\setlength{\DTbaselineskip}{12pt} % minimum size for \footnotesize %\renewcommand{\DTstyle}{\rmfamily\footnotesize}

%\setlength{\DTbaselineskip}{16pt} %minimum size for \normalsize %\renewcommand{\DTstyle}{\rmfamily\normalsize}

\setlength{\DTbaselineskip}{18pt} %minimum size for \large \renewcommand{\DTstyle}{\rmfamily\large} %

%\setlength{\DTbaselineskip}{22pt} %minimum size for \Large %\renewcommand{\DTstyle}{\rmfamily\Large} %

\textbf{Tree font size =} large

\textbf{baselineskip =} \the\baselineskip \bigskip

\dirtree{% 
    .1 Romance.
    .2 Eastern (4).
    .2 Italo-Western.
    .3 Italo-Dalmatian (5).
    .3 Western.
    .4 Gallo-Iberian.
    .5 Gallo-Romance.
    .6 Gallo-Italian (6).
    .6 Gallo-Rhaetian.
    .7 Oïl.
    .8 French (5).
    .8 Southeastern (1).
    .7 Rhaetian (3).
    .5 Ibero-Romance.
    .6 East Iberian (1).
    .6 Oc (2).
    .6 West Iberian.
    .7 Asturo-Leonese (2).
    .7 Castilian (4).
    .7 Portuguese-Galician (4).
    .4 Pyrenean-Mozarabic.
    .5 Pyrenean (1).
    .2 Southern.
    .3 Corsican (1).
    .3 Sardinian (4).
}       

\bigskip
In all theoretical sciences, the paralogisms of human reason would be falsified, as is proven in the ontological manuals. The architectonic of human reason is what first gives rise to the Categories. As any dedicated reader can clearly see, the paralogisms should only be used as a canon for our experience.

\newpage \setlength{\baselineskip}{30pt}

\setlength{\DTbaselineskip}{12pt} % minimum size for footnotesize \renewcommand{\DTstyle}{\rmfamily\footnotesize}

\textbf{Tree font size =} footnotesize

\textbf{baselineskip =} \the\baselineskip \bigskip

\dirtree{% .1 Romance. .2 Eastern (4). .2 Italo-Western. .3 Italo-Dalmatian (5). .3 Western. .4 Gallo-Iberian. .5 Gallo-Romance. .6 Gallo-Italian (6). .6 Gallo-Rhaetian. .7 Oïl. .8 French (5). .8 Southeastern (1). .7 Rhaetian (3). .5 Ibero-Romance. .6 East Iberian (1). .6 Oc (2). .6 West Iberian. .7 Asturo-Leonese (2). .7 Castilian (4). .7 Portuguese-Galician (4). .4 Pyrenean-Mozarabic. .5 Pyrenean (1). .2 Southern. .3 Corsican (1). .3 Sardinian (4). }
\bigskip In all theoretical sciences, the paralogisms of human reason would be falsified, as is proven in the ontological manuals. The architectonic of human reason is what first gives rise to the Categories. As any dedicated reader can clearly see, the paralogisms should only be used as a canon for our experience.

\end{document}

Simon Dispa
  • 39,141