Skip to content

Instantly share code, notes, and snippets.

Last active May 14, 2019 13:30
Show Gist options
  • Save PadreSVK/3648e3e4141180ce77e6e2231bf2e57b to your computer and use it in GitHub Desktop.
Save PadreSVK/3648e3e4141180ce77e6e2231bf2e57b to your computer and use it in GitHub Desktop.
DirtTree setup for latex

DirtTree setup for latex

%% This is file `dirtree.tex',
%% generated with the docstrip utility.
%% The original source files were:
%% dirtree.dtx (with options: `tex')
%% For the copyright see the source file.
%% Any modified versions of this file must be renamed
%% with new filenames distinct from dirtree.tex.
%% For distribution of the original source see the terms
%% for copying and modification in the file dirtree.dtx.
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% Package `dirtree.dtx'
%% -----------------------------------------------
%% Copyright (C) 2004-2009 Jean-C\^ome Charpentier
%% -----------------------------------------------
%% This work 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.
%% The latest version of this license is in
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%% See CTAN archives in directory macros/latex/base/lppl.txt.
%% This work consists of the files dirtree.ins and dirtree.dtx.
%% Derived files are dirtree.tex and dirtree.sty.
%% dirtree is a package displaying directory trees.
\message{`dirtree' v\fileversion, \filedate\space (jcc)}
\expandafter\ifx\csname DT@fromsty\endcsname\relax
\def\@namedef#1{\expandafter\def\csname #1\endcsname}
\def\@nameuse#1{\csname #1\endcsname}
\def\@nameedef#1{\expandafter\edef\csname #1\endcsname}
\newdimen\DT@offset \DT@offset=0.2em
\newdimen\DT@width \DT@width=1em
\newdimen\DT@sep \DT@sep=0.2em
\advance\DT@all \DT@width
\advance\DT@all \DT@sep
\newdimen\DT@rulewidth \DT@rulewidth=0.4pt
\newdimen\DT@dotwidth \DT@dotwidth=1.6pt
\newdimen\DTbaselineskip \DTbaselineskip=\baselineskip
\advance\DT@all by\DT@width
\advance\DT@all by\DT@sep
\expandafter\ifx\csname DT@fromsty\endcsname\relax
\def\strut{\vrule width\z@ height0.7\baselineskip depth0.3\baselineskip}%
\advance\dimen\z@ -\DT@offset
\advance\dimen\z@ -\DT@width
\setbox\z@=\hbox to\dimen\z@{%
\advance\dimen0 by\dp\z@
\advance\dimen0 by-0.7\baselineskip
\advance\DT@countii \@ne
\advance\DT@countiii \@ne
\advance\dimen\z@ by\DT@offset
\advance\dimen\z@ by-\DT@all
\advance\DT@countiv \m@ne
\ifnum\@nameuse{DT@level@\the\DT@countiv} >
\advance\hsize by-\dimen\z@
\advance\dimen\z@ by\dp\z@
\advance\dimen\z@ by-0.7\baselineskip
\advance\dimen3 by\dimen\z@
\advance\dimen3 by0.7\baselineskip
\advance\dimen\z@ by-\@nameuse{DT@lastlevel@\the\DT@countiv}\relax
\advance\dimen\z@ by0.3\baselineskip
\ifnum\@nameuse{DT@level@\the\DT@countiv} <
\advance\dimen\z@ by-0.5\baselineskip
\hbox{\vbox to\z@{\vss\hrule width\DT@rulewidth height\dimen\z@}}%
\vrule width\DT@dotwidth height0.5\DT@dotwidth depth0.5\DT@dotwidth
\vrule width\DT@width height0.5\DT@rulewidth depth0.5\DT@rulewidth
\def\DT@readarg.#1 #2. #3\@nil{%
\advance\DT@counti \@ne
%% End of file `dirtree.tex'.
function CreateDirtTree($folderRoot, $level)
if(-not $(Test-Path $folderRoot))
Write-Error "Path do not exist"
if(-not $level){
$level = 1
$items = New-Object System.Collections.ArrayList;
$childItems = ls -Path $folderRoot
foreach ($item in $childItems) {
$size = [math]::Round($($item.length/1KB))
if($size -eq 0){
$size = 1
$itemName = $item.Name -replace "_","\_" # latex do not accept _ char
if($item -is [System.IO.DirectoryInfo]){
$items += ("`t" * $($level-1)) + ".$level "+ $itemName + "/."
$dirItems = CreateDirtTree -folderRoot $item.FullName -level $($level + 1)
$dirItems | %{ $items += $_ }
$items += ("`t" * $level) + ".$level "+ $itemName +".\DTcomment{" + $size + " KB}."
return $items
# CreateDirtTree -folderRoot "pathToFolderForDirtree"
# with copy to clipboard - just run command
# CreateDirtTree -folderRoot "pathToFolderForDirtree" | clip
.1 /.
.2 node\_modules/.\DTcomment{cache NPM balíčkov}.
.2 src/.
.3 main.c.\DTcomment{Súbor obsahujúci C funkcie}.
.2 wwwroot/.\DTcomment{Priečinok pre WebServer}.
.3 main.html.\DTcomment{Hlavný HTML dokument}.
.3 main.js.\DTcomment{JavaScriptový súbor, ktorý volá WASM}.
.3 main.wasm.\DTcomment{Súbor vygenerovaný prekladačom}.
.2 build.ts.\DTcomment{Definovanie Gulp úlohy pre kompiláciu}.
.2 package-lock.json.
.2 package.json.\DTcomment{Definícia NPM balíčkov}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment