我正在使用 LaTeX 写一篇文章。这是一份关于使用 LaTeX 开发数学电子书的研究报告。它包含由文件夹和文件组成的目录列表,如下所示:
- [folder_icon][folder_name]
+ [file_icon][file_name.extension]
- [folder_icon][folder_name]
[file_icon][file_name.extension]
例如:
- [icon][MatheBook]
+ [icon][math_ebook.tex]
- [icon][Pictures]
[icon][math.png]
怎么做?我正在使用 MikTeX 和 TeXnicCenter。
答案1
既然您似乎认为这些dirtree
解决方案不起作用,这里有一个例子,我认为它可以向您证明这些解决方案是可行的。
您只需创建一个宏来生成图标/名称对。由于我不知道您如何实现图标,因此我在这里制作了一个模型。您需要对其进行修改以匹配图标的实际生成方式。
\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}