正如标题所示,我在创建目录树时遇到了问题。目前有问题的部分是:
\section{Use Cases}
\par Some entry explaining why I will be writing this dirtree.
\begin{figure}%
\dirtree{%
.1 Customer tests
.1 Connection tests
.2 Database Connection tests
.2 MailServer Connection tests
.2 Internet Connection tests
.2 CMS Connection tests
.3 Initialize Connection
.3 Close Connection
.3 Force Disconnect
.3 Simulate Internet Failure
.1 Service tests
}
\end{figure}
\par Some more sentences that will use the dirtree above
但是当我尝试构建文件时,出现错误“段落在 \next 完成之前结束”,指向目录树的结束括号。
我对 LaTeX 不是很有经验,因此我欢迎所有建议。非常感谢。
答案1
该语法要求在每个条目末尾添加一个句点:
\documentclass{article}
\usepackage{dirtree}
\begin{document}
\section{Use Cases}
Some entry explaining why I will be writing this dirtree.
\dirtree{%
.1 Customer tests.
.1 Connection tests.
.2 Database Connection tests.
.2 MailServer Connection tests.
.2 Internet Connection tests.
.2 CMS Connection tests.
.3 Initialize Connection.
.3 Close Connection.
.3 Force Disconnect.
.3 Simulate Internet Failure.
.1 Service tests.
}
Some more sentences that will use the dirtree above
\end{document}
这仍然是错误的。第一条规则,即根必须具有 1 级,并没有被违反,但以下节点必须具有 2 到n+ 1 有n与前一个节点的级别相同。
下面的例子
- 修正第二条规则,
- 添加一个新的根,
quote
使用环境 在树周围添加水平缩进和垂直空间minipage
。
\documentclass{article}
\usepackage{dirtree}
\begin{document}
\section{Use Cases}
Some entry explaining why I will be writing this dirtree.
\begin{quote}
\begin{minipage}{\linewidth}
\dirtree{%
.1 /.
.2 Customer tests.
.2 Connection tests.
.3 Database Connection tests.
.3 MailServer Connection tests.
.3 Internet Connection tests.
.3 CMS Connection tests.
.4 Initialize Connection.
.4 Close Connection.
.4 Force Disconnect.
.4 Simulate Internet Failure.
.2 Service tests.
}
\end{minipage}
\end{quote}
Some more sentences that will use the dirtree above
\end{document}