0

I am making a math book, which has many step by step instructions to solve problems. I want to make a list of All Instructions in beginning which similar to the table of contents "List of Images" and "List of Tables" we have.

Is there a way to do this.

2

1 Answer 1

2

Use the tocloft package.

% newlistofprob.tex  (revised) SE 566579

\documentclass{book}
\usepackage{tocloft}
%% the next creates a \listofinstruction macro
\newlistof[chapter]{instruction}{ins}{All Instructions}
%%% a guess at your instruction command
%\newcommand{\instruction}[1]{%
%  \refstepcounter{instruction}
%  \par\noindent\textbf{Instruction \theinstruction} #1
%  \addcontentsline{ins}{instruction}{\protect\numberline{\theinstruction}}\par}
\newenvironment{instruction}[1]{%
  \refstepcounter{instruction}
  \noindent
  \textbf{Instruction \theinstruction\ #1 }\par
  \addcontentsline{ins}{instruction}{\protect\numberline{\theinstruction}#1}%
  }%
  {\par}

\usepackage{etoolbox}
%% insert space in listofinstruction between chapters
\pretocmd{\chapter}{\addtocontents{ins}{\protect\addvspace{10pt}}}{}{}

\begin{document}
\listofinstruction
\chapter{First}
\begin{instruction}{An instruction}
  text of the instruction
\end{instruction}

 %\instruction{Another instruction}
\begin{instruction}{Another instruction}
  text of the instruction
\end{instruction}

\chapter{Second}

\begin{instruction}{An instruction}
  text of the instruction
\end{instruction}

\begin{instruction}{Another instruction}
  text of the instruction
\end{instruction}

\end{document}

Please read the tocloft manual for more detailed explanation. As you have not provided an MWE I have no idea how you have coded for "instructions". I provided something but I'm sure that not what you have done, but it gives you an idea of what is needed to get an instruction into the listofinstruction.

EDIT: I have changed my answer to give what I think might be more appropriate for the OP.

3
  • Thank you, so much for the answer! My last question was about coding instructions are in this link. The answer for coding steps was just what I wanted and hence, is accepted. Instructions have a heading, then plain text as description and steps written using 'paracol' package.
    – Pratyush
    Commented Oct 21, 2020 at 4:18
  • Excuse my utterly noob question ,but I need to know what MWE stands for?
    – Pratyush
    Commented Oct 21, 2020 at 4:22
  • 1
    @Pratyush MWE --- Mininum Working Document --- code from \documentclass... to \end{document} that we can compile that shows your problem. There is an emphasis on "Minimal" --- do not include lots of packages that are not relevant to the problem. You can use the lipsum package for including example text. And so on. Commented Oct 22, 2020 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .