6

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.

8

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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