16

I’m writing a document in the latex and it contains some BNF grammar noations in several places of the documents. (I used verbatim package in order to write these BNF grammar notations)

Now I want to add a new section to the document that shows name of all grammar notation and their page numbers. This should be similar to “List of Figures” page.

I’m new to Latex and your help will be very helpful for me.

Thanks

2 Answers 2

10

Use the tocloft package. For a short introduction see for example: http://texblog.org/2008/07/13/define-your-own-list-of/

1
  • If you need more specific advice, you should give a MWE. Otherwise "accepting" an answer is the proper way to show your content. Commented Jun 25, 2012 at 4:26
15

Example for the tocloft package:

\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} 

enter image description here

For the memoir package you need to build more things using the memoir's class emulation of tocloft. See the question for memoir's example: Custom list throw LaTeX Error: Command \mycustomfiction already defined?

1
  • I would like to format each entry in the "List of mycustomfiction" so that it follows this pattern "Figure 1.1 - Caption.......pagenumber" any thoughts on how to attack the issue? Commented Feb 4, 2020 at 14:57

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.