TransWikia.com

How to make a new "List of Instructions" similar to "list of tables", "List of Image"

TeX - LaTeX Asked by Pratyush on December 19, 2020

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.

One Answer

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}
%  parnoindenttextbf{Instruction theinstruction} #1
%  addcontentsline{ins}{instruction}{protectnumberline{theinstruction}}par}
newenvironment{instruction}[1]{%
  refstepcounter{instruction}
  noindent
  textbf{Instruction theinstruction #1 }par
  addcontentsline{ins}{instruction}{protectnumberline{theinstruction}#1}%
  }%
  {par}

usepackage{etoolbox}
%% insert space in listofinstruction between chapters
pretocmd{chapter}{addtocontents{ins}{protectaddvspace{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.

Answered by Peter Wilson on December 19, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP