我正在用 latex 编写文档,文档的几个地方包含一些 BNF 语法符号。(我使用 verbatim 包来编写这些 BNF 语法符号)
现在我想在文档中添加一个新部分,显示所有语法符号的名称及其页码。这应该类似于“图片列表“ 页。
我是 Latex 的新手,您的帮助对我很有帮助。
谢谢
答案1
答案2
包示例tocloft
:
\documentclass{report}
\usepackage{tocloft}
\usepackage{hyperref}
\usepackage[english]{babel}
\hypersetup{colorlinks=true}
\newcommand{\listexamplename}{List of mycustomfiction}
\newlistof{mycustomfiction}{mcf}{\listexamplename}
% Reset section numbering between unnumbered chapters
% https://tex.stackexchange.com/questions/71162/reset-section-numbering-between
\newcommand{\mycustomfiction}[1]
{%
\refstepcounter{mycustomfiction}
\addcontentsline{mcf}{mycustomfiction}
{\protect\numberline{\themycustomfiction}#1}\par
}
\begin{document}
% How to remove double “Contents” heading generated by memoir?
% https://tex.stackexchange.com/questions/47225/how-to-remove-double-contents-heading-generated-by-memoir
\tableofcontents
\newpage
\listofmycustomfiction
\chapter{Two mycustomfiction}
\mycustomfiction{Your first example}
\label{1st_ex}
Your first example
\mycustomfiction{Your second example}
\label{2nd_ex}
Your second example
\chapter{One example}
\mycustomfiction{Your third example. (See example \ref{1st_ex} and \ref{2nd_ex})}
Your third example. (See example \ref{1st_ex} and \ref{2nd_ex})
\end{document}
对于回忆录包,您需要使用memoir
的类模拟来构建更多内容tocloft
。请参阅 的示例问题memoir
:自定义列表抛出 LaTeX 错误:命令 \mycustomfiction 已定义?