Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing an article using LaTeX. It is a research report about developing mathematics ebook using LaTeX. It contains directory list consists of folders and files, like this:

    - [folder_icon][folder_name]
      + [file_icon][file_name.extension]
      - [folder_icon][folder_name]
        [file_icon][file_name.extension]

For example:

    - [icon][MatheBook]
      + [icon][math_ebook.tex]
      - [icon][Pictures]
        [icon][math.png]

How to do that? I am using MikTeX and TeXnicCenter.

share|improve this question
    
Welcome to TeX.sx! –  Papiro Jun 28 '13 at 10:22
    
Duplicate of tex.stackexchange.com/questions/23647/… –  zunbeltz Jun 28 '13 at 10:35
    
Do you have special requirements concerning the layout of the list? If not, I agree with @zunbeltz that this is a duplicate. Look also at ctan.org/pkg/dirtree –  Charles Stewart Jun 28 '13 at 10:39
    
I've read your references, but these examples without including icon. –  Edy Jo Jun 30 '13 at 4:02
    
Possible duplicate: Making a (simple) directory tree –  Werner Jun 30 '13 at 4:10
show 1 more comment

1 Answer

Since you seem to think that the dirtree solutions won't work, here's an example which I think will show you that they can.

You simply need to create a macro to generate the icon/name pair. Since I don't know how you are implementing your icons, I've made a mock-up here. You'd need to modify it to match the way your icons are actually generated.

\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{dirtree}
% The following is a dummy icon command
\newcommand\myicon[1]{{\color{#1}\rule{2ex}{2ex}}}
% If you have actual icon images, use \includegraphics to include them
% If you are generating them, put in the appropriate code for them here
% now we make a command for a folder/file which inserts the icon and its label
% adjust this as needed. If you only have 2 icons, then you could create
% a \myfile and \myfolder command with the icon fixed.
\newcommand{\myfolder}[2]{\myicon{#1}\ {#2}}

\begin{document}

\dirtree{%
.1 \myfolder{red}{Mathbook}.
.2 \myfolder{blue}{Pictures}.
.3 \myfolder{green}{math.png}.
.3 \myfolder{green}{math2.png}.
.2 \myfolder{blue}{Exercises}.
.4 \myfolder{brown}{Something}.
}

\end{document}

output of code

share|improve this answer
    
Thanks! quite helpful. –  Edy Jo Jun 30 '13 at 11:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.